MediaWiki:LBSSearch.js

Revision as of 05:30, 30 January 2017 by Jcblmaster (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
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");
}