aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md12
-rw-r--r--README.md11
-rw-r--r--content_scripts/link_hints.coffee3
-rw-r--r--content_scripts/scroller.coffee24
-rw-r--r--content_scripts/vimium_frontend.coffee3
-rw-r--r--lib/keyboard_utils.coffee2
-rw-r--r--lib/utils.coffee3
-rw-r--r--manifest.json2
-rw-r--r--tests/unit_tests/utils_test.coffee7
9 files changed, 47 insertions, 20 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e4ed8b8b..3423cc8e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -26,13 +26,23 @@ Please include the following when reporting an issue:
Vimium is written in Coffeescript, which compiles to Javascript. To
install Vimium from source:
- 1. Install [Coffeescript](http://coffeescript.org/#installation).
+ 1. Install [Coffeescript v1](http://coffeescript.org/#installation) (`npm install --global coffeescript@~1`).
1. Run `cake build` from within your vimium directory. Any coffeescript files you change will now be automatically compiled to Javascript.
+
+### Chrome/Chromium
+
1. Navigate to `chrome://extensions`
1. Toggle into Developer Mode
1. Click on "Load Unpacked Extension..."
1. Select the Vimium directory.
+### Firefox
+
+ 1. Open Firefox
+ 1. Enter "about:debugging" in the URL bar
+ 1. Click "Load Temporary Add-on"
+ 1. Open the Vimium directory and select any file inside.
+
## Development tips
1. Run `cake autobuild` to watch for changes to coffee files, and have the .js files automatically
diff --git a/README.md b/README.md
index 6971dfe0..dfa80c04 100644
--- a/README.md
+++ b/README.md
@@ -169,12 +169,21 @@ PRs are welcome.
Release Notes
-------------
-In `master` (not yet released)
+Not yet released
+
+- When yanking email addresses with `yf`, Vimium now strips the leading `mailto:`.
+
+1.64.1 (2018-09-04, not yet released)
+
+- Better scrolling on new Reddit ~and GMail~.
+
+1.64 (2018-08-30)
- Custom search engines can now be `javascript:` URLs (eg., search the current [site](https://github.com/philc/vimium/issues/2956#issuecomment-366509915)).
- You can now using local marks to mark a hash/anchor. This is particularly useful for marking labels on GMail.
- For filtered hints, you can now start typing the link text before the hints have been generated.
- On Twitter, expanded tweets are now scrollable.
+- Fix bug whereby `<Enter>` wasn't recognised in the Vomnibar in some circumstances.
- Various minor bug fixes.
1.63 (2018-02-16)
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 86cc4e4f..231f65ef 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -31,8 +31,9 @@ COPY_LINK_URL =
indicator: "Copy link URL to Clipboard"
linkActivator: (link) ->
if link.href?
- HUD.copyToClipboard link.href
url = link.href
+ url = url[7..] if url[...7] == "mailto:"
+ HUD.copyToClipboard url
url = url[0..25] + "...." if 28 < url.length
HUD.showForDuration "Yanked #{url}", 2000
else
diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee
index 2ce4d13b..36bbb671 100644
--- a/content_scripts/scroller.coffee
+++ b/content_scripts/scroller.coffee
@@ -9,7 +9,7 @@ activatedElement = null
# https://github.com/philc/vimium/pull/2168#issuecomment-236488091
getScrollingElement = ->
- document.scrollingElement ? document.body
+ getSpecialScrollingElement() ? document.scrollingElement ? document.body
# Return 0, -1 or 1: the sign of the argument.
# NOTE(smblott; 2014/12/17) We would like to use Math.sign(). However, according to this site
@@ -253,6 +253,10 @@ Scroller =
# yet implemented by Chrome.
activatedElement = event.deepPath?[0] ? event.path?[0] ? event.target
CoreScroller.init()
+ @reset()
+
+ reset: ->
+ activatedElement = null
# scroll the active element in :direction by :amount * :factor.
# :factor is needed because :amount can take on string values, which scrollBy converts to element dimensions.
@@ -314,15 +318,15 @@ Scroller =
element = findScrollableElement element, "x", amount, 1
CoreScroller.scroll element, "x", amount, false
-# Hack to make expanded tweets scrollable on Twitter (See #3045).
-if DomUtils.isTopFrame() and window.location.host == "twitter.com"
- for method in ["scrollTo", "scrollBy"]
- do ->
- func = Scroller[method]
- Scroller[method] = ->
- element = document.querySelector "div.permalink-container div.permalink[role=main]"
- activatedElement = element ? getScrollingElement()
- func arguments...
+getSpecialScrollingElement = ->
+ selector = specialScrollingElementMap[window.location.host]
+ if selector
+ document.querySelector selector
+
+specialScrollingElementMap =
+ 'twitter.com': 'div.permalink-container div.permalink[role=main]'
+ 'reddit.com': '#overlayScrollContainer'
+ 'new.reddit.com': '#overlayScrollContainer'
root = exports ? (window.root ?= {})
root.Scroller = Scroller
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 26aa3492..ff27c8a4 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -176,7 +176,7 @@ onFocus = forTrusted (event) ->
# We install these listeners directly (that is, we don't use installListener) because we still need to receive
# events when Vimium is not enabled.
window.addEventListener "focus", onFocus
-window.addEventListener "hashchange", -> checkEnabledAfterURLChange()
+window.addEventListener "hashchange", checkEnabledAfterURLChange
initializeOnDomReady = ->
# Tell the background page we're in the domReady state.
@@ -307,6 +307,7 @@ checkIfEnabledForUrl = do ->
# When we're informed by the background page that a URL in this tab has changed, we check if we have the
# correct enabled state (but only if this frame has the focus).
checkEnabledAfterURLChange = forTrusted ->
+ Scroller.reset() # The URL changing feels like navigation to the user, so reset the scroller (see #3119).
checkIfEnabledForUrl() if windowIsFocused()
# If we are in the help dialog iframe, then HelpDialog is already defined with the necessary functions.
diff --git a/lib/keyboard_utils.coffee b/lib/keyboard_utils.coffee
index 76f2f777..49897b6f 100644
--- a/lib/keyboard_utils.coffee
+++ b/lib/keyboard_utils.coffee
@@ -19,7 +19,7 @@ KeyboardUtils =
unless Settings.get "ignoreKeyboardLayout"
key = event.key
else unless event.code
- key = ""
+ key = event.key ? "" # Fall back to event.key (see #3099).
else if event.code[...6] == "Numpad"
# We cannot correctly emulate the numpad, so fall back to event.key; see #2626.
key = event.key
diff --git a/lib/utils.coffee b/lib/utils.coffee
index 6f38be8f..f44e0cbb 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -131,7 +131,8 @@ Utils =
# It would be better to pull the default search engine from chrome itself. However, chrome does not provide
# an API for doing so.
createSearchUrl: (query, searchUrl = Settings.get("searchUrl")) ->
- searchUrl += "%s" unless 0 <= searchUrl.indexOf "%s"
+ searchUrl += "%s" unless ['%s', '%S'].some (token) -> searchUrl.indexOf(token) >= 0
+ searchUrl = searchUrl.replace /%S/g, query
searchUrl.replace /%s/g, @createSearchQuery query
# Extract a query from url if it appears to be a URL created from the given search URL.
diff --git a/manifest.json b/manifest.json
index 48d8f625..9e00007a 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Vimium",
- "version": "1.63.8",
+ "version": "1.64.1",
"description": "The Hacker's Browser. Vimium provides keyboard shortcuts for navigation and control in the spirit of Vim.",
"icons": { "16": "icons/icon16.png",
"48": "icons/icon48.png",
diff --git a/tests/unit_tests/utils_test.coffee b/tests/unit_tests/utils_test.coffee
index 2794a6d7..0d1eeae2 100644
--- a/tests/unit_tests/utils_test.coffee
+++ b/tests/unit_tests/utils_test.coffee
@@ -50,6 +50,10 @@ context "convertToUrl",
assert.equal "https://www.google.com/search?q=go+ogle.com", Utils.convertToUrl("go ogle.com")
assert.equal "https://www.google.com/search?q=%40twitter", Utils.convertToUrl("@twitter")
+context "createSearchUrl",
+ should "replace %S without encoding", ->
+ assert.equal "https://www.github.com/philc/vimium/pulls", Utils.createSearchUrl "vimium/pulls", "https://www.github.com/philc/%S"
+
context "extractQuery",
should "extract queries from search URLs", ->
assert.equal "bbc sport 1", Utils.extractQuery "https://www.google.ie/search?q=%s", "https://www.google.ie/search?q=bbc+sport+1"
@@ -57,9 +61,6 @@ context "extractQuery",
assert.equal "bbc sport 3", Utils.extractQuery "https://www.google.ie/search?q=%s", "http://www.google.ie/search?q=bbc+sport+3"
assert.equal "bbc sport 4", Utils.extractQuery "https://www.google.ie/search?q=%s", "http://www.google.ie/search?q=bbc+sport+4&blah"
- should "extract not queries from incorrect search URLs", ->
- assert.isFalse Utils.extractQuery "https://www.google.ie/search?q=%s&foo=bar", "https://www.google.ie/search?q=bbc+sport"
-
context "hasChromePrefix",
should "detect chrome prefixes of URLs", ->
assert.isTrue Utils.hasChromePrefix "about:foobar"