Show
Ignore:
Timestamp:
03/12/08 17:36:39 (5 years ago)
Author:
drry
Message:

lang/javascript/userscripts/nicoclip.user.js:

  • 正規表現を修正しました。
  • ほか。
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/nicoclip.user.js

    r7644 r7848  
    197197  // <link rel="next" href="(.*?)"> を探す 
    198198  var links = doc.getElementsByTagName('link'); 
    199   var linksNum = links.length; 
    200199  this.nextAtomURL = null; 
    201   for (var i = 0; i < linksNum; i++) { 
     200  for (var i = links.length; i --> 0; ) { 
    202201    if (links[i].getAttribute('rel') == 'next') { 
    203202      this.nextAtomURL = links[i].getAttribute('href'); 
     
    205204        console.log('next Atom URL: ' + this.nextAtomURL); 
    206205      } 
     206      break; 
    207207    } 
    208208  } 
     
    213213  for (var i = 0; i < entriesNum; i++) { 
    214214    var title = (entries[i].getElementsByTagName('title'))[0].firstChild.nodeValue; 
    215     title = title.replace(/^ニコニコ動画\(.*?\)\s*‐/, ''); // RC2/RC 
    216     title = title.replace(/‐ニコニコ動画\(.*?\)$/, '');    // RC2 
    217     title = title.replace(/^ニコニコ動画\(.*?\) \| /, '');  // gamma 
    218     title = title.replace(/^ニコニコ動画γ \| /, '');       // gamma 
     215    title = title.replace(/^ニコニコ動画\(.*?\)\s*‐/, '');       // RC2/RC 
     216    title = title.replace(/‐ニコニコ動画\(.*?\)$/, '');          // RC2 
     217    title = title.replace(/^ニコニコ動画(?:γ|\(.*?\)) \| /, ''); // gamma 
    219218    // あとでcreateTextNodeするのでエンティティを解除 
    220219    title = title.replace('&lt;', '<'); 
     
    335334  } 
    336335  // ユーザー名を取得 
    337   if (resp.responseText.match(/Hatena.id\s*=\s*'(.*?)'/)) { 
     336  if (resp.responseText.match(/Hatena\.id\s*=\s*'([^']+)'/)) { 
    338337    this.hatenaUsername = RegExp.$1; 
    339338  } 
     
    355354  var datastr = resp.responseText; 
    356355  // コメント欄の中身を取得 
    357   if (datastr.match(/<input[^>]* value="(.*?)"[^>]* id="comment"/)) { 
     356  if (datastr.match(/<input\s+(?:|[^>]+?\s+)value="((?:\\"|[^"])*)"[^>]*? id="comment"/)) { 
    358357    var comment = RegExp.$1; 
    359358    if (DEBUG) { 
     
    409408      } 
    410409      // ユーザー名を取得 
    411       if (datastr.match(/Hatena.id\s*=\s*'(.*?)'/)) { 
     410      if (datastr.match(/Hatena\.id\s*=\s*'([^']+)'/)) { 
    412411        this.hatenaUsername = RegExp.$1; 
    413412      } 
     
    425424  var datastr = resp.responseText; 
    426425  // ユーザー名を取得 
    427   if (datastr.match(/Hatena.id\s*=\s*'(.*?)'/)) { 
     426  if (datastr.match(/Hatena\.id\s*=\s*'([^']+)'/)) { 
    428427    this.hatenaUsername = RegExp.$1; 
    429428  }