Use strict

Requires turning IrcUtils into an Angular service, because the global variable
trick won't work with use strict.
Reuse is still easily possible by removing the angular wrapping around it.
This commit is contained in:
Lorenz Hübschle-Schneider 2014-08-24 17:53:55 +01:00
commit a80db339f8
12 changed files with 100 additions and 55 deletions

View file

@ -2,6 +2,9 @@
* This file contains the weechat models and various
* helper methods to work with them.
*/
(function() {
'use strict';
var models = angular.module('weechatModels', []);
models.service('models', ['$rootScope', '$filter', function($rootScope, $filter) {
@ -282,6 +285,7 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
if (textEl.attrs.name !== null) {
textEl.classes.push('coa-' + textEl.attrs.name);
}
var val;
for (var attr in textEl.attrs.override) {
val = textEl.attrs.override[attr];
if (val) {
@ -449,7 +453,7 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
if (key === 'id') {
activeBuffer = this.model.buffers[bufferId];
}
else {
else {
activeBuffer = _.find(this.model.buffers, function(buffer) {
if (buffer[key] === bufferId) {
return buffer;
@ -526,3 +530,4 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
delete(this.model.buffers[bufferId]);
};
}]);
})();