From ac8361e6f6e81e25d3c17e14b973af53a9b93885 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 2 Dec 2018 21:52:50 +0300 Subject: add AppBase as a shared ancestor for main and prefs app objects remove event.observe stuff from startup, unneeded --- js/common.js | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'js/common.js') diff --git a/js/common.js b/js/common.js index 1da3e6d1b..de6d13a78 100755 --- a/js/common.js +++ b/js/common.js @@ -1,28 +1,8 @@ 'use strict' /* global dijit, __ */ -let init_params = {}; let _label_base_index = -1024; let loading_progress = 0; -let notify_hide_timerid = false; - -Ajax.Base.prototype.initialize = Ajax.Base.prototype.initialize.wrap( - function (callOriginal, options) { - - if (getInitParam("csrf_token") != undefined) { - Object.extend(options, options || { }); - - if (Object.isString(options.parameters)) - options.parameters = options.parameters.toQueryParams(); - else if (Object.isHash(options.parameters)) - options.parameters = options.parameters.toObject(); - - options.parameters["csrf_token"] = getInitParam("csrf_token"); - } - - return callOriginal(options); - } -); /* xhr shorthand helpers */ @@ -239,15 +219,15 @@ const Notify = { switch (kind) { case this.KIND_INFO: notify.addClassName("notify_info") - icon = getInitParam("icon_information"); + icon = App.getInitParam("icon_information"); break; case this.KIND_ERROR: notify.addClassName("notify_error"); - icon = getInitParam("icon_alert"); + icon = App.getInitParam("icon_alert"); break; case this.KIND_PROGRESS: notify.addClassName("notify_progress"); - icon = getInitParam("icon_indicator_white") + icon = App.getInitParam("icon_indicator_white") break; } @@ -255,7 +235,7 @@ const Notify = { msgfmt += (" ") - .replace("%s", getInitParam("icon_cross")); + .replace("%s", App.getInitParam("icon_cross")); notify.innerHTML = msgfmt; notify.addClassName("visible"); @@ -289,14 +269,6 @@ function displayIfChecked(checkbox, elemId) { } } -function getInitParam(key) { - return init_params[key]; -} - -function setInitParam(key, value) { - init_params[key] = value; -} - function fatalError(code, msg, ext_info) { if (code == 6) { window.location.href = "index.php"; @@ -390,5 +362,5 @@ function popupOpenArticle(id) { "height=900,width=900,resizable=yes,status=no,location=no,menubar=no,directories=no,scrollbars=yes,toolbar=no"); w.opener = null; - w.location = "backend.php?op=article&method=view&mode=raw&html=1&zoom=1&id=" + id + "&csrf_token=" + getInitParam("csrf_token"); + w.location = "backend.php?op=article&method=view&mode=raw&html=1&zoom=1&id=" + id + "&csrf_token=" + App.getInitParam("csrf_token"); } -- cgit v1.2.3