minor fixes, doc updates

This commit is contained in:
Jaime Pillora
2013-06-12 13:28:47 +10:00
parent 9bd9e58fec
commit 9275312b03
6 changed files with 49 additions and 33 deletions
+6 -7
View File
@@ -144,6 +144,7 @@ addStyle = (name, def) ->
insertCSS = (cssText) ->
elem = createElem("style")
elem.attr 'type', 'text/css'
$("head").append elem
try
elem.html cssText
@@ -158,6 +159,7 @@ insertCSS = (cssText) ->
#overridable options
pluginOptions =
clickToHide: true
autoHide: true
autoHideDelay: 5000
arrowShow: true
@@ -519,19 +521,16 @@ $.fn[pluginName] = (data, options) ->
@
#extra methods
$.extend $[pluginName], { defaults, addStyle, pluginOptions, getStyle }
$.extend $[pluginName], { defaults, addStyle, pluginOptions, getStyle, insertCSS }
#when ready
$ ->
#insert default style
insertCSS(coreStyle.css).attr('data-notify-style', 'core')
insertCSS(coreStyle.css).attr('id', 'core-notify')
#watch all notifications clicks
$(document).on 'click', ".#{pluginClassName}-wrapper", ->
$(document).on 'click notify-hide', ".#{pluginClassName}-wrapper", (e) ->
inst = $(@).data pluginClassName
return unless inst
if inst.elem
if inst and (inst.options.clickToHide or e.type is 'notify-hide')
inst.show false
else
inst.destroy()