Compare commits

..

No commits in common. "2c627b3d60b2946c912d4d4379e76f5807e65c07" and "50936e2b504ae702fb11d857ab08c2fdcd723af5" have entirely different histories.

2 changed files with 44 additions and 25 deletions

View file

@ -16,48 +16,67 @@
</div> </div>
<script> <script>
const commform = document.getElementById('commform');
commform._div = document.getElementById('commform-div');
commform._text = document.getElementById('commform-text');
commform._x = document.getElementById('commform-x');
commform._y = document.getElementById('commform-y');
commform._imgID = document.getElementById('commform-img-id');
commform._id = document.getElementById('commform-id');
commform._action = document.getElementById('commform-action');
// ctrl-enter submits form // ctrl-enter submits form
commform._text.addEventListener("keydown", ev => { document.getElementById("commform-text").addEventListener("keydown", ev =>
if (ev.code === "Enter" && ev.ctrlKey) commform.submit(); {
if( (ev.keyCode == 13 || ev.keyCode == 10 ) && ev.ctrlKey ) {
var form = document.getElementById('commform');
if( form ) {
form.submit();
}
}
}); });
//hide comment form //hide comment form
function close_commform() { function close_commform() {
commform._div.style.display = 'none'; var formdiv = document.getElementById('commform-div');
if( formdiv == null ) {
alert("form null");
return true;
}
formdiv.style.display = 'none';
return false; return false;
} }
//fill up comment form and show him //fill up comment form and show him
function show_form(img_id, dx, dy, id, text, action) { function show_form(img_id, dx, dy, id, text, action) {
var form = document.getElementById('commform');
var formdiv = document.getElementById('commform-div');
var textarea = document.getElementById('commform-text');
var inputX = document.getElementById('commform-x');
var inputY = document.getElementById('commform-y');
var inputImgId = document.getElementById('commform-img-id');
var inputId = document.getElementById('commform-id');
var inputAction = document.getElementById('commform-action');
var img = document.getElementById(img_id); var img = document.getElementById(img_id);
if (commform._div.style.display !== 'none' && commform._text.value !== "" && !confirm("Zavřít předchozí okénko přidávání korektury / editace komentáře?")) return 1; if( formdiv == null || textarea == null ) {
alert("form null");
return 1;
}
if (formdiv.style.display !== 'none' && textarea.value !== "" && !confirm("Zavřít předchozí okénko přidávání korektury / editace komentáře?")) return 1;
//form.action = "#" + img_id;
// set hidden values // set hidden values
commform._x.value = dx; inputX.value = dx;
commform._y.value = dy; inputY.value = dy;
commform._imgID.value = img_id; inputImgId.value = img_id;
commform._id.value = id; inputId.value = id;
commform._action.value = action; inputAction.value = action;
commform._text.value = text; textarea.value = text;
//textarea.value = "dxy:"+ dx + "x" + dy + "\n" + 'id:' + img_id;
// show form // show form
commform._div.style.display = 'block'; formdiv.style.display = 'block';
commform._div.style.left = dx; formdiv.style.left = dx;
commform._div.style.top = dy; formdiv.style.top = dy;
img.parentNode.appendChild(commform._div); img.parentNode.appendChild(formdiv);
commform._text.focus(); textarea.focus();
return true; return true;
} }

View file

@ -30,7 +30,7 @@
function zmenStavKorektury(event) { function zmenStavKorektury(event) {
event.preventDefault(); event.preventDefault();
const oprava = event.target.parentElement.parentElement.parentElement.parentElement; oprava = event.target.parentElement.parentElement.parentElement.parentElement;
const data = new FormData(event.target); const data = new FormData(event.target);
data.append("action", event.submitter.value); data.append("action", event.submitter.value);