summaryrefslogtreecommitdiff
path: root/web/share/js/tools.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/share/js/tools.js')
-rw-r--r--web/share/js/tools.js18
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();
};
};