diff options
author | Devaev Maxim <[email protected]> | 2021-07-14 16:26:56 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-07-14 16:26:56 +0300 |
commit | c903f60f85c143cf9234b88e2106f16d0a5fead1 (patch) | |
tree | 64897b64400900430ac542a4c5441d16d07dfbe1 /web/share/js/tools.js | |
parent | 0f3f85ac58af186b44ddde64bdae024f208bc749 (diff) |
save pak settings
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r-- | web/share/js/tools.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/web/share/js/tools.js b/web/share/js/tools.js index 6fcacf45..f61647b3 100644 --- a/web/share/js/tools.js +++ b/web/share/js/tools.js @@ -88,21 +88,27 @@ export var tools = new function() { return (matches ? decodeURIComponent(matches[1]) : ""); }; - this.setOnClick = function(el, callback) { + this.setOnClick = function(el, callback, prevent_default=true) { el.onclick = el.ontouchend = function(event) { - event.preventDefault(); + if (prevent_default) { + event.preventDefault(); + } callback(); }; }; - this.setOnDown = function(el, callback) { + this.setOnDown = function(el, callback, prevent_default=true) { el.onmousedown = el.ontouchstart = function(event) { - event.preventDefault(); + if (prevent_default) { + event.preventDefault(); + } callback(); }; }; - this.setOnUp = function(el, callback) { + this.setOnUp = function(el, callback, prevent_default=true) { el.onmouseup = el.ontouchend = function(event) { - event.preventDefault(); + if (prevent_default) { + event.preventDefault(); + } callback(); }; }; |