Mercurial > eldonilo > blog
changeset 2:eb5b6d3ab09b
Better import of ns and jid; fix email and missing ns.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 13 Jul 2011 13:11:54 +0200 |
parents | 82905edac9d8 |
children | 2e2a2154efbb |
files | atom.js jid.js ns.js server.js theme.css xml2json.js |
diffstat | 6 files changed, 12 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/atom.js +++ b/atom.js @@ -66,7 +66,7 @@ parsers[ns.atom] = function(id, xml) { if (atomEmail) { footer.appendChild(document.createTextNode(' (')); var a = document.createElementNS(ns.xhtml, 'a'); - a.href = atomEmail; + a.href = 'mailto:' + atomEmail; a.appendChild(document.createTextNode('email')); footer.appendChild(a); footer.appendChild(document.createTextNode(')'));
--- a/jid.js +++ b/jid.js @@ -101,5 +101,5 @@ var JID = function(jid) { this.full = jid; }; -if (typeof exports === 'object') - exports.JID = JID; +if (module) + module.exports = JID;
--- a/ns.js +++ b/ns.js @@ -12,5 +12,5 @@ var ns = { var parsers = {}; -if (typeof exports === 'object') - exports.ns = ns; +if (module) + module.exports = ns;
--- a/server.js +++ b/server.js @@ -9,8 +9,8 @@ var http = require('http'); var fs = require('fs'); var xmpp = require('node-xmpp'); var Element = xmpp.Element; -var JID = require('./jid').JID; -var ns = require('./ns').ns; +var JID = require('./jid'); +var ns = require('./ns'); var forms = require('./forms'); require('./date'); @@ -133,7 +133,7 @@ cl.on('stanza', function(stanza) { if (payload) return handlePubSub(payload, stanza.attrs.from); - } else if (stanza.is('message')) { + } else if (stanza.is('message', ns.j)) { var type = stanza.attrs.type; if (type === 'error') return; @@ -177,7 +177,7 @@ var parseAtom = function(atom, id, jid) try { var email = author.getChild('email', ns.atom).getText(); - footer.t(', (').c('a', {href: email}).t('email').up().t(')'); + footer.t(' (').c('a', {href: 'mailto:' + email}).t('email').up().t(')'); } catch (e) { } footer.up(); } @@ -242,7 +242,7 @@ var makePage = function(res, jid, form, body = article + 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); };