diff --git a/couchpotato/core/plugins/log/static/log.js b/couchpotato/core/plugins/log/static/log.js index a08b105b..a7caab6a 100644 --- a/couchpotato/core/plugins/log/static/log.js +++ b/couchpotato/core/plugins/log/static/log.js @@ -27,7 +27,7 @@ Page.Log = new Class({ 'nr': nr }, 'onComplete': function(json){ - self.log.set('html', self.addColors(json.log)); + self.log.adopt(self.createLogElements(json.log)); self.log.removeClass('loading'); new Fx.Scroll(window, {'duration': 0}).toBottom(); @@ -63,20 +63,22 @@ Page.Log = new Class({ }, - addColors: function(text){ + createLogElements: function(logs){ - text = text - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/\u001b\[31m/gi, '') - .replace(/\u001b\[36m/gi, '') - .replace(/\u001b\[33m/gi, '') - .replace(/\u001b\[0m\n/gi, '
') - .replace(/\u001b\[0m/gi, ''); + var elements = []; - return '
' + text + '
'; + logs.each(function(log){ + elements.include(new Element('div.time', { + 'text': log.time + }).grab( + new Element('span', { + 'class': log.type.toLowerCase(), + 'text': log.message + }) + )) + }); + + return elements; } });