1 |
46770
|
sandro.lab
|
/**
|
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 |
|
|
$(element).collapsible({
|
36 |
|
|
accordion: false // A setting that changes the collapsible behavior to expandable instead of the default accordion style
|
37 |
|
|
});
|
38 |
|
|
}
|
39 |
|
|
}
|
40 |
|
|
});
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
dliApp.directive('ngEnter', function () {
|
44 |
|
|
return function (scope, element, attrs) {
|
45 |
|
|
element.bind("keydown keypress", function (event) {
|
46 |
|
|
if (event.which === 13) {
|
47 |
|
|
scope.$apply(function () {
|
48 |
|
|
scope.$eval(attrs.ngEnter);
|
49 |
|
|
});
|
50 |
|
|
|
51 |
|
|
event.preventDefault();
|
52 |
|
|
}
|
53 |
|
|
});
|
54 |
|
|
};
|
55 |
|
|
});
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
dliApp.config(function ($routeProvider) {
|
59 |
|
|
$routeProvider.
|
60 |
|
|
when('/', {
|
61 |
|
|
templateUrl: 'partials/main.html',
|
62 |
|
|
controller: 'mainController'
|
63 |
|
|
}).
|
64 |
|
|
when('/contact', {
|
65 |
|
|
templateUrl: 'partials/contactus.html'
|
66 |
|
|
}).
|
67 |
|
|
when('/apis', {
|
68 |
|
|
templateUrl: 'partials/api.html'
|
69 |
|
|
}).
|
70 |
|
|
when('/statistics', {
|
71 |
|
|
templateUrl: 'partials/statistics.html',
|
72 |
|
|
controller: 'statsController'
|
73 |
|
|
}).
|
74 |
|
|
when('/detail/:id*', {
|
75 |
|
|
templateUrl: 'partials/detail.html',
|
76 |
|
|
controller: 'detailController'
|
77 |
|
|
}).
|
78 |
|
|
when('/about', {
|
79 |
|
|
templateUrl: 'partials/about.html'
|
80 |
|
|
}).
|
81 |
|
|
when('/query/q=:q*', {
|
82 |
|
|
templateUrl: 'partials/query.html',
|
83 |
|
|
controller: 'queryController'
|
84 |
|
|
}).
|
85 |
|
|
when('/query/page=:page/q=:q*', {
|
86 |
|
|
templateUrl: 'partials/query.html',
|
87 |
|
|
controller: 'queryController'
|
88 |
|
|
}).
|
89 |
|
|
when('/query/page=:page/filter=:filter/q=:q*', {
|
90 |
|
|
templateUrl: 'partials/query.html',
|
91 |
|
|
controller: 'queryController'
|
92 |
|
|
}).
|
93 |
|
|
when('/datasource/:id', {
|
94 |
|
|
templateUrl: 'partials/datasource.html',
|
95 |
|
|
controller: 'datasourceController'
|
96 |
|
|
}).
|
97 |
|
|
otherwise({
|
98 |
|
|
redirectTo: '/'
|
99 |
|
|
}
|
100 |
|
|
)
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
});
|