Changeset 18885

Show
Ignore:
Timestamp:
09/05/08 12:27:57 (4 months ago)
Author:
drry
Message:
  • fixed regexps.
  • et cetera.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/userscripts/hatena.rss.read.more.supporter.user.js

    r16692 r18885  
    294294ReadMore.parser = function (text) { 
    295295  function trimspace (str) { 
    296     return str.replace(/^\s*/, '').replace(/\s*$/, ''); 
     296    return str.replace(/^\s+|\s+$/g, ''); 
    297297  } 
    298298  function isValid (info) { 
     
    307307 
    308308  var info = {}; 
    309   var lines = text.split(/\r\n|[\r\n]/); 
     309  var lines = text.split(/\r?\n|\r/); 
    310310  var reg = /(^[^:]*?):(.*)$/; 
    311311  lines.forEach(function (line) { 
     
    480480// based on "Pagerization" by id:ofk (http://userscripts.org/scripts/show/7623) 
    481481function parseHTML(str) { 
    482   str = str.replace(/^[\s\S]*?<html(?:\s[^>]+?)?>|<\/html\s*>[\S\s]*$/ig, ''); 
     482  str = str.replace(/^[\s\S]*?<html(?:[ \t\r\n][^>]*?)?>|<\/html[ \t\r\n]*>[\S\s]*$/ig, ''); 
    483483  var res = document.implementation.createDocument(null, 'html', null); 
    484484  var range = document.createRange();