Skip to content

Instantly share code, notes, and snippets.

@peicheng
Created January 15, 2015 02:48
Show Gist options
  • Save peicheng/41afe17ec741d7749590 to your computer and use it in GitHub Desktop.
Save peicheng/41afe17ec741d7749590 to your computer and use it in GitHub Desktop.
Bookmarklet:post to plurk
javascript: (function () {
title = '';
setitle = '';
if (window.getSelection) setitle = window.getSelection();
if (document.getSelection) setitle = document.getSelection();
if (document.selection) setitle = document.selection.createRange().text;
str = '';
str = title.toString();
if (str.length == 0) title = document.title;
url = '';
url = location.href;
totallength = str.length + url.length;
strsetitle=setitle.toString();
if (strsetitle.length > 0) {
w = open('http://www.plurk.com/?qualifier=says&status=' + encodeURIComponent(title) + encodeURIComponent('\n') + encodeURIComponent(url) +encodeURIComponent('\n"') + encodeURIComponent(setitle) + '"');
} else {
w = open('http://www.plurk.com/?qualifier=says&status=' + encodeURIComponent(title) + encodeURIComponent('\n') + encodeURIComponent(url) + '');
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment