<commit_before>var module = angular.module('commafeed.services', [ 'ngResource' ]);

module.service('AnalyticsService', [ '$state', function($state) {
	this.track = function(path) {
		if (typeof ga === 'undefined') {
			return;
		}
		path = path || $state.$current.url.prefix;
		ga('send', 'pageview', {
			page : path
		});
	};
} ]);

module.service('MobileService', [ '$state', function($state) {
	this.leftMenu = false;
	this.rightMenu = false;
	this.toggleLeftMenu = function() {
		this.leftMenu = !this.leftMenu;
		$('body').toggleClass('left-menu-active');
	};
	this.toggleRightMenu = function() {
		this.rightMenu = !this.rightMenu;
		$('body').toggleClass('right-menu-active');
	};
	var width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
	this.mobile = width < 979;
}]);


module.factory('ProfileService', ['$resource', function($resource) {
	var res = $resource('rest/user/profile/');
	res.deleteAccount = $resource('rest/user/profile/deleteAccount').save;
	return res;
}]);

module.factory('SettingsService', ['$resource', function($resource) {
	var res = $resource('rest/user/settings');

	var s = {};
	s.settings = {};
	s.save = function(callback) {
		res.save(s.settings, function(data) {
			if (callback) {
				callback(data);
			}
		});
	};
	s.init = function(callback) {
		res.get(function(data) {
			s.settings = data;
			moment.lang(s.settings.language || 'en', {});
			if (callback) {
				callback(data);<commit_msg>make momentjs work with chinese (fix #366)<commit_after>var module = angular.module('commafeed.services', [ 'ngResource' ]);

module.service('AnalyticsService', [ '$state', function($state) {
	this.track = function(path) {
		if (typeof ga === 'undefined') {
			return;
		}
		path = path || $state.$current.url.prefix;
		ga('send', 'pageview', {
			page : path
		});
	};
} ]);

module.service('MobileService', [ '$state', function($state) {
	this.leftMenu = false;
	this.rightMenu = false;
	this.toggleLeftMenu = function() {
		this.leftMenu = !this.leftMenu;
		$('body').toggleClass('left-menu-active');
	};
	this.toggleRightMenu = function() {
		this.rightMenu = !this.rightMenu;
		$('body').toggleClass('right-menu-active');
	};
	var width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
	this.mobile = width < 979;
}]);


module.factory('ProfileService', ['$resource', function($resource) {
	var res = $resource('rest/user/profile/');
	res.deleteAccount = $resource('rest/user/profile/deleteAccount').save;
	return res;
}]);

module.factory('SettingsService', ['$resource', function($resource) {
	var res = $resource('rest/user/settings');

	var s = {};
	s.settings = {};
	s.save = function(callback) {
		res.save(s.settings, function(data) {
			if (callback) {
				callback(data);
			}
		});
	};
	s.init = function(callback) {
		res.get(function(data) {
			s.settings = data;
			var lang = s.settings.language || 'en';
			if (lang === 'zh') {
				lang = 'zh-cn';
			}
			moment.lang(lang, {});
			if (callback) {
				callback(data);
{'fraction_non_alphanumeric': 0.1988674217188541, 'fraction_numerical': 0.0036642238507661557, 'mean_word_length': 4.25, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '338431', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1017, 'n_words': 179}