Skip to content

Instantly share code, notes, and snippets.

@taizooo
Created March 1, 2011 05:42
Show Gist options
  • Save taizooo/848680 to your computer and use it in GitHub Desktop.
Save taizooo/848680 to your computer and use it in GitHub Desktop.
CopyTitleAndURL();
function CopyTitleAndURL(){
const EOL = "\r\n";
var unescapeHTML = function(s){
s = s.replace(/\&/g, "&");
s = s.replace(/</g, "&lt;");
s = s.replace(/>/g, "&gt;");
s = s.replace(/"/g, "&quot;");
// s = s.replace(/\'/g, "&#39");
// s = s.replace(/\\/g, "&#92");
return s;
}
var docTitle = window.content.document.title;
var docURL = window.content.document.location.href;
var docQuote = unescapeHTML(document.getSelection());
_jsaCScript.setClipBoardString(
docURL + EOL +
EOL +
'<blockquote>' + EOL +
docQuote +
EOL +
'</blockquote>'
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment