1234567891011 |
- /*
- * # Fomantic UI - 2.8.4
- * https://github.com/fomantic/Fomantic-UI
- * http://fomantic-ui.com/
- *
- * Copyright 2014 Contributors
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
- !function(y,k,e,S){"use strict";y.isFunction=y.isFunction||function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},k=void 0!==k&&k.Math==Math?k:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),y.fn.nag=function(u){var d,e=y(this),f=e.selector||"",m=(new Date).getTime(),p=[],h=u,b="string"==typeof h,v=[].slice.call(arguments,1);return e.each(function(){var r,t=y.isPlainObject(u)?y.extend(!0,{},y.fn.nag.settings,u):y.extend({},y.fn.nag.settings),e=t.selector,c=t.error,o=t.namespace,n="."+o,i=o+"-module",s=y(this),a=t.context?y(t.context):y("body"),l=this,g=s.data(i);r={initialize:function(){r.verbose("Initializing element"),s.on("click"+n,e.close,r.dismiss).data(i,r),t.detachable&&s.parent()[0]!==a[0]&&s.detach().prependTo(a),0<t.displayTime&&setTimeout(r.hide,t.displayTime),r.show()},destroy:function(){r.verbose("Destroying instance"),s.removeData(i).off(n)},show:function(){r.should.show()&&!s.is(":visible")&&(r.debug("Showing nag",t.animation.show),"fade"==t.animation.show?s.fadeIn(t.duration,t.easing):s.slideDown(t.duration,t.easing))},hide:function(){r.debug("Showing nag",t.animation.hide),"fade"==t.animation.show?s.fadeIn(t.duration,t.easing):s.slideUp(t.duration,t.easing)},onHide:function(){r.debug("Removing nag",t.animation.hide),s.remove(),t.onHide&&t.onHide()},dismiss:function(e){t.storageMethod&&r.storage.set(t.key,t.value),r.hide(),e.stopImmediatePropagation(),e.preventDefault()},should:{show:function(){return t.persist?(r.debug("Persistent nag is set, can show nag"),!0):r.storage.get(t.key)!=t.value.toString()?(r.debug("Stored value is not set, can show nag",r.storage.get(t.key)),!0):(r.debug("Stored value is set, cannot show nag",r.storage.get(t.key)),!1)}},get:{storageOptions:function(){var e={};return t.expires&&(e.expires=t.expires),t.domain&&(e.domain=t.domain),t.path&&(e.path=t.path),e}},clear:function(){r.storage.remove(t.key)},storage:{set:function(e,o){var n=r.get.storageOptions();if("localstorage"==t.storageMethod&&k.localStorage!==S)k.localStorage.setItem(e,o),r.debug("Value stored using local storage",e,o);else if("sessionstorage"==t.storageMethod&&k.sessionStorage!==S)k.sessionStorage.setItem(e,o),r.debug("Value stored using session storage",e,o);else{if(y.cookie===S)return void r.error(c.noCookieStorage);y.cookie(e,o,n),r.debug("Value stored using cookie",e,o,n)}},get:function(e,o){var n;return"localstorage"==t.storageMethod&&k.localStorage!==S?n=k.localStorage.getItem(e):"sessionstorage"==t.storageMethod&&k.sessionStorage!==S?n=k.sessionStorage.getItem(e):y.cookie!==S?n=y.cookie(e):r.error(c.noCookieStorage),"undefined"!=n&&"null"!=n&&n!==S&&null!==n||(n=S),n},remove:function(e){var o=r.get.storageOptions();"localstorage"==t.storageMethod&&k.localStorage!==S?k.localStorage.removeItem(e):"sessionstorage"==t.storageMethod&&k.sessionStorage!==S?k.sessionStorage.removeItem(e):y.cookie!==S?y.removeCookie(e,o):r.error(c.noStorage)}},setting:function(e,o){if(r.debug("Changing setting",e,o),y.isPlainObject(e))y.extend(!0,t,e);else{if(o===S)return t[e];y.isPlainObject(t[e])?y.extend(!0,t[e],o):t[e]=o}},internal:function(e,o){if(y.isPlainObject(e))y.extend(!0,r,e);else{if(o===S)return r[e];r[e]=o}},debug:function(){!t.silent&&t.debug&&(t.performance?r.performance.log(arguments):(r.debug=Function.prototype.bind.call(console.info,console,t.name+":"),r.debug.apply(console,arguments)))},verbose:function(){!t.silent&&t.verbose&&t.debug&&(t.performance?r.performance.log(arguments):(r.verbose=Function.prototype.bind.call(console.info,console,t.name+":"),r.verbose.apply(console,arguments)))},error:function(){t.silent||(r.error=Function.prototype.bind.call(console.error,console,t.name+":"),r.error.apply(console,arguments))},performance:{log:function(e){var o,n;t.performance&&(n=(o=(new Date).getTime())-(m||o),m=o,p.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:l,"Execution Time":n})),clearTimeout(r.performance.timer),r.performance.timer=setTimeout(r.performance.display,500)},display:function(){var e=t.name+":",n=0;m=!1,clearTimeout(r.performance.timer),y.each(p,function(e,o){n+=o["Execution Time"]}),e+=" "+n+"ms",f&&(e+=" '"+f+"'"),(console.group!==S||console.table!==S)&&0<p.length&&(console.groupCollapsed(e),console.table?console.table(p):y.each(p,function(e,o){console.log(o.Name+": "+o["Execution Time"]+"ms")}),console.groupEnd()),p=[]}},invoke:function(t,e,o){var i,s,n,a=g;return e=e||v,o=l||o,"string"==typeof t&&a!==S&&(t=t.split(/[\. ]/),i=t.length-1,y.each(t,function(e,o){var n=e!=i?o+t[e+1].charAt(0).toUpperCase()+t[e+1].slice(1):t;if(y.isPlainObject(a[n])&&e!=i)a=a[n];else{if(a[n]!==S)return s=a[n],!1;if(!y.isPlainObject(a[o])||e==i)return a[o]!==S?s=a[o]:r.error(c.method,t),!1;a=a[o]}})),y.isFunction(s)?n=s.apply(o,e):s!==S&&(n=s),Array.isArray(d)?d.push(n):d!==S?d=[d,n]:n!==S&&(d=n),s}},b?(g===S&&r.initialize(),r.invoke(h)):(g!==S&&g.invoke("destroy"),r.initialize())}),d!==S?d:this},y.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(){}},y.extend(y.easing,{easeOutQuad:function(e,o,n,t,i){return-t*(o/=i)*(o-2)+n}})}(jQuery,window,document);
|