webogram-i2p/app/js/app.js

69 lines
2.4 KiB
JavaScript
Raw Normal View History

2014-01-05 16:07:11 +00:00
/*!
2014-06-04 16:06:08 +00:00
* Webogram v0.1.4 - messaging web application for MTProto
2014-01-05 16:07:11 +00:00
* https://github.com/zhukov/webogram
* Copyright (C) 2014 Igor Zhukov <igor.beatle@gmail.com>
* https://github.com/zhukov/webogram/blob/master/LICENSE
*/
'use strict';
2014-06-03 11:08:26 +00:00
$(document.body)
.addClass(Config.Navigator.osX ? 'osx' : 'non_osx')
.addClass(Config.Navigator.retina ? 'is_2x' : 'is_1x');
2014-01-05 16:07:11 +00:00
2014-02-10 17:37:49 +00:00
$(window).on('load', function () {
setTimeout(function () {
window.scrollTo(0,1);
}, 0);
});
2014-01-05 16:07:11 +00:00
// Declare app level module which depends on filters, and services
angular.module('myApp', [
'ngRoute',
'ngAnimate',
'ngSanitize',
'ui.bootstrap',
2014-03-25 14:39:17 +00:00
'pasvaz.bindonce',
2014-03-12 21:55:12 +00:00
'mtproto.services',
2014-01-05 16:07:11 +00:00
'myApp.filters',
'myApp.services',
2014-03-12 21:55:12 +00:00
/*PRODUCTION_ONLY_BEGIN
'myApp.templates',
PRODUCTION_ONLY_END*/
2014-01-05 16:07:11 +00:00
'myApp.directives',
'myApp.controllers'
]).
config(['$locationProvider', '$routeProvider', '$compileProvider', function($locationProvider, $routeProvider, $compileProvider) {
var icons = {}, reverseIcons = {}, i, j, hex, name, dataItem, row, column, totalColumns;
2014-01-05 16:07:11 +00:00
for (j = 0; j < Config.EmojiCategories.length; j++) {
totalColumns = Config.EmojiCategorySpritesheetDimens[j][1];
for (i = 0; i < Config.EmojiCategories[j].length; i++) {
dataItem = Config.Emoji[Config.EmojiCategories[j][i]];
name = dataItem[1][0];
row = Math.floor(i / totalColumns);
column = (i % totalColumns);
icons[':' + name + ':'] = [j, row, column, ':'+name+':'];
reverseIcons[name] = dataItem[0];
2014-01-05 16:07:11 +00:00
}
}
$.emojiarea.spritesheetPath = 'img/emojisprite_!.png';
$.emojiarea.spritesheetDimens = Config.EmojiCategorySpritesheetDimens;
$.emojiarea.iconSize = 20;
2014-01-05 16:07:11 +00:00
$.emojiarea.icons = icons;
$.emojiarea.reverseIcons = reverseIcons;
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|blob|filesystem|chrome-extension|app):|data:image\//);
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|file|mailto|blob|filesystem|chrome-extension|app):|data:image\//);
2014-01-05 16:07:11 +00:00
// $locationProvider.html5Mode(true);
$routeProvider.when('/', {templateUrl: 'partials/welcome.html', controller: 'AppWelcomeController'});
$routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'AppLoginController'});
$routeProvider.when('/im', {templateUrl: 'partials/im.html', controller: 'AppIMController', reloadOnSearch: false});
2014-01-05 16:07:11 +00:00
$routeProvider.otherwise({redirectTo: '/'});
}]);