snipt/media/js/src/snipts.js

42 lines
1.0 KiB
JavaScript
Raw Normal View History

2013-06-27 17:52:04 -07:00
(function() {
'use strict';
2013-06-27 17:52:04 -07:00
if (typeof angular !== 'undefined') {
var root = this;
var $ = root.jQuery;
var controllers = {};
var app = root.app;
// Controllers.
controllers.SniptListController = function($scope, AccountStorage) {
$scope.$root.account = {
list_view: 'N'
};
AccountStorage.getAccount().then(function(response) {
$scope.$root.account = response.data;
$scope.$root.$watch('account.list_view', function(newView, oldView) {
if (oldView !== newView) {
2015-07-17 09:59:52 -07:00
if (newView === 'N') {
window.ll('tagEvent', 'Switched to normal view');
} else {
window.ll('tagEvent', 'Switched to compact view');
}
AccountStorage.saveAccount($scope.$root.account, ['list_view']).then(function(response) {
$scope.$root.account = response.data;
});
}
});
});
2013-06-27 17:52:04 -07:00
};
// Assign the controllers.
app.controller(controllers);
}
}).call(this);