From f9ab1ddfaec611b819355d6e41e37465a3c70940 Mon Sep 17 00:00:00 2001 From: Tom Doan Date: Sat, 11 Jan 2014 17:02:12 +0800 Subject: [PATCH] Initial Git release --- Autofill/chrome.manifest | 6 + Autofill/chrome/content/catdelete.xul | 21 + Autofill/chrome/content/catnew.xul | 55 + Autofill/chrome/content/catrename.xul | 59 + Autofill/chrome/content/confirm.xul | 33 + Autofill/chrome/content/editbox.xul | 39 + Autofill/chrome/content/ff-overlay.js | 511 +++++++++ Autofill/chrome/content/ff-overlay.xul | 28 + Autofill/chrome/content/moverule.xul | 38 + Autofill/chrome/content/options.js | 1020 +++++++++++++++++ Autofill/chrome/content/options.xul | 173 +++ Autofill/chrome/content/sound.wav | Bin 0 -> 1622 bytes Autofill/chrome/content/wizard.js | 454 ++++++++ Autofill/chrome/content/wizard.xul | 32 + Autofill/chrome/locale/en-US/translations.dtd | 115 ++ .../locale/en-US/translations.properties | 16 + Autofill/chrome/locale/vi-VN/translations.dtd | 115 ++ .../locale/vi-VN/translations.properties | 16 + Autofill/chrome/skin-linux/ff-overlay.css | 1 + Autofill/chrome/skin-linux/icon_16x16.png | Bin 0 -> 560 bytes Autofill/chrome/skin-linux/icon_48x48.png | Bin 0 -> 2440 bytes Autofill/chrome/skin-linux/icon_64x64.png | Bin 0 -> 2827 bytes Autofill/chrome/skin-linux/options.css | 76 ++ Autofill/chrome/skin-linux/options.png | Bin 0 -> 6823 bytes Autofill/chrome/skin-linux/wizard.css | 1 + Autofill/chrome/skin/ff-overlay.css | 1 + Autofill/chrome/skin/icon_16x16.png | Bin 0 -> 560 bytes Autofill/chrome/skin/icon_48x48.png | Bin 0 -> 2440 bytes Autofill/chrome/skin/icon_64x64.png | Bin 0 -> 2827 bytes Autofill/chrome/skin/options.css | 70 ++ Autofill/chrome/skin/options.png | Bin 0 -> 6823 bytes Autofill/chrome/skin/wizard.css | 1 + Autofill/defaults/preferences/prefs.js | 15 + Autofill/install.rdf | 30 + 34 files changed, 2926 insertions(+) create mode 100644 Autofill/chrome.manifest create mode 100644 Autofill/chrome/content/catdelete.xul create mode 100644 Autofill/chrome/content/catnew.xul create mode 100644 Autofill/chrome/content/catrename.xul create mode 100644 Autofill/chrome/content/confirm.xul create mode 100644 Autofill/chrome/content/editbox.xul create mode 100644 Autofill/chrome/content/ff-overlay.js create mode 100644 Autofill/chrome/content/ff-overlay.xul create mode 100644 Autofill/chrome/content/moverule.xul create mode 100644 Autofill/chrome/content/options.js create mode 100644 Autofill/chrome/content/options.xul create mode 100644 Autofill/chrome/content/sound.wav create mode 100644 Autofill/chrome/content/wizard.js create mode 100644 Autofill/chrome/content/wizard.xul create mode 100644 Autofill/chrome/locale/en-US/translations.dtd create mode 100644 Autofill/chrome/locale/en-US/translations.properties create mode 100644 Autofill/chrome/locale/vi-VN/translations.dtd create mode 100644 Autofill/chrome/locale/vi-VN/translations.properties create mode 100644 Autofill/chrome/skin-linux/ff-overlay.css create mode 100644 Autofill/chrome/skin-linux/icon_16x16.png create mode 100644 Autofill/chrome/skin-linux/icon_48x48.png create mode 100644 Autofill/chrome/skin-linux/icon_64x64.png create mode 100644 Autofill/chrome/skin-linux/options.css create mode 100644 Autofill/chrome/skin-linux/options.png create mode 100644 Autofill/chrome/skin-linux/wizard.css create mode 100644 Autofill/chrome/skin/ff-overlay.css create mode 100644 Autofill/chrome/skin/icon_16x16.png create mode 100644 Autofill/chrome/skin/icon_48x48.png create mode 100644 Autofill/chrome/skin/icon_64x64.png create mode 100644 Autofill/chrome/skin/options.css create mode 100644 Autofill/chrome/skin/options.png create mode 100644 Autofill/chrome/skin/wizard.css create mode 100644 Autofill/defaults/preferences/prefs.js create mode 100644 Autofill/install.rdf diff --git a/Autofill/chrome.manifest b/Autofill/chrome.manifest new file mode 100644 index 0000000..d85d28c --- /dev/null +++ b/Autofill/chrome.manifest @@ -0,0 +1,6 @@ +content autofill chrome/content/ +skin autofill classic/1.0 chrome/skin/ +skin autofill classic/1.0 chrome/skin-linux/ os=Linux +locale autofill en-US chrome/locale/en-US/ +locale autofill vi-VN chrome/locale/vi-VN/ +overlay chrome://browser/content/browser.xul chrome://autofill/content/ff-overlay.xul diff --git a/Autofill/chrome/content/catdelete.xul b/Autofill/chrome/content/catdelete.xul new file mode 100644 index 0000000..2e943b2 --- /dev/null +++ b/Autofill/chrome/content/catdelete.xul @@ -0,0 +1,21 @@ + + + + + &catdelete.desc; + + + diff --git a/Autofill/chrome/content/catnew.xul b/Autofill/chrome/content/catnew.xul new file mode 100644 index 0000000..3dac7e3 --- /dev/null +++ b/Autofill/chrome/content/catnew.xul @@ -0,0 +1,55 @@ + + + + + + &catnew.desc; + + + diff --git a/Autofill/chrome/content/catrename.xul b/Autofill/chrome/content/catrename.xul new file mode 100644 index 0000000..ed4b832 --- /dev/null +++ b/Autofill/chrome/content/catrename.xul @@ -0,0 +1,59 @@ + + + + + + &catrename.desc; + + + diff --git a/Autofill/chrome/content/confirm.xul b/Autofill/chrome/content/confirm.xul new file mode 100644 index 0000000..9540195 --- /dev/null +++ b/Autofill/chrome/content/confirm.xul @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git a/Autofill/chrome/content/editbox.xul b/Autofill/chrome/content/editbox.xul new file mode 100644 index 0000000..b5610c3 --- /dev/null +++ b/Autofill/chrome/content/editbox.xul @@ -0,0 +1,39 @@ + + + + + + + diff --git a/Autofill/chrome/content/ff-overlay.js b/Autofill/chrome/content/ff-overlay.js new file mode 100644 index 0000000..1090d48 --- /dev/null +++ b/Autofill/chrome/content/ff-overlay.js @@ -0,0 +1,511 @@ +/* + * @package Autofill + * @author Tom Doan + * @copyright (c) Tom Doan + * @license GNU General Public License + * @link http://www.tohodo.com/ + */ + +if (typeof Autofill=='undefined') { + var Autofill = { + /* Preferences interface */ + P: Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch), + /* Complex strings interface (for Unicode support) */ + SS: Components.interfaces.nsISupportsString, + /* Options window */ + O: null, + /* Wizard window */ + W: null, + /* Is right-clicked element a field? */ + field: false, + /* Delay 1 sec to allow dynamically built iframes to be detected */ + delay: function(e) { + var n = +Autofill.P.getCharPref('extensions.autofill.delaysec'); + if (n>0) window.setTimeout(function(){Autofill.execute(e);}, n*1000); + else Autofill.execute(e); + }, + /* Initialize */ + init: function() { + var oMenu = document.getElementById('contentAreaContextMenu'); + oMenu.addEventListener('popupshowing', this.drawMenu, false); + gBrowser.addEventListener('DOMContentLoaded', this.delay, true); + }, + /* Render main Autofill context menu */ + drawMenu: function() { + var D = document, + sTag = gContextMenu.target.nodeName, + bHide = (gContextMenu.onImage || gContextMenu.onLink || !Autofill.P.getBoolPref('extensions.autofill.menu')); + Autofill.field = (gContextMenu.onTextInput || sTag=='INPUT' || sTag=='SELECT' || sTag=='OPTION'); + D.getElementById('autofill-menu').hidden = bHide; + D.getElementById('autofill-menusep').hidden = bHide; + D.getElementById('autofill-menu-wizform').hidden = Autofill.field; + D.getElementById('autofill-menu-wizfield').hidden = !Autofill.field; + }, + /* Render Profiles context submenu */ + drawCatsMenu: function() { + var sX = 'extensions.autofill.', + oMenuCats = document.getElementById('autofill-menu-cats'), + aCats = (this.P.prefHasUserValue(sX + 'cats')) ? JSON.parse(this.P.getComplexValue(sX + 'cats', this.SS).data) : [], + nCatIndex = this.P.getIntPref(sX + 'catnow'); + for (var i=2, imax=Math.max(oMenuCats.itemCount-2, aCats.length), j=0, o; i-2|<.+?> *<.+?>/gi, n = 0, + oRules = (this.P.prefHasUserValue(sX + 'rules')) ? JSON.parse(this.P.getComplexValue(sX + 'rules', this.SS).data) : {}, + aCats = (this.P.prefHasUserValue(sX + 'cats')) ? JSON.parse(this.P.getComplexValue(sX + 'cats', this.SS).data) : [], + nCatIndex = this.P.getIntPref(sX + 'catnow'), + aExceptions = (this.P.getCharPref(sX + 'exceptions')) ? this.P.getComplexValue(sX + 'exceptions', this.SS).data.split('\n') : [], + oOther = { + labelmatch: this.P.getBoolPref(sX + 'labelmatch'), + vars: this.P.getBoolPref(sX + 'vars'), + sound: this.P.getBoolPref(sX + 'sound') + }, + bOverwrite = 0, + sLb, reLb = /^\(\?<([!=])([^)]+)\)(.+)/, reLbEnd, + sAlpha = 'abcdefghijklmnopqrstuvwxyz', + sNum = '0123456789', + sAlphaNum = sAlpha + sAlpha.toUpperCase() + sNum + sNum, + T = function(o) { + if (!sLb) { + if (re.test(o.name) || re.test(o.id)) return true; + else if ((sType=='button' || sType=='submit') && re.test(o.value)) return true; + else if (!(o.name || o.id) && re.test(o.className)) return true; + else if (o.src && re.test(o.src)) return true; // for certain iframes, e.g. WYMeditor + // Try to find match in text label + else if (oOther['labelmatch']) return Autofill.findText(o, re); + } else { + /* Process Regular Expression 'lookbehind' syntax */ + var bLb = false, + sHaystack = (o.name || o.id) ? o.name + ' ' + o.id : o.className, + aMatch; + while (aMatch = reLbEnd.x.reG(sHaystack)) { + /* If the inner pattern matched, but the leading or trailing lookbehind failed */ + if (reLbEnd.x.re.test(sHaystack.slice(0, aMatch.index))!=reLbEnd.x.type) bLb = true; + } + return bLb; + } + }; + // Exit if rules table is empty + for (var i in oRules) { + if (oRules.hasOwnProperty(i)) n++; + } + if (n<1) return; + else n = 0; + // Exit if document title or URL matches a pattern in aExceptions + for (var i=0, imax=aExceptions.length; i1) ? aCats[nCatIndex-2].k : (nCatIndex==0) ? 'all' : ''; + // If profile is not All or Unfiled... + if (sCat && sCat!='all') { + // Define site Regular Expression pattern for profile + re = new RegExp(aCats[nCatIndex-2].s || '.', 'i'); + // Only proceed if profile filter matches document title or URL + if (!(re.test(doc.title) || re.test(doc.location.href))) return; + // Get profile overwrite flag + bOverwrite = aCats[nCatIndex-2].o || 0; + // If profile is All... + } else if (sCat=='all') { + var oCats = {}; + for (var i=0, imax=aCats.length; i0) { + sOut = R(1, 9); + for (var k=1; k