'use strict'; /* App Module */ var app = angular.module('app', [ 'ui.bootstrap', 'ui.router', 'LocalStorageModule', 'dialogs.main', 'ngSanitize', 'luticateUtils', 'luticateAuth', 'appSdk' ]); app.config(['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider', function($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider) { //$locationProvider.html5Mode(true); $stateProvider.state('home',{ url:'/', templateUrl:'views/home.html', controller:'HomeController' }); $urlRouterProvider.otherwise('/'); }]) .directive('dateNow', ['$filter', function($filter) { return { link: function( $scope, $element, $attrs) { $element.text($filter('date')(new Date(), $attrs.dateNow)); } }; }]) .run(['$rootScope', '$state',function ($rootScope, $state) { $rootScope.$on('$stateChangeError', function (e, curr, prev) { //$state.go('login'); }); }]) .directive("dropzone", function() { return { restrict : "A", link: function (scope, elem) { function processEvent(evt) { if (evt != null) { evt.stopPropagation(); evt.preventDefault(); evt.dataTransfer.effectAllowed = 'copy'; evt.dataTransfer.dropEffect = 'copy'; } return false; } elem.bind('dragover', processEvent); elem.bind('dragenter', processEvent); elem.bind('dragstart', processEvent); elem.bind('drop', function(evt) { evt.stopPropagation(); evt.preventDefault(); var files = evt.dataTransfer.files; for (var i = 0, f; f = files[i]; i++) { var reader = new FileReader(); reader.readAsText(f, 'ISO-8859-1'); reader.onload = (function(file) { return function(e) { scope.$apply(function() { scope.setDraggedContent(e.target.result, file); }); }; })(f); } return false; }); } } });