From 6fe19c7d4cabfdbaea0beffaa627c1a7945e2908 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 19 May 2014 16:46:14 +0200 Subject: [PATCH] old remove --- program/hypfront/sel.js | 53 ----------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 program/hypfront/sel.js diff --git a/program/hypfront/sel.js b/program/hypfront/sel.js deleted file mode 100644 index a63fede..0000000 --- a/program/hypfront/sel.js +++ /dev/null @@ -1,53 +0,0 @@ -function getSelectionHtml() { - var html = ""; - if (typeof window.getSelection != "undefined") { - var sel = window.getSelection(); - if (sel.rangeCount) { - var container = document.createElement("div"); - for (var i = 0, len = sel.rangeCount; i < len; ++i) { - container.appendChild(sel.getRangeAt(i).cloneContents()); - } - html = container.innerHTML; - } - } else if (typeof document.selection != "undefined") { - if (document.selection.type == "Text") { - html = document.selection.createRange().htmlText; - } - } - return html; -} - -function stylizeHighlightedString(col) -{ - var range = window.getSelection().getRangeAt(0); - console.log(range) - var selectionContents = range.extractContents(); - var span = document.createElement("span"); - span.appendChild(selectionContents); - span.setAttribute("class","uiWebviewHighlight"); - span.style.backgroundColor = col; - span.style.color = "white"; - range.insertNode(span); -} - -function f_wanneer() { - stylizeHighlightedString("red") -} - -function f_wat() { - stylizeHighlightedString("green") -} - -function f_waar() { - stylizeHighlightedString("blue") -} - - -window.onload = function() { - var box = document.getElementById('htab'); - box.addEventListener('contextmenu', function(e) { - console.log(getSelectionHtml()); - }); -} - - -- 2.20.1