Skip to content

Instantly share code, notes, and snippets.

@johnmurch
Last active August 29, 2015 14:20
Show Gist options
  • Save johnmurch/200e7d937854ea145af1 to your computer and use it in GitHub Desktop.
Save johnmurch/200e7d937854ea145af1 to your computer and use it in GitHub Desktop.
Capture Highlighted Text
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
<div>Sample Title</div>
<pre>
Bacon ipsum dolor amet tenderloin ham hock pastrami turkey. Meatloaf ham hock pancetta pork loin. Hamburger ground round pork loin, short ribs prosciutto strip steak shank andouille. Beef bacon frankfurter cow pork pork chop shankle. Biltong short ribs cupim tongue, alcatra sirloin picanha leberkas cow hamburger. Short loin landjaeger bresaola corned beef picanha pancetta ham fatback beef ribs pork capicola pork belly sausage kevin pastrami.
Beef ribs turkey hamburger, andouille jowl leberkas shank salami pancetta cow capicola shankle chicken. Tongue beef landjaeger, pork corned beef bresaola leberkas strip steak swine shankle meatloaf porchetta kevin kielbasa. Alcatra cow pork pancetta, biltong pork belly prosciutto andouille turkey tongue tri-tip tail venison hamburger pork loin. Rump strip steak turkey spare ribs sausage venison.
Prosciutto alcatra pork loin, cow hamburger tongue beef ribs meatball venison andouille shoulder chicken boudin. Prosciutto ham hock short ribs tongue, filet mignon ham rump. Rump short loin kielbasa cow ground round beef ribs boudin shank salami kevin jerky turducken. Kielbasa pig chuck pancetta fatback tenderloin andouille venison spare ribs shankle bresaola tail. Hamburger shankle cow, sausage venison boudin shank biltong jerky shoulder kielbasa turducken meatball. Leberkas bresaola tri-tip, prosciutto tail biltong frankfurter capicola ham hock drumstick fatback shankle pork loin. Tail chuck biltong pork loin hamburger spare ribs capicola.
Chuck shank pork loin tri-tip, pork kielbasa turducken chicken jowl pancetta. Flank boudin biltong prosciutto. Jowl pastrami strip steak hamburger turkey tail pork belly kevin cow. Pig tenderloin venison, pastrami swine ball tip drumstick tongue kevin tri-tip kielbasa brisket shankle. Tri-tip filet mignon short loin beef boudin.
Tongue tri-tip short loin, meatball fatback kevin drumstick bresaola. Ribeye flank capicola shank tail turkey. Meatloaf kevin meatball swine, strip steak fatback turkey short loin filet mignon pastrami turducken ground round pork chop. Sausage meatloaf strip steak shoulder, filet mignon shank prosciutto alcatra spare ribs chuck rump ham. Swine ball tip boudin ham short loin ribeye sirloin strip steak picanha. Pork beef corned beef boudin prosciutto ball tip pastrami tongue chicken bresaola.
</pre>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
function getSelectionText() {
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
}
return text;
}
$(document).ready(function (){
$('div,pre').mouseup(function (e){
if(getSelectionText().trim()!=""){
alert(getSelectionText());
}
})
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment