This repository has been archived by the owner on Jul 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
core.js
119 lines (102 loc) · 3.33 KB
/
core.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
$(function () {
console.log('Hello there! <3 https://github.com/Amrykid/HanasuOnline');
h = $('html').height();
$('#stations').css("height",h-122);
$('#settingsPane').tabs();
setTimeout(function() {
var hanasu = new Hanasu();
hanasu.initializeApplication();
self.App = hanasu;
if(window.webkitNotifications) {
if (window.webkitNotifications.checkPermission() == 0) {
$('#notiToggle').html("Disable Notifications");
Hanasu.prototype.NotificationToggled = true;
} else {
$('#notiToggle').html("Enable Notifications");
Hanasu.prototype.NotificationToggled = false;
}
} else if (window.Notification) {
// Firefox Nightly as of time of writing.
if (window.Notification.permission == 'granted') {
$('#notiToggle').html("Disable Notifications");
Hanasu.prototype.NotificationToggled = true;
} else {
$('#notiToggle').html("Enable Notifications");
Hanasu.prototype.NotificationToggled = false;
}
} else if (navigator.mozNotification) {
// Firefox Mobile
$('#notiToggle').html("Disable Notifications");
Hanasu.prototype.NotificationToggled = true;
}
}, 1); //wait for the dom to load.
});
$(window).resize(function(){
h = $('html').height();
$('#stations').css('height',h-122);
});
$('#settingsButton').click(function(){
$('#settingsPane').tabs();
});
$('#faqButton').click(function(){
$('#paneCover, #faqPane').fadeToggle(200);
});
$('#historyButton').click(function(){
$('#paneCover, #historyPane').fadeToggle(200);
});
$('#settingsButton').click(function(){
$('#paneCover, #settingsPane').fadeToggle(200);
});
$('.closePane, .dialogButton').click(function(){
$('#paneCover, .pane').fadeOut(200);
});
$(".pane").draggable({ containment: $(document.body), scroll: false , opacity: 0.35}); //http://api.jqueryui.com/draggable/#option-containment
function dialog(title,message){
$('.dialog.closeable header h1').html(title);
$('.dialog.closeable p').html(message);
$('#paneCover, .dialog.closeable').fadeToggle(200);
}
function non_close_dialog(title,message){
$('.dialog.noncloseable header h1').html(title);
$('.dialog.noncloseable p').html(message);
$('#paneCover, .dialog.noncloseable').fadeToggle(200);
return function() {
$('#paneCover').fadeOut(200);
$('.dialog.noncloseable').fadeOut(200);
};
}
$('#notiToggle').click(function(){
if (Hanasu.prototype.NotificationToggled) {
Hanasu.prototype.NotificationToggled = false;
$(this).html("Enable Notifications");
} else {
Hanasu.prototype.obtainNotificationsPermission();
Hanasu.prototype.NotificationToggled = true;
$(this).html("Disable Notifications");
};
});
window.updateVolumeIcon = updateVolumeIcon;
function updateVolumeIcon(volumeValue) {
if (volumeValue == 0) {
$('#volumeIcon').attr('class', 'icon-remove-sign');
} else if (volumeValue < 33){
$('#volumeIcon').attr('class', 'icon-volume-off');
} else if (volumeValue < 66){
$('#volumeIcon').attr('class', 'icon-volume-down');
} else if (volumeValue >= 66){
$('#volumeIcon').attr('class', 'icon-volume-up');
}
}
window.toggleMuteCallback = toggleMuteCallback;
function toggleMuteCallback() {
if (Hanasu.prototype.muted) {
$('#volumeIcon').attr('class', 'icon-remove-sign');
} else {
updateVolumeIcon($("#volumeControl").val());
}
}
function onHanasuInitialized() {
$(".station").click(function() {
$(this).effect("shake", {direction: "up"});
});
}