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) {
var id = comments_sorted[c][0];
var x = comments_sorted[c][1];
@ -53,13 +52,8 @@ function place_comments_one_div(img_id, comments)
var bott = el.offsetTop + el.offsetHeight;
bott_max = ( bott_max > bott ) ? bott_max : bott;
//console.log( "par.w:" + par.style.width);
}
if( par.offsetHeight < bott_max ) {
//par.style.height = bott_max;
//alert("preteklo to:"+ par.offsetHeight +",mx:" + bott_max );
par.style.height = bott_max;
}
@ -74,12 +68,9 @@ function place_comments() {
// ctrl-enter submits form
function textarea_onkey(ev)
{
//console.log("ev:" + ev.keyCode + "," + ev.ctrlKey);
if( (ev.keyCode == 13 || ev.keyCode == 10 ) && ev.ctrlKey ) {
var form = document.getElementById('commform');
if( form ) {
save_scroll(form);
//form.action ='';
if( form ) {
form.submit();
}
return true;
@ -155,7 +146,7 @@ function box_edit(oid, action)
var text;
if (action == 'update') {
var text_el = document.getElementById(oid + '-text');
text = text_el.textContent; // FIXME původně tu bylo innerHTML.unescapeHTML()
text = text_el.textContent;
} else {
text = '';
@ -164,7 +155,6 @@ function box_edit(oid, action)
var dx = parseInt(divpointer.style.left);
var dy = parseInt(divpointer.style.top);
var divbox = document.getElementById(oid);
//alert('not yet 2:' + text + text_el); // + divpointer.style.top "x" + divpo );
id = oid.substring(2);
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 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');
}
@ -225,7 +215,6 @@ function show_form(img_id, dx, dy, id, text, action) {
function box_onmouseover(box)
{
var id = box.id;
var pointer = document.getElementById(box.id + '-pointer');
pointer.classList.remove('pointer');
pointer.classList.add('pointer-hi');
@ -233,20 +222,11 @@ function box_onmouseover(box)
function box_onmouseout(box)
{
var id = box.id;
var pointer = document.getElementById(box.id + '-pointer');
pointer.classList.remove('pointer-hi');
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)
{
var stylesheets = document.styleSheets;
@ -271,16 +251,6 @@ function toggle_corrections(aclass)
}
}
place_comments();
}
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">
<form action='' onsubmit='save_scroll(this)' id="commform" method="POST">
<form action='' id="commform" method="POST">
{% csrf_token %}
<input size="24" name="au" value="{{user.first_name}} {{user.last_name}}" readonly/>
<input type=submit value="Oprav!"/>

View file

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

View file

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