MediaWiki:LBSSearch.js: Difference between revisions

(Created page with "addOnloadHook(init) function init() { var button = document.getElementById("mainchain"); button.onclick = function(){ mainchainSearch() } } function mainchainSearc...")
 
No edit summary
Line 11: Line 11:
function mainchainSearch()
function mainchainSearch()
{
{
   var s4 = document.getElementById("4th");
   var ops = [];
   var s3 = document.getElementById("3th");
  ops[0] = document.getElementById("nre");
   var s2 = document.getElementById("2th");
  ops[1] = document.getElementById("4th");
   var s1 = document.getElementById("1th");
   ops[2] = document.getElementById("3th");
   ops[3] = document.getElementById("2nd");
  ops[4] = document.getElementById("1st");
   ops[5] = document.getElementById("re");


   var mainchain = ".*" + s4.options[s4.selectedIndex].value + s3.options[s3.selectedIndex].value + s2.options[s2.selectedIndex].value + s1.options[s1.selectedIndex].value + "Cer";
  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");
}