From 4a60e71d186349d82384aa4f59841d458c42213e Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Mon, 29 Oct 2012 20:19:55 -0400 Subject: Move a bunch of stuff under pages/ for tidiness. Also correct a bug with the show / hide advanced commands button. --- background_scripts/main.coffee | 4 +- content_scripts/vimium.css | 400 +++++++++++++++++++++++++++++++++++++++++ help_dialog.html | 51 ------ manifest.json | 6 +- options/options.coffee | 109 ----------- options/options.html | 357 ------------------------------------ pages/help_dialog.html | 51 ++++++ pages/options.coffee | 109 +++++++++++ pages/options.html | 357 ++++++++++++++++++++++++++++++++++++ pages/popup.html | 67 +++++++ pages/popup.js | 20 +++ popup.html | 67 ------- popup.js | 20 --- tests/dom_tests/dom_tests.html | 2 +- vimium.css | 400 ----------------------------------------- 15 files changed, 1010 insertions(+), 1010 deletions(-) create mode 100644 content_scripts/vimium.css delete mode 100644 help_dialog.html delete mode 100644 options/options.coffee delete mode 100644 options/options.html create mode 100644 pages/help_dialog.html create mode 100644 pages/options.coffee create mode 100644 pages/options.html create mode 100644 pages/popup.html create mode 100644 pages/popup.js delete mode 100644 popup.html delete mode 100644 popup.js delete mode 100644 vimium.css diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 90220145..0d00f9ab 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -101,7 +101,7 @@ root.helpDialogHtml = (showUnboundCommands, showCommandNames, customTitle) -> command = Commands.keyToCommandRegistry[key].command commandsToKey[command] = (commandsToKey[command] || []).concat(key) - dialogHtml = fetchFileContents("help_dialog.html") + dialogHtml = fetchFileContents("pages/help_dialog.html") for group of Commands.commandGroups dialogHtml = dialogHtml.replace("{{#{group}}}", helpDialogHtmlForCommandGroup(group, commandsToKey, Commands.availableCommands, @@ -501,7 +501,7 @@ shouldShowUpgradeMessage = -> openOptionsPageInNewTab = -> chrome.tabs.getSelected(null, (tab) -> - chrome.tabs.create({ url: chrome.extension.getURL("options/options.html"), index: tab.index + 1 })) + chrome.tabs.create({ url: chrome.extension.getURL("pages/options.html"), index: tab.index + 1 })) registerFrame = (request, sender) -> unless framesForTab[sender.tab.id] diff --git a/content_scripts/vimium.css b/content_scripts/vimium.css new file mode 100644 index 00000000..24619a30 --- /dev/null +++ b/content_scripts/vimium.css @@ -0,0 +1,400 @@ +/* + * Many CSS class names in this file use the verbose "vimiumXYZ" as the class name. This is so we don't + * use the same CSS class names that the page is using, so the page's CSS doesn't mess with the style of our + * Vimium dialogs. + */ + +/* + * This vimiumReset class can be added to any of our UI elements to give it a clean slate. This is useful in + * case the page has declared a broad rule like "a { padding: 50px; }" which will mess up our UI. These + * declarations contain more specifiers than necessary to increase their specificity (precedence). + */ +.vimiumReset, +div.vimiumReset, +span.vimiumReset, +table.vimiumReset, +a.vimiumReset, +a:visited.vimiumReset, +a:link.vimiumReset, +a:hover.vimiumReset, +td.vimiumReset, +tr.vimiumReset { + background: none; + border: none; + bottom: auto; + box-shadow: none; + color: black; + cursor: auto; + display: inline; + float: none; + font-family : "Helvetica Neue", "Helvetica", "Arial", sans-serif; + font-size: inherit; + font-style: normal; + font-variant: normal; + font-weight: normal; + height: auto; + left: auto; + letter-spacing: 0; + line-height: 100%; + margin: 0; + max-height: none; + max-width: none; + min-height: 0; + min-width: 0; + opacity: 1; + padding: 0; + position: static; + right: auto; + text-align: left; + text-decoration: none; + text-indent: 0; + text-shadow: none; + text-transform: none; + top: auto; + vertical-align: baseline; + white-space: normal; + width: auto; + z-index: 99999999; +} + +/* Linkhints CSS */ + +div.internalVimiumHintMarker { + position: absolute; + display: block; + top: -1px; + left: -1px; + white-space: nowrap; + overflow: hidden; + font-size: 11px; + padding: 1px 3px 0px 3px; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FFF785), color-stop(100%,#FFC542)); + border: solid 1px #C38A22; + border-radius: 3px; + box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.3); +} + +div.internalVimiumHintMarker span { + color: #302505; + font-family: Helvetica, Arial, sans-serif; + font-weight: bold; + font-size: 11px; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); +} + +div.internalVimiumHintMarker > .matchingCharacter { + color: #D4AC3A; +} + +/* Input hints CSS */ + +div.internalVimiumInputHint { + position: absolute; + display: block; + background-color: rgba(255, 247, 133, 0.3); + border: solid 1px #C38A22; +} + +div.internalVimiumSelectedInputHint { + background-color: rgba(255, 102, 102, 0.3); + border: solid 1px #993333 !important; +} + +div.internalVimiumSelectedInputHint span { + color: white !important; +} + +/* Help Dialog CSS */ + +div#vimiumHelpDialog { + border:3px solid red; + opacity:0.92; + background-color:#eee; + position:fixed; + border:2px solid #b3b3b3; + border-radius:6px; + padding:8px 12px; + width:640px; + max-height: 85%; + left:50%; + /* This needs to be 1/2 width to horizontally center the help dialog */ + margin-left:-320px; + top:50px; + -webkit-box-shadow: rgba(0, 0, 0, 0.4) 0px 0px 6px; + overflow-y: auto; + z-index:99999998; +} + +div#vimiumHelpDialog a { color:blue; } +div#vimiumTitle, div#vimiumTitle span, div#vimiumTitle * { font-size:20px; } +#vimiumTitle { + display: block; + line-height: 130%; +} +div.vimiumColumn { + width:50%; + float:left; + font-size: 11px; + line-height: 130%; +} + +div.vimiumColumn tr { + display: table-row; +} + +div.vimiumColumn td { + display: table-cell; + font-size: 11px; + line-height: 130%; +} +div.vimiumColumn table, div.vimiumColumn td, div.vimiumColumn tr { padding:0; margin:0; } +div.vimiumColumn table { width:100%; table-layout:auto; } +div.vimiumColumn td { vertical-align:top; padding:1px; } +div#vimiumHelpDialog div.vimiumColumn tr > td:first-of-type { + text-align:right; + font-weight:bold; + color:#2f508e; + white-space:nowrap; +} +/* Make the description column as wide as it can be. */ +div#vimiumHelpDialog div.vimiumColumn tr > td:nth-of-type(3) { width:100%; } +div#vimiumHelpDialog div.vimiumDivider { + display: block; + height:1px; + width:92%; + margin:10px auto; + background-color:#9a9a9a; +} +div#vimiumHelpDialog td.vimiumHelpSectionTitle { + font-weight:bold; + padding-top:3px; +} +div#vimiumHelpDialog div.commandName { font-family:"courier new"; } +/* Advanced commands are hidden by default until you show them. */ +div#vimiumHelpDialog div.advanced { display: none; } +div#vimiumHelpDialog div.advanced td:nth-of-type(3) { color: #555; } +div#vimiumHelpDialog a.closeButton { + position:absolute; + right:10px; + top:5px; + font-family:"courier new"; + font-weight:bold; + color:#555; + text-decoration:none; + padding-left:10px; + font-size:16px; +} +div#vimiumHelpDialog a { + text-decoration: underline; +} + +div#vimiumHelpDialog .optionsPage { + position: absolute; + display: block; + font-size: 11px; + line-height: 130%; + right: 60px; + top: 8px; +} +div#vimiumHelpDialog a.closeButton:hover { + color:black; + cursor:default; + -webkit-user-select:none; +} +div#vimiumHelpDialogFooter { + display: block; + position: relative; +} +div#vimiumHelpDialogFooter * { font-size:10px; } +div#vimiumHelpDialogFooter .toggleAdvancedCommands { + position: absolute; + right: 2px; + top: -34px; +} + +/* Vimium HUD CSS */ + +div.vimiumHUD { + display: block; + position: fixed; + top: auto; + left: auto; + bottom: 0px; + color: black; + height: 13px; + min-height: 13px; + width: auto; + max-width: 400px; + min-width: 150px; + text-align: left; + background-color: #ebebeb; + padding: 3px 3px 2px 3px; + margin: 0; + border: 1px solid #b3b3b3; + border-radius: 4px 4px 0 0; + font-family: "Lucida Grande", "Arial", "Sans"; + font-size: 12px; + /* One less than vimium's hint markers, so link hints can be shown e.g. for the panel's close button. */ + z-index: 99999997; + text-shadow: 0px 1px 2px #FFF; + line-height: 1.0; + opacity: 0; +} +/* Hide the span between search box letters */ +div.vimiumHUD span { + display: none; +} +div.vimiumHUD a:link, div.vimiumHUD a:hover { + background: transparent; + color: blue; + text-decoration: underline; +} +div.vimiumHUD a:link.close-button { + float:right; + font-family:courier new; + font-weight:bold; + color:#9C9A9A; + text-decoration:none; + padding-left:10px; + margin-top:-1px; + font-size:14px; +} +div.vimiumHUD a.close-button:hover { + color:#333333; + cursor:default; + -webkit-user-select:none; +} + +body.vimiumFindMode ::selection { + background: #ff9632; +}; + +/* Vomnibar CSS */ + +#vomnibar ol, #vomnibar ul { + list-style: none; + display: block; +} + +#vomnibar { + display: block; + position: fixed; + width: 80%; + min-width: 400px; + top: 70px; + left: 50%; + margin: 0 0 0 -40%; + font-family: sans-serif; + + background: #F1F1F1; + text-align: left; + border-radius: 4px; + box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.8); + border: 1px solid #aaa; + /* One less than hint markers and the help dialog. */ + z-index: 99999996; +} + +#vomnibar input { + font-size: 20px; + padding: 4px; + background-color: white; + border-radius: 3px; + border: 1px solid #E8E8E8; + box-shadow: #444 0px 0px 1px; + width: 100%; + outline: none; + box-sizing: border-box; +} + +#vomnibar .vomnibarSearchArea { + display: block; + padding: 10px; + background-color: #F1F1F1; + border-radius: 4px 4px 0 0; + border-bottom: 1px solid #C6C9CE; +} + +#vomnibar ul { + background-color: white; + border-radius: 0 0 4px 4px; + list-style: none; + padding: 10px 0; + padding-top: 0; +} + +#vomnibar li { + border-bottom: 1px solid #ddd; + line-height: 1.1em; + padding: 7px 10px; + font-size: 16px; + color: black; + position: relative; +} + +#vomnibar li:last-of-type { + border-bottom: none; +} + +#vomnibar li .vomnibarTopHalf, #vomnibar li .vomnibarBottomHalf { + display: block; + overflow: hidden; +} + +#vomnibar li .vomnibarBottomHalf { + font-size: 15px; + margin-top: 3px; + padding: 2px 0; +} + +#vomnibar li .vomnibarSource { + color: #777; + margin-right: 4px; +} +#vomnibar li .vomnibarRelevancy { + position: absolute; + right: 0; + top: 0; + padding: 5px; + background-color: white; + color: black; + font-family: monospace; + width: 100px; + overflow: hidden; +} + +#vomnibar li .vomnibarUrl { + white-space: nowrap; + color: #224684; +} + +#vomnibar li .vomnibarMatch { + font-weight: bold; + color: black; +} + +#vomnibar li em, #vomnibar li .vomnibarTitle { + color: black; + margin-left: 4px; + font-weight: normal; +} +#vomnibar li em { font-style: italic; } +#vomnibar li em .vomnibarMatch, #vomnibar li .vomnibarTitle .vomnibarMatch { + color: #333; + text-decoration: underline; +} + +#vomnibar li.vomnibarSelected { + background-color: #BBCEE9; + font-weight: normal; +} + + + +div#vimiumFlash { + box-shadow: 0px 0px 4px 2px #4183C4; + padding: 1px; + background-color: transparent; + position: absolute; + z-index: 99999; +} diff --git a/help_dialog.html b/help_dialog.html deleted file mode 100644 index 2a69ea03..00000000 --- a/help_dialog.html +++ /dev/null @@ -1,51 +0,0 @@ - - - -
- Options - x -
Vimium {{title}}
-
- - - - {{pageNavigation}} - -
Navigating the page
-
-
- - - - {{findCommands}} - - {{historyNavigation}} - - {{tabManipulation}} - - {{misc}} - -
Using find
Navigating history
Manipulating tabs
Miscellaneous
-
- -
-
- -
- Show advanced commands - -
- Enjoying Vimium? - Leave us - feedback.
- Found a bug? Report it here. -
-
- Version {{version}}
-
-
-
diff --git a/manifest.json b/manifest.json index 04b97c1a..da497706 100644 --- a/manifest.json +++ b/manifest.json @@ -17,7 +17,7 @@ "background_scripts/main.js" ] }, - "options_page": "options/options.html", + "options_page": "pages/options.html", "permissions": [ "tabs", "bookmarks", @@ -39,13 +39,13 @@ "content_scripts/marks.js", "content_scripts/vimium_frontend.js" ], - "css": ["vimium.css"], + "css": ["content_scripts/vimium.css"], "run_at": "document_start", "all_frames": true } ], "browser_action": { "default_icon": "icons/browser_action_disabled.png", - "default_popup": "popup.html" + "default_popup": "pages/popup.html" } } diff --git a/options/options.coffee b/options/options.coffee deleted file mode 100644 index abe3fee7..00000000 --- a/options/options.coffee +++ /dev/null @@ -1,109 +0,0 @@ -$ = (id) -> document.getElementById id - -bgSettings = chrome.extension.getBackgroundPage().Settings - -editableFields = [ "scrollStepSize", "excludedUrls", "linkHintCharacters", "linkHintNumbers", - "userDefinedLinkHintCss", "keyMappings", "filterLinkHints", "previousPatterns", - "nextPatterns", "hideHud", "regexFindMode", "searchUrl"] - -canBeEmptyFields = ["excludedUrls", "keyMappings", "userDefinedLinkHintCss"] - -postSaveHooks = keyMappings: (value) -> - commands = chrome.extension.getBackgroundPage().Commands - commands.clearKeyMappingsAndSetDefaults() - commands.parseCustomKeyMappings value - chrome.extension.getBackgroundPage().refreshCompletionKeysAfterMappingSave() - -document.addEventListener "DOMContentLoaded", -> - populateOptions() - - for field in editableFields - $(field).addEventListener "keyup", onOptionKeyup, false - $(field).addEventListener "change", enableSaveButton, false - $(field).addEventListener "change", onDataLoaded, false - - $("advancedOptionsLink").addEventListener "click", toggleAdvancedOptions, false - $("showCommands").addEventListener "click", (-> - showHelpDialog chrome.extension.getBackgroundPage().helpDialogHtml(true, true, "Command Listing"), frameId - ), false - document.getElementById("restoreSettings").addEventListener "click", restoreToDefaults - document.getElementById("saveOptions").addEventListener "click", saveOptions - -window.onbeforeunload = -> "You have unsaved changes to options." unless $("saveOptions").disabled - -onOptionKeyup = (event) -> - if (event.target.getAttribute("type") isnt "checkbox" and - event.target.getAttribute("savedValue") isnt event.target.value) - enableSaveButton() - -onDataLoaded = -> - hide = (el) -> el.parentNode.parentNode.style.display = "none" - show = (el) -> el.parentNode.parentNode.style.display = "table-row" - if $("filterLinkHints").checked - hide $("linkHintCharacters") - show $("linkHintNumbers") - else - show $("linkHintCharacters") - hide $("linkHintNumbers") - -enableSaveButton = -> - $("saveOptions").removeAttribute "disabled" - -# Saves options to localStorage. -saveOptions = -> - - # If the value is unchanged from the default, delete the preference from localStorage; this gives us - # the freedom to change the defaults in the future. - for fieldName in editableFields - field = $(fieldName) - switch field.getAttribute("type") - when "checkbox" - fieldValue = field.checked - when "number" - fieldValue = parseFloat field.value - else - fieldValue = field.value.trim() - field.value = fieldValue - - # If it's empty and not a field that we allow to be empty, restore to the default value - if not fieldValue and canBeEmptyFields.indexOf(fieldName) is -1 - bgSettings.clear fieldName - fieldValue = bgSettings.get(fieldName) - else - bgSettings.set fieldName, fieldValue - $(fieldName).value = fieldValue - $(fieldName).setAttribute "savedValue", fieldValue - postSaveHooks[fieldName] fieldValue if postSaveHooks[fieldName] - - $("saveOptions").disabled = true - -# Restores select box state to saved value from localStorage. -populateOptions = -> - for field in editableFields - val = bgSettings.get(field) or "" - setFieldValue $(field), val - onDataLoaded() - -restoreToDefaults = -> - for field in editableFields - val = bgSettings.defaults[field] or "" - setFieldValue $(field), val - onDataLoaded() - enableSaveButton() - -setFieldValue = (field, value) -> - unless field.getAttribute("type") is "checkbox" - field.value = value - field.setAttribute "savedValue", value - else - field.checked = value - -toggleAdvancedOptions = do (advancedMode=false) -> (event) -> - if advancedMode - $("advancedOptions").style.display = "table-row-group" - $("advancedOptionsLink").innerHTML = "Show advanced options…" - else - $("advancedOptions").style.display = "table-row-group" - $("advancedOptionsLink").innerHTML = "Hide advanced options" - advancedMode = !advancedMode - event.preventDefault() diff --git a/options/options.html b/options/options.html deleted file mode 100644 index f6059618..00000000 --- a/options/options.html +++ /dev/null @@ -1,357 +0,0 @@ - - - Vimium Options - - - - - - - - - - - - - - - - - -
-
Vimium options
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Scroll step size - px -
- Excluded URLs
-
-
- e.g. http*://mail.google.com/*
- This will disable Vimium on Gmail.

