From eaaf623e6f51f34d872c3e811e9276d9dcdb71fd Mon Sep 17 00:00:00 2001 From: Azareal Date: Mon, 29 Apr 2019 08:27:58 +1000 Subject: [PATCH] pushNotice should work properly in Cosora now. --- themes/cosora/public/misc.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/themes/cosora/public/misc.js b/themes/cosora/public/misc.js index 6415d017..1f3b9510 100644 --- a/themes/cosora/public/misc.js +++ b/themes/cosora/public/misc.js @@ -1,9 +1,20 @@ "use strict"; (() => { - console.log("bf") + function moveAlerts() { + // Move the alerts under the first header + let colSel = $(".colstack_right .colstack_head:first"); + let colSelAlt = $(".colstack_right .colstack_item:first"); + let colSelAltAlt = $(".colstack_right .coldyn_block:first"); + if(colSel.length > 0) $('.alert').insertAfter(colSel); + else if (colSelAlt.length > 0) $('.alert').insertBefore(colSelAlt); + else if (colSelAltAlt.length > 0) $('.alert').insertBefore(colSelAltAlt); + else $('.alert').insertAfter(".rowhead:first"); + } + + //console.log("bf") addInitHook("end_init", () => { - console.log("af") + //console.log("af") let loggedIn = document.head.querySelector("[property='x-loggedin']").content; if(loggedIn) { if(navigator.userAgent.indexOf("Firefox") != -1) $.trumbowyg.svgPath = "/static/trumbowyg/ui/icons.svg"; @@ -103,15 +114,10 @@ document.getElementById("back").appendChild(buttonPane); }); - // Move the alerts under the first header - let colSel = $(".colstack_right .colstack_head:first"); - let colSelAlt = $(".colstack_right .colstack_item:first"); - let colSelAltAlt = $(".colstack_right .coldyn_block:first"); - if(colSel.length > 0) $('.alert').insertAfter(colSel); - else if (colSelAlt.length > 0) $('.alert').insertBefore(colSelAlt); - else if (colSelAltAlt.length > 0) $('.alert').insertBefore(colSelAltAlt); - else $('.alert').insertAfter(".rowhead:first"); + moveAlerts(); }); + + addInitHook("after_notice", moveAlerts); })(); function newElement(etype, eclass) {