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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
1 'use strict';
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
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
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
4 var toDate = function() {
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
5 return new Date();
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
6 };
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
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
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
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
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
12 article.appendChild(document.createElementNS(ns.xhtml, 'h2').appendChild(document.createTextNode('This post is in an unknown namespace.')));
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
13 return article;
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
14 };
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
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
f62b5c395a48 Initial commit.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
19 }