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) {
|
2013-05-23 12:06:28 +02:00
|
|
|
var version="";
|
2013-05-19 16:54:31 +02:00
|
|
|
var url=document.getElementById("speccreateurl").value;
|
|
|
|
if (url.indexOf('&') > 0) url=url.substring(0,url.indexOf('&')+1);
|
2013-05-23 12:06:28 +02:00
|
|
|
var specname=url.substring(url.lastIndexOf('/')+1);
|
|
|
|
while (i=specname.lastIndexOf('.')) {
|
|
|
|
e=specname.substring(i);
|
|
|
|
if (e != ".tar" && e != ".gz" && e != ".zip" && e != ".bz2" &&
|
|
|
|
e != ".xz" && e != ".tgz" && e != ".zip" && e != ".src" &&
|
|
|
|
e != ".orig") break;
|
|
|
|
specname=specname.substring(0,i);
|
|
|
|
}
|
|
|
|
if (specname.lastIndexOf('-') > 0) {
|
|
|
|
version=specname.substring(specname.lastIndexOf('-')+1);
|
|
|
|
specname=specname.substring(0,specname.lastIndexOf('-'));
|
2013-05-19 16:54:31 +02:00
|
|
|
}
|
|
|
|
document.getElementById("speccreateurl").value=url;
|
2013-05-23 12:06:28 +02:00
|
|
|
if (url.search("cpan.org") >= 0) {
|
|
|
|
specname="perl-"+specname;
|
|
|
|
} else {
|
|
|
|
specname=specname.toLowerCase();
|
|
|
|
}
|
|
|
|
if (url.search("git://") >= 0) {
|
|
|
|
document.getElementById("speccreategitbranch").disabled=false;
|
|
|
|
} else {
|
|
|
|
document.getElementById("speccreategitbranch").disabled=true;
|
|
|
|
}
|
|
|
|
document.getElementById("speccreatename").value=specname;
|
2013-05-19 16:54:31 +02:00
|
|
|
document.getElementById("speccreateversion").value=version;
|
2013-05-23 12:06:28 +02:00
|
|
|
if (url) {
|
|
|
|
document.getElementById("speccreatename").disabled=false;
|
|
|
|
document.getElementById("speccreateversion").disabled=false;
|
|
|
|
document.getElementById("speccreatetype").disabled=false;
|
2013-05-19 16:54:31 +02:00
|
|
|
document.getElementById("speccreatebutton").disabled=false;
|
|
|
|
} else {
|
2013-05-23 12:06:28 +02:00
|
|
|
document.getElementById("speccreatename").disabled=true;
|
|
|
|
document.getElementById("speccreateversion").disabled=true;
|
|
|
|
document.getElementById("speccreatetype").disabled=true;
|
2013-05-19 16:54:31 +02:00
|
|
|
document.getElementById("speccreatebutton").disabled=true;
|
|
|
|
}
|
2013-05-23 12:06:28 +02:00
|
|
|
if (specname.search("perl-") >= 0) {
|
2013-05-19 16:54:31 +02:00
|
|
|
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;
|
|
|
|
};
|
2013-05-23 12:06:28 +02:00
|
|
|
} else if (specname.search("python-") >= 0) {
|
2013-05-19 16:54:31 +02:00
|
|
|
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;
|
|
|
|
};
|