Forked from saitamanodoruji/add_hatenab_keybind.user.js
Created
June 20, 2012 23:51
-
-
Save syoichi/2963006 to your computer and use it in GitHub Desktop.
HTMLElement.click(http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#dom-click )を使うように
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @id Add HatenaB keybind | |
// @name Add HatenaB keybind | |
// @version 0.0.1 | |
// @namespace http://b.hatena.ne.jp/saitamanodoruji | |
// @author saitamanodoruji | |
// @description はてなブックマークにショートカットキーを追加する | |
// @include http://b.hatena.ne.jp/* | |
// @run-at document-end | |
// ==/UserScript== | |
// keybind | |
// m: 「みんなのブックマーク」を開く | |
// h: 「すべて表示」をクリックする | |
(function(win, doc){ | |
doc.addEventListener('keypress', function(e){ | |
GM_log(e.keyCode + ', ' + e.charCode); | |
if ( e.keyCode == 72 || e.charCode == 104 ) { | |
var trigger = doc.querySelector( | |
'h3.current-element ~ ul.entry-comment span.toggle-show'); | |
if (trigger) trigger.click(); | |
} else if ( e.keyCode == 77 || e.charCode == 109 ) { | |
var url = doc.querySelector( | |
'h3.current-element a.entry-link').href; | |
GM_openInTab( | |
'http://b.hatena.ne.jp/entry?mode=more&url=' | |
+ url, true); | |
} | |
}, false); | |
})(window, document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment