modernish js

This commit is contained in:
Shish 2020-03-02 09:33:56 +00:00
parent e50ff27510
commit 3844595bd1

View File

@ -6,7 +6,7 @@ $(document).ready(function() {
$.fn.highlight = function (fadeOut) { $.fn.highlight = function (fadeOut) {
fadeOut = typeof fadeOut !== 'undefined' ? fadeOut : 5000; fadeOut = typeof fadeOut !== 'undefined' ? fadeOut : 5000;
$(this).each(function () { $(this).each(function () {
var el = $(this); let el = $(this);
$("<div/>") $("<div/>")
.width(el.outerWidth()) .width(el.outerWidth())
.height(el.outerHeight()) .height(el.outerHeight())
@ -33,27 +33,26 @@ $(document).ready(function() {
$("table.sortable").tablesorter(); $("table.sortable").tablesorter();
/** Setup sidebar toggle **/ /** Setup sidebar toggle **/
let sidebar_hidden = [];
try { try {
var sidebar_hidden = (Cookies.get("ui-sidebar-hidden") || "").split("|"); sidebar_hidden = (Cookies.get("ui-sidebar-hidden") || "").split("|");
for(var i in sidebar_hidden) { for (let i=0; i<sidebar_hidden.length; i++) {
if(sidebar_hidden.hasOwnProperty(i) && sidebar_hidden[i].length > 0) { if(sidebar_hidden[i].length > 0) {
$(sidebar_hidden[i]+" .blockbody").hide(); $(sidebar_hidden[i]+" .blockbody").hide();
} }
} }
} }
catch(err) { catch(err) {}
var sidebar_hidden = [];
}
$(".shm-toggler").each(function(idx, elm) { $(".shm-toggler").each(function(idx, elm) {
var tid = $(elm).data("toggle-sel"); let tid = $(elm).data("toggle-sel");
var tob = $(tid+" .blockbody"); let tob = $(tid+" .blockbody");
$(elm).click(function(e) { $(elm).click(function(e) {
tob.slideToggle("slow"); tob.slideToggle("slow");
if(sidebar_hidden.indexOf(tid) === -1) { if(sidebar_hidden.indexOf(tid) === -1) {
sidebar_hidden.push(tid); sidebar_hidden.push(tid);
} }
else { else {
for (var i in sidebar_hidden) { for (let i=0; i<sidebar_hidden.length; i++) {
if (sidebar_hidden[i] === tid) { if (sidebar_hidden[i] === tid) {
sidebar_hidden.splice(i, 1); sidebar_hidden.splice(i, 1);
} }
@ -65,8 +64,8 @@ $(document).ready(function() {
/** setup unlocker buttons **/ /** setup unlocker buttons **/
$(".shm-unlocker").each(function(idx, elm) { $(".shm-unlocker").each(function(idx, elm) {
var tid = $(elm).data("unlock-sel"); let tid = $(elm).data("unlock-sel");
var tob = $(tid); let tob = $(tid);
$(elm).click(function(e) { $(elm).click(function(e) {
$(elm).attr("disabled", true); $(elm).attr("disabled", true);
tob.attr("disabled", false); tob.attr("disabled", false);