Strip trailing slashes

This commit is contained in:
Philippe Proulx 2013-10-05 20:06:28 -04:00
parent 4f07d6048f
commit e8ae26d50e

View file

@ -99,7 +99,7 @@ weechat.factory('colors', [function($scope) {
return { return {
setAttrs: setAttrs, setAttrs: setAttrs,
getColor: getColor, getColor: getColor,
prepareCss: prepareCss, prepareCss: prepareCss,
@ -118,7 +118,7 @@ weechat.factory('pluginManager', ['youtubePlugin', 'urlPlugin', 'imagePlugin', f
} }
var contentForMessage = function(message) { var contentForMessage = function(message) {
var content = []; var content = [];
for (var i = 0; i < plugins.length; i++) { for (var i = 0; i < plugins.length; i++) {
var pluginContent = plugins[i].contentForMessage(message); var pluginContent = plugins[i].contentForMessage(message);
@ -131,7 +131,7 @@ weechat.factory('pluginManager', ['youtubePlugin', 'urlPlugin', 'imagePlugin', f
} }
} }
} }
return content; return content;
} }
@ -204,7 +204,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
/* /*
* Parse the text elements from the buffer line added * Parse the text elements from the buffer line added
* *
*/ */
function parseLineAddedTextElements(message) { function parseLineAddedTextElements(message) {
var prefix = colors.parse(message['objects'][0]['content'][0]['prefix']); var prefix = colors.parse(message['objects'][0]['content'][0]['prefix']);
@ -220,7 +220,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
return text_element; return text_element;
}); });
return text_elements; return text_elements;
} }
var buffer = message['objects'][0]['content'][0]['buffer']; var buffer = message['objects'][0]['content'][0]['buffer'];
@ -240,9 +240,9 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
var handleBufferLineAdded = function(message) { var handleBufferLineAdded = function(message) {
var buffer_line = {} var buffer_line = {}
message = new BufferLine(message); message = new BufferLine(message);
if (!_isActiveBuffer(message.buffer)) { if (!_isActiveBuffer(message.buffer)) {
$rootScope.buffers[message.buffer]['notification'] = true; $rootScope.buffers[message.buffer]['notification'] = true;
} }
@ -265,7 +265,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
var fullName = message['objects'][0]['content'][0]['full_name'] var fullName = message['objects'][0]['content'][0]['full_name']
var buffer = message['objects'][0]['content'][0]['pointers'][0] var buffer = message['objects'][0]['content'][0]['pointers'][0]
$rootScope.buffers[buffer] = { 'id': buffer, 'lines':[], 'full_name':fullName } $rootScope.buffers[buffer] = { 'id': buffer, 'lines':[], 'full_name':fullName }
} }
/* /*
@ -292,7 +292,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
} }
$rootScope.buffers = buffers; $rootScope.buffers = buffers;
} }
var handleEvent = function(event) { var handleEvent = function(event) {
if (_.has(eventHandlers, event['id'])) { if (_.has(eventHandlers, event['id'])) {
eventHandlers[event['id']](event); eventHandlers[event['id']](event);
@ -311,7 +311,7 @@ weechat.factory('handlers', ['$rootScope', 'colors', 'pluginManager', function($
var eventHandlers = { var eventHandlers = {
bufinfo: handleBufferInfo, bufinfo: handleBufferInfo,
_buffer_closing: handleBufferClosing, _buffer_closing: handleBufferClosing,
_buffer_line_added: handleBufferLineAdded, _buffer_line_added: handleBufferLineAdded,
_buffer_opened: handleBufferOpened _buffer_opened: handleBufferOpened
} }
@ -328,7 +328,7 @@ weechat.factory('connection', ['$rootScope', '$log', 'handlers', 'colors', funct
var websocket = null; var websocket = null;
// Sanitizes messages to be sent to the weechat relay // Sanitizes messages to be sent to the weechat relay
var doSend = function(message) { var doSend = function(message) {
msgs = message.replace(/[\r\n]+$/g, "").split("\n"); msgs = message.replace(/[\r\n]+$/g, "").split("\n");
for (var i = 0; i < msgs.length; i++) { for (var i = 0; i < msgs.length; i++) {