Last active
September 8, 2016 10:35
-
-
Save DKunin/5d84dc78791ded318ef3dc796a1cf2da to your computer and use it in GitHub Desktop.
Inject Mousetrap
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
| (function(d, script) { | |
| script = d.createElement('script'); | |
| script.type = 'text/javascript'; | |
| script.async = true; | |
| script.onload = function(){ | |
| console.log(Mousetrap) | |
| }; | |
| script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.4.6/mousetrap.min.js'; | |
| var head = d.getElementsByTagName('body')[0]; | |
| head.appendChild(script); | |
| }(document)); |
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
| (function(d) { | |
| function addExternalScript(doc, src, callBack) { | |
| var script = doc.createElement('script'); | |
| script.type = 'text/javascript'; | |
| script.async = true; | |
| script.onload = callBack; | |
| script.src = src; | |
| var head = doc.getElementsByTagName('body')[0]; | |
| head.appendChild(script); | |
| }; | |
| addExternalScript(d, 'https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.4.6/mousetrap.min.js', function(){ | |
| addExternalScript(d, 'https://cdn.rawgit.com/DKunin/dotfiles/master/mouse-trap-todoist-setting.js', function() { | |
| console.log('done'); | |
| }) | |
| }); | |
| }(document)); |
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
| (function(d, script) { | |
| script = d.createElement('script'); | |
| script.type = 'text/javascript'; | |
| script.async = true; | |
| script.onload = function(){ | |
| Mousetrap.bind('i n', function() { | |
| document.querySelectorAll('.filter')[0].click() | |
| }); | |
| Mousetrap.bind('t d', function() { | |
| document.querySelectorAll('.filter')[2].click() | |
| }); | |
| Mousetrap.bind('t m', function() { | |
| document.querySelectorAll('.filter')[3].click() | |
| }); | |
| }; | |
| script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mousetrap/1.4.6/mousetrap.min.js'; | |
| var head = d.getElementsByTagName('body')[0]; | |
| head.appendChild(script); | |
| }(document)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment