Project

General

Profile

1
/**
2
 * Created by sandro on 6/18/15.
3
 */
4

    
5

    
6
var dliApp= angular.module('dliApp',['ngRoute']);
7

    
8
function initSpinner() {
9
	spinnerOpts = {
10
			lines: 15,
11
			length: 16,
12
			width: 5,
13
			radius: 25,
14
			color: '#eeeeee',
15
			className: 'spinner',
16
			top: '40%'
17
		};
18
	spinnerTarget = document.getElementById('spinnerdiv');
19
}
20

    
21
function showSpinner() {
22
	spinner = new Spinner(spinnerOpts).spin(spinnerTarget);
23
	spinnerTarget.style.visibility = 'visible';
24
}
25

    
26
function hideSpinner()  {
27
	spinnerTarget.style.visibility = 'hidden';
28
	spinner.stop();
29
}
30

    
31
dliApp.directive('collapsible', function() {
32
    return {
33
    	restrict: 'A',
34
    	link: function(scope, element, attrs)
35
        {
36
            $(element).collapsible({
37
                accordion : false // A setting that changes the collapsible behavior to expandable instead of the default accordion style
38
            });
39
        }
40
    }
41
});
42

    
43

    
44

    
45

    
46
dliApp.directive('ngEnter', function () {
47
    return function (scope, element, attrs) {
48
        element.bind("keydown keypress", function (event) {
49
            if(event.which === 13) {
50
                scope.$apply(function (){
51
                    scope.$eval(attrs.ngEnter);
52
                });
53

    
54
                event.preventDefault();
55
            }
56
        });
57
    };
58
});
59

    
60

    
61
dliApp.config(function($routeProvider) {
62
   $routeProvider.
63
       when('/', {
64
        templateUrl:'partials/main.html',
65
        controller:'mainController'
66
        }).
67
       when('/contact', {
68
        templateUrl:'partials/contactus.html'
69
        }).
70
       when('/apis', {
71
        templateUrl:'partials/api.html'
72
        }).
73
       when('/statistics', {
74
        templateUrl:'partials/statistics.html',
75
        controller:'statsController'
76
        }).
77
       when('/detail/:id*', {
78
        templateUrl:'partials/detail.html',
79
        controller:'detailController'
80
        }).
81
       when('/about', {
82
        templateUrl:'partials/about.html'
83
        }).
84
       when('/query/q=:q*', {
85
        templateUrl:'partials/query.html',
86
        controller:'queryController'
87
        }).
88
       when('/query/page=:page/q=:q*', {
89
        templateUrl:'partials/query.html',
90
        controller:'queryController'
91
        }).
92
       when('/query/page=:page/filter=:filter/q=:q*', {
93
        templateUrl:'partials/query.html',
94
        controller:'queryController'
95
        }).
96
       otherwise({
97
           redirectTo:'/'
98
       }
99
   )
100

    
101

    
102
});
(1-1/3)