minor fixes

This commit is contained in:
Ville Rantanen
2022-09-23 14:23:36 +03:00
parent c042cdd04d
commit 4602b4aa06
3 changed files with 26 additions and 17 deletions

View File

@@ -50,7 +50,7 @@ function growTextarea(name) {
}
function reload() {
location.href=window.location.href;
location.href=window.location.href;
}
function hidetoggle(name) {
@@ -59,6 +59,12 @@ function hidetoggle(name) {
} else {
document.getElementById(name).style.display='inline-block';
document.getElementById(name).scrollIntoView();
if (name == 'disp_add') {
document.getElementById('add_md').focus();
}
if (name == 'disp_edit') {
document.getElementById('edit_md').focus();
}
}
hideOthers(name);
}
@@ -68,7 +74,7 @@ function hideOthers(name) {
for (var i = 0, n = allElements.length; i < n; ++i) {
var el = allElements[i];
if (el.id) {
if ((el.id.startsWith("disp_")) && (el.id!=name)) {
if ((el.id.startsWith("disp_")) && (el.id!=name)) {
document.getElementById(el.id).style.display='none';
}}
}
@@ -88,16 +94,16 @@ function dropDownHide() {
}
}
}
function get_cookie(name) {
var nameEQ = name+"=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length,c.length); }
}
return null
}
function get_cookie(name) {
var nameEQ = name+"=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length,c.length); }
}
return null
}
function sortMarkdown(boughtOrder=false) {
var divs = document.getElementsByClassName("entry");
@@ -111,7 +117,7 @@ function sortMarkdown(boughtOrder=false) {
parent.innerHTML = "";
for(var i = 0, l = divs.length; i < l; i++) {
parent.appendChild(divs[i]);
}
}
}
function fullStringSorter(a,b) {
var aValue=a.children[1].innerHTML;
@@ -123,14 +129,14 @@ function fullStringSorter(a,b) {
function orderStringSorter(a,b) {
var aValue=a.children[1].innerHTML.substring(0,3);
var bValue=b.children[1].innerHTML.substring(0,3);
if ( aValue == "[x]" && bValue == "[ ]" ) return 1;
if ( aValue == "[ ]" && bValue == "[x]" ) return -1;
if ( aValue == "[x]" && bValue == "[ ]" ) return 1;
if ( aValue == "[ ]" && bValue == "[x]" ) return -1;
return 0;
}
function scrollBack() {
var position=parseInt(get_cookie("position"));
window.scrollTo(0,position);
var position=parseInt(get_cookie("position"));
window.scrollTo(0,position);
}
// Close the dropdown menu if the user clicks outside of it