// ==UserScript== // @name Flickr User Persitance Thing // @namespace http://www.rhyley.org/gm/ // @description Add a drop-down box with your yahoo ID's to the Flickr login form. // @include http://www.flickr.com/login.gne* // ==/UserScript== (function() { // ** Add your user ID's to this array names = new Array("jrhyley@gmail.com","controlledchaos05@yahoo.com"); opts = new Array(); form = document.evaluate('//form[@name="loginform"]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(0); login = form.elements.namedItem('email'); passw = form.elements.namedItem('password'); function buildLoginThing() { if (names[0] == 'Put'){ alert('You must configure the script before it will \nwork propery. Go to \"Manage User Scripts\" and\nuse the \"Edit\" button to change the script.'); return; } var theSelect = document.createElement("select"); theSelect.setAttribute("id","first_field"); theSelect.setAttribute("name","email"); theSelect.setAttribute("class","input"); theSelect.addEventListener('change', handleOnChange, true); for (var i in names) { opts[i] = document.createElement("option") opts[i].setAttribute("value",names[i]); opts[i].innerHTML = names[i]; theSelect.appendChild(opts[i]); } opts[i] = document.createElement("option"); opts[i].innerHTML = "Other..."; theSelect.appendChild(opts[i]); login.parentNode.replaceChild(theSelect, login); } handleOnChange = function() { if (login.selectedIndex == login.options.length-1) { var theText = document.createElement("input"); theText.setAttribute("type","text"); theText.setAttribute("id","first_field"); theText.setAttribute("name","email"); theText.setAttribute("class","input"); login.parentNode.replaceChild(theText, elm); theText.focus(); } else passw.focus(); } if (login){ buildLoginThing(); setTimeout(function (){passw.focus()},100); } })();