Browse Source

code beautify

master
T. Meissner 12 years ago
parent
commit
3861daec30
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      scripts/haltestellen.js

+ 15
- 0
scripts/haltestellen.js View File

@ -79,6 +79,7 @@ function ajaxCall(dataUrl, outputElement, callback, responseType) {
// set the ajax server url dependent on the protocol // set the ajax server url dependent on the protocol
// for strato ssl-proxy, we have to insert the 1st part of the url path // for strato ssl-proxy, we have to insert the 1st part of the url path
serverUrl = window.location.protocol + "//" + window.location.hostname; serverUrl = window.location.protocol + "//" + window.location.hostname;
if (serverUrl.indexOf("https") === -1) { if (serverUrl.indexOf("https") === -1) {
serverUrl += "/cgi-bin/"; serverUrl += "/cgi-bin/";
} else { } else {
@ -146,17 +147,25 @@ function ajaxCall(dataUrl, outputElement, callback, responseType) {
// generate table entries // generate table entries
for (i = 0; i < dataLength; i++) { for (i = 0; i < dataLength; i++) {
htmlOutput += "<tr>"; htmlOutput += "<tr>";
entry = data[i].split(","); entry = data[i].split(",");
// debug log // debug log
if (DEBUG === 1) {console.log("part " + i + " of parsed data: " + entry);} if (DEBUG === 1) {console.log("part " + i + " of parsed data: " + entry);}
for (y = 0; y < 3; y++) { for (y = 0; y < 3; y++) {
// debug log // debug log
if (DEBUG === 1) {console.log("part " + y + ": " + entry[y]);} if (DEBUG === 1) {console.log("part " + y + ": " + entry[y]);}
htmlOutput += "<td>" + entry[y].slice(1, -1) + "</td>"; htmlOutput += "<td>" + entry[y].slice(1, -1) + "</td>";
} }
htmlOutput += "</tr>"; htmlOutput += "</tr>";
} }
// close table // close table
htmlOutput += "</table>"; htmlOutput += "</table>";
// print content into web page // print content into web page
@ -197,7 +206,9 @@ function ajaxCall(dataUrl, outputElement, callback, responseType) {
// process of response only if it's not empty // process of response only if it's not empty
if (data.indexOf("[]") !== -1) { if (data.indexOf("[]") !== -1) {
htmlOutput = "<p>unbekannte Haltstelle, bitte erneut versuchen</p>"; htmlOutput = "<p>unbekannte Haltstelle, bitte erneut versuchen</p>";
} else { } else {
// replace useless chars & split string into array // replace useless chars & split string into array
@ -217,6 +228,7 @@ function ajaxCall(dataUrl, outputElement, callback, responseType) {
// generate table entries // generate table entries
for (i = 0; i < dataLength; i++) { for (i = 0; i < dataLength; i++) {
htmlOutput += "<tr>"; htmlOutput += "<tr>";
entry = data[i].split(","); entry = data[i].split(",");
// debug log // debug log
@ -224,7 +236,9 @@ function ajaxCall(dataUrl, outputElement, callback, responseType) {
htmlOutput += "<td>" + entry[0].slice(1, -1) + "</td>"; htmlOutput += "<td>" + entry[0].slice(1, -1) + "</td>";
htmlOutput += "</tr>"; htmlOutput += "</tr>";
} }
// close table // close table
htmlOutput += "</table>"; htmlOutput += "</table>";
@ -232,6 +246,7 @@ function ajaxCall(dataUrl, outputElement, callback, responseType) {
// print content into web page // print content into web page
target.innerHTML = htmlOutput; target.innerHTML = htmlOutput;
} }
}; };


Loading…
Cancel
Save