<commit_before>/* global Backbone, Handlebars, relative_modified_date, formatDate, humanFileSize, views */
var Mail = {
	State:{
		currentFolderId: null,
		currentAccountId: null,
		currentMessageId: null,
		messageView: null,
		router: null
	},
	UI:{
		initializeInterface:function () {
			Handlebars.registerHelper("colorOfDate", function(dateInt) {
				var lastModified = new Date(dateInt*1000);
				var lastModifiedTime = Math.round(lastModified.getTime() / 1000);

				// date column
				var modifiedColor = Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5);
				if (modifiedColor > 200) {
					modifiedColor = 200;
				}
				return 'rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')';
			});

			Handlebars.registerHelper("relativeModifiedDate", function(dateInt) {
				var lastModified = new Date(dateInt*1000);
				var lastModifiedTime = Math.round(lastModified.getTime() / 1000);
				return relative_modified_date(lastModifiedTime);
			});

			Handlebars.registerHelper("formatDate", function(dateInt) {
				var lastModified = new Date(dateInt*1000);
				return formatDate(lastModified);
			});

			Handlebars.registerHelper("humanFileSize", function(size) {
				return humanFileSize(size);
			});

			var protocolHandlerUrl = window.location.protocol + '//' + window.location.host + OC.generateUrl('apps/mail/accounts?uri=%s');
			navigator.registerProtocolHandler("mailto", protocolHandlerUrl, "ownCloud Mail");

			var AppRouter = Backbone.Router.extend({
				routes: {
					"accounts/:id": "loadAccount",
					"*actions": "defaultRoute" // matches http://example.com/#anything-here
				},

				loadAccount: function(id) {
					if (id === 'new') {
						Mail.UI.addAccount();
					} else {
						Mail.UI.loadFoldersForAccount(id);
					}
				},

				defaultRoute: function() {
//					alert('default');
				}
			});
			// Initiate the router
			Mail.State.router = new AppRouter();

			// setup sendmail view
			Mail.State.messageView = new views.Messages({<commit_msg>make protocol handler work for Chrome<commit_after>/* global Backbone, Handlebars, relative_modified_date, formatDate, humanFileSize, views */
var Mail = {
	State:{
		currentFolderId: null,
		currentAccountId: null,
		currentMessageId: null,
		messageView: null,
		router: null
	},
	UI:{
		initializeInterface:function () {
			Handlebars.registerHelper("colorOfDate", function(dateInt) {
				var lastModified = new Date(dateInt*1000);
				var lastModifiedTime = Math.round(lastModified.getTime() / 1000);

				// date column
				var modifiedColor = Math.round((Math.round((new Date()).getTime() / 1000)-lastModifiedTime)/60/60/24*5);
				if (modifiedColor > 200) {
					modifiedColor = 200;
				}
				return 'rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')';
			});

			Handlebars.registerHelper("relativeModifiedDate", function(dateInt) {
				var lastModified = new Date(dateInt*1000);
				var lastModifiedTime = Math.round(lastModified.getTime() / 1000);
				return relative_modified_date(lastModifiedTime);
			});

			Handlebars.registerHelper("formatDate", function(dateInt) {
				var lastModified = new Date(dateInt*1000);
				return formatDate(lastModified);
			});

			Handlebars.registerHelper("humanFileSize", function(size) {
				return humanFileSize(size);
			});

			// ask to handle all mailto: links
			if(window.navigator.registerProtocolHandler) {
				var url = window.location.protocol + '//'
					+ window.location.host
					+ OC.generateUrl('apps/mail/accounts?uri=%s');
				window.navigator
					.registerProtocolHandler("mailto", url, "ownCloud Mail");
			}

			var AppRouter = Backbone.Router.extend({
				routes: {
					"accounts/:id": "loadAccount",
					"*actions": "defaultRoute" // matches http://example.com/#anything-here
				},

				loadAccount: function(id) {
					if (id === 'new') {
						Mail.UI.addAccount();
					} else {
						Mail.UI.loadFoldersForAccount(id);
					}
				},

				defaultRoute: function() {
//					alert('default');
				}
			});
			// Initiate the router
			Mail.State.router = new AppRouter();

			// setup sendmail view
			Mail.State.messageView = new views.Messages({
{'fraction_non_alphanumeric': 0.14333814333814335, 'fraction_numerical': 0.017797017797017797, 'mean_word_length': 3.7369020501138954, 'pattern_counts': {'":': 4, '<': 3, '<?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': '1614030', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1239, 'n_words': 238}