-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
150 lines (143 loc) · 6.12 KB
/
index.html
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
<html lang="en" ng-app="notifyMe" ng-controller="demoCtrl as vm">
<head>
<meta charset="UTF-8">
<title>Notify Me</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.3.1/css/foundation.min.css">
<link rel="stylesheet" href="build/notify-me.css">
<style type="text/css">
.translucent-form-overlay {
max-width: 500px;
width: 100%;
background-color: rgba(54, 54, 54, 0.4);
padding: 20px;
color: #fff;
}
.translucent-form-overlay input{
color: #0a0a0a;
}
.translucent-form-overlay input::placeholder {
color: #8a8a8a;
}
</style>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-98601920-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<div class="container">
<div class="row">
<div class="large-12 large-text-center columns">
<div class="panel">
<h1>Welcome to notifyMe demo!</h1>
</div>
</div>
</div>
<div class="row">
<div class="translucent-form-overlay">
<form name="demoForm">
<h3>Try different notifications</h3>
<div class="row columns">
<label>Title
<input type="text" ng-model="vm.notif.title" placeholder="Title" required>
</label>
</div>
<div class="row columns">
<label>Message
<input type="text" ng-model="vm.notif.message" placeholder="Message" required>
</label>
</div>
<div class="row columns">
<label>Do you want to set options?
<input type="checkbox" ng-model="vm.notif.options.setOpts" ng-change="vm.setOptions()">
</label>
</div>
<div class="row columns" ng-show="vm.notif.options.setOpts">
<div class="row columns">
<label>Auto dismiss?
<input type="checkbox" ng-model="vm.notif.options.autoDismiss">
</label>
</div>
<div class="row columns" ng-if="vm.notif.options.autoDismiss">
<label>Auto dismiss timer
<input type="number" min="0" max="100000" ng-model="vm.notif.options.timeout">
</label>
</div>
<div class="row columns">
<label>Closeable?
<input type="checkbox" ng-model="vm.notif.options.closeable">
</label>
</div>
</div>
<button type="button" class="primary button" ng-click="vm.showInfo()" ng-disabled="demoForm.$invalid">
Info
</button>
<button type="button" class="primary button" ng-click="vm.showError()" ng-disabled="demoForm.$invalid">
Error
</button>
<button type="button" class="primary button" ng-click="vm.showWarning()" ng-disabled="demoForm.$invalid">
Warning
</button>
<button type="button" class="secondary button" ng-click="vm.clearAll()">
Clear all
</button>
<pre>
{{vm.notif | json}}
</pre>
</form>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.6/angular-animate.min.js"></script>
<script src="build/notifyMe.js"></script>
<script type="text/javascript">
angular.module('notifyMe')
.controller('demoCtrl', ['notifyMe', function(notifyMe) {
this._notifyMe = notifyMe;
this.notif = {
message: 'This is the start of a beautiful journey.',
title: 'Welcome friends!',
options: {}
};
this.showInfo = function() {
this._notifyMe.ofInfo(this.notif.message, this.notif.title, this.notif.options);
this.setOptions();
};
this.showError = function() {
this._notifyMe.ofError(this.notif.message, this.notif.title, this.notif.options);
this.setOptions();
};
this.showWarning = function() {
this._notifyMe.ofWarning(this.notif.message, this.notif.title, this.notif.options);
this.setOptions();
};
this.clearAll = function() {
this._notifyMe.clear();
this.setOptions();
};
this.setOptions = function() {
if (this.notif.options.setOpts) {
this.notif.options = {
closeable: !!Math.round(Math.random()),
timeout: Math.round(Math.random() * 10000),
autoDismiss: !!Math.round(Math.random()),
setOpts: true
}
} else {
this.notif.options = {
setOpts: false
};
}
};
this.setOptions();
}])
</script>
</body>
</html>