From 083ed4dc8282de961e1733e1d98a792d79befc5f Mon Sep 17 00:00:00 2001 From: Phil Crosby Date: Sat, 5 May 2012 20:15:27 -0700 Subject: Put content scripts and background scripts in separate directories, so the purpose and execution mode are more clear. Sorry if you had patches in your local copies and this breaks them -- these renames were a long time coming, and now is better than later. --- background/settings.js | 81 --- background_page.html | 6 +- background_scripts/commands.js | 252 ++++++++ background_scripts/completion.js | 626 +++++++++++++++++++ background_scripts/settings.js | 81 +++ commands.js | 252 -------- content_scripts/link_hints.js | 552 +++++++++++++++++ content_scripts/vimium_frontend.js | 1182 ++++++++++++++++++++++++++++++++++++ content_scripts/vomnibar.js | 232 +++++++ lib/completion.js | 626 ------------------- lib/domUtils.js | 121 ---- lib/dom_utils.js | 121 ++++ lib/keyboardUtils.js | 66 -- lib/keyboard_utils.js | 66 ++ linkHints.js | 552 ----------------- manifest.json | 10 +- options.html | 8 +- test_harnesses/automated.html | 8 +- vimiumFrontend.js | 1182 ------------------------------------ vomnibar.js | 232 ------- 20 files changed, 3128 insertions(+), 3128 deletions(-) delete mode 100644 background/settings.js create mode 100644 background_scripts/commands.js create mode 100644 background_scripts/completion.js create mode 100644 background_scripts/settings.js delete mode 100644 commands.js create mode 100644 content_scripts/link_hints.js create mode 100644 content_scripts/vimium_frontend.js create mode 100644 content_scripts/vomnibar.js delete mode 100644 lib/completion.js delete mode 100644 lib/domUtils.js create mode 100644 lib/dom_utils.js delete mode 100644 lib/keyboardUtils.js create mode 100644 lib/keyboard_utils.js delete mode 100644 linkHints.js delete mode 100644 vimiumFrontend.js delete mode 100644 vomnibar.js diff --git a/background/settings.js b/background/settings.js deleted file mode 100644 index a00317b0..00000000 --- a/background/settings.js +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Used by everyone to manipulate localStorage. - */ -var settings = { - - defaults: { - scrollStepSize: 60, - linkHintCharacters: "sadfjklewcmpgh", - filterLinkHints: false, - hideHud: false, - userDefinedLinkHintCss: - "div > .vimiumHintMarker {" + "\n" + - "/* linkhint boxes */ " + "\n" + - "background-color: yellow;" + "\n" + - "border: 1px solid #E3BE23;" + "\n" + - "}" + "\n\n" + - "div > .vimiumHintMarker span {" + "\n" + - "/* linkhint text */ " + "\n" + - "color: black;" + "\n" + - "font-weight: bold;" + "\n" + - "font-size: 12px;" + "\n" + - "}" + "\n\n" + - "div > .vimiumHintMarker > .matchingCharacter {" + "\n" + - "}", - excludedUrls: "http*://mail.google.com/*\n" + - "http*://www.google.com/reader/*\n", - - // NOTE : If a page contains both a single angle-bracket link and a double angle-bracket link, then in - // most cases the single bracket link will be "prev/next page" and the double bracket link will be - // "first/last page", so we put the single bracket first in the pattern string so that it gets searched - // for first. - - // "\bprev\b,\bprevious\b,\bback\b,<,←,«,≪,<<" - previousPatterns: "prev,previous,back,<,\u2190,\xab,\u226a,<<", - // "\bnext\b,\bmore\b,>,→,»,≫,>>" - nextPatterns: "next,more,>,\u2192,\xbb,\u226b,>>", - }, - - init: function() { - // settingsVersion was introduced in v1.31, and is used to coordinate data migration. We do not use - // previousVersion as it is used to coordinate the display of the upgrade message, and is not updated - // early enough when the extension loads. - // 1.31 was also the version where we converted all localStorage values to JSON. - if (!this.has("settingsVersion")) { - for (var key in localStorage) { - // filterLinkHints' checkbox state used to be stored as a string - if (key == "filterLinkHints") - localStorage[key] = localStorage[key] === "true" ? true : false; - else - localStorage[key] = JSON.stringify(localStorage[key]); - } - this.set("settingsVersion", utils.getCurrentVersion()); - } - }, - - get: function(key) { - if (!(key in localStorage)) - return this.defaults[key]; - else - return JSON.parse(localStorage[key]); - }, - - set: function(key, value) { - // don't store the value if it is equal to the default, so we can change the defaults in the future - if (value === this.defaults[key]) - this.clear(key); - else - localStorage[key] = JSON.stringify(value); - }, - - clear: function(key) { - delete localStorage[key]; - }, - - has: function(key) { - return key in localStorage; - }, - -}; - -settings.init(); diff --git a/background_page.html b/background_page.html index e4b3e915..2c6f8e22 100644 --- a/background_page.html +++ b/background_page.html @@ -1,10 +1,10 @@
- + - - + + - - + + - - + + - - - + + + - +