aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/assets/js')
-rw-r--r--app/src/main/assets/js/textarea_listener.js27
-rw-r--r--app/src/main/assets/js/textarea_listener.min.js12
2 files changed, 39 insertions, 0 deletions
diff --git a/app/src/main/assets/js/textarea_listener.js b/app/src/main/assets/js/textarea_listener.js
new file mode 100644
index 00000000..e6951411
--- /dev/null
+++ b/app/src/main/assets/js/textarea_listener.js
@@ -0,0 +1,27 @@
+//focus listener for textareas
+//since swipe to refresh is quite sensitive, we will disable it
+//when we detect a user typing
+//note that this extends passed having a keyboard opened,
+//as a user may still be reviewing his/her post
+//swiping should automatically be reset on refresh
+if (!window.hasOwnProperty('frost_textarea_listener')) {
+ console.log('Registering frost_textarea_listener');
+ window.frost_textarea_listener = true;
+
+ var _frostFocus = function(e) {
+ var element = e.target || e.srcElement;
+ console.log('Frost focus', element.tagName);
+ if (element.tagName === 'TEXTAREA')
+ if (typeof Frost !== 'undefined') Frost.disableSwipeRefresh(true);
+ }
+
+ var _frostBlur = function(e) {
+ var element = e.target || e.srcElement;
+ console.log('Frost blur', element.tagName);
+ if (typeof Frost !== 'undefined') Frost.disableSwipeRefresh(false);
+ }
+
+ document.addEventListener('focus', _frostFocus, true);
+ document.addEventListener('blur', _frostBlur, true);
+
+}
diff --git a/app/src/main/assets/js/textarea_listener.min.js b/app/src/main/assets/js/textarea_listener.min.js
new file mode 100644
index 00000000..44ae9ceb
--- /dev/null
+++ b/app/src/main/assets/js/textarea_listener.min.js
@@ -0,0 +1,12 @@
+if(!window.hasOwnProperty("frost_textarea_listener")){
+console.log("Registering frost_textarea_listener"),
+window.frost_textarea_listener=!0
+;var _frostFocus=function(e){
+var t=e.target||e.srcElement
+;console.log("Frost focus",t.tagName),"TEXTAREA"===t.tagName&&"undefined"!=typeof Frost&&Frost.disableSwipeRefresh(!0)
+},_frostBlur=function(e){
+var t=e.target||e.srcElement
+;console.log("Frost blur",t.tagName),"undefined"!=typeof Frost&&Frost.disableSwipeRefresh(!1)
+}
+;document.addEventListener("focus",_frostFocus,!0),document.addEventListener("blur",_frostBlur,!0)
+} \ No newline at end of file