- Enter one URL per line.
-
-
- -
Custom key
mappings
-
-
- - Enter commands to remap your keys. Available commands:
-
-map j scrollDown
-unmap j
-unmapAll
-" this is a comment
-# this is also a comment
- Show available commands. -
-
- -
CSS for link hints -
-
- The CSS used to style the characters next to each link hint.

- Note: these styles are used in addition to and take precedence over Vimium's - default styles. -
-
- -
Characters used
for link hints
-
-
- The characters placed next to each link after typing "F" to enter link hinting mode. -
-
- -
Numbers used
for filtered link hints
-
-
- The numbers placed next to each link after typing "F" to enter link hinting mode. -
-
- -
-
-
- After typing "F" to enter link hinting mode, this option lets you type the text of a link - to select it. -
-
- -
-
-
- The Heads-Up Display appears when typing into text boxes. -
-
- -
-
-
- Switch back to plain find mode by using the \R escape sequence. -
-
- -
Previous Patterns -
-
- Vimium will match against these patterns when using the "navigate to the previous page" - command. -
-
- -
Next Patterns -
-
- Vimium will match against these patterns when using the "navigate to the next page" command. -
-
- -
Search -
-
- Set which search engine is used when searching from the Vomnibar (examples: "http://duckduckgo.com/?q=", "http://www.google.com/search?q="). -
-
- -
- -
- Show advanced options… -
- - -
-
- -
- - -
- - diff --git a/pages/help_dialog.html b/pages/help_dialog.html new file mode 100644 index 00000000..2a69ea03 --- /dev/null +++ b/pages/help_dialog.html @@ -0,0 +1,51 @@ + + + +
+ Options + x +
Vimium {{title}}
+
+ + + + {{pageNavigation}} + +
Navigating the page
+
+
+ + + + {{findCommands}} + + {{historyNavigation}} + + {{tabManipulation}} + + {{misc}} + +
Using find
Navigating history
Manipulating tabs
Miscellaneous
+
+ +
+
+ +
+ Show advanced commands + +
+ Enjoying Vimium? + Leave us + feedback.
+ Found a bug? Report it here. +
+
+ Version {{version}}
+
+
+
diff --git a/pages/options.coffee b/pages/options.coffee new file mode 100644 index 00000000..117ce4a6 --- /dev/null +++ b/pages/options.coffee @@ -0,0 +1,109 @@ +$ = (id) -> document.getElementById id + +bgSettings = chrome.extension.getBackgroundPage().Settings + +editableFields = [ "scrollStepSize", "excludedUrls", "linkHintCharacters", "linkHintNumbers", + "userDefinedLinkHintCss", "keyMappings", "filterLinkHints", "previousPatterns", + "nextPatterns", "hideHud", "regexFindMode", "searchUrl"] + +canBeEmptyFields = ["excludedUrls", "keyMappings", "userDefinedLinkHintCss"] + +postSaveHooks = keyMappings: (value) -> + commands = chrome.extension.getBackgroundPage().Commands + commands.clearKeyMappingsAndSetDefaults() + commands.parseCustomKeyMappings value + chrome.extension.getBackgroundPage().refreshCompletionKeysAfterMappingSave() + +document.addEventListener "DOMContentLoaded", -> + populateOptions() + + for field in editableFields + $(field).addEventListener "keyup", onOptionKeyup, false + $(field).addEventListener "change", enableSaveButton, false + $(field).addEventListener "change", onDataLoaded, false + + $("advancedOptionsLink").addEventListener "click", toggleAdvancedOptions, false + $("showCommands").addEventListener "click", (-> + showHelpDialog chrome.extension.getBackgroundPage().helpDialogHtml(true, true, "Command Listing"), frameId + ), false + document.getElementById("restoreSettings").addEventListener "click", restoreToDefaults + document.getElementById("saveOptions").addEventListener "click", saveOptions + +window.onbeforeunload = -> "You have unsaved changes to options." unless $("saveOptions").disabled + +onOptionKeyup = (event) -> + if (event.target.getAttribute("type") isnt "checkbox" and + event.target.getAttribute("savedValue") isnt event.target.value) + enableSaveButton() + +onDataLoaded = -> + hide = (el) -> el.parentNode.parentNode.style.display = "none" + show = (el) -> el.parentNode.parentNode.style.display = "table-row" + if $("filterLinkHints").checked + hide $("linkHintCharacters") + show $("linkHintNumbers") + else + show $("linkHintCharacters") + hide $("linkHintNumbers") + +enableSaveButton = -> + $("saveOptions").removeAttribute "disabled" + +# Saves options to localStorage. +saveOptions = -> + + # If the value is unchanged from the default, delete the preference from localStorage; this gives us + # the freedom to change the defaults in the future. + for fieldName in editableFields + field = $(fieldName) + switch field.getAttribute("type") + when "checkbox" + fieldValue = field.checked + when "number" + fieldValue = parseFloat field.value + else + fieldValue = field.value.trim() + field.value = fieldValue + + # If it's empty and not a field that we allow to be empty, restore to the default value + if not fieldValue and canBeEmptyFields.indexOf(fieldName) is -1 + bgSettings.clear fieldName + fieldValue = bgSettings.get(fieldName) + else + bgSettings.set fieldName, fieldValue + $(fieldName).value = fieldValue + $(fieldName).setAttribute "savedValue", fieldValue + postSaveHooks[fieldName] fieldValue if postSaveHooks[fieldName] + + $("saveOptions").disabled = true + +# Restores select box state to saved value from localStorage. +populateOptions = -> + for field in editableFields + val = bgSettings.get(field) or "" + setFieldValue $(field), val + onDataLoaded() + +restoreToDefaults = -> + for field in editableFields + val = bgSettings.defaults[field] or "" + setFieldValue $(field), val + onDataLoaded() + enableSaveButton() + +setFieldValue = (field, value) -> + unless field.getAttribute("type") is "checkbox" + field.value = value + field.setAttribute "savedValue", value + else + field.checked = value + +toggleAdvancedOptions = do (advancedMode=false) -> (event) -> + if advancedMode + $("advancedOptions").style.display = "none" + $("advancedOptionsLink").innerHTML = "Show advanced options…" + else + $("advancedOptions").style.display = "table-row-group" + $("advancedOptionsLink").innerHTML = "Hide advanced options" + advancedMode = !advancedMode + event.preventDefault() diff --git a/pages/options.html b/pages/options.html new file mode 100644 index 00000000..8c7c007a --- /dev/null +++ b/pages/options.html @@ -0,0 +1,357 @@ + + + Vimium Options + + + + + + + + + + + + + + + + + +
+
Vimium options
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Scroll step size + px +
+ Excluded URLs
+
+
+ e.g. http*://mail.google.com/*
+ This will disable Vimium on Gmail.

