diff --git a/public/css/style.less b/public/css/style.less index 81c55db407..2cdcb896ca 100644 --- a/public/css/style.less +++ b/public/css/style.less @@ -169,12 +169,14 @@ footer.footer { margin-top: 15px; border-radius: 0 0 5px 5px; font-size: 10px; + line-height: 18px; padding: 5px; padding-left: 10px; } .post-content { min-height: 50px; padding: 2px 5px 0 5px; + word-wrap: break-word; } .post-block { diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index e61aa5264e..36f4e233e8 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -26,7 +26,6 @@ var ajaxify = {}; socket.emit('event:enter_room', 'global'); current_room = 'global'; } - var url = url.replace(/\/$/, ""); var tpl_url = (url === '' || url === '/') ? 'home' : url.split('/')[0]; diff --git a/public/src/templates.js b/public/src/templates.js index 7fe0734437..e476f429ca 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -7,7 +7,15 @@ var templates = {}; //quick implementation because introducing a lib to handle several async callbacks if (callback == null && ready_callback) ready_callback(); else ready_callback = callback; - } + }; + + templates.prepare = function(raw_tpl, data) { + var template = {}; + template.html = raw_tpl; + template.parse = parse; + template.blocks = {}; + return template; + }; function loadTemplates(templatesToLoad) { var timestamp = new Date().getTime(); @@ -24,9 +32,10 @@ var templates = {}; template.prototype.parse = parse; template.prototype.html = String(html); - - templates[file] = new template; + template.prototype.blocks = {}; + templates[file] = new template; + loaded--; if (loaded == 0) templates.ready(); }).fail(function() { @@ -49,6 +58,8 @@ var templates = {}; //modified from https://github.com/psychobunny/dcp.templates var parse = function(data) { + var self = this; + function replace(key, value, template) { var searchRegex = new RegExp('{' + key + '}', 'g'); return template.replace(searchRegex, value); @@ -62,6 +73,8 @@ var templates = {}; data = template.match(regex); if (data == null) return; + if (block !== undefined) self.blocks[block] = data[0]; + data = data[0] .replace("", "") .replace("", ""); diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index ba0ada6fe0..11b5d716c0 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -5,22 +5,22 @@ -