|
@@ -0,0 +1,45 @@
|
|
|
+window.onload = function() {
|
|
|
+ var field = document.getElementById("passgen");
|
|
|
+ if (field != undefined) field.onclick = function() {
|
|
|
+ var cell = field.parentNode;
|
|
|
+ cell.removeChild(field);
|
|
|
+ cell.appendChild(document.createElement("img"));
|
|
|
+ cell.lastChild.src = "/static/img/coin.ajax.gif";
|
|
|
+ cell.appendChild(document.createTextNode(" Génération en cours…"));
|
|
|
+ var xhr = new XMLHttpRequest();
|
|
|
+ xhr.onreadystatechange = function() {
|
|
|
+ if (xhr.readyState != 4) return;
|
|
|
+ var table = cell.parentNode.parentNode;
|
|
|
+ if (xhr.responseXML == null)
|
|
|
+ var pass = (new DOMParser().parseFromString(xhr.responseText, "text/html")).getElementById("password");
|
|
|
+ else var pass = xhr.responseXML.getElementById("password");
|
|
|
+ table.insertBefore(pass.cloneNode(true), cell.parentNode);
|
|
|
+ do pass = pass.nextSibling; while (pass.nodeType == 3);
|
|
|
+ table.insertBefore(pass.cloneNode(true), cell.parentNode);
|
|
|
+ table.removeChild(cell.parentNode);
|
|
|
+ };
|
|
|
+ xhr.open("GET", field.href, false);
|
|
|
+ xhr.send(null);
|
|
|
+ return false;
|
|
|
+ };
|
|
|
+
|
|
|
+ var field = document.getElementById("trafic_zoom");
|
|
|
+ if (field != undefined) {
|
|
|
+ var select = document.createElement("select");
|
|
|
+ var options = {"hourly": "une heure", "daily": "24 heures", "weekly": "7 jours", "monthly": "un mois", "yearly": "un an"};
|
|
|
+ for (var i in options) {
|
|
|
+ var opt = document.createElement("option");
|
|
|
+ opt.appendChild(document.createTextNode(options[i]));
|
|
|
+ opt.value = i;
|
|
|
+ select.appendChild(opt);
|
|
|
+ }
|
|
|
+ select.childNodes[1].selected = "selected";
|
|
|
+ var graph = document.getElementById("trafic_graph");
|
|
|
+ var href = graph.src+"/";
|
|
|
+ select.onchange = function() {
|
|
|
+ graph.src = href+select.value;
|
|
|
+ };
|
|
|
+ field.parentNode.insertBefore(select, field);
|
|
|
+ field.parentNode.removeChild(field);
|
|
|
+ }
|
|
|
+};
|