-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.js
More file actions
55 lines (55 loc) · 1.66 KB
/
Copy pathcode.js
File metadata and controls
55 lines (55 loc) · 1.66 KB
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
document.cookie = "Cookie=SweatTomato";
var date = new Date();
date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
var expires = "expires=" + date.toUTCString();
document.cookie = "Cookie=chocolate; " + expires;
navigator.serviceWorker.register('/sw.js')
.then(function(registration) {
console.log('Service worker successfully registered.');
})
.catch(function(error) {
console.log('Service worker registration failed:', error);
});
Notification.requestPermission().then(function(permission) {
if (permission === 'granted') {
console.log('Notification permission granted.');
} else {
console.log('Unable to get permission to notify.');
}
});
navigator.serviceWorker.ready.then(function(registration) {
registration.pushManager.subscribe({userVisibleOnly: true})
.then(function(subscription) {
console.log('Subscribed for push:', subscription.endpoint);
})
.catch(function(error) {
console.log('Subscription failed:', error);
});
});
self.addEventListener('push', function(event) {
const title = 'New Message';
const options = {
body: 'Hello, world!',
};
event.waitUntil(self.registration.showNotification(title, options));
});
var piling = new Piling("#piling", {
direction: 'vertical',
animation: 'fade',
speed: 800,
spacing: "10%",
navigation: {
dots: true,
arrows: true
}
});
piling.on("enter", function(index) {
console.log("Entered section" + index)
});
let decTitle = document.title;
window.addEventListener('blur', () =>{
document.title = "Come Here!";
})
window.addEventListener('focus', () =>{
document.title = docTitle;
})