From 81781b63080a4ca90c1f9c610388c31c1bb40ea3 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Mon, 12 May 2014 15:18:07 +0200 Subject: [PATCH] newe stuff --- log/2014-05-08.txt | 13 ++++++ program/hypfront/contextmenu_o.js | 76 +++++++++++++++++++++++++++++++ program/hypfront/hyper.py | 17 +++++++ program/hypfront/sel.js | 3 +- 4 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 log/2014-05-08.txt create mode 100644 program/hypfront/contextmenu_o.js diff --git a/log/2014-05-08.txt b/log/2014-05-08.txt new file mode 100644 index 0000000..daff09f --- /dev/null +++ b/log/2014-05-08.txt @@ -0,0 +1,13 @@ +TIME: + +alternatieve zalen/locaties. xforms input scherm, organisatie, eindtijd +duur, hoofdact, support. +volgende week frontend af. +tijd apart van de datum + +suspect woorden: verplaatst, afgelast, uitverkocht, sold out + highlighten van woorden en in een lijst plaatsen evt + +evt. aanpassene organisatorische zaken zoals terminologie + +skype de week na volgende week. diff --git a/program/hypfront/contextmenu_o.js b/program/hypfront/contextmenu_o.js new file mode 100644 index 0000000..568cce4 --- /dev/null +++ b/program/hypfront/contextmenu_o.js @@ -0,0 +1,76 @@ +var mouse_x = 0; +var mouse_y = 0; +var mouse_left = false; +var mouse_right = false; +if (document.addEventListener != undefined) document.addEventListener('mousemove', mouseMove, true); +else if (document.layers) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP); +document.onmousemove = mouseMove; +document.oncontextmenu = RightMouseDown; +document.onmousedown = mouseDown; +document.onmouseup = mouseUp; + +function mouseMove(a) { + mouse_x = document.all ? event.clientX + document.body.scrollLeft : document.layers ? a.x + window.pageXOffset : a.clientX + window.pageXOffset; + mouse_y = document.all ? event.clientY + document.body.scrollTop : document.layers ? a.y + window.pageYOffset : a.clientY + window.pageYOffset +} + +function RightMouseDown() { + mouse_right = true; + return false +} + +function init(a, w) { + var b = document.createElement("DIV"); + b.id = "contextmenu"; + if (!w) var w = 120; + b.style.width = w + "px"; + var c = '
'; + c += a; + c += '
'; + b.innerHTML = c; + b.style.position = "absolute"; + b.style.left = "0px"; + b.style.top = "0px"; + b.style.visibility = "hidden"; + b.style.overflow = "hidden"; + b.style.padding = "4px"; + b.style.backgroundColor = "#ffffff"; + b.style.border = "1px solid #6a6868"; + document.body.appendChild(b); + delete b +} + +function mouseUp(e) { + selection = getSelectionHtml() + if (e.which == 1) document.getElementById("contextmenu").style.visibility = "hidden"; + else if (e.which == 3) mouse_right = false +} + +function mouseDown(e) { + if (e.which == 3) { + mouse_right = true; + document.getElementById("contextmenu").style.left = mouse_x + "px"; + document.getElementById("contextmenu").style.top = mouse_y + "px"; + document.getElementById("contextmenu").style.visibility = "visible" + console.log(selection) + } +} + +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; +} diff --git a/program/hypfront/hyper.py b/program/hypfront/hyper.py index 1ab4d8e..edf4786 100644 --- a/program/hypfront/hyper.py +++ b/program/hypfront/hyper.py @@ -17,12 +17,29 @@ def req_pre(req): HyperFrontend RSS feed input + Selecteer iets en klik de link
+ + +
+ """) diff --git a/program/hypfront/sel.js b/program/hypfront/sel.js index 416c23e..a63fede 100644 --- a/program/hypfront/sel.js +++ b/program/hypfront/sel.js @@ -20,6 +20,7 @@ function getSelectionHtml() { function stylizeHighlightedString(col) { var range = window.getSelection().getRangeAt(0); + console.log(range) var selectionContents = range.extractContents(); var span = document.createElement("span"); span.appendChild(selectionContents); @@ -33,7 +34,7 @@ function f_wanneer() { stylizeHighlightedString("red") } -function f_wie() { +function f_wat() { stylizeHighlightedString("green") } -- 2.20.1