diff options
| -rw-r--r-- | CREDITS | 1 | ||||
| -rw-r--r-- | background_page.html | 12 | ||||
| -rw-r--r-- | options.html | 26 | ||||
| -rw-r--r-- | vimiumFrontend.js | 12 | 
4 files changed, 41 insertions, 10 deletions
| @@ -27,5 +27,6 @@ Contributors:    Bill Casarin <jb@jb55.com> (github: jb55)    R.T. Lechow <rtlechow@gmail.com> (github: rtlechow)    Justin Blake <justin@hentzia.com> (github: blaix) +  Wang Ning <daning106@gmail.com> (github:daning)  Feel free to add real names in addition to GitHub usernames. diff --git a/background_page.html b/background_page.html index 5866ee48..7d8f749d 100644 --- a/background_page.html +++ b/background_page.html @@ -31,7 +31,17 @@        ".vimiumHintMarker {\n\n}\n" +        ".vimiumHintMarker > .matchingCharacter {\n\n}",      excludedUrls: "http*://mail.google.com/*\n" + -                  "http*://www.google.com/reader/*\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,>>",    };    // This is the base internal link hints CSS. It's combined with the userDefinedLinkHintCss before diff --git a/options.html b/options.html index 26d41aa4..8dfd23e8 100644 --- a/options.html +++ b/options.html @@ -84,8 +84,8 @@    $ = function(id) { return document.getElementById(id); };    var defaultSettings = chrome.extension.getBackgroundPage().defaultSettings; -  var editableFields = ["scrollStepSize", "excludedUrls", "linkHintCharacters", -                        "userDefinedLinkHintCss", "keyMappings", "filterLinkHints"]; +  var editableFields = ["scrollStepSize", "excludedUrls", "linkHintCharacters", "userDefinedLinkHintCss", +                        "keyMappings", "filterLinkHints", "previousPatterns", "nextPatterns"];    var canBeEmptyFields = ["excludedUrls", "keyMappings", "userDefinedLinkHintCss"]; @@ -290,6 +290,28 @@            </label>          </td>        </tr> +      <tr class="advancedOption"> +        <td class="caption">Previous Patterns</td> +        <td verticalAlign="top"> +            <div class="help"> +              <div class="example"> +                  Vimium will match against these patterns to navigate to a 'previous' page. +              </div> +            </div> +            <input id="previousPatterns" type="text" style="width:320px" /> +        </td> +      </tr> +      <tr class="advancedOption"> +        <td class="caption">Next Patterns</td> +        <td verticalAlign="top"> +            <div class="help"> +              <div class="example"> +                  Vimium will match against these patterns to navigate to a 'next' page. +              </div> +            </div> +            <input id="nextPatterns" type="text" style="width:320px" /> +        </td> +      </tr>      </table>      <div id="buttonsPanel"> diff --git a/vimiumFrontend.js b/vimiumFrontend.js index 452e9f37..a9dc1d37 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -4,7 +4,6 @@   * background page that we're in domReady and ready to accept normal commands by connectiong to a port named   * "domReady".   */ -  var getCurrentUrlHandlers = []; // function(url)  var insertModeLock = null; @@ -40,7 +39,7 @@ var textInputXPath = (function() {  var settings = {    values: {},    loadedValues: 0, -  valuesToLoad: ["scrollStepSize", "linkHintCharacters", "filterLinkHints"], +  valuesToLoad: ["scrollStepSize", "linkHintCharacters", "filterLinkHints", "previousPatterns", "nextPatterns"],    get: function (key) { return this.values[key]; }, @@ -635,15 +634,14 @@ function findAndFollowRel(value) {  }  function goPrevious() { -  // 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 check for single bracket first. -  var previousStrings = ["\bprev\b", "\bprevious\b", "\bback\b", "<", "←", "«", "≪", "<<"]; +  var previousPatterns = settings.get("previousPatterns") || ""; +  var previousStrings = previousPatterns.split(",");    findAndFollowRel('prev') || findAndFollowLink(previousStrings);  }  function goNext() { -  var nextStrings = ["\bnext\b", "\bmore\b", ">", "→", "»", "≫", ">>"]; +  var nextPatterns = settings.get("nextPatterns") || ""; +  var nextStrings = nextPatterns.split(",");    findAndFollowRel('next') || findAndFollowLink(nextStrings);  } | 
