From 7eaf3037a993b72d95f630902a2c19d929ada602 Mon Sep 17 00:00:00 2001 From: anekos Date: Tue, 7 Jun 2011 04:07:34 +0900 Subject: RegExp の関数的な呼び出しができなくなったので修正 for Firefox5 --- appendAnchor.js | 2 +- auto_source.js | 2 +- edit-vimperator-files.js | 2 +- feedSomeKeys_3.js | 2 +- gmail-commando.js | 8 ++++---- google-translator.js | 2 +- hints-for-embedded.js | 4 ++-- pluginManager.js | 4 ++-- session-manager.js | 2 +- stella.js | 8 ++++---- twittperator.js | 12 ++++++------ usi.js | 2 +- zip-de-download.js | 4 ++-- 13 files changed, 27 insertions(+), 27 deletions(-) diff --git a/appendAnchor.js b/appendAnchor.js index f148493..8ca02a2 100644 --- a/appendAnchor.js +++ b/appendAnchor.js @@ -73,7 +73,7 @@ let PLUGIN_INFO = // build URL let scheme = RegExp.$1, host = RegExp.$2, lastMatch = RegExp.lastMatch; - if (/^ttps?$/.exec(scheme)) scheme = 'h' + scheme; + if (/^ttps?$/.test(scheme)) scheme = 'h' + scheme; let href = scheme + '://' + host; // reset range diff --git a/auto_source.js b/auto_source.js index b1ff95f..5b979fd 100644 --- a/auto_source.js +++ b/auto_source.js @@ -135,7 +135,7 @@ let INFO = function source (filepath) { io.source(filepath); - if (/\.js$/(filepath)) { + if (/\.js$/.test(filepath)) { let ctx = liberator.plugins.contexts[filepath]; if (ctx) { if (typeof liberator.plugins[ctx.NAME] === 'undefined') diff --git a/edit-vimperator-files.js b/edit-vimperator-files.js index 0ee97fc..544c562 100644 --- a/edit-vimperator-files.js +++ b/edit-vimperator-files.js @@ -99,7 +99,7 @@ let INFO = [ [file.path, dir] for ([, file] in Iterator(io.File(dir).readDirectory(false))) - if (file.isFile() && /^[\._]vimperatorrc|\.(js|vimp|css)$/(file.leafName)) + if (file.isFile() && /^[\._]vimperatorrc|\.(js|vimp|css)$/.test(file.leafName)) ] for ([, dir] in Iterator(dirs)) ]); diff --git a/feedSomeKeys_3.js b/feedSomeKeys_3.js index e265084..b8891c5 100644 --- a/feedSomeKeys_3.js +++ b/feedSomeKeys_3.js @@ -520,7 +520,7 @@ let INFO = <> const ModeStringsCompleter = [ [name, disp + ' mode' + (char ? ' (alias: ' + char + ')' : '')] for ([n, {name, char, disp, extended}] in Iterator(modes._modeMap)) - if (!extended && /^\D+$/(n)) + if (!extended && /^\D+$/.test(n)) ]; diff --git a/gmail-commando.js b/gmail-commando.js index 3798898..699eeff 100644 --- a/gmail-commando.js +++ b/gmail-commando.js @@ -231,7 +231,7 @@ let INFO = get hasBuzz () !!this.doc.querySelector('input#\\:re'), - get labels() A(this.doc.querySelectorAll('a.n0')).filter(function (it) (/#label/(it.href))), + get labels() A(this.doc.querySelectorAll('a.n0')).filter(function (it) (/#label/.test(it.href))), // 入力欄 と 検索ボタンは Buzz の有効無効によって ID が変わる get input() this.doc.querySelector('input#\\:' + (this.hasBuzz ? 're' : 'rf')), @@ -280,7 +280,7 @@ let INFO = const Commando = { get inGmail () { try { - var result = /^mail\.google\.com$/(Elements.doc.location.hostname) + var result = /^mail\.google\.com$/.test(Elements.doc.location.hostname) } catch (e) {} return result; }, @@ -388,7 +388,7 @@ let INFO = let input = args.string.slice(0, context.caret); let m; - if (m = /([a-z]+):(?:([^\s\(\)\{\}]*)|[\(\{]([^\(\)\{\}]*))$/(input)) { + if (m = /([a-z]+):(?:([^\s\(\)\{\}]*)|[\(\{]([^\(\)\{\}]*))$/.exec(input)) { if (m[2]) { context.advance(input.length - m[2].length); } else { @@ -397,7 +397,7 @@ let INFO = } let key = m[1]; KeywordValueCompleter[key](context, args); - } else if (m = /[-\s]*([^-\s:\(\)\{\}]*)$/(input)) { + } else if (m = /[-\s]*([^-\s:\(\)\{\}]*)$/.exec(input)) { context.advance(input.length - m[1].length); context.completions = [ [v + ':', v] for ([, v] in Iterator(GMailSearchKeyword)) diff --git a/google-translator.js b/google-translator.js index a34819e..49d272b 100644 --- a/google-translator.js +++ b/google-translator.js @@ -201,7 +201,7 @@ let INFO = context.completions = [ [it, ''] for ([, it] in Iterator(getTexts())) - if (it.length > 3 && !/^\s* 3 && !/^\s*]*)?>([\s\S]+?)<\/VimperatorPlugin[ \t\r\n]*>/(source); + let m = /\bPLUGIN_INFO[ \t\r\n]*=[ \t\r\n]*]*)?>([\s\S]+?)<\/VimperatorPlugin[ \t\r\n]*>/.exec(source); if (m){ m = m[1].replace(/(?:))*\]\]|--(?:[^-]|-(?!-))*--)>)+/g, ''); - m = /^[\w\W]*?]*)?>([^<]+)<\/version[ \t\r\n]*>/(m); + m = /^[\w\W]*?]*)?>([^<]+)<\/version[ \t\r\n]*>/.exec(m); if (m){ version = m[1]; } diff --git a/session-manager.js b/session-manager.js index 0e377ba..10a7706 100644 --- a/session-manager.js +++ b/session-manager.js @@ -220,7 +220,7 @@ let INFO = context.completions = [ [file.leafName.replace(/\.session$/, ''), new Date(file.lastModifiedTime)] for ([,file] in Iterator(io.File(gSessionManager.getSessionDir()).readDirectory())) - if (!ignoreAuto || args['-auto'] || !/^(backup(-\d+)?|autosave)\.session$/(file.leafName)) + if (!ignoreAuto || args['-auto'] || !/^(backup(-\d+)?|autosave)\.session$/.test(file.leafName)) ].sort(function ([, a], [, b]) (b - a)); } }, diff --git a/stella.js b/stella.js index 9ded68e..8eb8119 100644 --- a/stella.js +++ b/stella.js @@ -380,11 +380,11 @@ Thanks: // 上手い具合に秒数に直すよ fromTimeCode: function (code, max) { var m; - if (max && (m = /^(-?\d+(?:\.\d)?)%/(code))) + if (max && (m = /^(-?\d+(?:\.\d)?)%/.exec(code))) return Math.round(max * (parseFloat(m[1]) / 100)); - if (m = /^(([-+]?)\d+):(\d+)$/(code)) + if (m = /^(([-+]?)\d+):(\d+)$/.exec(code)) return parseInt(m[1], 10) * 60 + (m[2] == '-' ? -1 : 1) * parseInt(m[3], 10); - if (m = /^([-+]?\d+\.\d+)$/(code)) + if (m = /^([-+]?\d+\.\d+)$/.exec(code)) return Math.round(parseFloat(m[1]) * 60); return parseInt(code, 10); }, @@ -834,7 +834,7 @@ Thanks: } YouTubePlayer.getIDfromURL = function (url) let ([_, r] = url.match(/[?;&]v=([-\w]+)/)) r; - YouTubePlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/(url); + YouTubePlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/.test(url); YouTubePlayer.prototype = { __proto__: Player.prototype, diff --git a/twittperator.js b/twittperator.js index e09a273..fc439db 100644 --- a/twittperator.js +++ b/twittperator.js @@ -1273,7 +1273,7 @@ let PLUGIN_INFO = } for (let [n, v] in Iterator(options)) { - if (/^on[A-Z]/(n) && (v instanceof Function)) + if (/^on[A-Z]/.test(n) && (v instanceof Function)) this.events[n.toLowerCase()] = v; } @@ -1409,7 +1409,7 @@ let PLUGIN_INFO = lines[0] = buf + lines[0]; for (let [, line] in Iterator(lines.slice(0, -1))) { try { - if (/^\s*\{/(line)) + if (/^\s*\{/.test(line)) onMsg(Utils.fixStatusObject(JSON.parse(line)), line); } catch (e) { liberator.log(e); } } @@ -1560,7 +1560,7 @@ let PLUGIN_INFO = } for (let [n, v] in Iterator(st)) { - if (/(^|_)id$/(n)) + if (/(^|_)id$/.test(n)) fixId(result, n); } @@ -1636,7 +1636,7 @@ let PLUGIN_INFO = function loadPluginFromDir(checkGV) { return function(dir) { dir.readDirectory().forEach(function(file) { - if (/\.tw$/(file.path) && (!checkGV || isEnabled(file))) + if (/\.tw$/.test(file.path) && (!checkGV || isEnabled(file))) Twittperator.sourceScriptFile(file); }); } @@ -2004,7 +2004,7 @@ let PLUGIN_INFO = "^" + this.command.map(function(c) let (r = util.escapeRegex(c)) - (/^\W$/(c) ? r : r + "( |$)") + (/^\W$/.test(c) ? r : r + "( |$)") ).join("|") ); }, @@ -2069,7 +2069,7 @@ let PLUGIN_INFO = description: "Open link", action: function(arg) Twittperator.openLink(arg), timelineCompleter: true, - completer: Completers.text(function(s) /https?:\/\//(s.text)) + completer: Completers.text(function(s) /https?:\/\//.test(s.text)) }), SubCommand({ command: ["delete"], diff --git a/usi.js b/usi.js index d0664d1..fe8db8f 100644 --- a/usi.js +++ b/usi.js @@ -700,7 +700,7 @@ let INFO = // FIXME http が補完できない let left = args.string.slice(0, context.caret); - let m = /(?:^|\s)([#!@=*^]|http)([^#!@=*^]*)$/(left); + let m = /(?:^|\s)([#!@=*^]|http)([^#!@=*^]*)$/.exec(left); if (m) { let completer = SmartAddCompleter[m[1]]; if (completer) { diff --git a/zip-de-download.js b/zip-de-download.js index a224011..9658057 100644 --- a/zip-de-download.js +++ b/zip-de-download.js @@ -176,7 +176,7 @@ let SITE_INFO = [ // 連番かもしれない id は無視する let id = elem.getAttribute('id'); - if (id && !/\d/(id)) + if (id && !/\d/.test(id)) return 'id("' + id + '")'; return getXPath(elem.parentNode) + '/' + elem.tagName.toLowerCase(); @@ -205,7 +205,7 @@ let SITE_INFO = [ return result; } function extensionValidator(vs) - vs && vs.every(function (v) /^[\da-zA-Z]+$/(v)); + vs && vs.every(function (v) /^[\da-zA-Z]+$/.test(v)); let self = { downloadZip: function(path, urls, comment, isAppend){ -- cgit v1.2.3