Mercurial > eldonilo > blog
comparison server.js @ 1:82905edac9d8
Fix some things.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Tue, 12 Jul 2011 17:47:32 +0200 |
parents | f62b5c395a48 |
children | eb5b6d3ab09b |
comparison
equal
deleted
inserted
replaced
0:f62b5c395a48 | 1:82905edac9d8 |
---|---|
145 if (payload) | 145 if (payload) |
146 return handlePubSub(payload, stanza.attrs.from); | 146 return handlePubSub(payload, stanza.attrs.from); |
147 } | 147 } |
148 }); | 148 }); |
149 | 149 |
150 var parseAtom = function(atom, id) { | 150 var parseAtom = function(atom, id, jid) { |
151 var article = new Element('article', {'e:id': id, 'e:date': '2011-06-02T10:59:39Z'}); | 151 var article = new Element('article', {'e:id': id, 'e:date': '2011-06-02T10:59:39Z'}); |
152 | 152 |
153 var avatar = article.c('aside').c('img') | 153 var avatar = article.c('aside').c('img') |
154 article.up(); | 154 article.up(); |
155 | 155 |
207 continue; | 207 continue; |
208 | 208 |
209 var href = new JID; | 209 var href = new JID; |
210 href.uri = link.attrs.href; | 210 href.uri = link.attrs.href; |
211 | 211 |
212 article.c('a', {href: '?jid=' + href.bare + ';node=' + href.query.node/* + ';comments=' + params.jid + '/' + params.node*/}).t('Comments !'); | 212 article.c('a', {href: '?jid=' + href.bare + ';node=' + href.query.node + ';origjid=' + jid.bare + ';orignode=' + jid.resource + ';origitem=' + id}).t('Comments !'); |
213 break; | 213 break; |
214 } | 214 } |
215 } catch (e) { } | 215 } catch (e) { } |
216 | 216 |
217 return article; | 217 return article; |
227 return; | 227 return; |
228 | 228 |
229 for (var i in s) { | 229 for (var i in s) { |
230 r = s[i]; | 230 r = s[i]; |
231 delete s[i]; | 231 delete s[i]; |
232 makePage(r.res, jid.full, form, data, r.noscript); | 232 makePage(r.res, jid, form, data, r.noscript); |
233 } | 233 } |
234 }; | 234 }; |
235 | 235 |
236 var makePage = function(res, jid, form, data, noscript) { | 236 var makePage = function(res, jid, form, data, noscript) { |
237 var body = '</div>'; | 237 var body = '</div>'; |
238 | 238 |
239 for (var id in data) { | 239 for (var id in data) { |
240 var item = data[id]; | 240 var item = data[id]; |
241 var article = parseAtom(item, id); | 241 var article = parseAtom(item, id, jid); |
242 body = article + body; | 242 body = article + body; |
243 } | 243 } |
244 body = '<div e:jid="' + jid + '">' + body; | 244 body = '<div e:jid="' + jid.full + '">' + body; |
245 | 245 |
246 home(res, form['pubsub#title'], form['pubsub#description'], body, 'Node created the <time>' + form['pubsub#creation_date'] + '</time> by <cite>' + form['pubsub#creator'] + '</cite> with <a href="http://linkmauve.fr/dev/eldonilo/blog">Eldonilo blog</a>.', noscript); | 246 home(res, form['pubsub#title'], form['pubsub#description'], body, 'Node created the <time>' + form['pubsub#creation_date'] + '</time> by <cite>' + form['pubsub#creator'] + '</cite> with <a href="http://linkmauve.fr/dev/eldonilo/blog">Eldonilo blog</a>.', noscript); |
247 }; | 247 }; |
248 | 248 |
249 var servePage = function(url, res) { | 249 var servePage = function(url, res) { |