+ Enter one URL per line.
+
+
+ +
Custom key
mappings
+
+
+ + Enter commands to remap your keys. Available commands:
+
+map j scrollDown
+unmap j
+unmapAll
+" this is a comment
+# this is also a comment
+ Show available commands. +
+
+ +
CSS for link hints +
+
+ The CSS used to style the characters next to each link hint.

+ Note: these styles are used in addition to and take precedence over Vimium's + default styles. +
+
+ +
Characters used
for link hints
+
+
+ The characters placed next to each link after typing "F" to enter link hinting mode. +
+
+ +
Numbers used
for filtered link hints
+
+
+ The numbers placed next to each link after typing "F" to enter link hinting mode. +
+
+ +
+
+
+ After typing "F" to enter link hinting mode, this option lets you type the text of a link + to select it. +
+
+ +
+
+
+ The Heads-Up Display appears when typing into text boxes. +
+
+ +
+
+
+ Switch back to plain find mode by using the \R escape sequence. +
+
+ +
Previous Patterns +
+
+ Vimium will match against these patterns when using the "navigate to the previous page" + command. +
+
+ +
Next Patterns +
+
+ Vimium will match against these patterns when using the "navigate to the next page" command. +
+
+ +
Search +
+
+ Set which search engine is used when searching from the Vomnibar (examples: "http://duckduckgo.com/?q=", "http://www.google.com/search?q="). +
+
+ +
+ +
+ Show advanced options… +
+ + +
+
+ +
+ + +
+ + diff --git a/pages/popup.html b/pages/popup.html new file mode 100644 index 00000000..c3cd3832 --- /dev/null +++ b/pages/popup.html @@ -0,0 +1,67 @@ + + + + + + +
+
+ + + +
+ +
+ +
+
+ + diff --git a/pages/popup.js b/pages/popup.js new file mode 100644 index 00000000..1ade3696 --- /dev/null +++ b/pages/popup.js @@ -0,0 +1,20 @@ +function onLoad() { + document.getElementById("optionsLink").setAttribute("href", chrome.extension.getURL("pages/options.html")); + chrome.tabs.getSelected(null, function(tab) { + // The common use case is to disable Vimium at the domain level. + // This regexp will match "http://www.example.com/" from "http://www.example.com/path/to/page.html". + var domain = tab.url.match(/[^\/]*\/\/[^\/]*\//) || tab.url; + document.getElementById("popupInput").value = domain + "*"; + }); +} + +function onExcludeUrl(e) { + var url = document.getElementById("popupInput").value; + chrome.extension.getBackgroundPage().addExcludedUrl(url); + document.getElementById("excludeConfirm").setAttribute("style", "display: inline-block"); +} + +document.addEventListener("DOMContentLoaded", function() { + document.getElementById("popupButton").addEventListener("click", onExcludeUrl, false); + onLoad(); +}); diff --git a/popup.html b/popup.html deleted file mode 100644 index c3cd3832..00000000 --- a/popup.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - -
-
- - - -
- -
- -
-
- - diff --git a/popup.js b/popup.js deleted file mode 100644 index 2c98e6ab..00000000 --- a/popup.js +++ /dev/null @@ -1,20 +0,0 @@ -function onLoad() { - document.getElementById("optionsLink").setAttribute("href", chrome.extension.getURL("options/options.html")); - chrome.tabs.getSelected(null, function(tab) { - // The common use case is to disable Vimium at the domain level. - // This regexp will match "http://www.example.com/" from "http://www.example.com/path/to/page.html". - var domain = tab.url.match(/[^\/]*\/\/[^\/]*\//) || tab.url; - document.getElementById("popupInput").value = domain + "*"; - }); -} - -function onExcludeUrl(e) { - var url = document.getElementById("popupInput").value; - chrome.extension.getBackgroundPage().addExcludedUrl(url); - document.getElementById("excludeConfirm").setAttribute("style", "display: inline-block"); -} - -document.addEventListener("DOMContentLoaded", function() { - document.getElementById("popupButton").addEventListener("click", onExcludeUrl, false); - onLoad(); -}); diff --git a/tests/dom_tests/dom_tests.html b/tests/dom_tests/dom_tests.html index 898546dc..feddafac 100644 --- a/tests/dom_tests/dom_tests.html +++ b/tests/dom_tests/dom_tests.html @@ -26,7 +26,7 @@ border-bottom: dashed 1px #999; } - + diff --git a/vimium.css b/vimium.css deleted file mode 100644 index 24619a30..00000000 --- a/vimium.css +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Many CSS class names in this file use the verbose "vimiumXYZ" as the class name. This is so we don't - * use the same CSS class names that the page is using, so the page's CSS doesn't mess with the style of our - * Vimium dialogs. - */ - -/* - * This vimiumReset class can be added to any of our UI elements to give it a clean slate. This is useful in - * case the page has declared a broad rule like "a { padding: 50px; }" which will mess up our UI. These - * declarations contain more specifiers than necessary to increase their specificity (precedence). - */ -.vimiumReset, -div.vimiumReset, -span.vimiumReset, -table.vimiumReset, -a.vimiumReset, -a:visited.vimiumReset, -a:link.vimiumReset, -a:hover.vimiumReset, -td.vimiumReset, -tr.vimiumReset { - background: none; - border: none; - bottom: auto; - box-shadow: none; - color: black; - cursor: auto; - display: inline; - float: none; - font-family : "Helvetica Neue", "Helvetica", "Arial", sans-serif; - font-size: inherit; - font-style: normal; - font-variant: normal; - font-weight: normal; - height: auto; - left: auto; - letter-spacing: 0; - line-height: 100%; - margin: 0; - max-height: none; - max-width: none; - min-height: 0; - min-width: 0; - opacity: 1; - padding: 0; - position: static; - right: auto; - text-align: left; - text-decoration: none; - text-indent: 0; - text-shadow: none; - text-transform: none; - top: auto; - vertical-align: baseline; - white-space: normal; - width: auto; - z-index: 99999999; -} - -/* Linkhints CSS */ - -div.internalVimiumHintMarker { - position: absolute; - display: block; - top: -1px; - left: -1px; - white-space: nowrap; - overflow: hidden; - font-size: 11px; - padding: 1px 3px 0px 3px; - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#FFF785), color-stop(100%,#FFC542)); - border: solid 1px #C38A22; - border-radius: 3px; - box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.3); -} - -div.internalVimiumHintMarker span { - color: #302505; - font-family: Helvetica, Arial, sans-serif; - font-weight: bold; - font-size: 11px; - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6); -} - -div.internalVimiumHintMarker > .matchingCharacter { - color: #D4AC3A; -} - -/* Input hints CSS */ - -div.internalVimiumInputHint { - position: absolute; - display: block; - background-color: rgba(255, 247, 133, 0.3); - border: solid 1px #C38A22; -} - -div.internalVimiumSelectedInputHint { - background-color: rgba(255, 102, 102, 0.3); - border: solid 1px #993333 !important; -} - -div.internalVimiumSelectedInputHint span { - color: white !important; -} - -/* Help Dialog CSS */ - -div#vimiumHelpDialog { - border:3px solid red; - opacity:0.92; - background-color:#eee; - position:fixed; - border:2px solid #b3b3b3; - border-radius:6px; - padding:8px 12px; - width:640px; - max-height: 85%; - left:50%; - /* This needs to be 1/2 width to horizontally center the help dialog */ - margin-left:-320px; - top:50px; - -webkit-box-shadow: rgba(0, 0, 0, 0.4) 0px 0px 6px; - overflow-y: auto; - z-index:99999998; -} - -div#vimiumHelpDialog a { color:blue; } -div#vimiumTitle, div#vimiumTitle span, div#vimiumTitle * { font-size:20px; } -#vimiumTitle { - display: block; - line-height: 130%; -} -div.vimiumColumn { - width:50%; - float:left; - font-size: 11px; - line-height: 130%; -} - -div.vimiumColumn tr { - display: table-row; -} - -div.vimiumColumn td { - display: table-cell; - font-size: 11px; - line-height: 130%; -} -div.vimiumColumn table, div.vimiumColumn td, div.vimiumColumn tr { padding:0; margin:0; } -div.vimiumColumn table { width:100%; table-layout:auto; } -div.vimiumColumn td { vertical-align:top; padding:1px; } -div#vimiumHelpDialog div.vimiumColumn tr > td:first-of-type { - text-align:right; - font-weight:bold; - color:#2f508e; - white-space:nowrap; -} -/* Make the description column as wide as it can be. */ -div#vimiumHelpDialog div.vimiumColumn tr > td:nth-of-type(3) { width:100%; } -div#vimiumHelpDialog div.vimiumDivider { - display: block; - height:1px; - width:92%; - margin:10px auto; - background-color:#9a9a9a; -} -div#vimiumHelpDialog td.vimiumHelpSectionTitle { - font-weight:bold; - padding-top:3px; -} -div#vimiumHelpDialog div.commandName { font-family:"courier new"; } -/* Advanced commands are hidden by default until you show them. */ -div#vimiumHelpDialog div.advanced { display: none; } -div#vimiumHelpDialog div.advanced td:nth-of-type(3) { color: #555; } -div#vimiumHelpDialog a.closeButton { - position:absolute; - right:10px; - top:5px; - font-family:"courier new"; - font-weight:bold; - color:#555; - text-decoration:none; - padding-left:10px; - font-size:16px; -} -div#vimiumHelpDialog a { - text-decoration: underline; -} - -div#vimiumHelpDialog .optionsPage { - position: absolute; - display: block; - font-size: 11px; - line-height: 130%; - right: 60px; - top: 8px; -} -div#vimiumHelpDialog a.closeButton:hover { - color:black; - cursor:default; - -webkit-user-select:none; -} -div#vimiumHelpDialogFooter { - display: block; - position: relative; -} -div#vimiumHelpDialogFooter * { font-size:10px; } -div#vimiumHelpDialogFooter .toggleAdvancedCommands { - position: absolute; - right: 2px; - top: -34px; -} - -/* Vimium HUD CSS */ - -div.vimiumHUD { - display: block; - position: fixed; - top: auto; - left: auto; - bottom: 0px; - color: black; - height: 13px; - min-height: 13px; - width: auto; - max-width: 400px; - min-width: 150px; - text-align: left; - background-color: #ebebeb; - padding: 3px 3px 2px 3px; - margin: 0; - border: 1px solid #b3b3b3; - border-radius: 4px 4px 0 0; - font-family: "Lucida Grande", "Arial", "Sans"; - font-size: 12px; - /* One less than vimium's hint markers, so link hints can be shown e.g. for the panel's close button. */ - z-index: 99999997; - text-shadow: 0px 1px 2px #FFF; - line-height: 1.0; - opacity: 0; -} -/* Hide the span between search box letters */ -div.vimiumHUD span { - display: none; -} -div.vimiumHUD a:link, div.vimiumHUD a:hover { - background: transparent; - color: blue; - text-decoration: underline; -} -div.vimiumHUD a:link.close-button { - float:right; - font-family:courier new; - font-weight:bold; - color:#9C9A9A; - text-decoration:none; - padding-left:10px; - margin-top:-1px; - font-size:14px; -} -div.vimiumHUD a.close-button:hover { - color:#333333; - cursor:default; - -webkit-user-select:none; -} - -body.vimiumFindMode ::selection { - background: #ff9632; -}; - -/* Vomnibar CSS */ - -#vomnibar ol, #vomnibar ul { - list-style: none; - display: block; -} - -#vomnibar { - display: block; - position: fixed; - width: 80%; - min-width: 400px; - top: 70px; - left: 50%; - margin: 0 0 0 -40%; - font-family: sans-serif; - - background: #F1F1F1; - text-align: left; - border-radius: 4px; - box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.8); - border: 1px solid #aaa; - /* One less than hint markers and the help dialog. */ - z-index: 99999996; -} - -#vomnibar input { - font-size: 20px; - padding: 4px; - background-color: white; - border-radius: 3px; - border: 1px solid #E8E8E8; - box-shadow: #444 0px 0px 1px; - width: 100%; - outline: none; - box-sizing: border-box; -} - -#vomnibar .vomnibarSearchArea { - display: block; - padding: 10px; - background-color: #F1F1F1; - border-radius: 4px 4px 0 0; - border-bottom: 1px solid #C6C9CE; -} - -#vomnibar ul { - background-color: white; - border-radius: 0 0 4px 4px; - list-style: none; - padding: 10px 0; - padding-top: 0; -} - -#vomnibar li { - border-bottom: 1px solid #ddd; - line-height: 1.1em; - padding: 7px 10px; - font-size: 16px; - color: black; - position: relative; -} - -#vomnibar li:last-of-type { - border-bottom: none; -} - -#vomnibar li .vomnibarTopHalf, #vomnibar li .vomnibarBottomHalf { - display: block; - overflow: hidden; -} - -#vomnibar li .vomnibarBottomHalf { - font-size: 15px; - margin-top: 3px; - padding: 2px 0; -} - -#vomnibar li .vomnibarSource { - color: #777; - margin-right: 4px; -} -#vomnibar li .vomnibarRelevancy { - position: absolute; - right: 0; - top: 0; - padding: 5px; - background-color: white; - color: black; - font-family: monospace; - width: 100px; - overflow: hidden; -} - -#vomnibar li .vomnibarUrl { - white-space: nowrap; - color: #224684; -} - -#vomnibar li .vomnibarMatch { - font-weight: bold; - color: black; -} - -#vomnibar li em, #vomnibar li .vomnibarTitle { - color: black; - margin-left: 4px; - font-weight: normal; -} -#vomnibar li em { font-style: italic; } -#vomnibar li em .vomnibarMatch, #vomnibar li .vomnibarTitle .vomnibarMatch { - color: #333; - text-decoration: underline; -} - -#vomnibar li.vomnibarSelected { - background-color: #BBCEE9; - font-weight: normal; -} - - - -div#vimiumFlash { - box-shadow: 0px 0px 4px 2px #4183C4; - padding: 1px; - background-color: transparent; - position: absolute; - z-index: 99999; -} -- cgit v1.2.3