minor fixes, doc updates
This commit is contained in:
@@ -3,8 +3,29 @@ Notify.js
|
|||||||
|
|
||||||
> A simple, versatile notification library
|
> A simple, versatile notification library
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
See demos and full documentation at:
|
See demos and full documentation at:
|
||||||
|
|
||||||
## http://notifyjs.com/
|
## http://notifyjs.com/
|
||||||
|
|
||||||
|
#### MIT License
|
||||||
|
|
||||||
|
Copyright © 2013 Jaime Pillora <dev@jpillora.com>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
Vendored
+8
-10
@@ -1,4 +1,4 @@
|
|||||||
/** Notify.js - v0.0.1 - 2013/06/11
|
/** Notify.js - v0.0.1 - 2013/06/12
|
||||||
* http://notifyjs.com/
|
* http://notifyjs.com/
|
||||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||||
*/
|
*/
|
||||||
@@ -109,6 +109,7 @@ addStyle = function(name, def) {
|
|||||||
insertCSS = function(cssText) {
|
insertCSS = function(cssText) {
|
||||||
var elem;
|
var elem;
|
||||||
elem = createElem("style");
|
elem = createElem("style");
|
||||||
|
elem.attr('type', 'text/css');
|
||||||
$("head").append(elem);
|
$("head").append(elem);
|
||||||
try {
|
try {
|
||||||
elem.html(cssText);
|
elem.html(cssText);
|
||||||
@@ -119,6 +120,7 @@ insertCSS = function(cssText) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pluginOptions = {
|
pluginOptions = {
|
||||||
|
clickToHide: true,
|
||||||
autoHide: true,
|
autoHide: true,
|
||||||
autoHideDelay: 5000,
|
autoHideDelay: 5000,
|
||||||
arrowShow: true,
|
arrowShow: true,
|
||||||
@@ -477,21 +479,17 @@ $.extend($[pluginName], {
|
|||||||
defaults: defaults,
|
defaults: defaults,
|
||||||
addStyle: addStyle,
|
addStyle: addStyle,
|
||||||
pluginOptions: pluginOptions,
|
pluginOptions: pluginOptions,
|
||||||
getStyle: getStyle
|
getStyle: getStyle,
|
||||||
|
insertCSS: insertCSS
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
insertCSS(coreStyle.css).attr('data-notify-style', 'core');
|
insertCSS(coreStyle.css).attr('id', 'core-notify');
|
||||||
return $(document).on('click', "." + pluginClassName + "-wrapper", function() {
|
return $(document).on('click notify-hide', "." + pluginClassName + "-wrapper", function(e) {
|
||||||
var inst;
|
var inst;
|
||||||
inst = $(this).data(pluginClassName);
|
inst = $(this).data(pluginClassName);
|
||||||
if (!inst) {
|
if (inst && (inst.options.clickToHide || e.type === 'notify-hide')) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (inst.elem) {
|
|
||||||
return inst.show(false);
|
return inst.show(false);
|
||||||
} else {
|
|
||||||
return inst.destroy();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Vendored
+8
-10
@@ -1,4 +1,4 @@
|
|||||||
/** Notify.js - v0.0.1 - 2013/06/11
|
/** Notify.js - v0.0.1 - 2013/06/12
|
||||||
* http://notifyjs.com/
|
* http://notifyjs.com/
|
||||||
* Copyright (c) 2013 Jaime Pillora - MIT
|
* Copyright (c) 2013 Jaime Pillora - MIT
|
||||||
*/
|
*/
|
||||||
@@ -109,6 +109,7 @@ addStyle = function(name, def) {
|
|||||||
insertCSS = function(cssText) {
|
insertCSS = function(cssText) {
|
||||||
var elem;
|
var elem;
|
||||||
elem = createElem("style");
|
elem = createElem("style");
|
||||||
|
elem.attr('type', 'text/css');
|
||||||
$("head").append(elem);
|
$("head").append(elem);
|
||||||
try {
|
try {
|
||||||
elem.html(cssText);
|
elem.html(cssText);
|
||||||
@@ -119,6 +120,7 @@ insertCSS = function(cssText) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pluginOptions = {
|
pluginOptions = {
|
||||||
|
clickToHide: true,
|
||||||
autoHide: true,
|
autoHide: true,
|
||||||
autoHideDelay: 5000,
|
autoHideDelay: 5000,
|
||||||
arrowShow: true,
|
arrowShow: true,
|
||||||
@@ -477,21 +479,17 @@ $.extend($[pluginName], {
|
|||||||
defaults: defaults,
|
defaults: defaults,
|
||||||
addStyle: addStyle,
|
addStyle: addStyle,
|
||||||
pluginOptions: pluginOptions,
|
pluginOptions: pluginOptions,
|
||||||
getStyle: getStyle
|
getStyle: getStyle,
|
||||||
|
insertCSS: insertCSS
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
insertCSS(coreStyle.css).attr('data-notify-style', 'core');
|
insertCSS(coreStyle.css).attr('id', 'core-notify');
|
||||||
return $(document).on('click', "." + pluginClassName + "-wrapper", function() {
|
return $(document).on('click notify-hide', "." + pluginClassName + "-wrapper", function(e) {
|
||||||
var inst;
|
var inst;
|
||||||
inst = $(this).data(pluginClassName);
|
inst = $(this).data(pluginClassName);
|
||||||
if (!inst) {
|
if (inst && (inst.options.clickToHide || e.type === 'notify-hide')) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (inst.elem) {
|
|
||||||
return inst.show(false);
|
return inst.show(false);
|
||||||
} else {
|
|
||||||
return inst.destroy();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+6
-7
@@ -144,6 +144,7 @@ addStyle = (name, def) ->
|
|||||||
insertCSS = (cssText) ->
|
insertCSS = (cssText) ->
|
||||||
|
|
||||||
elem = createElem("style")
|
elem = createElem("style")
|
||||||
|
elem.attr 'type', 'text/css'
|
||||||
$("head").append elem
|
$("head").append elem
|
||||||
try
|
try
|
||||||
elem.html cssText
|
elem.html cssText
|
||||||
@@ -158,6 +159,7 @@ insertCSS = (cssText) ->
|
|||||||
|
|
||||||
#overridable options
|
#overridable options
|
||||||
pluginOptions =
|
pluginOptions =
|
||||||
|
clickToHide: true
|
||||||
autoHide: true
|
autoHide: true
|
||||||
autoHideDelay: 5000
|
autoHideDelay: 5000
|
||||||
arrowShow: true
|
arrowShow: true
|
||||||
@@ -519,19 +521,16 @@ $.fn[pluginName] = (data, options) ->
|
|||||||
@
|
@
|
||||||
|
|
||||||
#extra methods
|
#extra methods
|
||||||
$.extend $[pluginName], { defaults, addStyle, pluginOptions, getStyle }
|
$.extend $[pluginName], { defaults, addStyle, pluginOptions, getStyle, insertCSS }
|
||||||
|
|
||||||
#when ready
|
#when ready
|
||||||
$ ->
|
$ ->
|
||||||
#insert default style
|
#insert default style
|
||||||
insertCSS(coreStyle.css).attr('data-notify-style', 'core')
|
insertCSS(coreStyle.css).attr('id', 'core-notify')
|
||||||
|
|
||||||
#watch all notifications clicks
|
#watch all notifications clicks
|
||||||
$(document).on 'click', ".#{pluginClassName}-wrapper", ->
|
$(document).on 'click notify-hide', ".#{pluginClassName}-wrapper", (e) ->
|
||||||
inst = $(@).data pluginClassName
|
inst = $(@).data pluginClassName
|
||||||
return unless inst
|
if inst and (inst.options.clickToHide or e.type is 'notify-hide')
|
||||||
if inst.elem
|
|
||||||
inst.show false
|
inst.show false
|
||||||
else
|
|
||||||
inst.destroy()
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user