From 3b6840957e2f11b6fd29dc522de716fc215462e7 Mon Sep 17 00:00:00 2001 From: Pusher Robot Date: Sun, 26 Jun 2016 18:58:01 -0400 Subject: [PATCH] Updated component to version 2.2.0 --- composer.json | 2 +- index.js | 37 +++++++++++++++++++++++++++++-------- nag.css | 3 +-- nag.js | 37 +++++++++++++++++++++++++++++-------- nag.min.css | 3 +-- nag.min.js | 5 ++--- package.js | 2 +- package.json | 2 +- 8 files changed, 65 insertions(+), 26 deletions(-) diff --git a/composer.json b/composer.json index 4bb80cc..aefe7c9 100755 --- a/composer.json +++ b/composer.json @@ -15,5 +15,5 @@ "framework" ], "license": "MIT", - "version": "2.1.7" + "version": "2.2.0" } \ No newline at end of file diff --git a/index.js b/index.js index 2cc31c5..099c7e1 100755 --- a/index.js +++ b/index.js @@ -1,9 +1,8 @@ /*! - * # Semantic UI 2.1.7 - Nag + * # Semantic UI 2.2.0 - Nag * http://github.com/semantic-org/semantic-ui/ * * - * Copyright 2015 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * @@ -13,6 +12,13 @@ "use strict"; +window = (typeof window != 'undefined' && window.Math == Math) + ? window + : (typeof self != 'undefined' && self.Math == Math) + ? self + : Function('return this')() +; + var _module = module; module.exports = function(parameters) { var @@ -256,7 +262,12 @@ module.exports = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; @@ -274,7 +285,7 @@ module.exports = function(parameters) { } }, debug: function() { - if(settings.debug) { + if(!settings.silent && settings.debug) { if(settings.performance) { module.performance.log(arguments); } @@ -285,7 +296,7 @@ module.exports = function(parameters) { } }, verbose: function() { - if(settings.verbose && settings.debug) { + if(!settings.silent && settings.verbose && settings.debug) { if(settings.performance) { module.performance.log(arguments); } @@ -296,8 +307,10 @@ module.exports = function(parameters) { } }, error: function() { - module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); - module.error.apply(console, arguments); + if(!settings.silent) { + module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); + module.error.apply(console, arguments); + } }, performance: { log: function(message) { @@ -431,13 +444,14 @@ _module.exports.settings = { name : 'Nag', + silent : false, debug : false, verbose : false, performance : true, namespace : 'Nag', - // allows cookie to be overriden + // allows cookie to be overridden persist : false, // set to zero to require manually dismissal, otherwise hides on its own @@ -484,4 +498,11 @@ _module.exports.settings = { }; +// Adds easing +$.extend( $.easing, { + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + } +}); + })( require("jquery"), window, document ); diff --git a/nag.css b/nag.css index 3626c1f..3c8815c 100755 --- a/nag.css +++ b/nag.css @@ -1,9 +1,8 @@ /*! - * # Semantic UI 2.1.7 - Nag + * # Semantic UI 2.2.0 - Nag * http://github.com/semantic-org/semantic-ui/ * * - * Copyright 2015 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * diff --git a/nag.js b/nag.js index de1d003..c8b0a25 100755 --- a/nag.js +++ b/nag.js @@ -1,9 +1,8 @@ /*! - * # Semantic UI 2.1.7 - Nag + * # Semantic UI 2.2.0 - Nag * http://github.com/semantic-org/semantic-ui/ * * - * Copyright 2015 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * @@ -13,6 +12,13 @@ "use strict"; +window = (typeof window != 'undefined' && window.Math == Math) + ? window + : (typeof self != 'undefined' && self.Math == Math) + ? self + : Function('return this')() +; + $.fn.nag = function(parameters) { var $allModules = $(this), @@ -255,7 +261,12 @@ $.fn.nag = function(parameters) { $.extend(true, settings, name); } else if(value !== undefined) { - settings[name] = value; + if($.isPlainObject(settings[name])) { + $.extend(true, settings[name], value); + } + else { + settings[name] = value; + } } else { return settings[name]; @@ -273,7 +284,7 @@ $.fn.nag = function(parameters) { } }, debug: function() { - if(settings.debug) { + if(!settings.silent && settings.debug) { if(settings.performance) { module.performance.log(arguments); } @@ -284,7 +295,7 @@ $.fn.nag = function(parameters) { } }, verbose: function() { - if(settings.verbose && settings.debug) { + if(!settings.silent && settings.verbose && settings.debug) { if(settings.performance) { module.performance.log(arguments); } @@ -295,8 +306,10 @@ $.fn.nag = function(parameters) { } }, error: function() { - module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); - module.error.apply(console, arguments); + if(!settings.silent) { + module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); + module.error.apply(console, arguments); + } }, performance: { log: function(message) { @@ -430,13 +443,14 @@ $.fn.nag.settings = { name : 'Nag', + silent : false, debug : false, verbose : false, performance : true, namespace : 'Nag', - // allows cookie to be overriden + // allows cookie to be overridden persist : false, // set to zero to require manually dismissal, otherwise hides on its own @@ -483,4 +497,11 @@ $.fn.nag.settings = { }; +// Adds easing +$.extend( $.easing, { + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + } +}); + })( jQuery, window, document ); diff --git a/nag.min.css b/nag.min.css index 113813c..a4f2539 100755 --- a/nag.min.css +++ b/nag.min.css @@ -1,9 +1,8 @@ /*! - * # Semantic UI 2.1.7 - Nag + * # Semantic UI 2.2.0 - Nag * http://github.com/semantic-org/semantic-ui/ * * - * Copyright 2015 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * diff --git a/nag.min.js b/nag.min.js index 274ff47..a4db7d7 100755 --- a/nag.min.js +++ b/nag.min.js @@ -1,11 +1,10 @@ /*! - * # Semantic UI 2.1.7 - Nag + * # Semantic UI 2.2.0 - Nag * http://github.com/semantic-org/semantic-ui/ * * - * Copyright 2015 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ -!function(e,o,t,n){"use strict";e.fn.nag=function(t){var i,s=e(this),a=s.selector||"",r=(new Date).getTime(),c=[],l=arguments[0],g="string"==typeof l,u=[].slice.call(arguments,1);return s.each(function(){var s,d=e.isPlainObject(t)?e.extend(!0,{},e.fn.nag.settings,t):e.extend({},e.fn.nag.settings),m=(d.className,d.selector),f=d.error,p=d.namespace,h="."+p,b=p+"-module",v=e(this),y=(v.find(m.close),e(d.context?d.context:"body")),k=this,S=v.data(b);o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||o.msRequestAnimationFrame||function(e){setTimeout(e,0)};s={initialize:function(){s.verbose("Initializing element"),v.on("click"+h,m.close,s.dismiss).data(b,s),d.detachable&&v.parent()[0]!==y[0]&&v.detach().prependTo(y),d.displayTime>0&&setTimeout(s.hide,d.displayTime),s.show()},destroy:function(){s.verbose("Destroying instance"),v.removeData(b).off(h)},show:function(){s.should.show()&&!v.is(":visible")&&(s.debug("Showing nag",d.animation.show),"fade"==d.animation.show?v.fadeIn(d.duration,d.easing):v.slideDown(d.duration,d.easing))},hide:function(){s.debug("Showing nag",d.animation.hide),"fade"==d.animation.show?v.fadeIn(d.duration,d.easing):v.slideUp(d.duration,d.easing)},onHide:function(){s.debug("Removing nag",d.animation.hide),v.remove(),d.onHide&&d.onHide()},dismiss:function(e){d.storageMethod&&s.storage.set(d.key,d.value),s.hide(),e.stopImmediatePropagation(),e.preventDefault()},should:{show:function(){return d.persist?(s.debug("Persistent nag is set, can show nag"),!0):s.storage.get(d.key)!=d.value.toString()?(s.debug("Stored value is not set, can show nag",s.storage.get(d.key)),!0):(s.debug("Stored value is set, cannot show nag",s.storage.get(d.key)),!1)}},get:{storageOptions:function(){var e={};return d.expires&&(e.expires=d.expires),d.domain&&(e.domain=d.domain),d.path&&(e.path=d.path),e}},clear:function(){s.storage.remove(d.key)},storage:{set:function(t,i){var a=s.get.storageOptions();if("localstorage"==d.storageMethod&&o.localStorage!==n)o.localStorage.setItem(t,i),s.debug("Value stored using local storage",t,i);else if("sessionstorage"==d.storageMethod&&o.sessionStorage!==n)o.sessionStorage.setItem(t,i),s.debug("Value stored using session storage",t,i);else{if(e.cookie===n)return void s.error(f.noCookieStorage);e.cookie(t,i,a),s.debug("Value stored using cookie",t,i,a)}},get:function(t,i){var a;return"localstorage"==d.storageMethod&&o.localStorage!==n?a=o.localStorage.getItem(t):"sessionstorage"==d.storageMethod&&o.sessionStorage!==n?a=o.sessionStorage.getItem(t):e.cookie!==n?a=e.cookie(t):s.error(f.noCookieStorage),("undefined"==a||"null"==a||a===n||null===a)&&(a=n),a},remove:function(t){var i=s.get.storageOptions();"localstorage"==d.storageMethod&&o.localStorage!==n?o.localStorage.removeItem(t):"sessionstorage"==d.storageMethod&&o.sessionStorage!==n?o.sessionStorage.removeItem(t):e.cookie!==n?e.removeCookie(t,i):s.error(f.noStorage)}},setting:function(o,t){if(s.debug("Changing setting",o,t),e.isPlainObject(o))e.extend(!0,d,o);else{if(t===n)return d[o];d[o]=t}},internal:function(o,t){if(e.isPlainObject(o))e.extend(!0,s,o);else{if(t===n)return s[o];s[o]=t}},debug:function(){d.debug&&(d.performance?s.performance.log(arguments):(s.debug=Function.prototype.bind.call(console.info,console,d.name+":"),s.debug.apply(console,arguments)))},verbose:function(){d.verbose&&d.debug&&(d.performance?s.performance.log(arguments):(s.verbose=Function.prototype.bind.call(console.info,console,d.name+":"),s.verbose.apply(console,arguments)))},error:function(){s.error=Function.prototype.bind.call(console.error,console,d.name+":"),s.error.apply(console,arguments)},performance:{log:function(e){var o,t,n;d.performance&&(o=(new Date).getTime(),n=r||o,t=o-n,r=o,c.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:k,"Execution Time":t})),clearTimeout(s.performance.timer),s.performance.timer=setTimeout(s.performance.display,500)},display:function(){var o=d.name+":",t=0;r=!1,clearTimeout(s.performance.timer),e.each(c,function(e,o){t+=o["Execution Time"]}),o+=" "+t+"ms",a&&(o+=" '"+a+"'"),(console.group!==n||console.table!==n)&&c.length>0&&(console.groupCollapsed(o),console.table?console.table(c):e.each(c,function(e,o){console.log(o.Name+": "+o["Execution Time"]+"ms")}),console.groupEnd()),c=[]}},invoke:function(o,t,a){var r,c,l,g=S;return t=t||u,a=k||a,"string"==typeof o&&g!==n&&(o=o.split(/[\. ]/),r=o.length-1,e.each(o,function(t,i){var a=t!=r?i+o[t+1].charAt(0).toUpperCase()+o[t+1].slice(1):o;if(e.isPlainObject(g[a])&&t!=r)g=g[a];else{if(g[a]!==n)return c=g[a],!1;if(!e.isPlainObject(g[i])||t==r)return g[i]!==n?(c=g[i],!1):(s.error(f.method,o),!1);g=g[i]}})),e.isFunction(c)?l=c.apply(a,t):c!==n&&(l=c),e.isArray(i)?i.push(l):i!==n?i=[i,l]:l!==n&&(i=l),c}},g?(S===n&&s.initialize(),s.invoke(l)):(S!==n&&S.invoke("destroy"),s.initialize())}),i!==n?i:this},e.fn.nag.settings={name:"Nag",debug:!1,verbose:!1,performance:!0,namespace:"Nag",persist:!1,displayTime:0,animation:{show:"slide",hide:"slide"},context:!1,detachable:!1,expires:30,domain:!1,path:"/",storageMethod:"cookie",key:"nag",value:"dismiss",error:{noCookieStorage:"$.cookie is not included. A storage solution is required.",noStorage:"Neither $.cookie or store is defined. A storage solution is required for storing state",method:"The method you called is not defined."},className:{bottom:"bottom",fixed:"fixed"},selector:{close:".close.icon"},speed:500,easing:"easeOutQuad",onHide:function(){}}}(jQuery,window,document); \ No newline at end of file +!function(e,o,t,n){"use strict";o="undefined"!=typeof o&&o.Math==Math?o:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.nag=function(t){var i,s=e(this),a=s.selector||"",r=(new Date).getTime(),l=[],c=arguments[0],g="string"==typeof c,u=[].slice.call(arguments,1);return s.each(function(){var s,d=e.isPlainObject(t)?e.extend(!0,{},e.fn.nag.settings,t):e.extend({},e.fn.nag.settings),m=(d.className,d.selector),f=d.error,p=d.namespace,h="."+p,b=p+"-module",v=e(this),y=(v.find(m.close),e(d.context?d.context:"body")),k=this,S=v.data(b);o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||o.msRequestAnimationFrame||function(e){setTimeout(e,0)};s={initialize:function(){s.verbose("Initializing element"),v.on("click"+h,m.close,s.dismiss).data(b,s),d.detachable&&v.parent()[0]!==y[0]&&v.detach().prependTo(y),d.displayTime>0&&setTimeout(s.hide,d.displayTime),s.show()},destroy:function(){s.verbose("Destroying instance"),v.removeData(b).off(h)},show:function(){s.should.show()&&!v.is(":visible")&&(s.debug("Showing nag",d.animation.show),"fade"==d.animation.show?v.fadeIn(d.duration,d.easing):v.slideDown(d.duration,d.easing))},hide:function(){s.debug("Showing nag",d.animation.hide),"fade"==d.animation.show?v.fadeIn(d.duration,d.easing):v.slideUp(d.duration,d.easing)},onHide:function(){s.debug("Removing nag",d.animation.hide),v.remove(),d.onHide&&d.onHide()},dismiss:function(e){d.storageMethod&&s.storage.set(d.key,d.value),s.hide(),e.stopImmediatePropagation(),e.preventDefault()},should:{show:function(){return d.persist?(s.debug("Persistent nag is set, can show nag"),!0):s.storage.get(d.key)!=d.value.toString()?(s.debug("Stored value is not set, can show nag",s.storage.get(d.key)),!0):(s.debug("Stored value is set, cannot show nag",s.storage.get(d.key)),!1)}},get:{storageOptions:function(){var e={};return d.expires&&(e.expires=d.expires),d.domain&&(e.domain=d.domain),d.path&&(e.path=d.path),e}},clear:function(){s.storage.remove(d.key)},storage:{set:function(t,i){var a=s.get.storageOptions();if("localstorage"==d.storageMethod&&o.localStorage!==n)o.localStorage.setItem(t,i),s.debug("Value stored using local storage",t,i);else if("sessionstorage"==d.storageMethod&&o.sessionStorage!==n)o.sessionStorage.setItem(t,i),s.debug("Value stored using session storage",t,i);else{if(e.cookie===n)return void s.error(f.noCookieStorage);e.cookie(t,i,a),s.debug("Value stored using cookie",t,i,a)}},get:function(t,i){var a;return"localstorage"==d.storageMethod&&o.localStorage!==n?a=o.localStorage.getItem(t):"sessionstorage"==d.storageMethod&&o.sessionStorage!==n?a=o.sessionStorage.getItem(t):e.cookie!==n?a=e.cookie(t):s.error(f.noCookieStorage),("undefined"==a||"null"==a||a===n||null===a)&&(a=n),a},remove:function(t){var i=s.get.storageOptions();"localstorage"==d.storageMethod&&o.localStorage!==n?o.localStorage.removeItem(t):"sessionstorage"==d.storageMethod&&o.sessionStorage!==n?o.sessionStorage.removeItem(t):e.cookie!==n?e.removeCookie(t,i):s.error(f.noStorage)}},setting:function(o,t){if(s.debug("Changing setting",o,t),e.isPlainObject(o))e.extend(!0,d,o);else{if(t===n)return d[o];e.isPlainObject(d[o])?e.extend(!0,d[o],t):d[o]=t}},internal:function(o,t){if(e.isPlainObject(o))e.extend(!0,s,o);else{if(t===n)return s[o];s[o]=t}},debug:function(){!d.silent&&d.debug&&(d.performance?s.performance.log(arguments):(s.debug=Function.prototype.bind.call(console.info,console,d.name+":"),s.debug.apply(console,arguments)))},verbose:function(){!d.silent&&d.verbose&&d.debug&&(d.performance?s.performance.log(arguments):(s.verbose=Function.prototype.bind.call(console.info,console,d.name+":"),s.verbose.apply(console,arguments)))},error:function(){d.silent||(s.error=Function.prototype.bind.call(console.error,console,d.name+":"),s.error.apply(console,arguments))},performance:{log:function(e){var o,t,n;d.performance&&(o=(new Date).getTime(),n=r||o,t=o-n,r=o,l.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:k,"Execution Time":t})),clearTimeout(s.performance.timer),s.performance.timer=setTimeout(s.performance.display,500)},display:function(){var o=d.name+":",t=0;r=!1,clearTimeout(s.performance.timer),e.each(l,function(e,o){t+=o["Execution Time"]}),o+=" "+t+"ms",a&&(o+=" '"+a+"'"),(console.group!==n||console.table!==n)&&l.length>0&&(console.groupCollapsed(o),console.table?console.table(l):e.each(l,function(e,o){console.log(o.Name+": "+o["Execution Time"]+"ms")}),console.groupEnd()),l=[]}},invoke:function(o,t,a){var r,l,c,g=S;return t=t||u,a=k||a,"string"==typeof o&&g!==n&&(o=o.split(/[\. ]/),r=o.length-1,e.each(o,function(t,i){var a=t!=r?i+o[t+1].charAt(0).toUpperCase()+o[t+1].slice(1):o;if(e.isPlainObject(g[a])&&t!=r)g=g[a];else{if(g[a]!==n)return l=g[a],!1;if(!e.isPlainObject(g[i])||t==r)return g[i]!==n?(l=g[i],!1):(s.error(f.method,o),!1);g=g[i]}})),e.isFunction(l)?c=l.apply(a,t):l!==n&&(c=l),e.isArray(i)?i.push(c):i!==n?i=[i,c]:c!==n&&(i=c),l}},g?(S===n&&s.initialize(),s.invoke(c)):(S!==n&&S.invoke("destroy"),s.initialize())}),i!==n?i:this},e.fn.nag.settings={name:"Nag",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"Nag",persist:!1,displayTime:0,animation:{show:"slide",hide:"slide"},context:!1,detachable:!1,expires:30,domain:!1,path:"/",storageMethod:"cookie",key:"nag",value:"dismiss",error:{noCookieStorage:"$.cookie is not included. A storage solution is required.",noStorage:"Neither $.cookie or store is defined. A storage solution is required for storing state",method:"The method you called is not defined."},className:{bottom:"bottom",fixed:"fixed"},selector:{close:".close.icon"},speed:500,easing:"easeOutQuad",onHide:function(){}},e.extend(e.easing,{easeOutQuad:function(e,o,t,n,i){return-n*(o/=i)*(o-2)+t}})}(jQuery,window,document); \ No newline at end of file diff --git a/package.js b/package.js index 3d892ce..55c1197 100755 --- a/package.js +++ b/package.js @@ -2,7 +2,7 @@ Package.describe({ name : 'semantic:ui-nag', summary : 'Semantic UI - Nag: Single component release', - version : '2.1.7', + version : '2.2.0', git : 'git://github.com/Semantic-Org/UI-Nag.git', }); diff --git a/package.json b/package.json index cd8189a..fd4e77e 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "semantic-ui-nag", - "version": "2.1.7", + "version": "2.2.0", "title": "Semantic UI - Nag", "description": "Single component release of nag", "homepage": "http://www.semantic-ui.com",