2012-09-21 13:03:27 +02:00
|
|
|
function getCheckedValuesByName(checkboxname) {
|
|
|
|
var e=document.getElementsByName(checkboxname);
|
|
|
|
var p="";
|
|
|
|
|
|
|
|
for (var j=0;j<e.length;j++) {
|
|
|
|
if (e[j].checked) p+=e[j].value+" ";
|
|
|
|
};
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2012-12-01 23:36:43 +01:00
|
|
|
function checkAllBoxes(checkboxname,checked) {
|
|
|
|
var e=document.getElementsByName(checkboxname);
|
|
|
|
|
|
|
|
for (var j=0;j<e.length;j++) {
|
|
|
|
e[j].checked=checked;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2012-10-18 00:49:13 +02:00
|
|
|
function getSelectedValueById(selectname,idx) {
|
|
|
|
if (idx == undefined) idx = 0;
|
2012-09-21 13:03:27 +02:00
|
|
|
var i=document.getElementById(selectname).selectedIndex;
|
2012-10-18 00:49:13 +02:00
|
|
|
return document.getElementById(selectname).options[i+idx].value;
|
2012-09-21 13:03:27 +02:00
|
|
|
}
|
2012-11-19 23:52:30 +01:00
|
|
|
|
|
|
|
function checkEnter(event) {
|
|
|
|
event=event || window.event;
|
|
|
|
getEvent=event.keyCode;
|
|
|
|
if (getEvent == "13") {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2013-01-19 16:24:26 +01:00
|
|
|
|
2013-05-19 16:54:31 +02:00
|
|
|
function suggestSpecName(url) {
|
|
|
|
var url=document.getElementById("speccreateurl").value;
|
|
|
|
if (url.indexOf('&') > 0) url=url.substring(0,url.indexOf('&')+1);
|
|
|
|
var filename=url.substring(url.lastIndexOf('/')+1);
|
|
|
|
if (filename.indexOf('.') > 0) filename=filename.substring(0,filename.indexOf('.'));
|
|
|
|
if (filename.lastIndexOf('-') > 0) {
|
|
|
|
var version=filename.substring(filename.lastIndexOf('-')+1);
|
|
|
|
filename=filename.substring(0,filename.lastIndexOf('-')).toLowerCase();
|
|
|
|
}
|
|
|
|
document.getElementById("speccreateurl").value=url;
|
|
|
|
document.getElementById("speccreatename").value=filename;
|
|
|
|
document.getElementById("speccreateversion").value=version;
|
|
|
|
if (filename) {
|
|
|
|
document.getElementById("speccreatebutton").disabled=false;
|
|
|
|
} else {
|
|
|
|
document.getElementById("speccreatebutton").disabled=true;
|
|
|
|
}
|
|
|
|
if (filename.search("perl-") >= 0) {
|
|
|
|
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
|
|
|
|
if (document.getElementById("speccreatetype").options[j].value == "perl")
|
|
|
|
document.getElementById("speccreatetype").options[j].selected=true;
|
|
|
|
};
|
|
|
|
} else if (filename.search("python-") >= 0) {
|
|
|
|
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
|
|
|
|
if (document.getElementById("speccreatetype").options[j].value == "python")
|
|
|
|
document.getElementById("speccreatetype").options[j].selected=true;
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
|
|
|
|
if (document.getElementById("speccreatetype").options[j].value == "library")
|
|
|
|
document.getElementById("speccreatetype").options[j].selected=true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-19 16:24:26 +01:00
|
|
|
function replaceHTML(el, html) {
|
|
|
|
var oldEl = typeof el === "string" ? document.getElementById(el) : el;
|
|
|
|
/*@cc_on // Pure innerHTML is slightly faster in IE
|
|
|
|
oldEl.innerHTML = html;
|
|
|
|
return oldEl;
|
|
|
|
@*/
|
|
|
|
var newEl = oldEl.cloneNode(false);
|
|
|
|
newEl.innerHTML = html;
|
|
|
|
oldEl.parentNode.replaceChild(newEl, oldEl);
|
|
|
|
/* Since we just removed the old element from the DOM, return a reference
|
|
|
|
to the new element, which can be used to restore variable references. */
|
|
|
|
return newEl;
|
|
|
|
};
|