diff options
author | suVene | 2008-12-11 18:15:52 +0000 |
---|---|---|
committer | suVene | 2008-12-11 18:15:52 +0000 |
commit | 29f70c4d1e3942215ca583b22b7fb26f4f1423e3 (patch) | |
tree | cee83a0729be077982df2f6ce44b415c1491713a /nextlink.js | |
parent | a50bcdca77e1a9f2962670f1c8e1ab2f14510f02 (diff) | |
download | vimperator-plugins-29f70c4d1e3942215ca583b22b7fb26f4f1423e3.tar.bz2 |
siteinfo を hash のまま保持。(ごめんねほかは途中)
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26437 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'nextlink.js')
-rwxr-xr-x | nextlink.js | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/nextlink.js b/nextlink.js index 842baaa..4b7d4a4 100755 --- a/nextlink.js +++ b/nextlink.js @@ -29,6 +29,9 @@ liberator.plugins.nextlink = (function() { var $U = libly.$U;
var logger = $U.getLogger('nextlink');
+ var isFollowLink = typeof liberator.globalVariables.nextlink_followlink == 'undefined' ?
+ true : $U.eval(liberator.globalVariables.nextlink_followlink);
+
var NextLink = function() {//{{{
this.initialize.apply(this, arguments);
};
@@ -46,8 +49,8 @@ liberator.plugins.nextlink = (function() { function(res) {
var json = $U.evalJson(res.responseText);
if (!json) return;
- this.siteinfo = json.map(function(item) [item.data.url, item.data.nextLink])
- .sort(function(a, b) b[0].length - a[0].length); // sort url.length desc
+ this.siteinfo = json.map(function(item) item.data)
+ .sort(function(a, b) b.url.length - a.url.length); // sort url.length desc
this.initialized = true;
}
));
@@ -75,8 +78,8 @@ liberator.plugins.nextlink = (function() { }
for (let i = 0, len = this.siteinfo.length; i < len; i++) {
- if (url.match(this.siteinfo[i][0])) {
- this.setCache(url, 'xpath', this.siteinfo[i][1]);
+ if (url.match(this.siteinfo[i].url)) {
+ this.setCache(url, 'xpath', this.siteinfo[i].nextLink)
this.onLocationChange(url);
return;
}
@@ -111,17 +114,24 @@ liberator.plugins.nextlink = (function() { if (!prevUrl) {
mappings.remove(config.browserModes, "[[");
} else {
- mappings.addUserMap(config.browserModes, ["[["], "customize by nextlink.js",
- function(count) { liberator.open(prevUrl, liberator.CURRENT_TAB); },
- { flags: Mappings.flags.COUNT });
+ if (isFollowLink) {
+ mappings.addUserMap(config.browserModes, ["[["], "customize by nextlink.js",
+ function(count) { liberator.open(prevUrl, liberator.CURRENT_TAB); },
+ { flags: Mappings.flags.count });
+ } else {
+ }
}
if (!nextUrl) {
mappings.remove(config.browserModes, "]]");
} else {
- mappings.addUserMap(config.browserModes, ["]]"], "customize by nextlink.js",
- function(count) { buffer.followLink(elem, liberator.CURRENT_TAB); },
- { flags: Mappings.flags.COUNT });
+ if (isFollowLink) {
+ mappings.addUserMap(config.browserModes, ["]]"], "customize by nextlink.js",
+ function(count) { buffer.followLink(elem, liberator.CURRENT_TAB); },
+ { flags: Mappings.flags.COUNT });
+ } else {
+ // TODO: pagirize!
+ }
}
this.isCurOriginalMap = false;
|