Optimizations of webbuild.js and socialbox.js
This commit is contained in:
parent
61960704b0
commit
12b9f32dd4
@ -1,14 +1,8 @@
|
||||
var webbuildhost = ""
|
||||
//var url = "http://buildvm01.openmamba.org/cgi-bin/webbuild"
|
||||
var url = "/cgi-bin/webbuild.cgi"
|
||||
|
||||
/*function socialbox_refresh_times() {
|
||||
socialbox_refresh_times(false);
|
||||
}*/
|
||||
|
||||
var socialbox_fullrefresh_count = 0;
|
||||
|
||||
function socialbox_refresh_times() {
|
||||
"use strict";
|
||||
var times = document.getElementsByName("socialtime");
|
||||
var datenow = new Date();
|
||||
var utcnow = parseInt(Date.UTC(datenow.getUTCFullYear(), datenow.getUTCMonth(), datenow.getUTCDate(),
|
||||
@ -45,13 +39,15 @@ function socialbox_refresh_times() {
|
||||
}
|
||||
|
||||
var socialbox_interval = null;
|
||||
var socialbox_reloadtime = 15000;
|
||||
var socialbox_reloadtime = 5000;
|
||||
|
||||
function ajax_getvalues_refresh(request,user,user_email,secret) {
|
||||
var url = "/cgi-bin/webbuild.cgi"
|
||||
// var url = "http://buildvm01.openmamba.org/cgi-bin/webbuild"
|
||||
"use strict";
|
||||
|
||||
var webbuildurl = "/cgi-bin/webbuild.cgi"
|
||||
|
||||
if (typeof webbuildhost != 'undefined' && webbuildhost != "") {
|
||||
url = "/cgi-bin/webbuild-" + webbuildhost + ".cgi";
|
||||
webbuildurl = "/cgi-bin/webbuild-" + webbuildhost + ".cgi";
|
||||
}
|
||||
|
||||
var fromid = 0;
|
||||
@ -71,9 +67,9 @@ function ajax_getvalues_refresh(request,user,user_email,secret) {
|
||||
request="REQUEST=refresh&USER="+user+"&USER_EMAIL="+user_email+"&SECRET="+secret+"&FROMID="+fromid;
|
||||
|
||||
if (window.XMLHttpRequest)
|
||||
xmlhttp1 = new XMLHttpRequest();
|
||||
var xmlhttp1 = new XMLHttpRequest();
|
||||
else if (window.ActiveXObject)
|
||||
xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
var xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
else
|
||||
return;
|
||||
|
||||
@ -86,23 +82,19 @@ function ajax_getvalues_refresh(request,user,user_email,secret) {
|
||||
var xmldoc = xmlhttp1.responseXML.documentElement;
|
||||
var nodes = xmldoc.getElementsByTagName("socialbox")[0].childNodes;
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
id = nodes[i].attributes[0].value;
|
||||
document.getElementById("socialbox").innerHTML =
|
||||
"<span name=social sid=\""+ id + "\">" + nodes[i].childNodes[0].nodeValue + "</span>" +
|
||||
document.getElementById("socialbox").innerHTML;
|
||||
// alert(document.getElementById("socialbox").innerHTML);
|
||||
var id = nodes[i].attributes[0].value;
|
||||
$("<span name=social sid=\""+ id + "\">" + nodes[i].childNodes[0].nodeValue + "</span>")
|
||||
.clone().hide().prependTo("#socialbox").slideDown();
|
||||
}
|
||||
if (xmldoc.getElementsByTagName("processes")[0] != undefined) {
|
||||
document.getElementById("processes").innerHTML = xmldoc.getElementsByTagName("processes")[0].childNodes[0].nodeValue;
|
||||
$(function() { $('.scroll-pane3').jScrollPane({scrollbarWidth:10}); });
|
||||
}
|
||||
$(function() { $('.scroll-pane').jScrollPane({scrollbarWidth:10}); });
|
||||
// lastupdate = (+new Date());
|
||||
socialbox_refresh_times();
|
||||
//alert("refreshed_times");
|
||||
}
|
||||
|
||||
xmlhttp1.open("POST", url, true);
|
||||
xmlhttp1.open("POST", webbuildurl, true);
|
||||
xmlhttp1.setRequestHeader("Content-type","application/x-www-form-urlencoded");
|
||||
xmlhttp1.send(request);
|
||||
socialbox_interval = setInterval("ajax_getvalues_refresh(\"\",\""+user+"\",\""+user_email+"\",\""+secret+"\",\""+webbuildhost+"\")",socialbox_reloadtime);
|
||||
|
@ -32,7 +32,7 @@ function getSelectedValueById(selectname,idx) {
|
||||
|
||||
function checkEnter(event) {
|
||||
event=event || window.event;
|
||||
getEvent=event.keyCode;
|
||||
var getEvent=event.keyCode;
|
||||
if (getEvent == "13") {
|
||||
return true;
|
||||
}
|
||||
@ -51,7 +51,7 @@ function suggestSpecName(url) {
|
||||
var url=document.getElementById("speccreateurl").value;
|
||||
if (url.indexOf('?') > 0) url=url.substring(0,url.indexOf('?'));
|
||||
var specname=url.substring(url.lastIndexOf('/')+1);
|
||||
var extension;
|
||||
var extension,i,e;
|
||||
while (i=specname.lastIndexOf('.')) {
|
||||
e=specname.substring(i);
|
||||
if (e != ".tar" && e != ".gz" && e != ".zip" && e != ".bz2" &&
|
||||
@ -163,7 +163,7 @@ function getDownload(request) {
|
||||
alert("ERROR: webbuildhost is undefined!");
|
||||
return;
|
||||
}
|
||||
url = "/cgi-bin/webbuild-" + webbuildhost + ".cgi";
|
||||
var url = "/cgi-bin/webbuild-" + webbuildhost + ".cgi";
|
||||
|
||||
if (request != "")
|
||||
request=request+"&USER="+user+"&USER_EMAIL="+user_email+"&SECRET="+encodeURIComponent(secret);
|
||||
@ -174,7 +174,7 @@ function getDownload(request) {
|
||||
|
||||
// var hiddenIFrameID = 'hiddenDownloader', iframe = document.getElementById(hiddenIFrameID);
|
||||
// if (iframe == null) {
|
||||
iframe = document.createElement('iframe');
|
||||
var iframe = document.createElement('iframe');
|
||||
// iframe.id = hiddenIFrameID;
|
||||
iframe.style.display = 'none';
|
||||
// }
|
||||
|
@ -8,6 +8,8 @@ pre {
|
||||
box-shadow:none;
|
||||
font-family: monospace;
|
||||
word-break: break-all;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
code {
|
||||
|
@ -3,7 +3,7 @@
|
||||
var lastupdate = 0;
|
||||
var reloadtime = 15000;
|
||||
var editor;
|
||||
var xmlhttp;
|
||||
var lastxmlhttp;
|
||||
|
||||
function getUrlVars() {
|
||||
var vars = {};
|
||||
@ -13,9 +13,9 @@ function getUrlVars() {
|
||||
return vars;
|
||||
}
|
||||
|
||||
function clearid(id) {
|
||||
function clearid(id,xmlhttp) {
|
||||
document.getElementById(id).innerHTML = '';
|
||||
if (xmlhttp != undefined) xmlhttp.abort();
|
||||
if (lastxmlhttp != undefined) lastxmlhttp.abort();
|
||||
}
|
||||
|
||||
function editorChanged() {
|
||||
@ -28,7 +28,7 @@ function editorChanged() {
|
||||
function ajax_getvalues(request,confirm) {
|
||||
var url;
|
||||
// limit to this function the scope of xmlhttp to avoid sockets left pending
|
||||
var xmlhttp;
|
||||
var o = {};
|
||||
|
||||
if (host != undefined) {
|
||||
webbuildhost=host;
|
||||
@ -54,11 +54,12 @@ function ajax_getvalues(request,confirm) {
|
||||
/* if (window.location.href.indexOf('?') > 0)
|
||||
url = url + "?" + window.location.href.replace(/.*\?/,"");*/
|
||||
if (window.XMLHttpRequest)
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
o.xmlhttp = new XMLHttpRequest();
|
||||
else if (window.ActiveXObject)
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
o.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
else
|
||||
return;
|
||||
lastxmlhttp = o.xmlhttp;
|
||||
document.getElementById("noajax_msg").innerHTML = "";
|
||||
|
||||
document.getElementById("status").innerHTML =
|
||||
@ -68,17 +69,18 @@ function ajax_getvalues(request,confirm) {
|
||||
'<div style="position:fixed;left:95%;top:95%;color:red;"><a href="javascript:clearid(\'status\');">[x] Close</a></div>'+
|
||||
'</div>';
|
||||
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (xmlhttp.readyState < 4)
|
||||
o.xmlhttp.onreadystatechange = function() {
|
||||
if (o.xmlhttp.readyState < 4) {
|
||||
return;
|
||||
if (xmlhttp.responseXML == undefined) {
|
||||
}
|
||||
if (o.xmlhttp.responseXML == undefined) {
|
||||
// && xmlhttp.responseText == undefined) {
|
||||
document.getElementById("status").innerHTML = "";
|
||||
document.getElementById("output").innerHTML = "<br>ERROR: there was a network connection problem.";
|
||||
xmlhttp.abort();
|
||||
o.xmlhttp.abort();
|
||||
return;
|
||||
}
|
||||
var xmldoc = xmlhttp.responseXML.documentElement;
|
||||
var xmldoc = o.xmlhttp.responseXML.documentElement;
|
||||
if (xmldoc == undefined) {
|
||||
return;
|
||||
}
|
||||
@ -88,10 +90,10 @@ function ajax_getvalues(request,confirm) {
|
||||
document.title = nodes[i].childNodes[0].nodeValue;
|
||||
} else if (document.getElementById(nodes[i].nodeName) != undefined) {
|
||||
// var node = document.getElementById(nodes[i].nodeName)
|
||||
//alert("replace " + node.nodeValue + "with " + nodes[i].childNodes[0].nodeValue);
|
||||
// node = replaceHTML(node, nodes[i].childNodes[0].nodeValue);
|
||||
$("#"+nodes[i].nodeName).html(nodes[i].childNodes[0].nodeValue);
|
||||
spectext = document.getElementById("spectext");
|
||||
replaceHTML(document.getElementById(nodes[i].nodeName), nodes[i].childNodes[0].nodeValue);
|
||||
// document.getElementById(nodes[i].nodeName).innerHTML = nodes[i].childNodes[0].nodeValue;
|
||||
// $("#"+nodes[i].nodeName).html(nodes[i].childNodes[0].nodeValue);
|
||||
var spectext = document.getElementById("spectext");
|
||||
if ((nodes[i].nodeName == "editor") && (spectext != undefined) && (spectext.parentNode != undefined))
|
||||
{
|
||||
editor = CodeMirror.fromTextArea(spectext,
|
||||
@ -112,7 +114,7 @@ function ajax_getvalues(request,confirm) {
|
||||
document.getElementById("status").innerHTML = "";
|
||||
}
|
||||
|
||||
xmlhttp.onprogress = function() {
|
||||
o.xmlhttp.onprogress = function() {
|
||||
var end = 0,to;
|
||||
// save responseText length when entering the function
|
||||
to = this.responseText.length - 1;
|
||||
@ -135,10 +137,10 @@ function ajax_getvalues(request,confirm) {
|
||||
}
|
||||
}
|
||||
|
||||
xmlhttp.open("POST", url, true);
|
||||
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
|
||||
xmlhttp.send(request);
|
||||
// setTimeout(function() { alert ("Timeout expired"); xmlhttp.abort(); }, 600000);
|
||||
o.xmlhttp.open("POST", url, true);
|
||||
o.xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
|
||||
o.xmlhttp.send(request);
|
||||
// setTimeout(function() { alert ("Timeout expired"); o.xmlhttp.abort(); }, 600000);
|
||||
|
||||
var currpos = 0, start = -1;
|
||||
|
||||
@ -193,7 +195,7 @@ function ajaxFileUpload(request)
|
||||
}
|
||||
|
||||
var webbuild_status_lastupdate = 0;
|
||||
var webbuild_status_reloadtime = 60000;
|
||||
var webbuild_status_reloadtime = 300000;
|
||||
|
||||
function webbuild_status_getvalues() {
|
||||
var url = "/cgi-bin/autodist";
|
||||
|
Loading…
Reference in New Issue
Block a user