-
Notifications
You must be signed in to change notification settings - Fork 83
/
index.htm
175 lines (148 loc) · 6.88 KB
/
index.htm
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery UI Notification Widget by Eric Hynds</title>
<link type="text/css" rel="stylesheet" href="http://www.erichynds.com/examples/style.css" />
<link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/redmond/jquery-ui.css" />
<link type="text/css" rel="stylesheet" href="ui.notify.css" />
<style type="text/css">form input { display:block; width:250px; margin-bottom:5px }</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js" type="text/javascript"></script>
<script src="src/jquery.notify.js" type="text/javascript"></script>
<script type="text/javascript">
function create( template, vars, opts ){
return $container.notify("create", template, vars, opts);
}
$(function(){
// initialize widget on a container, passing in all the defaults.
// the defaults will apply to any notification created within this
// container, but can be overwritten on notification-by-notification
// basis.
$container = $("#container").notify();
// create two when the pg loads
create("default", { title:'Default Notification', text:'Example of a default notification. I will fade out after 5 seconds'});
create("sticky", { title:'Sticky Notification', text:'Example of a "sticky" notification. Click on the X above to close me.'},{ expires:false });
// bindings for the examples
$("#default").click(function(){
create("default", { title:'Default Notification', text:'Example of a default notification. I will fade out after 5 seconds'});
});
$("#sticky").click(function(){
create("sticky", { title:'Sticky Notification', text:'Example of a "sticky" notification. Click on the X above to close me.'},{ expires:false });
});
$("#warning").click(function(){
create("withIcon", { title:'Warning!', text:'OMG the quick brown fox jumped over the lazy dog. You\'ve been warned. <a href="#" class="ui-notify-close">Close me.</a>', icon:'alert.png' },{
expires:false
});
});
$("#themeroller").click(function(){
create("themeroller", { title:'Warning!', text:'The <code>custom</code> option is set to false for this notification, which prevents the widget from imposing it\'s own coloring. With this option off, you\'re free to style however you want without changing the original widget\'s CSS.' },{
custom: true,
expires: false
});
});
$("#clickable").click(function(){
create("default", { title:'Clickable Notification', text:'Click on me to fire a callback. Do it quick though because I will fade out after 5 seconds.'}, {
click: function(e,instance){
alert("Click triggered!\n\nTwo options are passed into the click callback: the original event obj and the instance object.");
}
});
});
$("#buttons").click(function(){
var n = create("buttons", { title:'Confirm some action', text:'This template has a button.' },{
expires:false
});
n.widget().delegate("input","click", function(){
n.close();
});
});
// second
var container = $("#container-bottom").notify({ stack:'above' });
container.notify("create", {
title:'Look ma, two containers!',
text:'This container is positioned on the bottom of the screen. Notifications will stack on top of each other with the <code>position</code> attribute set to <code>above</code>.'
},{ expires:false });
container.notify("widget").find("input").bind("click", function(){
container.notify("create", 1, { title:'Another Notification!', text:'The quick brown fox jumped over the lazy dog.' });
});
// third
var container = $("#container-bottom-right").notify();
$("#queue").click(function(){
container.notify("create", "queueing", {
title:'Queueing', text:'Example of a notification with queuing. For this container, no more than three notifications of this type will be visible at one time.'
}, { queue: 3 });
});
});
</script>
</head>
<body>
<div id="content">
<h1>jQuery UI Notify Widget</h1>
<p>This is a growl/ubuntu-like notification system built on top of jQuery UI.</p>
<p>Download & follow @ <a href="http://github.com/ehynds/jquery-notify">http://github.com/ehynds/jquery-notify</a>.</p>
<p>Documentation @ <a href="http://www.erichynds.com/jquery/a-jquery-ui-growl-ubuntu-notification-widget/">http://www.erichynds.com/jquery/a-jquery-ui-growl-ubuntu-notification-widget/</a></p>
<form style="margin:20px 0">
<input type="button" id="default" value="Open with default configuration" />
<input type="button" id="queue" value="Or with Queueing" />
<input type="button" id="sticky" value="Create a "sticky" notification" />
<input type="button" id="warning" value="Use icons in your templates" />
<input type="button" id="buttons" value="Or buttons even" />
<input type="button" id="clickable" value="The entire notification can be clicked on" />
<input type="button" id="themeroller" value="ThemeRoller Support" />
</form>
<!--- container to hold notifications, and default templates --->
<div id="container" style="display:none">
<div id="default">
<h1>#{title}</h1>
<p>#{text}</p>
</div>
<div id="sticky">
<a class="ui-notify-close ui-notify-cross" href="#">x</a>
<h1>#{title}</h1>
<p>#{text}</p>
</div>
<div id="themeroller" class="ui-state-error" style="padding:10px; -moz-box-shadow:0 0 6px #980000; -webkit-box-shadow:0 0 6px #980000; box-shadow:0 0 6px #980000;">
<a class="ui-notify-close" href="#"><span class="ui-icon ui-icon-close" style="float:right"></span></a>
<span style="float:left; margin:0 5px 0 0;" class="ui-icon ui-icon-alert"></span>
<h1>#{title}</h1>
<p>#{text}</p>
<p style="text-align:center"><a class="ui-notify-close" href="#">Close Me</a></p>
</div>
<div id="withIcon">
<a class="ui-notify-close ui-notify-cross" href="#">x</a>
<div style="float:left;margin:0 10px 0 0"><img src="#{icon}" alt="warning" /></div>
<h1>#{title}</h1>
<p>#{text}</p>
</div>
<div id="buttons">
<h1>#{title}</h1>
<p>#{text}</p>
<p style="margin-top:10px;text-align:center">
<input type="button" class="confirm" value="Close Dialog" />
</p>
</div>
</div>
<!--- second container - bottom notifications --->
<div id="container-bottom" style="display:none; top:auto; left:0; bottom:0; margin:0 0 10px 10px">
<div>
<h1>#{title}</h1>
<p>#{text}</p>
<p style="margin-top:10px;text-align:center">
<input type="button" class="confirm" value="Create Another Notification!" />
</p>
</div>
<div>
<h1>#{title}</h1>
<p>#{text}</p>
</div>
</div>
<!--- third container - bottom-right notifications --->
<div id="container-bottom-right" style="display:none; top:0; right:360px; margin:10px 10px 0 0">
<div id="queueing">
<h1>#{title}</h1>
<p>#{text}</p>
</div>
</div>
</div>
</body>
</html>