forked from roshiro/TitleNotifier.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
64 lines (53 loc) · 2.01 KB
/
Copy pathindex.html
File metadata and controls
64 lines (53 loc) · 2.01 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
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Title Notifier.js Example Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Show number of unread notifications in page's title">
<meta name="author" content="Rafael Oshiro">
<!-- Title Notifier JS file -->
<script src="../title_notifier.js"></script>
</head>
<body>
<input type="button" id="add_btn" value="+1 notification"/>
<br><br>
<input type="button" id="sub_btn" value="-1 notification"/>
<br><br>
<input type="button" id="get_btn" value="How many notifications do I have?"/>
<br><br>
<input type="text" id="number_notification" value="10"/><input type="button" id="set_btn" value="Set total"/>
<br><br>
<input type="text" id="max_notification" value="10"/><input type="button" id="max_btn" value="Set maximum"/>
<br><br>
<input type="button" id="res_btn" value="reset"/>
<script>
var addButton = document.getElementById('add_btn'),
subButton = document.getElementById('sub_btn'),
getButton = document.getElementById('get_btn'),
setButton = document.getElementById('set_btn'),
maxButton = document.getElementById('max_btn'),
resButton = document.getElementById('res_btn');
addButton.onclick = function() {
titlenotifier.add();
};
subButton.onclick = function() {
titlenotifier.sub();
};
getButton.onclick = function() {
alert('You have ' + titlenotifier.get() + ' notifications');
};
setButton.onclick = function() {
var value = document.getElementById('number_notification');
titlenotifier.set(value.value);
};
maxButton.onclick = function() {
var value = document.getElementById('max_notification');
titlenotifier.max(value.value);
};
resButton.onclick = function() {
titlenotifier.reset();
};
</script>
</body>
</html>