You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
6.4 KiB
11 lines
6.4 KiB
/*
|
|
* # Semantic UI
|
|
* https://github.com/Semantic-Org/Semantic-UI
|
|
* http://beta.semantic-ui.com/
|
|
*
|
|
* Copyright 2014 Contributors
|
|
* Released under the MIT license
|
|
* http://opensource.org/licenses/MIT
|
|
*
|
|
*/
|
|
!function(e,o,n,t){"use strict";e.fn.nag=function(n){var i,r=e(this),a=r.selector||"",s=(new Date).getTime(),c=[],u=arguments[0],l="string"==typeof u,d=[].slice.call(arguments,1);return r.each(function(){{var r,g=e.isPlainObject(n)?e.extend(!0,{},e.fn.nag.settings,n):e.extend({},e.fn.nag.settings),m=(g.className,g.selector),f=g.error,p=g.namespace,h="."+p,v=p+"-module",b=e(this),y=b.find(m.close),k=e(g.context?g.context:"body"),x=this,w=b.data(v);o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||o.msRequestAnimationFrame||function(e){setTimeout(e,0)}}r={initialize:function(){r.verbose("Initializing element"),b.data(v,r),y.on("click"+h,r.dismiss),g.detachable&&b.parent()[0]!==k[0]&&b.detach().prependTo(k),g.displayTime>0&&setTimeout(r.hide,g.displayTime),r.show()},destroy:function(){r.verbose("Destroying instance"),b.removeData(v).off(h)},show:function(){r.should.show()&&!b.is(":visible")&&(r.debug("Showing nag",g.animation.show),"fade"==g.animation.show?b.fadeIn(g.duration,g.easing):b.slideDown(g.duration,g.easing))},hide:function(){r.debug("Showing nag",g.animation.hide),"fade"==g.animation.show?b.fadeIn(g.duration,g.easing):b.slideUp(g.duration,g.easing)},onHide:function(){r.debug("Removing nag",g.animation.hide),b.remove(),g.onHide&&g.onHide()},dismiss:function(e){g.storageMethod&&r.storage.set(g.key,g.value),r.hide(),e.stopImmediatePropagation(),e.preventDefault()},should:{show:function(){return g.persist?(r.debug("Persistent nag is set, can show nag"),!0):r.storage.get(g.key)!=g.value.toString()?(r.debug("Stored value is not set, can show nag",r.storage.get(g.key)),!0):(r.debug("Stored value is set, cannot show nag",r.storage.get(g.key)),!1)}},get:{storageOptions:function(){var e={};return g.expires&&(e.expires=g.expires),g.domain&&(e.domain=g.domain),g.path&&(e.path=g.path),e}},clear:function(){r.storage.remove(g.key)},storage:{set:function(n,i){var a=r.get.storageOptions();if("localstorage"==g.storageMethod&&o.localStorage!==t)o.localStorage.setItem(n,i),r.debug("Value stored using local storage",n,i);else{if(e.cookie===t)return void r.error(f.noCookieStorage);e.cookie(n,i,a),r.debug("Value stored using cookie",n,i,a)}},get:function(n){var i;return"localstorage"==g.storageMethod&&o.localStorage!==t?i=o.localStorage.getItem(n):e.cookie!==t?i=e.cookie(n):r.error(f.noCookieStorage),("undefined"==i||"null"==i||i===t||null===i)&&(i=t),i},remove:function(n){var i=r.get.storageOptions();"local"==g.storageMethod&&o.store!==t?o.localStorage.removeItem(n):e.cookie!==t?e.removeCookie(n,i):r.error(f.noStorage)}},setting:function(o,n){if(r.debug("Changing setting",o,n),e.isPlainObject(o))e.extend(!0,g,o);else{if(n===t)return g[o];g[o]=n}},internal:function(o,n){if(e.isPlainObject(o))e.extend(!0,r,o);else{if(n===t)return r[o];r[o]=n}},debug:function(){g.debug&&(g.performance?r.performance.log(arguments):(r.debug=Function.prototype.bind.call(console.info,console,g.name+":"),r.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?r.performance.log(arguments):(r.verbose=Function.prototype.bind.call(console.info,console,g.name+":"),r.verbose.apply(console,arguments)))},error:function(){r.error=Function.prototype.bind.call(console.error,console,g.name+":"),r.error.apply(console,arguments)},performance:{log:function(e){var o,n,t;g.performance&&(o=(new Date).getTime(),t=s||o,n=o-t,s=o,c.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:x,"Execution Time":n})),clearTimeout(r.performance.timer),r.performance.timer=setTimeout(r.performance.display,100)},display:function(){var o=g.name+":",n=0;s=!1,clearTimeout(r.performance.timer),e.each(c,function(e,o){n+=o["Execution Time"]}),o+=" "+n+"ms",a&&(o+=" '"+a+"'"),(console.group!==t||console.table!==t)&&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,n,a){var s,c,u,l=w;return n=n||d,a=x||a,"string"==typeof o&&l!==t&&(o=o.split(/[\. ]/),s=o.length-1,e.each(o,function(n,i){var a=n!=s?i+o[n+1].charAt(0).toUpperCase()+o[n+1].slice(1):o;if(e.isPlainObject(l[a])&&n!=s)l=l[a];else{if(l[a]!==t)return c=l[a],!1;if(!e.isPlainObject(l[i])||n==s)return l[i]!==t?(c=l[i],!1):(r.error(f.method,o),!1);l=l[i]}})),e.isFunction(c)?u=c.apply(a,n):c!==t&&(u=c),e.isArray(i)?i.push(u):i!==t?i=[i,u]:u!==t&&(i=u),c}},l?(w===t&&r.initialize(),r.invoke(u)):(w!==t&&r.destroy(),r.initialize())}),i!==t?i:this},e.fn.nag.settings={name:"Nag",debug:!1,verbose:!0,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:{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),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){function o(e){return s.raw?e:encodeURIComponent(e)}function n(e){return s.raw?e:decodeURIComponent(e)}function t(e){return o(s.json?JSON.stringify(e):String(e))}function i(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(a," ")),s.json?JSON.parse(e):e}catch(o){}}function r(o,n){var t=s.raw?o:i(o);return e.isFunction(n)?n(t):t}var a=/\+/g,s=e.cookie=function(i,a,c){if(void 0!==a&&!e.isFunction(a)){if(c=e.extend({},s.defaults,c),"number"==typeof c.expires){var u=c.expires,l=c.expires=new Date;l.setTime(+l+864e5*u)}return document.cookie=[o(i),"=",t(a),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":""].join("")}for(var d=i?void 0:{},g=document.cookie?document.cookie.split("; "):[],m=0,f=g.length;f>m;m++){var p=g[m].split("="),h=n(p.shift()),v=p.join("=");if(i&&i===h){d=r(v,a);break}i||void 0===(v=r(v))||(d[h]=v)}return d};s.defaults={},e.removeCookie=function(o,n){return void 0===e.cookie(o)?!1:(e.cookie(o,"",e.extend({},n,{expires:-1})),!e.cookie(o))}});
|