aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsuVene2008-12-13 23:30:47 +0000
committersuVene2008-12-13 23:30:47 +0000
commitd4953e527e3f80ebeabe6ae74670a0f78f6a8bd6 (patch)
tree3ca54572e3f721e58e76fa3cacc090d48bdbd8aa
parent04713ed6c8aac7875b92f1316595139185f5dd4d (diff)
downloadvimperator-plugins-d4953e527e3f80ebeabe6ae74670a0f78f6a8bd6.tar.bz2
1.2, 2.0preの判定方法間違い
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26659 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r--nextlink.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/nextlink.js b/nextlink.js
index 898c645..82c5fc2 100644
--- a/nextlink.js
+++ b/nextlink.js
@@ -75,7 +75,7 @@ liberator.plugins.nextlink = (function() {
this.cache = {}; // {url: {xpath: xpath, next: element, prev: url}} or null
this.pager = pager;
this.browserModes = config.browserModes || [modes.NORMAL, modes.VISUAL];
- this.isNew = autocommands['DOMLoad'] ? false : true; // toriaezu
+ this.is2_0later = config.autocommands.some(function ([k, v]) k == 'DOMLoad'); // toriaezu
var req = new libly.Request(this.WEDATA_AUTOPAGERIZE);
req.addEventListener('onSuccess', $U.bind(this,
@@ -104,7 +104,8 @@ liberator.plugins.nextlink = (function() {
$U.bind(this, function(args) { this.handler(args); }), null, true
);
var loadEvent = autocommands['DOMLoad'] || 'PageLoad'; // for 1.2
- liberator.execute(':autocmd! ' + loadEvent + ' .* :nextlink onLoad');
+logger.log('event:' + loadEvent + (this.is2_0later ? 'DOMLoad' : 'PageLoad') );
+ liberator.execute(':autocmd! ' + (this.is2_0later ? 'DOMLoad' : 'PageLoad') + ' .* :nextlink onLoad');
liberator.execute(':autocmd! LocationChange .* :nextlink onLocationChange');
},
handler: function(args) {
@@ -113,7 +114,6 @@ liberator.plugins.nextlink = (function() {
commandline.echo('');
},
onLoad: function(url) {
-
if (!this.initialized) return;
if (this.cache[url] &&
this.cache[url].hasOwnProperty('xpath')) {
@@ -210,7 +210,7 @@ liberator.plugins.nextlink = (function() {
insertPoint = lastPageElement.nextSibling ||
lastPageElement.parentNode.appendChild(doc.createTextNode(' '));
- if (context.isNew) {
+ if (context.is2_0later) {
let css = $U.xmlToDom(pageNaviCss, doc);
let node = doc.importNode(css, true);
doc.body.insertBefore(node, doc.body.firstChild);