diff --git a/scripts/socialbox.js b/scripts/socialbox.js index 077e235..4ba566e 100644 --- a/scripts/socialbox.js +++ b/scripts/socialbox.js @@ -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 = - "" + nodes[i].childNodes[0].nodeValue + "" + - document.getElementById("socialbox").innerHTML; -// alert(document.getElementById("socialbox").innerHTML); + var id = nodes[i].attributes[0].value; + $("" + nodes[i].childNodes[0].nodeValue + "") + .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); diff --git a/scripts/webbuild/webbuild.js b/scripts/webbuild/webbuild.js index 78c0e15..9e23300 100644 --- a/scripts/webbuild/webbuild.js +++ b/scripts/webbuild/webbuild.js @@ -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'; // } diff --git a/styles/webbuild-post.css b/styles/webbuild-post.css index 4cffc84..a65ed2e 100644 --- a/styles/webbuild-post.css +++ b/styles/webbuild-post.css @@ -8,6 +8,8 @@ pre { box-shadow:none; font-family: monospace; word-break: break-all; + white-space: pre-wrap; + word-wrap: break-word; } code { diff --git a/webbuild.js.inc b/webbuild.js.inc index eb848df..624d856 100644 --- a/webbuild.js.inc +++ b/webbuild.js.inc @@ -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) { '
'+ ''; - 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 = "