From b95f775693bc6aaa150c995cce9faa50aee45b4b Mon Sep 17 00:00:00 2001 From: drry Date: Mon, 3 Nov 2008 15:23:58 +0000 Subject: * fixed and removed regexes. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@22651 d0d07461-0603-4401-acd4-de1884942a52 --- reading.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'reading.js') diff --git a/reading.js b/reading.js index 9a1802f..b2c2015 100644 --- a/reading.js +++ b/reading.js @@ -56,7 +56,7 @@ const POST_URL = 'https://twitter.com/statuses/update.json'; function Scraper() {} Scraper.prototype = { constants: { - VERSION: '0.22', + VERSION: '0.22', }, version: function() { return this.constants.VERSION; }, @@ -68,9 +68,8 @@ Scraper.prototype = { getTitle: function() { var title = $f('//title'); return title - ? title.text.replace(/^\s+/, '') - .replace(/\s+$/, '') - .replace(/\n/g, ' ') + ? title.text.replace(/^\s+|\s+$/g, '') + .replace(/\r\n|[\r\n\t]/g, ' ') : null; }, @@ -138,7 +137,7 @@ liberator.modules.commands.addUserCommand(['reading'], "update Twitter's status }, // complete logic is none. { - bang: true, + bang: true, } ); @@ -176,7 +175,7 @@ function canonicalizeURL(url) { req.open('GET', PATHTRAQ_CANONICALIZE_URL_API + encodeURI(url), false); req.send(null); if(req.status === 200) { - let canonicalized = req.responseText.replace(/^"/, '').replace(/"$/, ''); + let canonicalized = req.responseText.replace(/^"|"$/g, ''); return canonicalized ? canonicalized : url; } else { -- cgit v1.2.3