[FIX] Javascript vernünftig "gestyled" - wenn da schon ein paar tausend Zeilen Code bei herauskommen dann sollen die auch gut ausschauen...

This commit is contained in:
CasparA 2016-05-12 10:16:01 +02:00
parent b3ba905afc
commit 0e20132eaa

View File

@ -36,13 +36,13 @@ EOT;
echo <<<EOT echo <<<EOT
<script> <script>
function populateA(s1,s2){ function populateA(){
var s1 = document.getElementById(s1); var s1 = document.getElementById("fw-dl-1");
var s2 = document.getElementById(s2); var s2 = document.getElementById("fw-dl-2");
var s3 = document.getElementById("slct3"); var s3 = document.getElementById("fw-dl-3");
var s4 = document.getElementById("slct4"); var s4 = document.getElementById("fw-dl-4");
var s5 = document.getElementById("slct5"); var s5 = document.getElementById("fw-dl-5");
var s6 = document.getElementById("slct6"); var s6 = document.getElementById("fw-dl-6");
var img_router_front = document.getElementById("img_router_front"); var img_router_front = document.getElementById("img_router_front");
var img_router_back = document.getElementById("img_router_back"); var img_router_back = document.getElementById("img_router_back");
s2.innerHTML = ""; s2.innerHTML = "";
@ -97,12 +97,12 @@ EOT;
img_router_front.src = "router_images/keinbild.jpg"; img_router_front.src = "router_images/keinbild.jpg";
img_router_back.src = "router_images/keinbild.jpg"; img_router_back.src = "router_images/keinbild.jpg";
} }
function populateB(s1,s2){ function populateB(){
var s1 = document.getElementById(s1); var s1 = document.getElementById("fw-dl-2");
var s2 = document.getElementById(s2); var s2 = document.getElementById("fw-dl-3");
var s4 = document.getElementById("slct4"); var s4 = document.getElementById("fw-dl-4");
var s5 = document.getElementById("slct5"); var s5 = document.getElementById("fw-dl-5");
var s6 = document.getElementById("slct6"); var s6 = document.getElementById("fw-dl-6");
var img_router_front = document.getElementById("img_router_front"); var img_router_front = document.getElementById("img_router_front");
var img_router_back = document.getElementById("img_router_back"); var img_router_back = document.getElementById("img_router_back");
s2.innerHTML = ""; s2.innerHTML = "";
@ -151,11 +151,11 @@ EOT;
img_router_front.src = "router_images/keinbild.jpg"; img_router_front.src = "router_images/keinbild.jpg";
img_router_back.src = "router_images/keinbild.jpg"; img_router_back.src = "router_images/keinbild.jpg";
} }
function populateC(s1,s2){ function populateC(){
var s1 = document.getElementById(s1); var s1 = document.getElementById("fw-dl-3");
var s2 = document.getElementById(s2); var s2 = document.getElementById("fw-dl-4");
var s5 = document.getElementById("slct5"); var s5 = document.getElementById("fw-dl-5");
var s6 = document.getElementById("slct6"); var s6 = document.getElementById("fw-dl-6");
var img_router_front = document.getElementById("img_router_front"); var img_router_front = document.getElementById("img_router_front");
var img_router_back = document.getElementById("img_router_back"); var img_router_back = document.getElementById("img_router_back");
s2.innerHTML = ""; s2.innerHTML = "";
@ -198,10 +198,10 @@ EOT;
img_router_front.src = newImageFront; img_router_front.src = newImageFront;
img_router_back.src = newImageBack; img_router_back.src = newImageBack;
} }
function populateD(s1,s2){ function populateD(){
var s1 = document.getElementById(s1); var s1 = document.getElementById("fw-dl-4");
var s2 = document.getElementById(s2); var s2 = document.getElementById("fw-dl-5");
var s6 = document.getElementById("slct6"); var s6 = document.getElementById("fw-dl-6");
s2.innerHTML = ""; s2.innerHTML = "";
EOT; EOT;
$i=0; $i=0;
@ -257,9 +257,9 @@ EOT;
s6.className += " btn-primary disabled"; s6.className += " btn-primary disabled";
s6.innerHTML = "Download Firmware"; s6.innerHTML = "Download Firmware";
} }
function populateE(s1,s2){ function populateE(){
var s1 = document.getElementById(s1); var s1 = document.getElementById("fw-dl-5");
var s2 = document.getElementById(s2); var s2 = document.getElementById("fw-dl-6");
s2.innerHTML = ""; s2.innerHTML = "";
EOT; EOT;
$i=0; $i=0;
@ -371,7 +371,7 @@ EOT;
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<select id="slct1" name="slct1" onchange="populateA(this.id,'slct2')"> <select id="fw-dl-1" name="fw-dl-1" onchange="populateA()">
<option value="">Hersteller auswählen</option> <option value="">Hersteller auswählen</option>
EOT; EOT;
for( $i=0; $i<count($hersteller); $i++) { for( $i=0; $i<count($hersteller); $i++) {
@ -392,7 +392,7 @@ EOT;
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<select id="slct2" name="slct2" onchange="populateB(this.id,'slct3')"></select> <select id="fw-dl-2" name="fw-dl-2" onchange="populateB()"></select>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
</div> </div>
@ -406,7 +406,7 @@ EOT;
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<select id="slct3" name="slct3" onchange="populateC(this.id,'slct4')"></select> <select id="fw-dl-3" name="fw-dl-3" onchange="populateC()"></select>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
</div> </div>
@ -422,7 +422,7 @@ EOT;
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<select id="slct4" name="slct4" onchange="populateD(this.id,'slct5')"></select> <select id="fw-dl-4" name="fw-dl-4" onchange="populateD()"></select>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
</div> </div>
@ -436,7 +436,7 @@ EOT;
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<select id="slct5" name="slct5" onchange="populateE(this.id,'slct6')"></select> <select id="fw-dl-5" name="fw-dl-5" onchange="populateE()"></select>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
</div> </div>
@ -452,7 +452,7 @@ EOT;
<div class="panel-body"> <div class="panel-body">
<img src="router_images/keinbild.jpg" id="img_router_back" alt="Router Rückseite" width=200px" style="float:right;"> <img src="router_images/keinbild.jpg" id="img_router_back" alt="Router Rückseite" width=200px" style="float:right;">
<img src="router_images/keinbild.jpg" id="img_router_front" alt="Router Vorderseite" width=200px" style="float:right;"> <img src="router_images/keinbild.jpg" id="img_router_front" alt="Router Vorderseite" width=200px" style="float:right;">
<a href="#" id="slct6" name="slct6" role="button" class="btn btn-primary disabled">Download Firmware</a> <a href="#" id="fw-dl-6" name="fw-dl-6" role="button" class="btn btn-primary disabled">Download Firmware</a>
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
<img src="images/ccbyncsa.png" alt="CC BY-NC-SA" width="60px"> Die Router Bilder sind von Daniel Krah und sind lizensiert unter einer <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target:"_blank">Creative Commons Namensnennung - Nicht-kommerziell - Weitergabe unter gleichen Bedingungen 4.0 International Lizenz</a> <img src="images/ccbyncsa.png" alt="CC BY-NC-SA" width="60px"> Die Router Bilder sind von Daniel Krah und sind lizensiert unter einer <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target:"_blank">Creative Commons Namensnennung - Nicht-kommerziell - Weitergabe unter gleichen Bedingungen 4.0 International Lizenz</a>
@ -461,7 +461,6 @@ EOT;
</div> </div>
</div> </div>
</div> </div>
<script src="js/jquery-2.2.3.min.js"></script> <script src="js/jquery-2.2.3.min.js"></script>
<script src="js/bootstrap.min.js"></script> <script src="js/bootstrap.min.js"></script>
<script src="js/validator.min.js"></script> <script src="js/validator.min.js"></script>