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/02 11:19:38 UTC
[1/7] incubator-ponymail git commit: add hash detector
Repository: incubator-ponymail
Updated Branches:
refs/heads/coffee-and-cake f2cdcb474 -> e3d0fc756
add hash detector
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/58a1dbd2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/58a1dbd2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/58a1dbd2
Branch: refs/heads/coffee-and-cake
Commit: 58a1dbd207d6c696e58a290c9226a925d1f35ce0
Parents: f2cdcb4
Author: Daniel Gruno <hu...@apache.org>
Authored: Fri Sep 2 12:55:12 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Fri Sep 2 12:55:12 2016 +0200
----------------------------------------------------------------------
site/js/coffee/misc.coffee | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/58a1dbd2/site/js/coffee/misc.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/misc.coffee b/site/js/coffee/misc.coffee
index 8a6e5af..89c2fa5 100644
--- a/site/js/coffee/misc.coffee
+++ b/site/js/coffee/misc.coffee
@@ -42,10 +42,16 @@ Number.prototype.pad = (n) ->
### isArray: function to detect if an object is an array ###
-isArray = ( value ) ->
+isArray = (value) ->
value and
typeof value is 'object' and
value instanceof Array and
typeof value.length is 'number' and
typeof value.splice is 'function' and
not ( value.propertyIsEnumerable 'length' )
+
+### isHash: function to detect if an object is a hash ###
+isHash = (value) ->
+ value and
+ typeof value is 'object' and
+ not isArray(value)
[6/7] incubator-ponymail git commit: convert to textNode if string
Posted by hu...@apache.org.
convert to textNode if string
might as well have this here as well, speeds up things.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/bdbf65e7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/bdbf65e7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/bdbf65e7
Branch: refs/heads/coffee-and-cake
Commit: bdbf65e783f6ce19b9353d978d457f19e32c7dba
Parents: 874179e
Author: Daniel Gruno <hu...@apache.org>
Authored: Fri Sep 2 13:18:48 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Fri Sep 2 13:18:48 2016 +0200
----------------------------------------------------------------------
site/js/coffee/dom_utils.coffee | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/bdbf65e7/site/js/coffee/dom_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/dom_utils.coffee b/site/js/coffee/dom_utils.coffee
index fe10125..9ca7fed 100644
--- a/site/js/coffee/dom_utils.coffee
+++ b/site/js/coffee/dom_utils.coffee
@@ -108,8 +108,14 @@ get = (a) ->
HTMLElement.prototype.inject = (child) ->
if isArray(child)
for item in child
+ # Convert to textNode if string
+ if typeof item is 'string'
+ item = txt(item)
this.appendChild(item)
else
+ # Convert to textNode if string
+ if typeof child is 'string'
+ child = txt(child)
this.appendChild(child)
return child
[4/7] incubator-ponymail git commit: linting
Posted by hu...@apache.org.
linting
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/81aa2820
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/81aa2820
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/81aa2820
Branch: refs/heads/coffee-and-cake
Commit: 81aa28205bf0af126e415432cb9bb82a9a4b6b52
Parents: 435a392
Author: Daniel Gruno <hu...@apache.org>
Authored: Fri Sep 2 12:59:19 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Fri Sep 2 12:59:19 2016 +0200
----------------------------------------------------------------------
site/js/coffee/dom_utils.coffee | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/81aa2820/site/js/coffee/dom_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/dom_utils.coffee b/site/js/coffee/dom_utils.coffee
index f594ffb..8397eaa 100644
--- a/site/js/coffee/dom_utils.coffee
+++ b/site/js/coffee/dom_utils.coffee
@@ -104,16 +104,20 @@ get = (a) ->
### Cog: Loading panel for when waiting for a response ###
cog = (div, size = 200) ->
- idiv = mk('div', { class: "icon", style: {
- texAlign: 'center',
- verticalAlign: 'middle',
- height: '500px'
+ idiv = mk('div', {
+ class: "icon",
+ style: {
+ texAlign: 'center',
+ verticalAlign: 'middle',
+ height: '500px'
}
})
- i = mk('i', { class: 'fa fa-spin fa-cog', style: {
- fontSize: size+'pt !important',
- color: '#AAB'
+ i = mk('i', {
+ class: 'fa fa-spin fa-cog',
+ style: {
+ fontSize: size + 'pt !important',
+ color: '#AAB'
}
})
app(idiv, [i, mk('br'), "Loading data, please wait..."])
[7/7] incubator-ponymail git commit: add a simple DOM test
Posted by hu...@apache.org.
add a simple DOM test
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/e3d0fc75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/e3d0fc75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/e3d0fc75
Branch: refs/heads/coffee-and-cake
Commit: e3d0fc75658ed38ee197e40a110cec840dd4bb54
Parents: bdbf65e
Author: Daniel Gruno <hu...@apache.org>
Authored: Fri Sep 2 13:18:58 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Fri Sep 2 13:18:58 2016 +0200
----------------------------------------------------------------------
site/js/coffee/test.coffee | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/e3d0fc75/site/js/coffee/test.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/test.coffee b/site/js/coffee/test.coffee
new file mode 100644
index 0000000..30a7cb1
--- /dev/null
+++ b/site/js/coffee/test.coffee
@@ -0,0 +1,11 @@
+testCoffee = () ->
+ ### Get main div from HTML ###
+ parent = get('testdiv')
+ # Make a paragraph with some text in it
+ p = mk('p', { onclick: 'testToggle(this);', class: "fooclass", style: { textAlign: 'center'}}, "Text goes here")
+ # Inject paragraph into div
+ parent.inject(p)
+ p.inject(". More text here")
+
+testToggle = (div) ->
+ div.show()
\ No newline at end of file
[3/7] incubator-ponymail git commit: utilize isHash some more
Posted by hu...@apache.org.
utilize isHash some more
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/435a392f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/435a392f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/435a392f
Branch: refs/heads/coffee-and-cake
Commit: 435a392f86aa5fd138dd3d4889b8ad061950bee9
Parents: 271f10f
Author: Daniel Gruno <hu...@apache.org>
Authored: Fri Sep 2 12:58:27 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Fri Sep 2 12:58:27 2016 +0200
----------------------------------------------------------------------
site/js/coffee/dom_utils.coffee | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/435a392f/site/js/coffee/dom_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/dom_utils.coffee b/site/js/coffee/dom_utils.coffee
index c033a14..f594ffb 100644
--- a/site/js/coffee/dom_utils.coffee
+++ b/site/js/coffee/dom_utils.coffee
@@ -32,7 +32,7 @@ mk = (type, params, children) ->
r = document.createElement(type)
### If params have been passed, set them ###
- if params
+ if isHash(params)
for k, v of params
### Standard string value? ###
if typeof v is "string"
@@ -40,7 +40,7 @@ mk = (type, params, children) ->
else if isArray(v)
### Are we passing a list of data to set? concatenate then ###
r.setAttribute(k, v.join(" "))
- else if typeof(v) is "object"
+ else if isHash(v)
### Are we trying to set multiple sub elements, like a style? ###
for x,y of v
r[k][x] = y
[5/7] incubator-ponymail git commit: add HTML element prototypes
Posted by hu...@apache.org.
add HTML element prototypes
add a show/hide toggle and an injection shotcut
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/874179ef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/874179ef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/874179ef
Branch: refs/heads/coffee-and-cake
Commit: 874179efbc32b7ba1a29c881b6d5a9971bd457d1
Parents: 81aa282
Author: Daniel Gruno <hu...@apache.org>
Authored: Fri Sep 2 13:17:02 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Fri Sep 2 13:17:02 2016 +0200
----------------------------------------------------------------------
site/js/coffee/dom_utils.coffee | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/874179ef/site/js/coffee/dom_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/dom_utils.coffee b/site/js/coffee/dom_utils.coffee
index 8397eaa..fe10125 100644
--- a/site/js/coffee/dom_utils.coffee
+++ b/site/js/coffee/dom_utils.coffee
@@ -101,6 +101,36 @@ txt = (a) ->
get = (a) ->
return document.getElementById(a)
+###*
+# prototype injector for HTML elements:
+# Example: mydiv.inject(otherdiv)
+###
+HTMLElement.prototype.inject = (child) ->
+ if isArray(child)
+ for item in child
+ this.appendChild(item)
+ else
+ this.appendChild(child)
+ return child
+
+###*
+# prototype show/hide function for HTML elements:
+# If called with a bool, show if True, hide if False.
+# If no bool, toggle show/hide based on current state.
+###
+HTMLElement.prototype.show = (bool) ->
+ d = 'block'
+ # If no bool is provided, toggle show/hide based on current state
+ if typeof bool is 'undefined'
+ d = if this.style.display == 'none' then 'block' else 'none'
+ else if bool == false
+ # bool set to false, hide stuff
+ d = 'none'
+ else if bool == true
+ # bool set to true, show stuff
+ b = 'block'
+ this.style.display = d
+ return d
### Cog: Loading panel for when waiting for a response ###
cog = (div, size = 200) ->
@@ -120,6 +150,6 @@ cog = (div, size = 200) ->
color: '#AAB'
}
})
- app(idiv, [i, mk('br'), "Loading data, please wait..."])
+ idiv.inject([i, mk('br'), "Loading data, please wait..."])
div.innerHTML = ""
div.appendChild(idiv)
[2/7] incubator-ponymail git commit: detect if form data is a hash or
not
Posted by hu...@apache.org.
detect if form data is a hash or not
if not, just return empty string.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/271f10f1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/271f10f1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/271f10f1
Branch: refs/heads/coffee-and-cake
Commit: 271f10f1fa3823d6b54f37ef585eb73147ae3559
Parents: 58a1dbd
Author: Daniel Gruno <hu...@apache.org>
Authored: Fri Sep 2 12:56:34 2016 +0200
Committer: Daniel Gruno <hu...@apache.org>
Committed: Fri Sep 2 12:56:34 2016 +0200
----------------------------------------------------------------------
site/js/coffee/http_utils.coffee | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/271f10f1/site/js/coffee/http_utils.coffee
----------------------------------------------------------------------
diff --git a/site/js/coffee/http_utils.coffee b/site/js/coffee/http_utils.coffee
index 60d8e13..3194a25 100644
--- a/site/js/coffee/http_utils.coffee
+++ b/site/js/coffee/http_utils.coffee
@@ -76,7 +76,7 @@ class HTTPRequest
@rdata = @formdata(@data)
### If tasked with appending data to the URL, do so ###
- if @getdata
+ if isHash(@getdata)
tmp = @formdata(@getdata)
if tmp.length > 0
### Do we have form data here aleady? if so, append the new ###
@@ -125,11 +125,12 @@ class HTTPRequest
### Standard form data joiner for POST data ###
formdata: (kv) ->
ar = []
- ### For each key/value pair ###
- for k,v of kv
- ### Only append if the value is non-empty ###
- if v and v != ""
- ### URI-Encode value and add to an array ###
- ar.push(k + "=" + encodeURIComponent(v))
+ ### For each key/value pair (assuming this is a hash) ###
+ if isHash(kv)
+ for k,v of kv
+ ### Only append if the value is non-empty ###
+ if v and v != ""
+ ### URI-Encode value and add to an array ###
+ ar.push(k + "=" + encodeURIComponent(v))
### Join the array with ampersands, so we get "foo=bar&foo2=baz" ###
return ar.join("&")