summaryrefslogtreecommitdiff
path: root/js/common.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-19 06:40:35 +0300
committerAndrew Dolgov <[email protected]>2021-02-19 06:40:35 +0300
commitd57e7eaa98b8669837d6ccb98d6f7d0d739f52e8 (patch)
tree577aa4a96716bbf925a2386e8a1a38da69ddbe14 /js/common.js
parent5475eed4526c099b0139a896963d5bf94a389a4a (diff)
move stuff in common.js around a bit
Diffstat (limited to 'js/common.js')
-rwxr-xr-xjs/common.js30
1 files changed, 14 insertions, 16 deletions
diff --git a/js/common.js b/js/common.js
index 9275bd09f..1adf5d56e 100755
--- a/js/common.js
+++ b/js/common.js
@@ -27,8 +27,6 @@ Element.prototype.removeClassName = function(className) {
};
Element.prototype.toggleClassName = function(className) {
- console.log(this, className);
-
if (this.hasClassName(className))
return this.removeClassName(className);
else
@@ -97,6 +95,20 @@ Element.hasClassName = function (elem, className) {
return elem.hasClassName(className);
}
+Array.prototype.remove = function(s) {
+ for (let i=0; i < this.length; i++) {
+ if (s == this[i]) this.splice(i, 1);
+ }
+};
+
+Array.prototype.uniq = function() {
+ return this.filter((v, i, a) => a.indexOf(v) === i);
+};
+
+String.prototype.stripTags = function() {
+ return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?(\/)?>|<\/\w+>/gi, '');
+}
+
/* xhr shorthand helpers */
/* exported xhrPost */
@@ -122,20 +134,6 @@ function xhrPost(url, params = {}, complete = undefined) {
});
}
-Array.prototype.remove = function(s) {
- for (let i=0; i < this.length; i++) {
- if (s == this[i]) this.splice(i, 1);
- }
-};
-
-Array.prototype.uniq = function() {
- return this.filter((v, i, a) => a.indexOf(v) === i);
-};
-
-String.prototype.stripTags = function() {
- return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?(\/)?>|<\/\w+>/gi, '');
-}
-
/* exported xhrJson */
function xhrJson(url, params = {}, complete = undefined) {
return new Promise((resolve, reject) =>