diff options
author | anekos | 2011-08-04 23:42:19 +0900 |
---|---|---|
committer | anekos | 2011-08-04 23:42:19 +0900 |
commit | 1536bf48d3b766fb12faed7d3d1d34441a137c37 (patch) | |
tree | c414bd7901baa71a18d3d6222f5ae083ac07d73b /google-plus-commando.js | |
parent | c172211d1bb532262807cd9b01dbe237f29ca471 (diff) | |
download | vimperator-plugins-1536bf48d3b766fb12faed7d3d1d34441a137c37.tar.bz2 |
XPath 用のオブジェクトを定義
Diffstat (limited to 'google-plus-commando.js')
-rw-r--r-- | google-plus-commando.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/google-plus-commando.js b/google-plus-commando.js index f16200d..26a6e8e 100644 --- a/google-plus-commando.js +++ b/google-plus-commando.js @@ -175,9 +175,9 @@ let g:gplus_commando_map_menu = "m" // Selector {{{ - const S = (function () { + const [S, X] = (function () { - return { + let selector = { role: role, typePlusone: '[g\\:type="plusone"]', editable: '.editable', @@ -229,6 +229,18 @@ let g:gplus_commando_map_menu = "m" closeButton: '.rl.hW' // Viewer 等 }; + let xpath = { + hints: [ + 'span[@role="button"]', + 'div[@role="button"]', + 'div[@data-content-type]', + 'img[contains(@class,"O-g-Sd-la")]', // /photos の写真 + //FIXME 'div[contains(@class,"a-z-nb-A")]' + ] + }; + + return [selector, xpath]; + function role (name, prefix) ((prefix || '') + '[role="' + name + '"]'); @@ -774,21 +786,13 @@ let g:gplus_commando_map_menu = "m" function removeRoot (s) s.replace(/^\s*\/\//, ''); - const ext = [ - 'span[@role="button"]', - 'div[@role="button"]', - 'div[@data-content-type]', - 'img[contains(@class,"P-g-ie-ma")]', // /photos の写真 - //FIXME 'div[contains(@class,"a-z-nb-A")]' - ]; - const roots = [ {get visible () !!Elements.viewer, selector: ('div[contains(@class, "' + s2x(S.viewer.root) + '")]')}, {get visible () !!Elements.dialog, selector: ('div[contains(@class, "' + s2x(S.dialog.root) + '")]')}, {get visible () !!Elements.frames.notifications.visible, selector: 'id("nw-content")'} ]; - let xpath = options['hinttags'].split(/\s*\|\s*/).map(removeRoot).concat(ext); + let xpath = options['hinttags'].split(/\s*\|\s*/).map(removeRoot).concat(X.hints); for (let [, root] in Iterator(roots)) { if (!root.visible) |