MediaWiki:LBSSearch.js: Difference between revisions
Jcblmaster (talk | contribs) (Created page with "addOnloadHook(init) function init() { var button = document.getElementById("mainchain"); button.onclick = function(){ mainchainSearch() } } function mainchainSearc...") |
Jcblmaster (talk | contribs) No edit summary |
||
Line 11: | Line 11: | ||
function mainchainSearch() | function mainchainSearch() | ||
{ | { | ||
var | var ops = []; | ||
ops[0] = document.getElementById("nre"); | |||
ops[1] = document.getElementById("4th"); | |||
ops[2] = document.getElementById("3th"); | |||
ops[3] = document.getElementById("2nd"); | |||
ops[4] = document.getElementById("1st"); | |||
ops[5] = document.getElementById("re"); | |||
var mainchain = ". | var st; | ||
window.open("http://jcbl.jp/wiki/Volatile:ListMol/LBS?my_1=Mainchain" + mainchain, "_blank"); | var mc; | ||
var searchtext = ""; | |||
var mainchain = ""; | |||
var counter = 0; | |||
for(var i = 0; i < ops.length; i ++){ | |||
st = ops[i].options[ops[i].selectedIndex].innerHTML; | |||
mc = ops[i].options[ops[i].selectedIndex].value; | |||
searchtext += st; | |||
mainchain += mc; | |||
if(i == 0 || i == ops.length-1) | |||
continue; | |||
if(st === "(any)" || st === "(free)") | |||
counter ++; | |||
} | |||
if(counter >= 3) | |||
alert("3つ以上のあいまい条件指定はできません。"); | |||
else | |||
window.open("http://jcbl.jp/wiki/Volatile:ListMol/LBS?my_1=Mainchain=" + mainchain + "&my_2=&my_3=" + searchtext, "_blank"); | |||
} | } |
Revision as of 05:30, 30 January 2017
addOnloadHook(init) function init() { var button = document.getElementById("mainchain"); button.onclick = function(){ mainchainSearch() } } function mainchainSearch() { var ops = []; ops[0] = document.getElementById("nre"); ops[1] = document.getElementById("4th"); ops[2] = document.getElementById("3th"); ops[3] = document.getElementById("2nd"); ops[4] = document.getElementById("1st"); ops[5] = document.getElementById("re"); var st; var mc; var searchtext = ""; var mainchain = ""; var counter = 0; for(var i = 0; i < ops.length; i ++){ st = ops[i].options[ops[i].selectedIndex].innerHTML; mc = ops[i].options[ops[i].selectedIndex].value; searchtext += st; mainchain += mc; if(i == 0 || i == ops.length-1) continue; if(st === "(any)" || st === "(free)") counter ++; } if(counter >= 3) alert("3つ以上のあいまい条件指定はできません。"); else window.open("http://jcbl.jp/wiki/Volatile:ListMol/LBS?my_1=Mainchain=" + mainchain + "&my_2=&my_3=" + searchtext, "_blank"); }