Last active
December 24, 2015 23:29
-
-
Save 0x4a/6880359 to your computer and use it in GitHub Desktop.
Pinboard Shortcut for #firefox - Press Ctrl + D to add the opened webpage to #pinboard.in this is a modified version of the shortcut #userscript by leplay (https://userscripts.org/scripts/show/120694) all the credit for the actual code goes to him,I just changed it from a popup to opening on the same page with a tagcloud. I also changed the shor…
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== | |
// @name Pinboard - Shortcut (Ctrl+D) | |
// @author leplay / jekyll | |
// @namespace http://userscripts.org/scripts/show/156067 | |
// @description Press Ctrl + D to add the opened webpage to pinboard.in using the same-page tag-cloud bookmarklet | |
// @grant none | |
// ==/UserScript== | |
// original script by leplay - http://userscripts.org/scripts/show/120694 | |
// modified by [email protected] | |
function KeyDownEvent(event) { | |
// changed key to D | |
if (String.fromCharCode(event.which) == "D"&& event.ctrlKey && !event.altKey && !event.metaKey) { | |
var q=location.href; | |
if(document.getSelection){ | |
var d=document.getSelection(); | |
} | |
else{ | |
var d=''; | |
}; | |
var p=document.title; | |
// changed to same-page tag-cloud bookmarklet | |
document.location='https://pinboard.in/add?showtags=yes&next=same&url='+encodeURIComponent(q)+'&description='+encodeURIComponent(d)+'&title='+encodeURIComponent(p); | |
try { | |
event.preventDefault(); | |
} catch (e) { | |
} | |
return false; | |
} | |
return true; | |
} | |
document.addEventListener("keydown", KeyDownEvent, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment