User:Cuckooman4/favtab2.js

☆ Save On Wikipedia ↗
//Made by cuckooman4.
//
//Same as original, (User:Cuckooman4/favtab.js) except it uses a dropdown list.
//<pre><nowiki>
addOnloadHook(
  function() {
    mw.util.addPortletLink('p-cactions','javascript:favgo()','Go!','ca-fav')
    document.getElementById("ca-fav").innerHTML = "<select id='favdropdown'>" + writefavlist() + "</select> " + document.getElementById("ca-fav").innerHTML
  }
)

function writefavlist() {
  var i = 0
  var strtoreturn = ""
  while(i < favlist.length) {
    strtoreturn += "<option onclick='location.href=\"http://en.wikipedia.org/wiki/" + favlist[i] + "\"' style='width:200px;'>" + favlist[i] + "</option>"
    i++
  }
  return(strtoreturn)
}

function favgo() {
  location.href = "http://en.wikipedia.org/wiki/" + document.getElementById("favdropdown").all[document.getElementById("favdropdown").selectedIndex].innerText
}
//</nowiki></pre>