aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml3
-rw-r--r--CONTRIBUTING.md53
-rw-r--r--CREDITS1
-rw-r--r--Cakefile6
-rw-r--r--README.md83
-rw-r--r--background_scripts/commands.coffee4
-rw-r--r--background_scripts/main.coffee5
-rw-r--r--content_scripts/vimium.css5
-rw-r--r--content_scripts/vimium_frontend.coffee20
-rw-r--r--content_scripts/vomnibar.coffee14
-rw-r--r--manifest.json7
-rw-r--r--pages/help_dialog.html2
-rw-r--r--pages/options.html6
-rw-r--r--tests/dom_tests/dom_tests.coffee29
-rw-r--r--tests/dom_tests/phantom_runner.coffee15
16 files changed, 181 insertions, 73 deletions
diff --git a/.gitignore b/.gitignore
index 9ac3be14..9df0d559 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,5 +3,6 @@
*.swp
*.crx
*.js
+*.sublime*
node_modules/*
dist
diff --git a/.travis.yml b/.travis.yml
index d79a1559..6393bfaf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,8 @@
language: node_js
-node_js: 0.8
+node_js: 0.10
before_install:
- "npm install -g coffee-script"
+ - "npm install path"
- "cake build"
script: "cake test"
notifications:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 21cdb98b..03ac26e9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,10 +1,11 @@
# Contributing to Vimium
You'd like to fix a bug or implement a feature? Great! Check out the bugs on our issues tracker, or implement
-one of the suggestions there that have been tagged 'todo'. If you have a suggestion of your own, start a
-discussion on the issues tracker or on the [mailing list](http://groups.google.com/group/vimium-dev?hl=en). If
-it mirrors a similar feature in another browser or in Vim itself, let us know! Once you've picked something to
-work on, add a comment to the respective issue so others don't duplicate your effort.
+one of the suggestions there that have been tagged "help wanted". If you have a suggestion of your own, start
+a discussion on the issues tracker or on the
+[mailing list](http://groups.google.com/group/vimium-dev?hl=en). If it mirrors a similar feature in another
+browser or in Vim itself, let us know. Once you've picked something to work on, add a comment to the
+respective issue so others don't duplicate your effort.
## Reporting Issues
@@ -25,19 +26,25 @@ install Vimium from source:
1. Click on "Load Unpacked Extension..."
1. Select the Vimium directory.
-## Tests
+## Development tips
+
+ 1. Run `cake autobuild` to watch for changes to coffee files, and have the .js files automatically
+ regenerated
+
+## Running the tests
Our tests use [shoulda.js](https://github.com/philc/shoulda.js) and [PhantomJS](http://phantomjs.org/). To run the tests:
1. `git submodule update --init --recursive` -- this pulls in shoulda.js.
- 1. [Install PhantomJS.](http://phantomjs.org/download.html)
+ 1. Install [PhantomJS](http://phantomjs.org/download.html).
+ 1. `npm install path` to install the [Node.js Path module](http://nodejs.org/api/path.html), used by the test runner.
1. `cake build` to compile `*.coffee` to `*.js`
1. `cake test` to run the tests.
## Code Coverage
-Bugs and features are not the only way to contribute -- more tests are always welcome. You can find out which
-portions of code need them by looking at our coverage reports. To generate these reports:
+You can find out which portions of code need them by looking at our coverage reports. To generate these
+reports:
1. Download [JSCoverage](http://siliconforks.com/jscoverage/download.html) or `brew install jscoverage`
1. `npm install temp`
@@ -45,11 +52,6 @@ portions of code need them by looking at our coverage reports. To generate these
then be viewed using [jscoverage-report](https://github.com/int3/jscoverage-report). See
jscoverage-report's [README](https://github.com/int3/jscoverage-report#jscoverage-report) for more details.
-## Pull Requests
-
-When you're done with your changes, send us a pull request on Github. Feel free to include a change to the
-CREDITS file with your patch.
-
## Coding Style
* We follow the recommendations from
@@ -57,3 +59,28 @@ CREDITS file with your patch.
* We follow two major differences from this style guide:
* Wrap lines at 110 characters instead of 80.
* Use double-quoted strings by default.
+
+## Pull Requests
+
+When you're done with your changes, send us a pull request on Github. Feel free to include a change to the
+CREDITS file with your patch.
+
+## How to release Vimium to the Chrome Store
+
+This process is currently only done by Phil or Ilya.
+
+1. Increment the version number in manifest.json
+2. Update the Changelog in README.md
+
+ You can see a summary of commits since the last version: `git log --oneline v1.45..`
+
+3. Push your commits
+4. Create a git tag for this newly released version
+
+ git tag -a v1.45 -m "v1.45 release"
+
+5. Run `cake package`
+6. Take the distributable found in `dist` and upload it
+ [here](https://chrome.google.com/webstore/developer/dashboard)
+7. Update the description in the Chrome store to include the latest version's release notes
+8. Celebrate
diff --git a/CREDITS b/CREDITS
index 605860fe..d8aee04f 100644
--- a/CREDITS
+++ b/CREDITS
@@ -28,6 +28,7 @@ Contributors:
markstos
Matthew Cline <matt@nightrealms.com>
Matt Garriott (github: mgarriott)
+ Michael Hauser-Raspe (github: mijoharas)
Murph (github: pandeiro)
Niklas Baumstark <niklas.baumstark@gmail.com> (github: niklasb)
rodimius
diff --git a/Cakefile b/Cakefile
index bae79009..0fa75e24 100644
--- a/Cakefile
+++ b/Cakefile
@@ -1,8 +1,14 @@
+util = require "util"
fs = require "fs"
path = require "path"
child_process = require "child_process"
spawn = (procName, optArray, silent=false) ->
+ if process.platform is "win32"
+ # if win32, prefix arguments with "/c {original command}"
+ # e.g. "coffee -c c:\git\vimium" becomes "cmd.exe /c coffee -c c:\git\vimium"
+ optArray.unshift "/c", procName
+ procName = "cmd.exe"
proc = child_process.spawn procName, optArray
unless silent
proc.stdout.on 'data', (data) -> process.stdout.write data
diff --git a/README.md b/README.md
index d0ae8213..fc38c2b8 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ Keyboard Bindings
-----------------
Modifier keys are specified as `<c-x>`, `<m-x>`, and `<a-x>` for ctrl+x, meta+x, and alt+x
-respectively. See the next section for instructions on modifying these bindings.
+respectively. See the next section for instructions on customizing these bindings.
Navigating the current page:
@@ -74,7 +74,7 @@ Manipulating tabs:
x close current tab
X restore closed tab (i.e. unwind the 'x' command)
T search through your open tabs
- . pin/unpin current tab
+ <a-p> pin/unpin current tab
Additional advanced browsing commands:
@@ -90,6 +90,8 @@ Additional advanced browsing commands:
Vimium supports command repetition so, for example, hitting '5t' will open 5 tabs in rapid succession. `<ESC>` (or
`<c-[>`) will clear any partial commands in the queue and will also exit insert and find modes.
+There are some advanced commands which aren't documented here. Refer to the help dialog (type `?`) for a full
+list.
Custom Key Mappings
-------------------
@@ -126,18 +128,31 @@ The following special keys are available for mapping:
Shifts are automatically detected so, for example, `<c-&>` corresponds to ctrl+shift+7 on an English keyboard.
+More documentation
+------------------
+Many of the more advanced or involved features are documented on [Vimium's github wiki](https://github.com/philc/vimium/wiki).
+
Contributing
------------
Please see [CONTRIBUTING.md](https://github.com/philc/vimium/blob/master/CONTRIBUTING.md) for details.
Release Notes
-------------
-1.44 (11/06/2013)
+1.45 (2014-07-20)
+
+- Vimium's settings are now synced across computers.
+- New commands: "open link in new tab and focus", "move tab left", "move tab right", "pin/unpin tab".
+- Vomnibar can now use [search engine shortcuts](https://github.com/philc/vimium/wiki/Search-Engines), similar to Chrome's Omnibar.
+- Due to significant ranking improvements, Vomnibar's search results are now even more helpful.
+- When reopening a closed tab, its history is now preserved.
+- Bugfixes.
+
+1.44 (2013-11-06)
- Add support for recent versions of Chromium.
- Bugfixes.
-1.43 (05/18/2013)
+1.43 (2013-05-18)
- Relevancy improvements to the Vomnibar's domain & history search.
- Added gU, which goes to the root of the current URL.
@@ -149,25 +164,25 @@ Release Notes
- Update our Chrome APIs so Vimium works on Chrome 28+.
- Bugfixes.
-1.42 (11/03/2012)
+1.42 (2012-11-03)
- Bugfixes.
-1.41 (10/27/2012)
+1.41 (2012-10-27)
- Bugfixes.
-1.40 (10/27/2012)
+1.40 (2012-10-27)
- Bugfixes.
- Added options for search engines and regex find.
- Pressing unmapped keys in hints mode now deactivates the mode.
-1.39 (09/09/2012)
+1.39 (2012-09-09)
- Bugfixes.
-1.38 (09/08/2012)
+1.38 (2012-09-08)
- `O` now opens Vomnibar results in a new tab. `B` does the same for bookmarks only.
- Add a browser icon to quickly add sites to Vimium's exclude list.
@@ -175,33 +190,33 @@ Release Notes
- `gi` now launches a new mode that allows the user to tab through the input elements on the page.
- Bugfixes.
-1.37 (07/07/2012)
+1.37 (2012-07-07)
- Select the first result by default in Vomnibar tab and bookmark modes.
-1.36 (07/07/2012)
+1.36 (2012-07-07)
- 'b' brings up a bookmark-only Vomnibar.
- Better support for some bookmarklets.
-1.35 (07/05/2012)
+1.35 (2012-07-05)
- Bugfixes.
-1.34 (07/03/2012)
+1.34 (2012-07-03)
- A bugfix for bookmarklets in Vomnibar.
-1.33 (07/02/2012)
+1.33 (2012-07-02)
- A Vomnibar, which allows you to open sites from history, bookmarks, and tabs using Vimium's UI. Type "o" to try it.
-1.32 (03/05/2012)
+1.32 (2012-03-05)
- More tweaks to the next / previous link-detection algorithm.
- Minor bug fixes.
-1.31 (02/28/2012)
+1.31 (2012-02-28)
- Improve style of link hints, and use fewer characters for hints.
- Add an option to hide the heads up display (HUD). Notably, the HUD obscures Facebook Chat's textbox.
@@ -211,7 +226,7 @@ Release Notes
- A new find mode which optionally supports case sensitivity and regular expressions.
- Bug fixes.
-1.30 (12/04/2011)
+1.30 (2011-12-04)
- Support for image maps in link hints.
- Counts now work with forward & backward navigation.
@@ -219,29 +234,29 @@ Release Notes
- An alternate link hints mode: type the title of a link to select it. You can enable it in Vimium's Advanced Preferences.
- Bug fixes.
-1.29 (07/30/2011)
+1.29 (2012-07-30)
- `yf` to copy a link hint url to the clipboard.
- Scatter link hints to prevent clustering on dense sites.
- Don't show insert mode notification unless you specifically hit `i`.
- Remove zooming functionality now that Chrome does it all natively.
-1.28 (06/29/2011)
+1.28 (2011-06-29)
- Support for opening bookmarks (`b` and `B`).
- Support for contenteditable text boxes.
- Speed improvements and bugfixes.
-1.27 (03/24/2011)
+1.27 (2011-03-24)
- Improvements and bugfixes.
-1.26 (02/17/2011)
+1.26 (2011-02-17)
- `<c-d>`, `<c-f>` and related are no longer bound by default. You can rebind them on the options page.
- Faster link hinting.
-1.22, 1.23, 1.24, 1.25 (02/10/2011)
+1.22, 1.23, 1.24, 1.25 (2011-02-10)
- Some sites are now excluded by default.
- View source (`gs`) now opens in a new tab.
@@ -251,11 +266,11 @@ Release Notes
- Improvements to link hinting.
- Bugfixes.
-1.21 (10/24/2010)
+1.21 (2010-10-24)
- Critical bugfix for an excluded URLs regression due to frame support.
-1.20 (10/24/2010)
+1.20 (2010-10-24)
- In link hints mode, holding down the shift key will now toggle between opening in the current tab and
opening in a new tab.
@@ -266,12 +281,12 @@ Release Notes
- More robust support for non-US keyboard layouts.
- Numerous bug fixes.
-1.19 (06/29/2010)
+1.19 (2010-06-29)
- A critical bug fix for development channel Chromium.
- Vimium icons for the Chrome extensions panel and other places.
-1.18 (06/22/2010)
+1.18 (2010-06-22)
- Vimium now runs on pages with file:/// and ftp:///
- The Options page is now linked from the Help dialog.
@@ -282,7 +297,7 @@ Release Notes
does not support command repetition.
- Bug fixes and optimizations.
-1.17 (04/18/2010)
+1.17 (2010-04-18)
- 'u' now restores tabs that were closed by the mouse or with native shortcuts. Tabs are also restored in
their prior position.
@@ -290,24 +305,24 @@ does not support command repetition.
- Link hints are now faster and more reliable.
- Bug fixes.
-1.16 (03/09/2010)
+1.16 (2010-03-09)
- Add support for configurable key mappings under Advanced Options.
- A help dialog which shows all currently bound keyboard shortcuts. Type "?" to see it.
- Bug fixes related to key stroke handling.
-1.15 (01/31/2010)
+1.15 (2010-01-31)
- Make the CSS used by the link hints configurable. It's under Advanced Options.
- Add a notification linking to the changelog when Vimium is updated in the background.
- Link-hinting performance improvements and bugfixes.
- Ctrl+D and Ctrl+U now scroll by 1/2 page instead of a fixed amount, to mirror Vim's behavior.
-1.14 (01/21/2010)
+1.14 (2010-01-21)
- Fixed a bug introduced in 1.13 that prevented excluded URLs from being saved.
-1.13 (01/21/2010)
+1.13 (2010-01-21)
- `<c-f>` and `<c-b>` are now mapped to scroll a full page up or down respectively.
- Bugfixes related to entering insert mode when the page first loads, and when focusing Flash embeds.
@@ -317,7 +332,7 @@ does not support command repetition.
- `<c-e>` and `<c-y>` are now mapped to scroll down and up respectively.
- The characters used for link hints are now configurable under Advanced Options.
-1.11, 1.12 (01/08/2010)
+1.11, 1.12 (2010-01-08)
- Commands 'gt' & 'gT' to move to the next & previous tab.
- Command 'yy' to yank (copy) the current tab's url to the clipboard.
@@ -325,7 +340,7 @@ does not support command repetition.
- Fix for Shift+F link hints.
- ESC now clears the keyQueue. So, for example, hitting 'g', 'ESC', 'g' will no longer scroll the page.
-1.1 (01/03/2010)
+1.1 (2010-01-03)
- A nicer looking settings page.
- An exclusion list that allows you to define URL patterns for which Vimium will be disabled (e.g.
@@ -336,4 +351,4 @@ does not support command repetition.
License
-------
-Copyright (c) 2010 Phil Crosby, Ilya Sukhar. See MIT-LICENSE.txt for details.
+Copyright (c) Phil Crosby, Ilya Sukhar. See MIT-LICENSE.txt for details.
diff --git a/background_scripts/commands.coffee b/background_scripts/commands.coffee
index 50302cf7..35c94bb9 100644
--- a/background_scripts/commands.coffee
+++ b/background_scripts/commands.coffee
@@ -161,6 +161,8 @@ defaultKeyMappings =
"J": "previousTab"
"gt": "nextTab"
"gT": "previousTab"
+ "<<": "moveTabLeft"
+ ">>": "moveTabRight"
"g0": "firstTab"
"g$": "lastTab"
@@ -170,7 +172,7 @@ defaultKeyMappings =
"x": "removeTab"
"X": "restoreTab"
- ".": "togglePinTab"
+ "<a-p>": "togglePinTab"
"o": "Vomnibar.activate"
"O": "Vomnibar.activateInNewTab"
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 072745d7..93ef1449 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -248,9 +248,8 @@ BackgroundCommands =
chrome.tabs.remove(tab.id))
restoreTab: (callback) ->
# TODO: remove if-else -block when adopted into stable
- if chrome.sessionRestore
- chrome.sessionRestore.getRecentlyClosed((closed) ->
- chrome.sessionRestore.restore(closed[0]))
+ if chrome.sessions
+ chrome.sessions.restore(null, (restoredSession) -> callback())
else
# TODO(ilya): Should this be getLastFocused instead?
chrome.windows.getCurrent((window) ->
diff --git a/content_scripts/vimium.css b/content_scripts/vimium.css
index acfc806c..7998fe5c 100644
--- a/content_scripts/vimium.css
+++ b/content_scripts/vimium.css
@@ -175,14 +175,14 @@ 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;
+ right:7px;
top:5px;
font-family:"courier new";
font-weight:bold;
color:#555;
text-decoration:none;
padding-left:10px;
- font-size:16px;
+ font-size:20px;
}
div#vimiumHelpDialog a {
text-decoration: underline;
@@ -198,7 +198,6 @@ div#vimiumHelpDialog .optionsPage {
}
div#vimiumHelpDialog a.closeButton:hover {
color:black;
- cursor:default;
-webkit-user-select:none;
}
div#vimiumHelpDialogFooter {
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 895f9104..896253a6 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -8,7 +8,7 @@ window.handlerStack = new HandlerStack
insertModeLock = null
findMode = false
-findModeQuery = { rawQuery: "" }
+findModeQuery = { rawQuery: "", matchCount: 0 }
findModeQueryHasResults = false
findModeAnchorNode = null
isShowingHelpDialog = false
@@ -554,6 +554,18 @@ updateFindModeQuery = ->
text = document.body.innerText
findModeQuery.regexMatches = text.match(pattern)
findModeQuery.activeRegexIndex = 0
+ findModeQuery.matchCount = findModeQuery.regexMatches?.length
+ # if we are doing a basic plain string match, we still want to grep for matches of the string, so we can
+ # show a the number of results. We can grep on document.body.innerText, as it should be indistinguishable
+ # from the internal representation used by window.find.
+ else
+ # escape all special characters, so RegExp just parses the string 'as is'.
+ # Taken from http://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
+ escapeRegExp = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g
+ parsedNonRegexQuery = findModeQuery.parsedQuery.replace(escapeRegExp, (char) -> "\\" + char)
+ pattern = new RegExp(parsedNonRegexQuery, "g" + (if findModeQuery.ignoreCase then "i" else ""))
+ text = document.body.innerText
+ findModeQuery.matchCount = text.match(pattern)?.length
handleKeyCharForFindMode = (keyChar) ->
findModeQuery.rawQuery += keyChar
@@ -799,7 +811,7 @@ findAndFollowRel = (value) ->
for tag in relTags
elements = document.getElementsByTagName(tag)
for element in elements
- if (element.hasAttribute("rel") && element.rel == value)
+ if (element.hasAttribute("rel") && element.rel.toLowerCase() == value)
followLink(element)
return true
@@ -815,7 +827,7 @@ window.goNext = ->
showFindModeHUDForQuery = ->
if (findModeQueryHasResults || findModeQuery.parsedQuery.length == 0)
- HUD.show("/" + findModeQuery.rawQuery)
+ HUD.show("/" + findModeQuery.rawQuery + " (" + findModeQuery.matchCount + " Matches)")
else
HUD.show("/" + findModeQuery.rawQuery + " (No Matches)")
@@ -918,7 +930,7 @@ HUD =
HUD.upgradeNotificationElement().innerHTML = "Vimium has been updated to
<a class='vimiumReset'
href='https://chrome.google.com/extensions/detail/dbepggeogbaibhgnhhndojpepiihcmeb'>
- #{version}</a>.<a class='vimiumReset close-button' href='#'>x</a>"
+ #{version}</a>.<a class='vimiumReset close-button' href='#'>&times;</a>"
links = HUD.upgradeNotificationElement().getElementsByTagName("a")
links[0].addEventListener("click", HUD.onUpdateLinkClicked, false)
links[1].addEventListener "click", (event) ->
diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee
index 6782ab28..6997d387 100644
--- a/content_scripts/vomnibar.coffee
+++ b/content_scripts/vomnibar.coffee
@@ -68,8 +68,18 @@ class VomnibarUI
@update(true)
updateSelection: ->
+ # We have taken the option to add some global state here (previousCompletionType) to tell if a search
+ # item has just appeared or disappeared, if that happens we either set the initialSelectionValue to 0 or 1
+ # I feel that this approach is cleaner than bubbling the state up from the suggestion level
+ # so we just inspect it afterwards
+ if @completions[0]
+ if @previousCompletionType != "search" && @completions[0].type == "search"
+ @selection = 0
+ else if @previousCompletionType == "search" && @completions[0].type != "search"
+ @selection = -1
for i in [0...@completionList.children.length]
@completionList.children[i].className = (if i == @selection then "vomnibarSelected" else "")
+ @previousCompletionType = @completions[0].type if @completions[0]
#
# Returns the user's action ("up", "down", "enter", "dismiss" or null) based on their keypress.
@@ -192,8 +202,8 @@ class BackgroundCompleter
filter: (query, callback) ->
id = Utils.createUniqueId()
- @filterPort.onMessage.addListener (msg) ->
- return if (msg.id != id)
+ @filterPort.onMessage.addListener (msg) =>
+ @filterPort.onMessage.removeListener(arguments.callee)
# The result objects coming from the background page will be of the form:
# { html: "", type: "", url: "" }
# type will be one of [tab, bookmark, history, domain].
diff --git a/manifest.json b/manifest.json
index de2ad173..9a4e0167 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Vimium",
- "version": "1.44",
+ "version": "1.45",
"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",
@@ -46,9 +46,10 @@
"all_frames": true
},
{
- "matches": ["file://*"],
+ "matches": ["file:///", "file:///*/"],
"css": ["content_scripts/file_urls.css"],
- "run_at": "document_start"
+ "run_at": "document_start",
+ "all_frames": true
}
],
"browser_action": {
diff --git a/pages/help_dialog.html b/pages/help_dialog.html
index 2a69ea03..0884f2cd 100644
--- a/pages/help_dialog.html
+++ b/pages/help_dialog.html
@@ -7,7 +7,7 @@
page with the up-to-date key bindings when the dialog is shown. -->
<div id="vimiumHelpDialog" class="vimiumReset">
<a class="vimiumReset optionsPage" href="#">Options</a>
- <a class="vimiumReset closeButton" href="#">x</a>
+ <a class="vimiumReset closeButton" href="#">&times;</a>
<div id="vimiumTitle" class="vimiumReset"><span class="vimiumReset" style="color:#2f508e">Vim</span>ium {{title}}</div>
<div class="vimiumReset vimiumColumn">
<table class="vimiumReset">
diff --git a/pages/options.html b/pages/options.html
index 0869b02a..b71625e8 100644
--- a/pages/options.html
+++ b/pages/options.html
@@ -330,7 +330,7 @@ unmapAll
</td>
</tr>
<tr>
- <td class="caption">Search</td>
+ <td class="caption">Default Search<br/>Engine</td>
<td verticalAlign="top">
<div class="help">
<div class="example">
@@ -342,14 +342,14 @@ unmapAll
</td>
</tr>
<tr>
- <td class="caption">Search Engines</td>
+ <td class="caption">Custom Search<br/>Engines</td>
<td verticalAlign="top">
<div class="help">
<div class="example">
Use this to add shortcuts for your common search engines when using the Vomnibar.<br/><br/>
The format is:<br/>
<pre>your-keyword: http://the-site.com/?q=%s</pre>
- %s will be replcaed with your search term.<br/>
+ %s will be replaced with your search term.<br/>
Lines which start with "#" are comments.
</div>
</div>
diff --git a/tests/dom_tests/dom_tests.coffee b/tests/dom_tests/dom_tests.coffee
index 04c81068..ac3f9ebe 100644
--- a/tests/dom_tests/dom_tests.coffee
+++ b/tests/dom_tests/dom_tests.coffee
@@ -184,6 +184,12 @@ context "Input focus",
assert.equal "third", document.activeElement.id
handlerStack.bubbleEvent 'keydown', mockKeyboardEvent("A")
+# TODO: these find prev/next link tests could be refactored into unit tests which invoke a function which has
+# a tighter contract than goNext(), since they test minor aspects of goNext()'s link matching behavior, and we
+# don't need to construct external state many times over just to test that.
+# i.e. these tests should look something like:
+# assert.equal(findLink(html("<a href=...">))[0].href, "first")
+# These could then move outside of the dom_tests file.
context "Find prev / next links",
setup ->
@@ -215,6 +221,29 @@ context "Find prev / next links",
goNext()
assert.equal '#second', window.location.hash
+ should "find link relation in header", ->
+ document.getElementById("test-div").innerHTML = """
+ <link rel='next' href='#first'>
+ """
+ goNext()
+ assert.equal '#first', window.location.hash
+
+ should "favor link relation to text matching", ->
+ document.getElementById("test-div").innerHTML = """
+ <link rel='next' href='#first'>
+ <a href='#second'>next</a>
+ """
+ goNext()
+ assert.equal '#first', window.location.hash
+
+ should "match mixed case link relation", ->
+ document.getElementById("test-div").innerHTML = """
+ <link rel='Next' href='#first'>
+ """
+ goNext()
+ assert.equal '#first', window.location.hash
+
+
createLinks = (n) ->
for i in [0...n] by 1
link = document.createElement("a")
diff --git a/tests/dom_tests/phantom_runner.coffee b/tests/dom_tests/phantom_runner.coffee
index 91eeb526..d05d9ab4 100644
--- a/tests/dom_tests/phantom_runner.coffee
+++ b/tests/dom_tests/phantom_runner.coffee
@@ -1,5 +1,6 @@
system = require 'system'
fs = require 'fs'
+path = require 'path'
page = require('webpage').create()
page.settings.userAgent = 'phantom'
@@ -12,12 +13,16 @@ page.viewportSize =
page.onConsoleMessage = (msg) ->
console.log msg
-dirname = do ->
- pathParts = system.args[0].split(fs.separator)
- pathParts[pathParts.length - 1] = ''
- pathParts.join(fs.separator)
+page.onError = (msg, trace) ->
+ console.log(msg);
+ trace.forEach (item) ->
+ console.log(' ', item.file, ':', item.line)
-page.open dirname + 'dom_tests.html', (status) ->
+page.onResourceError = (resourceError) ->
+ console.log(resourceError.errorString)
+
+testfile = path.join(path.dirname(system.args[0]), 'dom_tests.html')
+page.open testfile, (status) ->
if status != 'success'
console.log 'Unable to load tests.'
phantom.exit 1