This commit is contained in:
Jaime Pillora
2013-06-11 18:28:39 +10:00
parent 6cff558639
commit 9bd9e58fec
5 changed files with 41 additions and 11 deletions
+14 -3
View File
@@ -1,11 +1,11 @@
/** Notify.js - v0.0.1 - 2013/06/06
/** Notify.js - v0.0.1 - 2013/06/11
* http://notifyjs.com/
* Copyright (c) 2013 Jaime Pillora - MIT
*/
(function(window,document,undefined) {
'use strict';
var Notification, addStyle, coreStyle, createElem, defaults, getAnchorElement, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
var Notification, addStyle, coreStyle, createElem, defaults, getAnchorElement, getStyle, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
pluginName = 'notify';
@@ -61,8 +61,18 @@ stylePrefixes = {
"border-radius": ["-webkit-", "-moz-"]
};
getStyle = function(name) {
return styles[name];
};
addStyle = function(name, def) {
var cssText, _ref;
if (!name) {
throw "Missing Style name";
}
if (!def) {
throw "Missing Style definition";
}
if ((_ref = styles[name]) != null ? _ref.cssElem : void 0) {
if (window.console) {
console.warn("" + pluginName + ": overwriting style '" + name + "'");
@@ -466,7 +476,8 @@ $.fn[pluginName] = function(data, options) {
$.extend($[pluginName], {
defaults: defaults,
addStyle: addStyle,
pluginOptions: pluginOptions
pluginOptions: pluginOptions,
getStyle: getStyle
});
$(function() {
+2 -2
View File
File diff suppressed because one or more lines are too long
+14 -3
View File
@@ -1,11 +1,11 @@
/** Notify.js - v0.0.1 - 2013/06/06
/** Notify.js - v0.0.1 - 2013/06/11
* http://notifyjs.com/
* Copyright (c) 2013 Jaime Pillora - MIT
*/
(function(window,document,undefined) {
'use strict';
var Notification, addStyle, coreStyle, createElem, defaults, getAnchorElement, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
var Notification, addStyle, coreStyle, createElem, defaults, getAnchorElement, getStyle, globalAnchors, hAligns, incr, inherit, insertCSS, mainPositions, opposites, parsePosition, pluginClassName, pluginName, pluginOptions, positions, realign, stylePrefixes, styles, vAligns,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
pluginName = 'notify';
@@ -61,8 +61,18 @@ stylePrefixes = {
"border-radius": ["-webkit-", "-moz-"]
};
getStyle = function(name) {
return styles[name];
};
addStyle = function(name, def) {
var cssText, _ref;
if (!name) {
throw "Missing Style name";
}
if (!def) {
throw "Missing Style definition";
}
if ((_ref = styles[name]) != null ? _ref.cssElem : void 0) {
if (window.console) {
console.warn("" + pluginName + ": overwriting style '" + name + "'");
@@ -466,7 +476,8 @@ $.fn[pluginName] = function(data, options) {
$.extend($[pluginName], {
defaults: defaults,
addStyle: addStyle,
pluginOptions: pluginOptions
pluginOptions: pluginOptions,
getStyle: getStyle
});
$(function() {
+2 -2
View File
File diff suppressed because one or more lines are too long
+9 -1
View File
@@ -101,8 +101,16 @@ coreStyle =
stylePrefixes =
"border-radius": ["-webkit-", "-moz-"]
getStyle = (name) ->
styles[name]
addStyle = (name, def) ->
unless name
throw "Missing Style name"
unless def
throw "Missing Style definition"
if styles[name]?.cssElem
if window.console
console.warn "#{pluginName}: overwriting style '#{name}'"
@@ -511,7 +519,7 @@ $.fn[pluginName] = (data, options) ->
@
#extra methods
$.extend $[pluginName], { defaults, addStyle, pluginOptions }
$.extend $[pluginName], { defaults, addStyle, pluginOptions, getStyle }
#when ready
$ ->