You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2016/09/05 07:01:24 UTC

[2/6] incubator-ponymail git commit: fix up keyboard shortcuts to actually work

fix up keyboard shortcuts to actually work


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/5feeaef7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/5feeaef7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/5feeaef7

Branch: refs/heads/coffee-and-cake
Commit: 5feeaef7e7cf15c0499a586f6160cad551b55942
Parents: 54bc964
Author: Daniel Gruno <hu...@apache.org>
Authored: Mon Sep 5 08:59:39 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Mon Sep 5 08:59:39 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/defaults.coffee           |  4 +++-
 site/js/coffee/keyboard_shortcuts.coffee | 30 +++++++++------------------
 2 files changed, 13 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5feeaef7/site/js/coffee/defaults.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/defaults.coffee b/site/js/coffee/defaults.coffee
index 55d1cbc..79ceedc 100644
--- a/site/js/coffee/defaults.coffee
+++ b/site/js/coffee/defaults.coffee
@@ -28,4 +28,6 @@ ponymail_domain = ""
 ponymail_list_json = {}
 
 ponymail_current_listview = null # Current listview class
-ponymail_email_open = false # Is the user viewing an email right now? (disable scrolling then)
\ No newline at end of file
+ponymail_email_open = [] # Is the user viewing an email right now? (disable scrolling then)
+ponymail_current_email = null # if more than one email is open, this points to the last one opened
+ponymail_stored_email = {} # Hash containing stored JSON objects of email already fetched
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/5feeaef7/site/js/coffee/keyboard_shortcuts.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/keyboard_shortcuts.coffee b/site/js/coffee/keyboard_shortcuts.coffee
index f65f5ef..ca7a0ad 100644
--- a/site/js/coffee/keyboard_shortcuts.coffee
+++ b/site/js/coffee/keyboard_shortcuts.coffee
@@ -25,33 +25,23 @@ dealWithKeyboard = (e) ->
         if (splash and splash.style.display == 'block')
             splash.style.display = "none"
             #saveDraft()
-        else if (location.href.search(/list\.html/) != -1)
+        else if (location.href.search(/list\d?\.html/) != -1)
             ### should only work for the list view ###
             
             ### If datepicker popup is shown, hide it on escape ###
-            tid = (current_thread||"").toString().replace(/@<.+>/, "")
-            thread = get('thread_' + tid) || get('thread_treeview_' + tid)
-
-            ### minimize datepicker if shown ###
             dp = get('datepicker_popup')
             if dp and dp.style.display == "block"
                 dp.show(false)
             
-            else if thread
-                ### Otherwise, collapse a thread ?? ###
-                if (thread.style.display == 'block')
-                    if (prefs.displayMode == 'treeview')
-                        toggleEmails_threaded(current_thread, true)
-                        toggleEmails_treeview(current_thread, true)
-                    else
-                        toggleEmails_threaded(current_thread, true)
-                    
+            else if ponymail_email_open.length > 0
+                ### Close the currently open email? ###
+                if ponymail_current_email
+                    ponymail_current_email.hide()
                 else
-                    ### Close all threads? ###
-                    kiddos = []
-                    traverseThread(document.body, '(thread|helper)_', 'DIV')
-                    for i in kiddos
-                        kiddos[i].style.display = 'none';
+                    ### Close all email ? ###
+                    for email in ponymail_email_open
+                        email.hide()
+
                     
                     
     ### Make sure the below shortcuts don't interfere with normal operations ###
@@ -75,7 +65,7 @@ dealWithKeyboard = (e) ->
             compose(null, ponymail_list, 'new')
         else if e.keyCode == 82
             ### R key: reply ###
-            if (openEmail() && last_opened_email)
+            if (ponymail_current_email && ponymail_email_open.length > 0)
                 compose(last_opened_email, null, 'reply')
         else if e.keyCode == 83
             ### S key: quick search ###