-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
86 lines (69 loc) · 2.59 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// app.js
angular.module('battyApp', ['ngRoute']).config(configFn);
configFn.$injcetor = ['$routeProvider'];
function configFn($routeProvider) {
$routeProvider.when('/', {
templateUrl: 'Home.html',
controller: 'homeController'
}).when('/me', {
templateUrl: 'Me.html',
controller: 'meController'
})
.when('/works', {
templateUrl: 'Work.html',
controller: 'workController'
})
.when('/course', {
templateUrl: 'Musings.html',
controller: 'musingsController'
});
}
// CONTROLLERS ============================================
angular.module('battyApp').controller('mainController', function($scope, $location) {
var mcc = this;
mcc.linkFlag = false;
angular.element("body").removeClass("yMenu").addClass("nMenu");
mcc.changeTab = function(oEvent) {
if (event.target.getAttribute("data-link")) {
$location.path('/' + event.target.getAttribute("data-link"));
$(event.currentTarget).find('a').removeClass('active');
$(event.target).addClass("active");
}
};
mcc.toggleMenu = function(oEvent) {
if (angular.element("#menuIconId").css("display") === "none") {
angular.element("#crossIconId").hide(300);
angular.element("#menuIconId").show(300);
angular.element(".menuItems").hide(1400);
} else {
angular.element("#crossIconId").show(300);
angular.element("#menuIconId").hide(300);
angular.element(".menuItems").show(1500);
}
};
mcc.unlock = function(x) {
if (event.target.getAttribute("src") === "img/lock.ico") {
event.target.src = "img/unlock.ico";
mcc.linkFlag = true;
} else {
event.target.src = "img/lock.ico";
mcc.linkFlag = false;
}
};
});
// home page controller
angular.module('battyApp').controller('meController', function($scope) {
angular.element("body").removeClass("nMenu").addClass("yMenu");
});
// home page controller
angular.module('battyApp').controller('homeController', function($scope, $interval) {
angular.element("body").removeClass("yMenu").addClass("nMenu");
});
// about page controller
angular.module('battyApp').controller('workController', function($scope) {
angular.element("body").removeClass("nMenu").addClass("yMenu");
});
// contact page controller
angular.module('battyApp').controller('musingsController', function($scope) {
angular.element("body").removeClass("nMenu").addClass("yMenu");
});