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/03 09:18:50 UTC

[1/5] incubator-ponymail git commit: pad months when switching

Repository: incubator-ponymail
Updated Branches:
  refs/heads/coffee-and-cake 743bb187f -> ebb64dc40


pad months when switching


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

Branch: refs/heads/coffee-and-cake
Commit: 40d88324ae67e5d2a2a982af50ba319813fc2f53
Parents: 743bb18
Author: Daniel Gruno <hu...@apache.org>
Authored: Sat Sep 3 11:17:09 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sat Sep 3 11:17:09 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/calendar.coffee | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/40d88324/site/js/coffee/calendar.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/calendar.coffee b/site/js/coffee/calendar.coffee
index 5dc0820..0deb851 100644
--- a/site/js/coffee/calendar.coffee
+++ b/site/js/coffee/calendar.coffee
@@ -112,7 +112,7 @@ toggleMonth = (div) ->
     
     ### Update the list view using the new month ###
     listView({
-        month: m
+        month: year+"-"+parseInt(month).pad(2)
     })
     
     
\ No newline at end of file


[5/5] incubator-ponymail git commit: regen JS

Posted by hu...@apache.org.
regen JS


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

Branch: refs/heads/coffee-and-cake
Commit: ebb64dc4059aa70a82ffb1630ad979813e6c4d7d
Parents: dad2769
Author: Daniel Gruno <hu...@apache.org>
Authored: Sat Sep 3 11:18:35 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sat Sep 3 11:18:35 2016 +0200

----------------------------------------------------------------------
 site/js/ponymail-coffee.js | 94 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 79 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/ebb64dc4/site/js/ponymail-coffee.js
----------------------------------------------------------------------
diff --git a/site/js/ponymail-coffee.js b/site/js/ponymail-coffee.js
index c1706bf..a01ac2d 100644
--- a/site/js/ponymail-coffee.js
+++ b/site/js/ponymail-coffee.js
@@ -1,5 +1,5 @@
 // Generated by CoffeeScript 1.9.3
-var BasicListView, Calendar, HTML, HTTPRequest, calendar_months, cog, dbRead, dbWrite, e, genColors, get, hsl2rgb, isArray, isHash, listView, listviewScaffolding, parseURL, pendingURLStatus, pending_spinner_at, pending_url_operations, pm_snap, pm_storage_available, pm_storage_globvar, ponymail_list, ponymail_lists, ponymail_month, ponymail_query, ponymail_version, renderListView, set, setupAccount, spinCheck, testCoffee, testToggle, toggleMonth, toggleYear, txt;
+var BasicListView, Calendar, HTML, HTTPRequest, calendar_months, cog, dbRead, dbWrite, e, genColors, get, hasRead, hsl2rgb, isArray, isHash, listView, listviewScaffolding, markRead, parseURL, pendingURLStatus, pending_spinner_at, pending_url_operations, pm_snap, pm_storage_available, pm_storage_globvar, ponymail_list, ponymail_lists, ponymail_month, ponymail_query, ponymail_version, readEmail, renderListView, set, setupAccount, spinCheck, testCoffee, testToggle, toggleMonth, toggleYear, txt;
 
 calendar_months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
 
@@ -119,7 +119,7 @@ toggleMonth = function(div) {
 
   /* Update the list view using the new month */
   return listView({
-    month: m
+    month: year + "-" + parseInt(month).pad(2)
   });
 };
 
