diff options
-rw-r--r-- | appendAnchor.js | 2 | ||||
-rw-r--r-- | auto_detect_link.js | 5 | ||||
-rw-r--r-- | auto_source.js | 2 | ||||
-rw-r--r-- | caret-hint.js | 2 | ||||
-rw-r--r-- | edit-vimperator-files.js | 2 | ||||
-rw-r--r-- | feedSomeKeys_3.js | 2 | ||||
-rw-r--r-- | gmail-commando.js | 27 | ||||
-rw-r--r-- | google-translator.js | 2 | ||||
-rw-r--r-- | hints-for-embedded.js | 4 | ||||
-rw-r--r-- | loginManager.js | 11 | ||||
-rw-r--r-- | pluginManager.js | 4 | ||||
-rw-r--r-- | session-manager.js | 2 | ||||
-rw-r--r-- | sl.js | 16 | ||||
-rw-r--r-- | stella.js | 8 | ||||
-rw-r--r-- | twaudio.js | 81 | ||||
-rw-r--r-- | twittperator.js | 12 | ||||
-rw-r--r-- | usi.js | 2 | ||||
-rw-r--r-- | zip-de-download.js | 4 |
18 files changed, 46 insertions, 142 deletions
diff --git a/appendAnchor.js b/appendAnchor.js index 77496e8..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?$/(scheme)) scheme = 'h' + scheme; + if (/^ttps?$/.test(scheme)) scheme = 'h' + scheme; let href = scheme + '://' + host; // reset range diff --git a/auto_detect_link.js b/auto_detect_link.js index c2083af..4f11cc8 100644 --- a/auto_detect_link.js +++ b/auto_detect_link.js @@ -3,10 +3,9 @@ var PLUGIN_INFO = <name>Auto Detect Link</name> <description>Find (next|previous) link, and jump.</description> <description lang="ja">(次|前)っぽいページへのリンクを探してジャンプ</description> - <version>1.8.2</version> + <version>1.8.3</version> <author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author> <minVersion>2.0pre</minVersion> - <maxVersion>2.4</maxVersion> <updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/auto_detect_link.js</updateURL> <license document="http://creativecommons.org/licenses/by-sa/3.0/"> Creative Commons Attribution-Share Alike 3.0 Unported @@ -182,7 +181,7 @@ var PLUGIN_INFO = // 要素をクリックする function clickElement (elem) - buffer.followLink(elem); + buffer.followLink(elem, liberator.CURRENT_TAB); // 開いたURIなどの表示 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/caret-hint.js b/caret-hint.js index ba6772e..60c6ec0 100644 --- a/caret-hint.js +++ b/caret-hint.js @@ -288,7 +288,7 @@ let INFO = // Vimperator 3.0 までと 3.1 以降に両対応 const [CaretKey, VisualKey] = - /caret/(mappings.getDefault(modes.NORMAL, 'i').description) ? ['i', 'v'] : ['c', 'v']; + /caret/.exec(mappings.getDefault(modes.NORMAL, 'i').description) ? ['i', 'v'] : ['c', 'v']; function moveCaret (elem, head, select) { let doc = elem.ownerDocument; 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 9e437b1..699eeff 100644 --- a/gmail-commando.js +++ b/gmail-commando.js @@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - <plugin name="GMailCommando" version="1.4.6" + <plugin name="GMailCommando" version="1.4.7" href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/gmail-commando.js" summary="The handy commands for GMail" lang="en-US" @@ -72,7 +72,7 @@ let INFO = </description> </item> </plugin> - <plugin name="GMailコマンドー" version="1.4.6" + <plugin name="GMailコマンドー" version="1.4.7" href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/gmail-commando.js" summary="便利なGMail用コマンドー" lang="ja" @@ -229,12 +229,14 @@ let INFO = const Elements = { get doc() content.frames[3].document, - get labels() A(this.doc.querySelectorAll('a.n0')).filter(function (it) (/#label/(it.href))), + get hasBuzz () !!this.doc.querySelector('input#\\:re'), - // 入力欄 - input - get input() this.doc.getElementById(':rf'), + get labels() A(this.doc.querySelectorAll('a.n0')).filter(function (it) (/#label/.test(it.href))), - get searchButton() this.doc.getElementById(':rj'), + // 入力欄 と 検索ボタンは Buzz の有効無効によって ID が変わる + get input() this.doc.querySelector('input#\\:' + (this.hasBuzz ? 're' : 'rf')), + + get searchButton() this.doc.querySelector('div#\\:' + (this.hasBuzz ? 'ri' : 'rj')), get translateButton () (this.mail && this.mail.querySelector('tr > td.SA > .iL.B9')), get translateButtons () A(this.doc.querySelectorAll('tr > td.SA > .iL.B9')), @@ -275,17 +277,10 @@ let INFO = Elements.doc.querySelectorAll('.NRYPqe > .J-Zh-I.J-J5-Ji.J-Zh-I.J-Zh-I-Js-Zq')[2] }; - //'.J-M-JJ > input' - //let (e = Elements.doc.querySelector('.J-LC-Jz')) { - // liberator.log(e); - // buffer.followLink(e); - // //plugins.feedSomeKeys_3.API.feed('<Cr>', ['keydown'], e) - //} - 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; }, @@ -393,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 { @@ -402,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*</(it)) + if (it.length > 3 && !/^\s*</.test(it)) ]; } diff --git a/hints-for-embedded.js b/hints-for-embedded.js index 221e8fd..cf86b4e 100644 --- a/hints-for-embedded.js +++ b/hints-for-embedded.js @@ -185,7 +185,7 @@ let INFO = if (elem.tagName === 'IMG' && elem.src) { if (openParent) { let p = elem.parentNode; - if (p.tagName === 'A' && /(gif|png|jpe?g)$/i(p.href)) + if (p.tagName === 'A' && /(gif|png|jpe?g)$/i.test(p.href)) return liberator.open(p.href, liberator.NEW_TAB); } return liberator.open(elem.src, liberator.NEW_TAB); @@ -209,7 +209,7 @@ let INFO = } } - let urls = info.filter(function ([n, v]) /^https?:\/\//(v)); + let urls = info.filter(function ([n, v]) /^https?:\/\//.test(v)); if (!urls.length) return liberator.echoerr('Could not found URL'); diff --git a/loginManager.js b/loginManager.js index 2628211..70a061d 100644 --- a/loginManager.js +++ b/loginManager.js @@ -4,9 +4,9 @@ var PLUGIN_INFO = <name>{NAME}</name> <description>login manager</description> <author mail="konbu.komuro@gmail.com" homepage="http://d.hatena.ne.jp/hogelog/">hogelog</author> - <version>0.0.7</version> + <version>0.0.8</version> <minVersion>2.0pre</minVersion> - <maxVersion>3.1</maxVersion> + <maxVersion>3.2</maxVersion> <updateURL>https://github.com/vimpr/vimperator-plugins/raw/master/loginManger.js</updateURL> <license>public domain</license> <detail><![CDATA[ @@ -132,6 +132,13 @@ var services = { login: "Sign In", }, }, + readitlater: { + HOST: ["http://readitlaterlist.com"], + LOGIN: "/login_process/", + LOGOUT: "/lo", + usernameField: "feed_id", + passwordField: "password", + }, }; for (name in services){ services[name] = new Service(services[name]); diff --git a/pluginManager.js b/pluginManager.js index 5cbd940..f191b9a 100644 --- a/pluginManager.js +++ b/pluginManager.js @@ -325,10 +325,10 @@ Plugin.prototype = { // {{{ } }); } catch (e){} - let m = /\bPLUGIN_INFO[ \t\r\n]*=[ \t\r\n]*<VimperatorPlugin(?:[ \t\r\n][^>]*)?>([\s\S]+?)<\/VimperatorPlugin[ \t\r\n]*>/(source); + let m = /\bPLUGIN_INFO[ \t\r\n]*=[ \t\r\n]*<VimperatorPlugin(?:[ \t\r\n][^>]*)?>([\s\S]+?)<\/VimperatorPlugin[ \t\r\n]*>/.exec(source); if (m){ m = m[1].replace(/(?:<!(?:\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]|--(?:[^-]|-(?!-))*--)>)+/g, ''); - m = /^[\w\W]*?<version(?:[ \t\r\n][^>]*)?>([^<]+)<\/version[ \t\r\n]*>/(m); + m = /^[\w\W]*?<version(?:[ \t\r\n][^>]*)?>([^<]+)<\/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)); } }, @@ -255,22 +255,6 @@ SL.prototype = { // {{{ let luckyStar = (function(){ -function extend(class, obj){ - var flag; - for (let i in obj){ - flag = false; - if (obj.__lookupGetter__(i)){ - class.prototype.__defineGetter__(i, obj.__lookupGetter__(i)); - flag = true; - } - if (obj.__lookupSetter__(i)){ - class..prototype.__defineSetter__(i, obj.__lookupSetter__(i)); - flag = true; - } - if (!flag) class.prototype[i] = obj[i]; - } -} - let colors = [ ["rgba(255,215,0,alpha)", "rgba(255,255,0,alpha)"], //gold, yellow ["rgba(255,20,147,alpha)","rgba(255,0,255, alpha)"], // deeppink, magenta @@ -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/twaudio.js b/twaudio.js deleted file mode 100644 index cddf478..0000000 --- a/twaudio.js +++ /dev/null @@ -1,81 +0,0 @@ -// INFO // -var INFO = -<plugin name="twaudio.js" version="0.1" - summary="twaud.io player controller" - href="http://github.com/vimpr/vimperator-plugins/blob/master/twaudio.js" - xmlns="http://vimperator.org/namespaces/liberator"> - <author email="mitsugu.oyama@gmail.com">Mitsugu Oyama</author> - <license href="http://opensource.org/licenses/mit-license.php">MIT</license> - <project name="Vimperator" minVersion="2.3"/> - <p>twaud.io player controller.</p> - <item> - <tags>'twaudio'</tags> - <spec>:twp<oa>lay</oa></spec> -<!-- - 実装するか未定。jQueryが許さないかも。 - <spec>:twv<oa>olume</oa> <oa>level</oa></spec> ---> - <description> - <p>twaud.io player controller.</p> - </description> - </item> -</plugin>; - -commands.addUserCommand( - ['twp[lay]'], - 'toggle to play button', - function(){ - let contents=gBrowser.selectedBrowser.contentDocument; - // twaud.ioのjQueryの使い方によりマウス・イベントをエミュレート - // するしかないっぽい。 - let evt=contents.createEvent("MouseEvents"); - evt.initMouseEvent( - 'click', - true, // canBubble - true, // cancelable - window, // view - 0, // detail - 0, // screenX - 0, // screenY - 0, // clientX - 0, // clientY - false, // ctrlKey - false, // altKey - false, // shiftKey - false, // metaKey - 0, // button - null //relatedTarget - ); - let btnPlay=contents.getElementById('play0'); - let btnPause=contents.getElementById('pause0'); - if(('display: block;'==btnPlay.getAttribute('style')) - ||(null==btnPlay.getAttribute('style'))){ - btnPlay.dispatchEvent(evt); - }else{ - let btnPause=contents.getElementById('pause0'); - btnPause.dispatchEvent(evt); - } - }, - { - literal: false - }, - true -); - -/* -実装するか未定。jQueryが許さないかも。 -commands.addUserCommand( - ['twv[olume]'], - 'set volume of twaud.io player.', - function(args){ - if(1!=args.length){ - liberator.echoerr('argument error'); - return false; - } - }, - { - literal: false - }, - true -); -*/ 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"], @@ -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){ |