Forked from avivo/diigo-oneclick-bookmarklet.js
Last active
January 21, 2018 03:03
-
-
Save fghhfg/2e2556bd11299e56da951f66b56ab3b2 to your computer and use it in GitHub Desktop.
A bookmarklet to make a diigo bookmark with a default tag with one click.
This file contains 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
javascript: | |
(function(){ | |
var path = 'https://secure.diigo.com/api/v2/bookmarks'; | |
var params = { | |
'url': document.URL, | |
'title': document.title, | |
'tags': 'oneclick', | |
'shared': 'no' | |
}; | |
var form = document.createElement("form"); | |
form.setAttribute("method", "post"); | |
form.setAttribute("action", path); | |
form.setAttribute("target", "formresult"); | |
for (var key in params) { | |
var hiddenField = document.createElement("input"); | |
hiddenField.setAttribute("type", "hidden"); | |
hiddenField.setAttribute("name", key); | |
hiddenField.setAttribute("value", params[key]); | |
form.appendChild(hiddenField); | |
} | |
document.body.appendChild(form); | |
var w = window.open('about:blank', 'formresult', 'scrollbars=no,menubar=no,height=300,width=400,resizable=yes,toolbar=no,status=no,location=no'); | |
form.submit(); | |
var existing_onclick = (document.onclick) ? document.onclick : function(){ | |
}; | |
var existing_onunload = (document.body.onunload) ? document.body.onunload : function(){ | |
}; | |
document.body.onunload = function(event){ | |
w.close(); | |
existing_onunload(event); | |
}; | |
document.onclick = function(event){ | |
document.onclick = existing_onclick; | |
document.body.onunload = existing_onunload; | |
window.setTimeout(function(){ | |
w.close(); | |
}, 2000); | |
existing_onclick(event); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
{"message":"Please use API key http://www.diigo.com/api_dev. If you spam diigo, your key will be disabled."}
Sign up for an API key
This is currently a premium feature