@@ -509,10 +509,10 @@ pending_url_operations = {};
 pending_spinner_at = 0;
 
 spinCheck = function(div) {
-  var ndiv, now;
-  now = new Date().getTime();
-  if ((now - pending_spinner_at) >= 4000) {
-    pending_spinner_at = now;
+  var ndiv, spnow;
+  spnow = new Date().getTime();
+  if ((spnow - pending_spinner_at) >= 4000) {
+    pending_spinner_at = spnow;
     ndiv = div.cloneNode(true);
     ndiv.addEventListener('animationend', function(e) {
       return spinCheck(ndiv);
@@ -522,15 +522,15 @@ spinCheck = function(div) {
 };
 
 pendingURLStatus = function() {
-  var div, now, pending, time, url;
+  var div, pending, spnow, time, url;
   pending = 0;
-  now = new Date().getTime();
+  spnow = new Date().getTime();
   div = get('loading');
   for (url in pending_url_operations) {
     time = pending_url_operations[url];
 
     /* Is something taking too long?? */
-    if ((now - time) > 1500) {
+    if ((spnow - time) > 1500) {
       pending++;
       if (!div) {
         div = new HTML('div', {
@@ -546,7 +546,7 @@ pendingURLStatus = function() {
           }))), new HTML('br'), "Loading, please wait..."
         ]);
         document.body.inject(div);
-        pending_spinner_at = now;
+        pending_spinner_at = spnow;
         div.addEventListener('animationend', function(e) {
           return spinCheck(div);
         });
@@ -795,7 +795,7 @@ BasicListView = (function() {
   /* scroll: scroll to a position and show N emails/threads */
 
   BasicListView.prototype.scroll = function(rpp, pos) {
-    var avatar, date, date_style, diff, item, j, len, noeml, now, original, people, ref, sender, stats, subject;
+    var avatar, date, date_style, diff, item, j, len, noeml, now, original, people, readStyle, ref, sender, stats, subject, uid;
     this.lastScroll = new Date().getTime();
     now = new Date().getTime() / 1000;
 
@@ -814,18 +814,45 @@ BasicListView = (function() {
         noeml = this.countEmail(item);
 
         /* Render the email in the LV */
+
+        /* First set some data points for later */
+        uid = parseInt(Math.random() * 999999999999).toString(16);
+
+        /* Gravatar */
         avatar = new HTML('img', {
           src: "https://secure.gravatar.com/avatar/" + original.gravatar + ".png?s=24&r=g&d=mm"
         });
-        sender = new HTML('div', {}, original.from.replace(/\s*<.+>/, ""));
+
+        /* Sender, without the <fo...@bar> part - just the name */
+        sender = new HTML('div', {
+          style: {
+            fontWeight: "bold"
+          }
+        }, original.from.replace(/\s*<.+>/, "").replace(/"/g, ''));
+
+        /* readStyle: bold if new email, normal if read before */
+        readStyle = "bold";
+        if (hasRead(item.tid)) {
+          readStyle = "normal";
+        }
+
+        /* Subject, PLUS a bit of the body with a break before */
         subject = new HTML('div', {}, [
-          original.subject, new HTML('br'), new HTML('span', {
+          new HTML('a', {
+            style: {
+              fontWeight: readStyle
+            },
+            href: "thread.html/" + item.tid,
+            onclick: "readEmail(this.parentNode.parentNode); return false;"
+          }, original.subject), new HTML('br'), new HTML('span', {
             style: {
               color: "#999",
               fontSize: "0.7rem"
             }
           }, item.body)
         ]);
+
+        /* replies and authors */
         stats = new HTML('div', {
           "class": "listview_right"
         }, " " + people + " people, " + noeml + " replies");
@@ -839,6 +866,8 @@ BasicListView = (function() {
           "class": "listview_right " + date_style
         }, new Date(item.epoch * 1000).ISOBare());
         item = new HTML('div', {
+          id: uid,
+          data: item.tid,
           "class": "listview_item"
         }, [avatar, sender, subject, date, stats]);
         this.lv.inject(item);
@@ -846,7 +875,7 @@ BasicListView = (function() {
     }
     now = new Date().getTime();
     diff = now - this.lastScroll;
-    return this.lv.inject("Rendered in " + parseInt(diff) + "ms.");
+    return this.lv.inject("Fetched in " + parseInt(this.json.took / 1000) + "ms, rendered in " + parseInt(diff) + "ms.");
   };
 
 
@@ -1031,7 +1060,7 @@ listView = function(hash, reParse) {
   /* Push a new history state using new args */
   newhref = htmlfile + "?" + args;
   if (location.href !== newhref) {
-    window.history.pushState({}, newhref);
+    window.history.pushState({}, null, newhref);
   }
   ref2 = ponymail_list.split("@", 2), list = ref2[0], domain = ref2[1];
 
@@ -1128,6 +1157,41 @@ dbRead = function(key) {
   }
 };
 
+hasRead = function(mid) {
+  if (dbRead("ponymail_read_" + mid)) {
+    return true;
+  } else {
+    return false;
+  }
+};
+
+markRead = function(mid) {
+  dbWrite("ponymail_read_" + mid, new Date().getTime());
+  return true;
+};
+
+readEmail = function(obj) {
+  var insertPoint, mailDiv, mid;
+  mid = null;
+  insertPoint = null;
+
+  /* Did we get this from a div? if so, find out things */
+  if (typeof obj === 'object') {
+    mid = obj.getAttribute("data");
+    insertPoint = obj;
+  } else if (typeof obj === 'string') {
+    mid = obj;
+    insertPoint = new HTML('div');
+    document.body.inject(insertPoint);
+  }
+  if (mid && insertPoint) {
+    markRead(mid);
+    mailDiv = new HTML('div');
+    insertPoint.inject(mailDiv);
+    return mailDiv.inject("foo bar baz!");
+  }
+};
+
 
 /*
  Licensed to the Apache Software Foundation (ASF) under one or more


[4/5] incubator-ponymail git commit: start work on what happens when you click a subject

Posted by hu...@apache.org.
start work on what happens when you click a subject

begin basic email display


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

Branch: refs/heads/coffee-and-cake
Commit: dad276908377ee8d4b51e65d3cd589a8a30c25da
Parents: 7df7aa5
Author: Daniel Gruno <hu...@apache.org>
Authored: Sat Sep 3 11:18:27 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sat Sep 3 11:18:27 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/listview_basic.coffee | 26 ++++++++++++++++++++++----
 site/js/coffee/localstorage.coffee   | 10 ++++++++++
 site/js/coffee/mailview_basic.coffee | 17 +++++++++++++++++
 3 files changed, 49 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/dad27690/site/js/coffee/listview_basic.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview_basic.coffee b/site/js/coffee/listview_basic.coffee
index b0088fe..dd45bcf 100644
--- a/site/js/coffee/listview_basic.coffee
+++ b/site/js/coffee/listview_basic.coffee
@@ -57,13 +57,30 @@ class BasicListView
                 noeml = @countEmail(item)
                 
                 ### Render the email in the LV ###
+                
+                ### First set some data points for later ###
+                uid = parseInt(Math.random() * 999999999999).toString(16)
+                
+                
+                ### Gravatar ###
                 avatar = new HTML('img', { src: "https://secure.gravatar.com/avatar/#{original.gravatar}.png?s=24&r=g&d=mm"})
-                sender = new HTML('div', {}, original.from.replace(/\s*<.+>/, ""))
+                
+                ### Sender, without the <fo...@bar> part - just the name ###
+                sender = new HTML('div', {style: {fontWeight: "bold"}}, original.from.replace(/\s*<.+>/, "").replace(/"/g, ''))
+                
+                ### readStyle: bold if new email, normal if read before ###
+                readStyle = "bold"
+                if hasRead(item.tid)
+                    readStyle = "normal"
+                    
+                ### Subject, PLUS a bit of the body with a break before ###
                 subject = new HTML('div', {}, [
-                    original.subject,
+                    new HTML('a', { style: {fontWeight: readStyle}, href: "thread.html/#{item.tid}", onclick: "readEmail(this.parentNode.parentNode); return false;"}, original.subject),
                     new HTML('br'),
                     new HTML('span', { style: { color: "#999", fontSize: "0.7rem"}}, item.body)
                 ])
+                
+                ### replies and authors ###
                 stats = new HTML('div', {class:"listview_right"}, " #{people} people, #{noeml} replies")
                 
                 ### Add date; yellow if <= 1day, grey otherwise ###
@@ -72,12 +89,13 @@ class BasicListView
                     date_style = "listview_yellow"
                 date = new HTML('div', {class:"listview_right #{date_style}"}, new Date(item.epoch*1000).ISOBare())
                 
-                item = new HTML('div', {class: "listview_item"}, [avatar, sender, subject, date, stats])
+                item = new HTML('div', {id: uid, data: item.tid, class: "listview_item"}, [avatar, sender, subject, date, stats])
+                
                 @lv.inject(item)
         
         now = new Date().getTime()
         diff = now - @lastScroll
-        @lv.inject("Rendered in " + parseInt(diff) + "ms.")
+        @lv.inject("Fetched in " + parseInt(@json.took/1000) + "ms, rendered in " + parseInt(diff) + "ms.")
     ### findEmail: find an email given an ID ###
     findEmail: (id) ->
         for email in @json.emails

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/dad27690/site/js/coffee/localstorage.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/localstorage.coffee b/site/js/coffee/localstorage.coffee
index d4339ab..0fcf25e 100644
--- a/site/js/coffee/localstorage.coffee
+++ b/site/js/coffee/localstorage.coffee
@@ -51,3 +51,13 @@ dbRead = (key) ->
         ### Nope, try global var ###
         return pm_storage_globvar[key]
     
+
+hasRead = (mid) ->
+    if dbRead("ponymail_read_" + mid)
+        return true
+    else
+        return false
+
+markRead = (mid) ->
+    dbWrite("ponymail_read_" + mid, new Date().getTime())
+    return true
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/dad27690/site/js/coffee/mailview_basic.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/mailview_basic.coffee b/site/js/coffee/mailview_basic.coffee
new file mode 100644
index 0000000..42fe98a
--- /dev/null
+++ b/site/js/coffee/mailview_basic.coffee
@@ -0,0 +1,17 @@
+readEmail = (obj) ->
+    mid = null
+    insertPoint = null
+    ### Did we get this from a div? if so, find out things ###
+    if typeof obj is 'object'
+        mid = obj.getAttribute("data")
+        insertPoint = obj
+    else if typeof obj is 'string'
+        mid = obj
+        insertPoint = new HTML('div')
+        document.body.inject(insertPoint)
+    if mid and insertPoint
+        markRead(mid)
+        mailDiv = new HTML('div')
+        insertPoint.inject(mailDiv)
+        mailDiv.inject("foo bar baz!")
+        
\ No newline at end of file


[2/5] incubator-ponymail git commit: CSS updates

Posted by hu...@apache.org.
CSS updates

enlarge spinner a bit, set background and font style for labels


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

Branch: refs/heads/coffee-and-cake
Commit: 1170586bed10aca95d5229e3836e6f7a826f0b2c
Parents: 40d8832
Author: Daniel Gruno <hu...@apache.org>
Authored: Sat Sep 3 11:17:41 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sat Sep 3 11:17:41 2016 +0200

----------------------------------------------------------------------
 site/css/ponymail2.css | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/1170586b/site/css/ponymail2.css
----------------------------------------------------------------------
diff --git a/site/css/ponymail2.css b/site/css/ponymail2.css
index 2a8ec83..5160ef4 100644
--- a/site/css/ponymail2.css
+++ b/site/css/ponymail2.css
@@ -134,6 +134,7 @@ body, html {
     font-family: sans-serif;
     font-size: 14pt;
     width: 100%;
+    margin: 0px;
 }
 
 #calendar {
@@ -147,6 +148,7 @@ body, html {
     font-size: 9pt;
     font-weight: 500;
     margin-left: 20px;
+    margin-top: 20px;
 }
 
 #listview {
@@ -180,8 +182,8 @@ h3, h2, h1 {
     position: fixed;
     top: calc(40% - 90px);
     left: calc(50% - 150px);
-    width: 300px;
-    height: 200px;
+    width: 360px;
+    height: 240px;
     background: #3285BC;
     border-radius: 8px;
     font-size: 9pt;
@@ -190,7 +192,7 @@ h3, h2, h1 {
     font-family: sans-serif;
 }
 .spinwheel {
-    margin: 8px auto;
+    margin: 28px auto;
     border-top: 10px solid rgba(30,190,200,0.95);
     border-right: 10px solid rgba(220, 30, 120, 0.95);
     border-bottom: 10px solid rgba(120, 200, 30, 0.95);
@@ -308,18 +310,23 @@ h3, h2, h1 {
     float: right !important;
     background: #1789D6;
     border-radius: 3px;
-    border: 1px solid #668;
+    border: 1px solid rgba(0,0,0,0.1);
     padding: 2px;
     margin-top: 6px;
     color: #FFF;
-    font-weight: 400;
+    font-weight: 600;
+    font-size: 85%;
     margin-left: 5px;
 }
 
 .listview_yellow {
-    background: #E29E0B;
+    background: #E59019;
 }
 
 .listview_grey {
-    background: #A5A5A5;
+    background: #888;
+}
+
+a {
+    color: #248;
 }
\ No newline at end of file


[3/5] incubator-ponymail git commit: push new state properly

Posted by hu...@apache.org.
push new state properly

misplaced arg, argh!


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

Branch: refs/heads/coffee-and-cake
Commit: 7df7aa5d04f5073f3aa1643e370335085a3b700d
Parents: 1170586
Author: Daniel Gruno <hu...@apache.org>
Authored: Sat Sep 3 11:17:54 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Sat Sep 3 11:17:54 2016 +0200

----------------------------------------------------------------------
 site/js/coffee/listview.coffee | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/7df7aa5d/site/js/coffee/listview.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/listview.coffee b/site/js/coffee/listview.coffee
index 5ace897..45f0a69 100644
--- a/site/js/coffee/listview.coffee
+++ b/site/js/coffee/listview.coffee
@@ -83,7 +83,7 @@ listView = (hash, reParse) ->
     ### Push a new history state using new args ###
     newhref = "#{htmlfile}?#{args}"
     if location.href != newhref
-        window.history.pushState({}, newhref)
+        window.history.pushState({}, null, newhref)
     
     [list, domain] = ponymail_list.split("@", 2)
     ### Request month view from API, send to list view callback ###