add Element toggleClassName

This commit is contained in:
Andrew Dolgov 2021-02-18 22:05:06 +03:00
parent 70fa423026
commit f77c17c6f0
2 changed files with 8 additions and 22 deletions

View File

@ -184,27 +184,6 @@ const App = {
if (callback) callback(); if (callback) callback();
} }
}, },
/*enableCsrfSupport: function() {
const _this = this;
Ajax.Base.prototype.initialize = Ajax.Base.prototype.initialize.wrap(
function (callOriginal, options) {
if (_this.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"] = _this.getInitParam("csrf_token");
}
return callOriginal(options);
}
);
}, */
postCurrentWindow: function(target, params) { postCurrentWindow: function(target, params) {
const form = document.createElement("form"); const form = document.createElement("form");
@ -663,7 +642,6 @@ const App = {
this.setLoadingProgress(30); this.setLoadingProgress(30);
this.initHotkeyActions(); this.initHotkeyActions();
//this.enableCsrfSupport();
const params = { const params = {
op: "rpc", op: "rpc",

View File

@ -15,6 +15,14 @@ Element.prototype.removeClassName = function(className) {
dojo.removeClass(this, className); dojo.removeClass(this, className);
}; };
Element.prototype.toggleClassName = function(className) {
if (this.hasClassName(className))
this.removeClassName(className);
else
this.addClassName(className);
};
Element.prototype.setStyle = function(args) { Element.prototype.setStyle = function(args) {
Object.keys(args).forEach((k) => { Object.keys(args).forEach((k) => {
this.style[k] = args[k]; this.style[k] = args[k];