diff 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
line wrap: on
line diff
--- a/server.js
+++ b/server.js
@@ -147,7 +147,7 @@ cl.on('stanza', function(stanza) {
 	}
 });
 
-var parseAtom = function(atom, id) {
+var parseAtom = function(atom, id, jid) {
 	var article = new Element('article', {'e:id': id, 'e:date': '2011-06-02T10:59:39Z'});
 
 	var avatar = article.c('aside').c('img')
@@ -209,7 +209,7 @@ var parseAtom = function(atom, id) {
 			var href = new JID;
 			href.uri = link.attrs.href;
 
-			article.c('a', {href: '?jid=' + href.bare + ';node=' + href.query.node/* + ';comments=' + params.jid + '/' + params.node*/}).t('Comments !');
+			article.c('a', {href: '?jid=' + href.bare + ';node=' + href.query.node + ';origjid=' + jid.bare + ';orignode=' + jid.resource + ';origitem=' + id}).t('Comments !');
 			break;
 		}
 	} catch (e) { }
@@ -229,7 +229,7 @@ var generatePage = function(jid) {
 	for (var i in s) {
 		r = s[i];
 		delete s[i];
-		makePage(r.res, jid.full, form, data, r.noscript);
+		makePage(r.res, jid, form, data, r.noscript);
 	}
 };
 
@@ -238,10 +238,10 @@ var makePage = function(res, jid, form, 
 
 	for (var id in data) {
 		var item = data[id];
-		var article = parseAtom(item, id);
+		var article = parseAtom(item, id, jid);
 		body = article + body;
 	}
-	body = '<div e:jid="' + jid + '">' + body;
+	body = '<div e:jid="' + jid.full + '">' + body;
 	
 	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);
 };