From: Mart Lubbers Date: Mon, 19 May 2014 14:46:14 +0000 (+0200) Subject: old remove X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=6fe19c7d4cabfdbaea0beffaa627c1a7945e2908;p=bsc-thesis1415.git old remove --- 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()); - }); -} - -