1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 02:55:55 +00:00

add AppBase as a shared ancestor for main and prefs app objects

remove event.observe stuff from startup, unneeded
This commit is contained in:
Andrew Dolgov
2018-12-02 21:52:50 +03:00
parent eeb49d375c
commit ac8361e6f6
10 changed files with 728 additions and 728 deletions

35
js/AppBase.js Normal file
View File

@@ -0,0 +1,35 @@
'use strict'
/* global __, ngettext */
define(["dojo/_base/declare"], function (declare) {
return declare("fox.AppBase", null, {
_initParams: [],
getInitParam: function(k) {
return this._initParams[k];
},
setInitParam: function(k, v) {
this._initParams[k] = v;
},
constructor: function(args) {
//
},
enableCsrfSupport: function() {
Ajax.Base.prototype.initialize = Ajax.Base.prototype.initialize.wrap(
function (callOriginal, options) {
if (App.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"] = App.getInitParam("csrf_token");
}
return callOriginal(options);
}
);
}
});
});