Drobný úklid

This commit is contained in:
Jonas Havelka 2025-01-20 18:38:47 +01:00
parent dd86fc1fcb
commit ee69bf4c4f
4 changed files with 9 additions and 39 deletions

View file

@ -22,7 +22,6 @@ function place_comments_one_div(img_id, comments)
} }
}); });
//console.log("w:" + w);
for (c in comments_sorted) { for (c in comments_sorted) {
var id = comments_sorted[c][0]; var id = comments_sorted[c][0];
var x = comments_sorted[c][1]; var x = comments_sorted[c][1];
@ -53,13 +52,8 @@ function place_comments_one_div(img_id, comments)
var bott = el.offsetTop + el.offsetHeight; var bott = el.offsetTop + el.offsetHeight;
bott_max = ( bott_max > bott ) ? bott_max : bott; bott_max = ( bott_max > bott ) ? bott_max : bott;
//console.log( "par.w:" + par.style.width);
} }
if( par.offsetHeight < bott_max ) { if( par.offsetHeight < bott_max ) {
//par.style.height = bott_max;
//alert("preteklo to:"+ par.offsetHeight +",mx:" + bott_max );
par.style.height = bott_max; par.style.height = bott_max;
} }
@ -74,12 +68,9 @@ function place_comments() {
// ctrl-enter submits form // ctrl-enter submits form
function textarea_onkey(ev) function textarea_onkey(ev)
{ {
//console.log("ev:" + ev.keyCode + "," + ev.ctrlKey);
if( (ev.keyCode == 13 || ev.keyCode == 10 ) && ev.ctrlKey ) { if( (ev.keyCode == 13 || ev.keyCode == 10 ) && ev.ctrlKey ) {
var form = document.getElementById('commform'); var form = document.getElementById('commform');
if( form ) { if( form ) {
save_scroll(form);
//form.action ='';
form.submit(); form.submit();
} }
return true; return true;
@ -155,7 +146,7 @@ function box_edit(oid, action)
var text; var text;
if (action == 'update') { if (action == 'update') {
var text_el = document.getElementById(oid + '-text'); var text_el = document.getElementById(oid + '-text');
text = text_el.textContent; // FIXME původně tu bylo innerHTML.unescapeHTML() text = text_el.textContent;
} else { } else {
text = ''; text = '';
@ -164,7 +155,6 @@ function box_edit(oid, action)
var dx = parseInt(divpointer.style.left); var dx = parseInt(divpointer.style.left);
var dy = parseInt(divpointer.style.top); var dy = parseInt(divpointer.style.top);
var divbox = document.getElementById(oid); var divbox = document.getElementById(oid);
//alert('not yet 2:' + text + text_el); // + divpointer.style.top "x" + divpo );
id = oid.substring(2); id = oid.substring(2);
return show_form(divbox.img_id, dx, dy, id, text, action); return show_form(divbox.img_id, dx, dy, id, text, action);
} }
@ -177,7 +167,7 @@ function update_comment(oid,ktid)
var dy = parseInt(divpointer.style.top); var dy = parseInt(divpointer.style.top);
var divbox = document.getElementById(oid); var divbox = document.getElementById(oid);
var text = document.getElementById(ktid).textContent; // FIXME původně tu bylo innerHTML.unescapeHTML() var text = document.getElementById(ktid).textContent;
return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment'); return show_form(divbox.img_id, dx, dy, ktid.substring(2), text, 'update-comment');
} }
@ -225,7 +215,6 @@ function show_form(img_id, dx, dy, id, text, action) {
function box_onmouseover(box) function box_onmouseover(box)
{ {
var id = box.id;
var pointer = document.getElementById(box.id + '-pointer'); var pointer = document.getElementById(box.id + '-pointer');
pointer.classList.remove('pointer'); pointer.classList.remove('pointer');
pointer.classList.add('pointer-hi'); pointer.classList.add('pointer-hi');
@ -233,20 +222,11 @@ function box_onmouseover(box)
function box_onmouseout(box) function box_onmouseout(box)
{ {
var id = box.id;
var pointer = document.getElementById(box.id + '-pointer'); var pointer = document.getElementById(box.id + '-pointer');
pointer.classList.remove('pointer-hi'); pointer.classList.remove('pointer-hi');
pointer.classList.add('pointer'); pointer.classList.add('pointer');
} }
function save_scroll(form)
{
//alert('save_scroll:' + document.body.scrollTop);
form.scroll.value = document.body.scrollTop;
//alert('save_scroll:' + form.scroll.value);
return true;
}
function toggle_corrections(aclass) function toggle_corrections(aclass)
{ {
var stylesheets = document.styleSheets; var stylesheets = document.styleSheets;
@ -274,13 +254,3 @@ function toggle_corrections(aclass)
} }
String.prototype.unescapeHTML = function () {
return(
this.replace(/&amp;/g,'&').
replace(/&gt;/g,'>').
replace(/&lt;/g,'<').
replace(/&quot;/g,'"')
);
};

View file

@ -1,5 +1,5 @@
<div id="commform-div"> <div id="commform-div">
<form action='' onsubmit='save_scroll(this)' id="commform" method="POST"> <form action='' id="commform" method="POST">
{% csrf_token %} {% csrf_token %}
<input size="24" name="au" value="{{user.first_name}} {{user.last_name}}" readonly/> <input size="24" name="au" value="{{user.first_name}} {{user.last_name}}" readonly/>
<input type=submit value="Oprav!"/> <input type=submit value="Oprav!"/>

View file

@ -5,7 +5,7 @@
<div class='author'>{{k.autor}}</div> <div class='author'>{{k.autor}}</div>
<div class="float-right"> <div class="float-right">
<!-- Komentar !--> <!-- Komentar !-->
<form action='' onsubmit='save_scroll(this)' method='POST'> <form action='' method='POST'>
{% csrf_token %} {% csrf_token %}
<input type='hidden' name='id' value='{{k.id}}'> <input type='hidden' name='id' value='{{k.id}}'>
<input type='hidden' name='scroll'> <input type='hidden' name='scroll'>

View file

@ -19,7 +19,7 @@
<div class='corr-header'> <div class='corr-header'>
<span class='float-right'> <span class='float-right'>
<span id='op{{o.id}}-buttons'> <span id='op{{o.id}}-buttons'>
<form action='' onsubmit='save_scroll(this)' method='POST'> <form action='' method='POST'>
{% csrf_token %} {% csrf_token %}
<input type='hidden' name='id' value='{{o.id}}'> <input type='hidden' name='id' value='{{o.id}}'>
<input type='hidden' name='scroll'> <input type='hidden' name='scroll'>