From 240a1f999a6382a23434db33d18d162e6244f8c6 Mon Sep 17 00:00:00 2001 From: Sebastian Titz Date: Thu, 14 Jul 2022 09:01:28 +0200 Subject: [PATCH] WIP: selText --- selText.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 selText.js diff --git a/selText.js b/selText.js new file mode 100644 index 0000000..0ef8505 --- /dev/null +++ b/selText.js @@ -0,0 +1,13 @@ +$(function(){ + $(document.body).bind('mouseup', function(e){ + var selection; + + if (window.getSelection) { + selection = window.getSelection(); + } else if (document.selection) { + selection = document.selection.createRange(); + } + + selection.toString() !== '' && alert('"' + selection.toString() + '" was selected at ' + e.pageX + '/' + e.pageY); + }); +}); \ No newline at end of file