From 0e20132eaaf81872b76dced699f790b8a2760d0f Mon Sep 17 00:00:00 2001 From: CasparA Date: Thu, 12 May 2016 10:16:01 +0200 Subject: [PATCH] =?UTF-8?q?[FIX]=20Javascript=20vern=C3=BCnftig=20"gestyle?= =?UTF-8?q?d"=20-=20wenn=20da=20schon=20ein=20paar=20tausend=20Zeilen=20Co?= =?UTF-8?q?de=20bei=20herauskommen=20dann=20sollen=20die=20auch=20gut=20au?= =?UTF-8?q?sschauen...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.php | 367 +++++++++++++++++++++++++++--------------------------- 1 file changed, 183 insertions(+), 184 deletions(-) diff --git a/index.php b/index.php index a2c9540..86329a7 100644 --- a/index.php +++ b/index.php @@ -36,20 +36,20 @@ EOT; echo << -function populateA(s1,s2){ - var s1 = document.getElementById(s1); - var s2 = document.getElementById(s2); - var s3 = document.getElementById("slct3"); - var s4 = document.getElementById("slct4"); - var s5 = document.getElementById("slct5"); - var s6 = document.getElementById("slct6"); - var img_router_front = document.getElementById("img_router_front"); - var img_router_back = document.getElementById("img_router_back"); - s2.innerHTML = ""; +function populateA(){ + var s1 = document.getElementById("fw-dl-1"); + var s2 = document.getElementById("fw-dl-2"); + var s3 = document.getElementById("fw-dl-3"); + var s4 = document.getElementById("fw-dl-4"); + var s5 = document.getElementById("fw-dl-5"); + var s6 = document.getElementById("fw-dl-6"); + var img_router_front = document.getElementById("img_router_front"); + var img_router_back = document.getElementById("img_router_back"); + s2.innerHTML = ""; EOT; for( $i=0; $ihersteller == $hersteller[$i]) { @@ -67,50 +67,50 @@ EOT; $j++; } echo("];\n"); - echo("}\n"); + echo(" }\n"); } echo << 1) { - s3.remove(s3.length-1); - } - while(s4.length > 1) { - s4.remove(s4.length-1); - } - while(s5.length > 1) { - s5.remove(s5.length-1); - } - s6.href = "#"; - s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' ); - s6.className += " btn-primary disabled"; - s6.innerHTML = "Download Firmware"; - img_router_front.src = "router_images/keinbild.jpg"; - img_router_back.src = "router_images/keinbild.jpg"; + for(var option in optionArray){ + var pair = optionArray[option].split("|"); + var newOption = document.createElement("option"); + newOption.value = pair[0]; + newOption.innerHTML = pair[1]; + s2.options.add(newOption); + } + while(s3.length > 1) { + s3.remove(s3.length-1); + } + while(s4.length > 1) { + s4.remove(s4.length-1); + } + while(s5.length > 1) { + s5.remove(s5.length-1); + } + s6.href = "#"; + s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' ); + s6.className += " btn-primary disabled"; + s6.innerHTML = "Download Firmware"; + img_router_front.src = "router_images/keinbild.jpg"; + img_router_back.src = "router_images/keinbild.jpg"; } -function populateB(s1,s2){ - var s1 = document.getElementById(s1); - var s2 = document.getElementById(s2); - var s4 = document.getElementById("slct4"); - var s5 = document.getElementById("slct5"); - var s6 = document.getElementById("slct6"); - var img_router_front = document.getElementById("img_router_front"); - var img_router_back = document.getElementById("img_router_back"); - s2.innerHTML = ""; +function populateB(){ + var s1 = document.getElementById("fw-dl-2"); + var s2 = document.getElementById("fw-dl-3"); + var s4 = document.getElementById("fw-dl-4"); + var s5 = document.getElementById("fw-dl-5"); + var s6 = document.getElementById("fw-dl-6"); + var img_router_front = document.getElementById("img_router_front"); + var img_router_back = document.getElementById("img_router_back"); + s2.innerHTML = ""; EOT; $i=0; while( $imodell."\"){\n"); - echo("var optionArray = [\"|Version auswählen\""); + echo("\n if(s1.value == \"".$router[$i]->modell."\"){\n"); + echo(" var optionArray = [\"|Version auswählen\""); echo(",\"".$i."|".$router[$i]->version."\""); if( $imodell == $router[$i+1]->modell) { @@ -123,49 +123,49 @@ EOT; } } echo("];\n"); - echo("}\n"); + echo(" }\n"); $i++; } echo << 1) { - s4.remove(s4.length-1); - } - while(s5.length > 1) { - s5.remove(s5.length-1); - } - s6.href = "#"; - s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' ); - s6.className += " btn-primary disabled"; - s6.innerHTML = "Download Firmware"; - img_router_front.src = "router_images/keinbild.jpg"; - img_router_back.src = "router_images/keinbild.jpg"; + for(var option in optionArray){ + var pair = optionArray[option].split("|"); + var newOption = document.createElement("option"); + newOption.value = pair[0]; + newOption.innerHTML = pair[1]; + s2.options.add(newOption); + } + while(s4.length > 1) { + s4.remove(s4.length-1); + } + while(s5.length > 1) { + s5.remove(s5.length-1); + } + s6.href = "#"; + s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' ); + s6.className += " btn-primary disabled"; + s6.innerHTML = "Download Firmware"; + img_router_front.src = "router_images/keinbild.jpg"; + img_router_back.src = "router_images/keinbild.jpg"; } -function populateC(s1,s2){ - var s1 = document.getElementById(s1); - var s2 = document.getElementById(s2); - var s5 = document.getElementById("slct5"); - var s6 = document.getElementById("slct6"); - var img_router_front = document.getElementById("img_router_front"); - var img_router_back = document.getElementById("img_router_back"); - s2.innerHTML = ""; +function populateC(){ + var s1 = document.getElementById("fw-dl-3"); + var s2 = document.getElementById("fw-dl-4"); + var s5 = document.getElementById("fw-dl-5"); + var s6 = document.getElementById("fw-dl-6"); + var img_router_front = document.getElementById("img_router_front"); + var img_router_back = document.getElementById("img_router_back"); + s2.innerHTML = ""; EOT; $i=0; while( $iimagefront."\";\n"); - echo("var newImageBack = \"".$router[$i]->imageback."\";\n"); - echo("var optionArray = [\"|Erstinstallation?\""); + echo("\n if(s1.value == \"".$i."\"){\n"); + echo(" var newImageFront = \"".$router[$i]->imagefront."\";\n"); + echo(" var newImageBack = \"".$router[$i]->imageback."\";\n"); + echo(" var optionArray = [\"|Erstinstallation?\""); if( ($router[$i]->betafactory == 1) || ($router[$i]->brokenfactory == 1) || ($router[$i]->experimentalfactory == 1) || ($router[$i]->stablefactory == 1) ) { echo(",\"".$i."J|Ja\""); } @@ -173,41 +173,41 @@ EOT; echo(",\"".$i."N|Nein\""); } echo("];\n"); - echo("}\n"); + echo(" }\n"); $i++; } echo << 1) { - s5.remove(s5.length-1); - } - s6.href = "#"; - s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' ); - s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' ); - s6.className += " btn-primary disabled"; - s6.innerHTML = "Download Firmware"; - img_router_front.src = newImageFront; - img_router_back.src = newImageBack; + for(var option in optionArray){ + var pair = optionArray[option].split("|"); + var newOption = document.createElement("option"); + newOption.value = pair[0]; + newOption.innerHTML = pair[1]; + s2.options.add(newOption); + } + while(s5.length > 1) { + s5.remove(s5.length-1); + } + s6.href = "#"; + s6.className = s6.className.replace( /(?:^|\s)disabled(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-primary(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-danger(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-warning(?!\S)/g , '' ); + s6.className = s6.className.replace( /(?:^|\s)btn-success(?!\S)/g , '' ); + s6.className += " btn-primary disabled"; + s6.innerHTML = "Download Firmware"; + img_router_front.src = newImageFront; + img_router_back.src = newImageBack; } -function populateD(s1,s2){ - var s1 = document.getElementById(s1); - var s2 = document.getElementById(s2); - var s6 = document.getElementById("slct6"); - s2.innerHTML = ""; +function populateD(){ + var s1 = document.getElementById("fw-dl-4"); + var s2 = document.getElementById("fw-dl-5"); + var s6 = document.getElementById("fw-dl-6"); + s2.innerHTML = ""; EOT; $i=0; while( $ibetafactory == 1) ) { echo(",\"".$i."Jbeta|Beta\""); } @@ -221,9 +221,9 @@ EOT; echo(",\"".$i."Jstable|Stable\""); } echo("];\n"); - echo("}\n"); - echo("\nif(s1.value == \"".$i."N\"){\n"); - echo("var optionArray = [\"|Entwicklungsstadium?\""); + echo(" }\n"); + echo("\n if(s1.value == \"".$i."N\"){\n"); + echo(" var optionArray = [\"|Entwicklungsstadium?\""); if( ($router[$i]->betasysupgrade == 1) ) { echo(",\"".$i."Nbeta|Beta\""); } @@ -237,92 +237,92 @@ EOT; echo(",\"".$i."Nstable|Stable\""); } echo("];\n"); - echo("}\n"); + echo(" }\n"); $i++; } echo <<betafactory == 1) ) { - echo("\nif(s1.value == \"".$i."Jbeta\"){\n"); - echo("var link = \"".$router[$i]->betafactorylink."\";\n"); - echo("var linkclass = \" btn-warning\";\n"); - echo("}\n"); + echo("\n if(s1.value == \"".$i."Jbeta\"){\n"); + echo(" var link = \"".$router[$i]->betafactorylink."\";\n"); + echo(" var linkclass = \" btn-warning\";\n"); + echo(" }\n"); } if( ($router[$i]->brokenfactory == 1) ) { - echo("\nif(s1.value == \"".$i."Jbroken\"){\n"); - echo("var link = \"".$router[$i]->brokenfactorylink."\";\n"); - echo("var linkclass = \" btn-danger\";\n"); - echo("}\n"); + echo("\n if(s1.value == \"".$i."Jbroken\"){\n"); + echo(" var link = \"".$router[$i]->brokenfactorylink."\";\n"); + echo(" var linkclass = \" btn-danger\";\n"); + echo(" }\n"); } if( ($router[$i]->experimentalfactory == 1) ) { - echo("\nif(s1.value == \"".$i."Jexp\"){\n"); - echo("var link = \"".$router[$i]->experimentalfactorylink."\";\n"); - echo("var linkclass = \" btn-warning\";\n"); - echo("}\n"); + echo("\n if(s1.value == \"".$i."Jexp\"){\n"); + echo(" var link = \"".$router[$i]->experimentalfactorylink."\";\n"); + echo(" var linkclass = \" btn-warning\";\n"); + echo(" }\n"); } if( ($router[$i]->stablefactory == 1) ) { - echo("\nif(s1.value == \"".$i."Jstable\"){\n"); - echo("var link = \"".$router[$i]->stablefactorylink."\";\n"); - echo("var linkclass = \" btn-success\";\n"); - echo("}\n"); + echo("\n if(s1.value == \"".$i."Jstable\"){\n"); + echo(" var link = \"".$router[$i]->stablefactorylink."\";\n"); + echo(" var linkclass = \" btn-success\";\n"); + echo(" }\n"); } if( ($router[$i]->betasysupgrade == 1) ) { - echo("\nif(s1.value == \"".$i."Nbeta\"){\n"); - echo("var link = \"".$router[$i]->betasysupgradelink."\";\n"); - echo("var linkclass = \" btn-warning\";\n"); - echo("}\n"); + echo("\n if(s1.value == \"".$i."Nbeta\"){\n"); + echo(" var link = \"".$router[$i]->betasysupgradelink."\";\n"); + echo(" var linkclass = \" btn-warning\";\n"); + echo(" }\n"); } if( ($router[$i]->brokensysupgrade == 1) ) { - echo("\nif(s1.value == \"".$i."Nbroken\"){\n"); - echo("var link = \"".$router[$i]->brokensysupgradelink."\";\n"); - echo("var linkclass = \" btn-danger\";\n"); - echo("}\n"); + echo("\n if(s1.value == \"".$i."Nbroken\"){\n"); + echo(" var link = \"".$router[$i]->brokensysupgradelink."\";\n"); + echo(" var linkclass = \" btn-danger\";\n"); + echo(" }\n"); } if( ($router[$i]->experimentalsysupgrade == 1) ) { - echo("\nif(s1.value == \"".$i."Nexp\"){\n"); - echo("var link = \"".$router[$i]->experimentalsysupgradelink."\";\n"); - echo("var linkclass = \" btn-warning\";\n"); - echo("}\n"); + echo("\n if(s1.value == \"".$i."Nexp\"){\n"); + echo(" var link = \"".$router[$i]->experimentalsysupgradelink."\";\n"); + echo(" var linkclass = \" btn-warning\";\n"); + echo(" }\n"); } if( ($router[$i]->stablesysupgrade == 1) ) { - echo("\nif(s1.value == \"".$i."Nstable\"){\n"); - echo("var link = \"".$router[$i]->stablesysupgradelink."\";\n"); - echo("var linkclass = \" btn-success\";\n"); - echo("}\n"); + echo("\n if(s1.value == \"".$i."Nstable\"){\n"); + echo(" var link = \"".$router[$i]->stablesysupgradelink."\";\n"); + echo(" var linkclass = \" btn-success\";\n"); + echo(" }\n"); } $i++; } echo << @@ -371,7 +371,7 @@ EOT;
- EOT; for( $i=0; $i
- +
@@ -406,7 +406,7 @@ EOT;
- +
@@ -422,7 +422,7 @@ EOT;
- +
@@ -436,7 +436,7 @@ EOT;
- +
@@ -452,7 +452,7 @@ EOT; -