Skip to content

Instantly share code, notes, and snippets.

@YungSang
Last active June 14, 2016 01:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save YungSang/9cd4ff8d5e46921a68d2 to your computer and use it in GitHub Desktop.
Save YungSang/9cd4ff8d5e46921a68d2 to your computer and use it in GitHub Desktop.
Taberareloo 用パッチ:KeyConfig 用 Taberareloo.general を復活させて、Form ポストにショートカットキーを割り当てる
// ==Taberareloo==
// {
// "name" : "Add a shortcut key for KeyConfig:Taberareloo.general"
// , "description" : "Add a shortcut key for KeyConfig:Taberareloo.general"
// , "include" : ["background", "content"]
// , "match" : ["*://*/*"]
// , "version" : "0.1.1"
// , "downloadURL" : "https://gist.github.com/YungSang/9cd4ff8d5e46921a68d2/raw/patch.shortcutkey.contextual.post.tbrl.js"
// }
// ==/Taberareloo==
(function() {
if (inContext('background')) {
var CHROME_GESTURES = 'jpkfjicglakibpenojifdiepckckakgk';
var CHROME_KEYCONFIG = 'okneonigbfnolfkmfgjmaeniipdjkgkl';
var action = {
group : 'Taberareloo',
actions : [{
name : 'Taberareloo.general'
}]
};
chrome.runtime.sendMessage(CHROME_GESTURES, action, function (res) {});
chrome.runtime.sendMessage(CHROME_KEYCONFIG, action, function (res) {});
return;
}
update(TBRL, {
target : { x : 0, y : 0 },
general : function () {
var ctx = TBRL.createContext(TBRL.getTarget());
var ext = Extractors.check(ctx)[0];
return TBRL.share(ctx, ext, true);
},
mousehandler : function (ev) {
TBRL.target.x = ev.clientX;
TBRL.target.y = ev.clientY;
},
getTarget : function () {
return document.elementFromPoint(TBRL.target.x, TBRL.target.y);
}
});
document.addEventListener('mousemove', TBRL.mousehandler, false);
window.addEventListener('Taberareloo.general', TBRL.general, false);
document.addEventListener('unload', function () {
document.removeEventListener('mousemove', TBRL.mousehandler, false);
window.removeEventListener('Taberareloo.general', TBRL.general, false);
}, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment