PK U.D@chrome/PK 9*9Q!chrome.manifestcontent forceautocomplete content/ overlay chrome://browser/content/browser.xul chrome://forceautocomplete/content/script-compiler-overlay.xulPK 1Bcontent/PK 9p3content/forceautocomplete.js// ==UserScript== // @name Force AutoComplete // @namespace http://loucypher.cjb.net/ // @include * // @exclude http://greasemonkeyed.com/* // @exclude http://userscript*.com/* // @description Makes autocomplete always on // ==/UserScript== // Changelog: // - Conditions added (function() { var form, input; form = document.getElementsByTagName('form'); if(form) { for(i = 0; i < form.length; i++) { form[i].setAttribute('autocomplete', 'on'); } input = document.getElementsByTagName('input'); for(i = 0; i < input.length; i++) { if(input[i].type=='text' || input[i].type=='password') { input[i].setAttribute('autocomplete', 'on'); } } } })(); PK 9*9]s s content/prefman.jsfunction forceautocomplete_PrefManager() { var startPoint="forceautocomplete."; var pref=Components.classes["@mozilla.org/preferences-service;1"]. getService(Components.interfaces.nsIPrefService). getBranch(startPoint); var observers={}; // whether a preference exists this.exists=function(prefName) { return pref.getPrefType(prefName) != 0; } // returns the named preference, or defaultValue if it does not exist this.getValue=function(prefName, defaultValue) { var prefType=pref.getPrefType(prefName); // underlying preferences object throws an exception if pref doesn't exist if (prefType==pref.PREF_INVALID) { return defaultValue; } switch (prefType) { case pref.PREF_STRING: return pref.getCharPref(prefName); case pref.PREF_BOOL: return pref.getBoolPref(prefName); case pref.PREF_INT: return pref.getIntPref(prefName); } } // sets the named preference to the specified value. values must be strings, // booleans, or integers. this.setValue=function(prefName, value) { var prefType=typeof(value); switch (prefType) { case "string": case "boolean": break; case "number": if (value % 1 != 0) { throw new Error("Cannot set preference to non integral number"); } break; default: throw new Error("Cannot set preference with datatype: " + prefType); } // underlying preferences object throws an exception if new pref has a // different type than old one. i think we should not do this, so delete // old pref first if this is the case. if (this.exists(prefName) && prefType != typeof(this.getValue(prefName))) { this.remove(prefName); } // set new value using correct method switch (prefType) { case "string": pref.setCharPref(prefName, value); break; case "boolean": pref.setBoolPref(prefName, value); break; case "number": pref.setIntPref(prefName, Math.floor(value)); break; } } // deletes the named preference or subtree this.remove=function(prefName) { pref.deleteBranch(prefName); } // call a function whenever the named preference subtree changes this.watch=function(prefName, watcher) { // construct an observer var observer={ observe:function(subject, topic, prefName) { watcher(prefName); } }; // store the observer in case we need to remove it later observers[watcher]=observer; pref.QueryInterface(Components.interfaces.nsIPrefBranchInternal). addObserver(prefName, observer, false); } // stop watching this.unwatch=function(prefName, watcher) { if (observers[watcher]) { pref.QueryInterface(Components.interfaces.nsIPrefBranchInternal) .removeObserver(prefName, observers[watcher]); } } }PK 9*9[#content/script-compiler-overlay.xulPK 9*9acontent/script-compiler.jsvar forceautocomplete_gmCompiler={ // getUrlContents adapted from Greasemonkey Compiler // http://www.letitblog.com/code/python/greasemonkey.py.txt // used under GPL permission // // most everything else below based heavily off of Greasemonkey // http://greasemonkey.mozdev.org/ // used under GPL permission getUrlContents: function(aUrl){ var ioService=Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var scriptableStream=Components .classes["@mozilla.org/scriptableinputstream;1"] .getService(Components.interfaces.nsIScriptableInputStream); var channel=ioService.newChannel(aUrl, null, null); var input=channel.open(); scriptableStream.init(input); var str=scriptableStream.read(input.available()); scriptableStream.close(); input.close(); return str; }, isGreasemonkeyable: function(url) { var scheme=Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService) .extractScheme(url); return ( (scheme == "http" || scheme == "https" || scheme == "file") && !/hiddenWindow\.html$/.test(url) ); }, contentLoad: function(e) { var unsafeWin=e.target.defaultView; if (unsafeWin.wrappedJSObject) unsafeWin=unsafeWin.wrappedJSObject; var unsafeLoc=new XPCNativeWrapper(unsafeWin, "location").location; var href=new XPCNativeWrapper(unsafeLoc, "href").href; if ( forceautocomplete_gmCompiler.isGreasemonkeyable(href) && ( /.*/.test(href) ) && !( /http:\/\/greasemonkeyed\.com\/.*/.test(href) || /http:\/\/userscript.*\.com\/.*/.test(href) ) ) { var script=forceautocomplete_gmCompiler.getUrlContents( 'chrome://forceautocomplete/content/forceautocomplete.js' ); forceautocomplete_gmCompiler.injectScript(script, href, unsafeWin); } }, injectScript: function(script, url, unsafeContentWin) { var sandbox, script, logger, storage, xmlhttpRequester; var safeWin=new XPCNativeWrapper(unsafeContentWin); sandbox=new Components.utils.Sandbox(safeWin); var storage=new forceautocomplete_ScriptStorage(); xmlhttpRequester=new forceautocomplete_xmlhttpRequester( unsafeContentWin, window//appSvc.hiddenDOMWindow ); sandbox.window=safeWin; sandbox.document=sandbox.window.document; sandbox.unsafeWindow=unsafeContentWin; // patch missing properties on xpcnw sandbox.XPathResult=Components.interfaces.nsIDOMXPathResult; // add our own APIs sandbox.GM_addStyle=function(css) { forceautocomplete_gmCompiler.addStyle(sandbox.document, css) }; sandbox.GM_setValue=forceautocomplete_gmCompiler.hitch(storage, "setValue"); sandbox.GM_getValue=forceautocomplete_gmCompiler.hitch(storage, "getValue"); sandbox.GM_openInTab=forceautocomplete_gmCompiler.hitch(this, "openInTab", unsafeContentWin); sandbox.GM_xmlhttpRequest=forceautocomplete_gmCompiler.hitch( xmlhttpRequester, "contentStartRequest" ); //unsupported sandbox.GM_registerMenuCommand=function(){}; sandbox.GM_log=function(){}; sandbox.GM_getResourceURL=function(){}; sandbox.GM_getResourceText=function(){}; sandbox.__proto__=sandbox.window; try { this.evalInSandbox( "(function(){"+script+"})()", url, sandbox); } catch (e) { var e2=new Error(typeof e=="string" ? e : e.message); e2.fileName=script.filename; e2.lineNumber=0; //GM_logError(e2); alert(e2); } }, evalInSandbox: function(code, codebase, sandbox) { if (Components.utils && Components.utils.Sandbox) { // DP beta+ Components.utils.evalInSandbox(code, sandbox); } else if (Components.utils && Components.utils.evalInSandbox) { // DP alphas Components.utils.evalInSandbox(code, codebase, sandbox); } else if (Sandbox) { // 1.0.x evalInSandbox(code, sandbox, codebase); } else { throw new Error("Could not create sandbox."); } }, openInTab: function(unsafeContentWin, url) { var tabBrowser = getBrowser(), browser, isMyWindow = false; for (var i = 0; browser = tabBrowser.browsers[i]; i++) if (browser.contentWindow == unsafeContentWin) { isMyWindow = true; break; } if (!isMyWindow) return; var loadInBackground, sendReferrer, referrer = null; loadInBackground = tabBrowser.mPrefs.getBoolPref("browser.tabs.loadInBackground"); sendReferrer = tabBrowser.mPrefs.getIntPref("network.http.sendRefererHeader"); if (sendReferrer) { var ios = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); referrer = ios.newURI(content.document.location.href, null, null); } tabBrowser.loadOneTab(url, referrer, null, null, loadInBackground); }, hitch: function(obj, meth) { var unsafeTop = new XPCNativeWrapper(unsafeContentWin, "top").top; for (var i = 0; i < this.browserWindows.length; i++) { this.browserWindows[i].openInTab(unsafeTop, url); } }, apiLeakCheck: function(allowedCaller) { var stack=Components.stack; var leaked=false; do { if (2==stack.language) { if ('chrome'!=stack.filename.substr(0, 6) && allowedCaller!=stack.filename ) { leaked=true; break; } } stack=stack.caller; } while (stack); return leaked; }, hitch: function(obj, meth) { if (!obj[meth]) { throw "method '" + meth + "' does not exist on object '" + obj + "'"; } var hitchCaller=Components.stack.caller.filename; var staticArgs = Array.prototype.splice.call(arguments, 2, arguments.length); return function() { if (forceautocomplete_gmCompiler.apiLeakCheck(hitchCaller)) { return; } // make a copy of staticArgs (don't modify it because it gets reused for // every invocation). var args = staticArgs.concat(); // add all the new arguments for (var i = 0; i < arguments.length; i++) { args.push(arguments[i]); } // invoke the original function with the correct this obj and the combined // list of static and dynamic arguments. return obj[meth].apply(obj, args); }; }, addStyle:function(doc, css) { var head, style; head = doc.getElementsByTagName('head')[0]; if (!head) { return; } style = doc.createElement('style'); style.type = 'text/css'; style.innerHTML = css; head.appendChild(style); }, onLoad: function() { var appcontent=window.document.getElementById("appcontent"); if (appcontent && !appcontent.greased_forceautocomplete_gmCompiler) { appcontent.greased_forceautocomplete_gmCompiler=true; appcontent.addEventListener("DOMContentLoaded", forceautocomplete_gmCompiler.contentLoad, false); } }, onUnLoad: function() { //remove now unnecessary listeners window.removeEventListener('load', forceautocomplete_gmCompiler.onLoad, false); window.removeEventListener('unload', forceautocomplete_gmCompiler.onUnLoad, false); window.document.getElementById("appcontent") .removeEventListener("DOMContentLoaded", forceautocomplete_gmCompiler.contentLoad, false); }, }; //object forceautocomplete_gmCompiler function forceautocomplete_ScriptStorage() { this.prefMan=new forceautocomplete_PrefManager(); } forceautocomplete_ScriptStorage.prototype.setValue = function(name, val) { this.prefMan.setValue(name, val); } forceautocomplete_ScriptStorage.prototype.getValue = function(name, defVal) { return this.prefMan.getValue(name, defVal); } window.addEventListener('load', forceautocomplete_gmCompiler.onLoad, false); window.addEventListener('unload', forceautocomplete_gmCompiler.onUnLoad, false);PK 9*9RWRV V content/xmlhttprequester.jsfunction forceautocomplete_xmlhttpRequester(unsafeContentWin, chromeWindow) { this.unsafeContentWin = unsafeContentWin; this.chromeWindow = chromeWindow; } // this function gets called by user scripts in content security scope to // start a cross-domain xmlhttp request. // // details should look like: // {method,url,onload,onerror,onreadystatechange,headers,data} // headers should be in the form {name:value,name:value,etc} // can't support mimetype because i think it's only used for forcing // text/xml and we can't support that forceautocomplete_xmlhttpRequester.prototype.contentStartRequest = function(details) { // important to store this locally so that content cannot trick us up with // a fancy getter that checks the number of times it has been accessed, // returning a dangerous URL the time that we actually use it. var url = details.url; // make sure that we have an actual string so that we can't be fooled with // tricky toString() implementations. if (typeof url != "string") { throw new Error("Invalid url: url must be of type string"); } var ioService=Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var scheme = ioService.extractScheme(url); // This is important - without it, GM_xmlhttpRequest can be used to get // access to things like files and chrome. Careful. switch (scheme) { case "http": case "https": case "ftp": this.chromeWindow.setTimeout( forceautocomplete_gmCompiler.hitch(this, "chromeStartRequest", url, details), 0); break; default: throw new Error("Invalid url: " + url); } } // this function is intended to be called in chrome's security context, so // that it can access other domains without security warning forceautocomplete_xmlhttpRequester.prototype.chromeStartRequest=function(safeUrl, details) { var req = new this.chromeWindow.XMLHttpRequest(); this.setupRequestEvent(this.unsafeContentWin, req, "onload", details); this.setupRequestEvent(this.unsafeContentWin, req, "onerror", details); this.setupRequestEvent(this.unsafeContentWin, req, "onreadystatechange", details); req.open(details.method, safeUrl); if (details.headers) { for (var prop in details.headers) { req.setRequestHeader(prop, details.headers[prop]); } } req.send(details.data); } // arranges for the specified 'event' on xmlhttprequest 'req' to call the // method by the same name which is a property of 'details' in the content // window's security context. forceautocomplete_xmlhttpRequester.prototype.setupRequestEvent = function(unsafeContentWin, req, event, details) { if (details[event]) { req[event] = function() { var responseState = { // can't support responseXML because security won't // let the browser call properties on it responseText:req.responseText, readyState:req.readyState, responseHeaders:(req.readyState==4?req.getAllResponseHeaders():''), status:(req.readyState==4?req.status:0), statusText:(req.readyState==4?req.statusText:'') } // Pop back onto browser thread and call event handler. // Have to use nested function here instead of GM_hitch because // otherwise details[event].apply can point to window.setTimeout, which // can be abused to get increased priveledges. new XPCNativeWrapper(unsafeContentWin, "setTimeout()") .setTimeout(function(){details[event](responseState);}, 0); } } }PK 1B +ENgg install.rdf {28f053a2-ad2d-41e2-a824-9421dd8ad59a} Force Autocomplete Extension 11.0 Makes autocomplete always on SION LouCypher (GMscript) http://xxsionxx.blog17.fc2.com/blog-entry-1223.html {ec8030f7-c20a-464f-9b0e-13a3a9e97384} 2.0 18.0.* PK U.D@ chrome/PK 9*9Q! %chrome.manifestPK 1B content/PK 9p3 content/forceautocomplete.jsPK 9*9]s s  6content/prefman.jsPK 9*9[# content/script-compiler-overlay.xulPK 9*9a content/script-compiler.jsPK 9*9RWRV V  -content/xmlhttprequester.jsPK 1B +ENgg ;install.rdfPK M>