-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMM-navbar.js
executable file
·89 lines (68 loc) · 2.06 KB
/
MM-navbar.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
87
88
89
/* Weather-Button */
Module.register("MM-navbar",{
getScripts: function(){
return ["modules/MM-navbar/jquery-3.1.1.js"];
},
getStyles: function(){
return ["weather-icons.css", "navbar.css", "font-awesome.css"];
},
notificationReceived: function(notification, payload, sender){
if (notification === 'DOM_OBJECTS_CREATED'){
MM.getModules().exceptModule(this).exceptWithClass('clock').enumerate(function(module){
module.hide(1000, function(){
});
});
}
},
getDom: function(){
var wrapper = document.createElement("div");
var weatherhidden = true;
var calendarhidden = true;
var newshidden = true;
var weatherbutton = document.createElement("span");
var calendarbutton = document.createElement("span");
var newsbutton = document.createElement("span");
wrapper.className = "center";
weatherbutton.className = "wi wi-day-rain-mix navbar";
calendarbutton.className = "fa fa-calendar navbar";
newsbutton.className = "fa fa-newspaper-o navbar";
var forecast = MM.getModules().withClass('weatherforecast');
var weather = MM.getModules().withClass('currentweather');
var calendar = MM.getModules().withClass('calendar');
var news = MM.getModules().withClass('newsfeed');
wrapper.appendChild(weatherbutton);
wrapper.appendChild(calendarbutton);
wrapper.appendChild(newsbutton);
$(weatherbutton).on("click", function(){
if(weatherhidden){
forecast[0].show();
weather[0].show();
weatherhidden = false;
}else{
forecast[0].hide();
weather[0].hide();
weatherhidden = true;
}
});
$(calendarbutton).on("click", function(){
if(calendarhidden){
calendar[0].show();
calendarhidden = false;
}else{
calendar[0].hide();
calendarhidden = true;
}
});
$(newsbutton).on("click", function(){
if(newshidden){
news[0].show();
newshidden = false;
}else{
news[0].hide();
newshidden = true;
}
});
return wrapper;
Log.info("NavigationBar created");
}
});