Show
Ignore:
Timestamp:
07/30/08 19:41:35 (4 months ago)
Author:
anekos
Message:

succ するときに、URIの後ろの方の数字/文字を優先するように修正

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/vimperator-plugins/trunk/auto_detect_link.js

    r16816 r16883  
    33// @description-ja (次|前)っぽいページへのリンクを探してジャンプ 
    44// @license        Creative Commons 2.1 (Attribution + Share Alike) 
    5 // @version        1.0 
     5// @version        1.0.1 
    66// ==/VimperatorPlugin== 
    77// 
     
    195195    let [_, dir, file] = urim, result = []; 
    196196    // succ number 
    197     let (dm, succs, file = file, left = '') { 
     197    let (dm, succs, file = file, left = '', temp = []) { 
    198198      while (file && (dm = file.match(/\d+/))) { 
    199199        let [rcontext, lcontext, lmatch] = [RegExp.rightContext, RegExp.leftContext, RegExp.lastMatch]; 
     
    201201        succs = succNumber(lmatch, next); 
    202202        for each (let succ in succs) { 
    203           result.push(dir + left + succ + rcontext); 
     203          temp.push(dir + left + succ + rcontext); 
    204204        } 
    205205        left += lmatch; 
    206206        file = rcontext; 
    207207      } 
    208     } 
     208      result = result.concat(temp.reverse()); 
     209    } 
     210    liberator.log(result); 
    209211    // succ string 
    210     let (dm, succs, file = file, left = '') { 
     212    let (dm, succs, file = file, left = '', temp = []) { 
    211213      while (file && (dm = file.match(/(^|[^a-zA-Z])([a-zA-Z])([^a-zA-Z]|$)/))) { 
    212214        let [rcontext, lcontext] = [RegExp.rightContext, RegExp.leftContext]; 
     
    214216        succs = succString(dm[2], next); 
    215217        for each (let succ in succs) { 
    216           result.push(dir + left + succ + dm[3] + rcontext); 
     218          temp.push(dir + left + succ + dm[3] + rcontext); 
    217219        } 
    218220        left += dm[1]; 
    219221        file = dm[3] + rcontext; 
    220222      } 
     223      result = result.concat(temp.reverse()); 
    221224    } 
    222225    return result; 
     
    266269    for each (let it in content.document.links) { 
    267270      if (linkFilter(it)) 
    268         result.push({frame: content, uri: it.href, text: it.textContent, element: it}); 
     271        result.push({ 
     272          type: 'link', 
     273          frame: content, 
     274          uri: it.href, 
     275          text: it.textContent, 
     276          element: it 
     277        }); 
    269278    } 
    270279    // Form 
     
    272281      (function (input) { 
    273282        result.push({ 
     283          type: 'input', 
    274284          frame: content,  
    275285          uri: input.form && input.form.action,  
     
    329339      if (setting.useSuccPattern) { 
    330340        for each (succ in succs) { 
    331           let link = find(links, function (link) (link.uri.indexOf(succ) >= 0)); 
     341          let link = find(links, function (link) (link.uri && (link.uri.indexOf(succ) >= 0))); 
    332342          if (link) 
    333343            return link;