Mercurial > eldonilo > blog
annotate nothing.js @ 14:03be0717d3f8
Use the same code for client- and server-side Atom parsing.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 03 Nov 2011 16:42:00 -0700 |
parents | 161d4ea1c3f8 |
children |
rev | line source |
---|---|
0 | 1 'use strict'; |
2 | |
13
161d4ea1c3f8
Migration of the client-side to XMPP.js instead of Strophe.js.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
3 parsers[''] = function(item) { |
0 | 4 var toDate = function() { |
5 return new Date(); | |
6 }; | |
7 | |
13
161d4ea1c3f8
Migration of the client-side to XMPP.js instead of Strophe.js.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
8 var toHTML = function(item, date) { |
0 | 9 var article = document.createElementNS(ns.xhtml, 'article'); |
14
03be0717d3f8
Use the same code for client- and server-side Atom parsing.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
13
diff
changeset
|
10 article.setAttributeNS(ns.e, 'id', item.id); |
5
4d7a67349089
Finish the changing of name to Eldonilo.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
0
diff
changeset
|
11 article.setAttributeNS(ns.e, 'date', date.to8601()); |
0 | 12 article.appendChild(document.createElementNS(ns.xhtml, 'h2').appendChild(document.createTextNode('This post is in an unknown namespace.'))); |
13 return article; | |
14 }; | |
15 | |
13
161d4ea1c3f8
Migration of the client-side to XMPP.js instead of Strophe.js.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
16 this.xml = item.payload; |
161d4ea1c3f8
Migration of the client-side to XMPP.js instead of Strophe.js.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
17 this.date = toDate(); |
161d4ea1c3f8
Migration of the client-side to XMPP.js instead of Strophe.js.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
5
diff
changeset
|
18 this.html = toHTML(item, this.date); |
0 | 19 } |