Čára (pointer) jako atribut opravy místo grepování "opid-pointer"

This commit is contained in:
Jonas Havelka 2025-01-21 08:17:12 +01:00
parent 370dd7d841
commit d5c57da921

View file

@ -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');
}