webbuild.js: support for "Start from URL" related fields autocompletion
This commit is contained in:
parent
dd369356c5
commit
19233fce7d
@ -32,28 +32,51 @@ function checkEnter(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function suggestSpecName(url) {
|
function suggestSpecName(url) {
|
||||||
|
var version="";
|
||||||
var url=document.getElementById("speccreateurl").value;
|
var url=document.getElementById("speccreateurl").value;
|
||||||
if (url.indexOf('&') > 0) url=url.substring(0,url.indexOf('&')+1);
|
if (url.indexOf('&') > 0) url=url.substring(0,url.indexOf('&')+1);
|
||||||
var filename=url.substring(url.lastIndexOf('/')+1);
|
var specname=url.substring(url.lastIndexOf('/')+1);
|
||||||
if (filename.indexOf('.') > 0) filename=filename.substring(0,filename.indexOf('.'));
|
while (i=specname.lastIndexOf('.')) {
|
||||||
if (filename.lastIndexOf('-') > 0) {
|
e=specname.substring(i);
|
||||||
var version=filename.substring(filename.lastIndexOf('-')+1);
|
if (e != ".tar" && e != ".gz" && e != ".zip" && e != ".bz2" &&
|
||||||
filename=filename.substring(0,filename.lastIndexOf('-')).toLowerCase();
|
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('-'));
|
||||||
}
|
}
|
||||||
document.getElementById("speccreateurl").value=url;
|
document.getElementById("speccreateurl").value=url;
|
||||||
document.getElementById("speccreatename").value=filename;
|
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;
|
||||||
document.getElementById("speccreateversion").value=version;
|
document.getElementById("speccreateversion").value=version;
|
||||||
if (filename) {
|
if (url) {
|
||||||
|
document.getElementById("speccreatename").disabled=false;
|
||||||
|
document.getElementById("speccreateversion").disabled=false;
|
||||||
|
document.getElementById("speccreatetype").disabled=false;
|
||||||
document.getElementById("speccreatebutton").disabled=false;
|
document.getElementById("speccreatebutton").disabled=false;
|
||||||
} else {
|
} else {
|
||||||
|
document.getElementById("speccreatename").disabled=true;
|
||||||
|
document.getElementById("speccreateversion").disabled=true;
|
||||||
|
document.getElementById("speccreatetype").disabled=true;
|
||||||
document.getElementById("speccreatebutton").disabled=true;
|
document.getElementById("speccreatebutton").disabled=true;
|
||||||
}
|
}
|
||||||
if (filename.search("perl-") >= 0) {
|
if (specname.search("perl-") >= 0) {
|
||||||
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
|
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
|
||||||
if (document.getElementById("speccreatetype").options[j].value == "perl")
|
if (document.getElementById("speccreatetype").options[j].value == "perl")
|
||||||
document.getElementById("speccreatetype").options[j].selected=true;
|
document.getElementById("speccreatetype").options[j].selected=true;
|
||||||
};
|
};
|
||||||
} else if (filename.search("python-") >= 0) {
|
} else if (specname.search("python-") >= 0) {
|
||||||
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
|
for (var j=0;j<document.getElementById("speccreatetype").length;j++) {
|
||||||
if (document.getElementById("speccreatetype").options[j].value == "python")
|
if (document.getElementById("speccreatetype").options[j].value == "python")
|
||||||
document.getElementById("speccreatetype").options[j].selected=true;
|
document.getElementById("speccreatetype").options[j].selected=true;
|
||||||
|
Loading…
Reference in New Issue
Block a user