Changeset 26646
- Timestamp:
- 12/14/08 03:49:06 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/javascript/vimperator-plugins/trunk/nextlink.js
r26642 r26646 96 96 this.siteinfo = [ 97 97 { 98 url: '^http:\\/\\/192\\.168\\.', 99 nextLink: 'id("next")', 100 pageElement: '//*' 101 }, 102 { 103 url: '^http:\\/\\/localhost', 98 url: '^https?://(?:192\\.168(?:\\.\\d+){2}|localhost)(?::\\d+)?/', 104 99 nextLink: 'id("next")', 105 100 pageElement: '//*' … … 131 126 132 127 for (let i = 0, len = this.siteinfo.length; i < len; i++) { 133 if (url.match(this.siteinfo[i].url) && !/^\^https\?:\/\/\.$/.test(this.siteinfo[i].url)) {128 if (url.match(this.siteinfo[i].url) && this.siteinfo[i].url != '^https?://.') { 134 129 this.setCache(url, 135 130 ['doc', 'xpath', 'siteinfo'], … … 187 182 removeMap: function(cmd) { 188 183 try { 189 if (mappings.hasMap(this.browserModes, cmd)) { ;184 if (mappings.hasMap(this.browserModes, cmd)) { 190 185 mappings.remove(this.browserModes, cmd); 191 186 } … … 243 238 if (cache.curPage == 1) { 244 239 return; 240 } else if (--cache.curPage == 1) { 241 window.content.scrollTo(0, 0); 245 242 } else { 246 cache.curPage--; 247 if (cache.curPage == 1) { 248 window.content.scrollTo(0, 0); 249 } else { 250 this.focusPagenavi(context, url, cache.curPage); 251 } 243 this.focusPagenavi(context, url, cache.curPage); 252 244 } 253 245 }), … … 270 262 } 271 263 if (cache.loadedURLs[reqUrl]) { 272 cache.curPage++; 273 this.focusPagenavi(context, url, cache.curPage); 264 this.focusPagenavi(context, url, ++cache.curPage); 274 265 return; 275 266 } … … 399 390 $U.getNodesFromXPath(cache.xpath, doc, function(item) elem = item, this); 400 391 401 var nextUrl = $U.pathToURL(elem, doc); 402 var prev = $U.getNodesFromXPath('//a[@rel="prev"] | //link[@rel="prev"]', doc); 392 var nextURL = $U.pathToURL(elem, doc); 393 var xpath = ['a', 'link'].map(function(e) '//' + e + '[translate(normalize-space(@rel), "EPRV", "eprv")="prev"]') 394 .join(' | '); 395 var prev = $U.getNodesFromXPath(xpath, doc); 403 396 if (prev.length) { 404 397 context.setCache(url, 'prev', prev[0]); 405 398 } 406 context.setCache(nextU rl, 'prev', url);399 context.setCache(nextURL, 'prev', url); 407 400 context.setCache(url, 'next', elem); 408 401 },
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)