From d5c57da92170a4db180122b444c45c28b004ff7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Tue, 21 Jan 2025 08:17:12 +0100 Subject: [PATCH] =?UTF-8?q?=C4=8C=C3=A1ra=20(pointer)=20jako=20atribut=20o?= =?UTF-8?q?pravy=20m=C3=ADsto=20grepov=C3=A1n=C3=AD=20"opid-pointer"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/static/korektury/opraf.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/korektury/static/korektury/opraf.js b/korektury/static/korektury/opraf.js index c7403393..38449bcd 100644 --- a/korektury/static/korektury/opraf.js +++ b/korektury/static/korektury/opraf.js @@ -44,6 +44,7 @@ function place_comments_one_div(img_id, comments) elp.style.width = w - x + w_skip; elp.style.height = pointer_min_h + delta_y; + el.pointer = elp; el.img_id = img_id; el.style.position = 'absolute'; el.style.left = w + w_skip; @@ -101,8 +102,7 @@ function toggle_visibility(oprava){ // show comment form, when 'comment' button pressed function comment(op) { - var divpointer = document.getElementById(op.id + '-pointer'); - + var divpointer = op.pointer; var dx = parseInt(divpointer.style.left); var dy = parseInt(divpointer.style.top); return show_form(op.img_id, dx, dy, op.dataset.opid, "", "comment"); @@ -111,11 +111,10 @@ function comment(op) // show comment form when 'update-comment' button pressed function update_comment(oid,ktid) { - var divpointer = document.getElementById(oid + '-pointer'); + var divbox = document.getElementById(oid); + var divpointer = divbox.pointer; var dx = parseInt(divpointer.style.left); var dy = parseInt(divpointer.style.top); - - var divbox = document.getElementById(oid); var text = document.getElementById(ktid).textContent; return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment'); @@ -123,14 +122,14 @@ function update_comment(oid,ktid) function box_onmouseover(box) { - var pointer = document.getElementById(box.id + '-pointer'); + var pointer = box.pointer; pointer.classList.remove('pointer'); pointer.classList.add('pointer-hi'); } function box_onmouseout(box) { - var pointer = document.getElementById(box.id + '-pointer'); + var pointer = box.pointer; pointer.classList.remove('pointer-hi'); pointer.classList.add('pointer'); }