summaryrefslogtreecommitdiff
path: root/js/common.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-18 22:05:06 +0300
committerAndrew Dolgov <[email protected]>2021-02-18 22:05:06 +0300
commitf77c17c6f00d37ac535f065589335e801824641b (patch)
tree69732c9eec70c6dd03ce7727a7d365c6645b23b3 /js/common.js
parent70fa4230268a422d0b7eef1ea223ca5cc1c14646 (diff)
add Element toggleClassName
Diffstat (limited to 'js/common.js')
-rwxr-xr-xjs/common.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/common.js b/js/common.js
index 982bb94a7..95eaa3e36 100755
--- a/js/common.js
+++ b/js/common.js
@@ -15,6 +15,14 @@ Element.prototype.removeClassName = function(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) {
Object.keys(args).forEach((k) => {
this.style[k] = args[k];