Created
June 4, 2018 14:46
-
-
Save purtuga/a2bf5e692b5b87529feab7d49c49238a to your computer and use it in GitHub Desktop.
Post with Buffer by opening a new window to the buffer add page
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
(function(encodeURI, DOCUMENT){ | |
var link = DOCUMENT.createElement("a"); | |
link.href="https://buffer.com/add?text=" + encodeURI(DOCUMENT.title) + "&url=" + DOCUMENT.location; | |
link.setAttribute("style", "position:absolute;left=-99999px;top:-99999px;visibility:hidden"); | |
link.setAttribute("target", "_blank"); | |
DOCUMENT.body.appendChild(link); | |
link.click(); | |
setTimeout(function(){link.parentNode.removeChild(link);}, 10); | |
})(encodeURIComponent, document); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment