aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2011-07-15 05:28:06 +0900
committeranekos2011-07-15 05:28:06 +0900
commitdc79250cea37a1c08d78fe8825414bc002f799a8 (patch)
treeb5a2b50d09840b6d62e149ac8a1de1f4b724b8e4
parent769dd2e3459515ee7f27a0f8fb28f86ab06ef48e (diff)
downloadvimperator-plugins-dc79250cea37a1c08d78fe8825414bc002f799a8.tar.bz2
ヒント時に +1 ボタンを一時的に表示するようにした
-rw-r--r--google-plus-commando.js32
1 files changed, 29 insertions, 3 deletions
diff --git a/google-plus-commando.js b/google-plus-commando.js
index 16e3fbf..a731d07 100644
--- a/google-plus-commando.js
+++ b/google-plus-commando.js
@@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
// INFO {{{
let INFO =
<>
- <plugin name="GooglePlusCommando" version="1.4.2"
+ <plugin name="GooglePlusCommando" version="1.5.0"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/google-plus-commando.js"
summary="The handy commands for Google+"
lang="en-US"
@@ -261,6 +261,8 @@ let INFO =
// Define hints {{{
+ const HintStyleName = 'google-plus-commando-hint';
+
[
['o', 'f', function (e) click(e)],
['t', 'F', function (e) buffer.followLink(e, liberator.NEW_TAB)],
@@ -270,7 +272,20 @@ let INFO =
hints.addMode(
modeName,
hints._hintModes[modeChar].prompt,
- action,
+ function (elem, count) {
+ function mouseEvent (name) {
+ let evt = elem.ownerDocument.createEvent('MouseEvents');
+ evt.initMouseEvent(name, true, true, elem.ownerDocument.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ elem.dispatchEvent(evt);
+ }
+
+ let plusone = elem.getAttribute('g:type') === 'plusone';
+ if (plusone)
+ mouseEvent('mouseover');
+ action(elem, count);
+ if (plusone)
+ mouseEvent('mouseout');
+ },
function () {
function removeRoot (s)
s.replace(/^\s*\/\//, '');
@@ -285,7 +300,6 @@ let INFO =
let xpath = options['hinttags'].split(/\s*\|\s*/).map(removeRoot).concat(ext);
-
for (let [, name] in Iterator(['viewer', 'dialog'])) {
if (!Elements[name])
continue;
@@ -294,6 +308,8 @@ let INFO =
break;
}
+ styles.addSheet(false, HintStyleName, "plus\\.google\\.com", '.a-b-f-W-Tj.a-f-W-Tj { display: inline !important }');
+
return xpath.map(function (it) '//' + it).join(' | ');
}
);
@@ -309,6 +325,16 @@ let INFO =
);
});
+ plugins.libly.$U.around(
+ hints,
+ 'hide',
+ function (next) {
+ setTimeout(function () styles.removeSheet(false, HintStyleName, 'plus\\.google\\.com'), 0);
+ return next();
+ },
+ true
+ );
+
// }}}
// Export {{{