aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/js/textarea_listener.coffee
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-12-10 14:25:29 -0500
committerGitHub <noreply@github.com>2017-12-10 14:25:29 -0500
commit1d4380cee77fc049a54d280a27dcefa3fa6ff1fd (patch)
tree6aa222b3f88862a46c8ffd0e46bfb94755d54729 /app/src/main/assets/js/textarea_listener.coffee
parent30eb51a44a271512e27c97aecc02f3a339f572bf (diff)
downloadfrost-1d4380cee77fc049a54d280a27dcefa3fa6ff1fd.tar.gz
frost-1d4380cee77fc049a54d280a27dcefa3fa6ff1fd.tar.bz2
frost-1d4380cee77fc049a54d280a27dcefa3fa6ff1fd.zip
theme (#546)
* Update to coffee and use webstorm * Add chrome as well * Update all * Reinstall android 27
Diffstat (limited to 'app/src/main/assets/js/textarea_listener.coffee')
-rw-r--r--app/src/main/assets/js/textarea_listener.coffee22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/src/main/assets/js/textarea_listener.coffee b/app/src/main/assets/js/textarea_listener.coffee
new file mode 100644
index 00000000..950f663e
--- /dev/null
+++ b/app/src/main/assets/js/textarea_listener.coffee
@@ -0,0 +1,22 @@
+# 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
+
+_frostFocus = (e) ->
+ element = e.target or e.srcElement
+ console.log "Frost focus", element.tagName
+ if element.tagName == "TEXTAREA"
+ Frost?.disableSwipeRefresh true
+ return
+
+_frostBlur = (e) ->
+ element = e.target or e.srcElement
+ console.log "Frost blur", element.tagName
+ Frost?.disableSwipeRefresh false
+ return
+
+document.addEventListener "focus", _frostFocus, true
+document.addEventListener "blur", _frostBlur, true