Changeset 38133

Show
Ignore:
Timestamp:
08/02/10 22:55:03 (3 years ago)
Author:
anekos
Message:

修正&リンクを開くサブコマンド追加

Files:
1 modified

Legend:

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

    r38132 r38133  
    13391339    }); 
    13401340  } // }}} 
     1341  function openLink(text) { // {{{ 
     1342    // TODO 複数のリンクに対応 
     1343    let m = text.match(/https?:\/\/\S+/); 
     1344    if (m) 
     1345      liberator.open(m[0], liberator.NEW_TAB); 
     1346  } // }}} 
    13411347  function ReTweet(id) { // {{{ 
    13421348    let url = "http://api.twitter.com/1/statuses/retweet/" + id + ".json"; 
     
    13881394 
    13891395    const Completers = { 
    1390       name_text: function (context, args) { 
     1396      name: function (context, args) { 
    13911397        context.title = ["Name","Entry"]; 
    13921398        context.completions = 
    13931399          history.map(rt(function(s) ["@" + s.user.screen_name, s])); 
    13941400      }, 
    1395       name_id_text: function (context, args) { 
     1401      link: function (context, args) { 
     1402        context.title = ["Name","Entry"]; 
     1403        context.completions = 
     1404          history.filter(function (s) /https?:\/\//(s.text)).map(rt(function(s) [s.text, s])); 
     1405      }, 
     1406      text: function (context, args) { 
     1407        context.title = ["Name","Entry"]; 
     1408        context.completions = 
     1409          history.map(rt(function(s) [s.text, s])); 
     1410      }, 
     1411      name_id: function (context, args) { 
    13961412        context.title = ["Name","Entry"]; 
    13971413        context.completions = 
     
    14331449        description: "Show mentions", 
    14341450        action: function (args) showTwitterMentions(args.literalArg), 
    1435         completer: Completers.name_text 
     1451        completer: Completers.name 
    14361452      }, 
    14371453      { 
     
    14401456        description: "Twitter search", 
    14411457        action: function (args) showTwitterSearchResult(args.literalArg), 
    1442         completer: Completers.name_text 
     1458        completer: Completers.text 
     1459      }, 
     1460      { 
     1461        match: function (s) s.match(/^\//), 
     1462        command: "/", 
     1463        description: "Open link", 
     1464        action: function (args) openLink(args.literalArg), 
     1465        completer: Completers.link 
    14431466      } 
    14441467    ];