From d4953e527e3f80ebeabe6ae74670a0f78f6a8bd6 Mon Sep 17 00:00:00 2001 From: suVene Date: Sat, 13 Dec 2008 23:30:47 +0000 Subject: 1.2, 2.0preの判定方法間違い git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26659 d0d07461-0603-4401-acd4-de1884942a52 --- nextlink.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'nextlink.js') 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); -- cgit v1.2.3