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.
1 lines
3.0 KiB
1 lines
3.0 KiB
!function(a,b,c,d){a.fn.nag=function(c){var e=a.extend(!0,{},a.fn.nag.settings,c),f=arguments||!1;return a(this).each(function(){var c,g,h,i,j,k,l,m,n,o=a(this),p=o.find(e.selector.close),q=a(e.context),r=o.data("module"),s=e.className,t=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)};return n={initialize:function(){c=o.offset(),g=o.outerHeight(),h=q.outerWidth(),i=q.outerHeight(),j=q.offset(),o.data("module",n),p.on("click",n.dismiss),e.context==b&&"fixed"==e.position&&o.addClass(s.fixed),e.sticky&&("absolute"==e.position?q.on("scroll resize",n.event.scroll):a(b).on("scroll resize",n.event.scroll),a.proxy(n.event.scroll,this)()),e.displayTime>0&&setTimeout(n.hide,e.displayTime),n.should.show()?o.is(":visible")||n.show():n.hide()},refresh:function(){c=o.offset(),g=o.outerHeight(),h=q.outerWidth(),i=q.outerHeight(),j=q.offset()},show:function(){a.fn.popIn!==d?o.popIn(e.duration):o.fadeIn(e.duration,e.easing)},hide:function(){o.fadeOut(e.duration,e.easing,this.onHide)},onHide:function(){o.remove(),e.onHide&&e.onHide()},stick:function(){if(n.refresh(),"fixed"==e.position){var c=a(b).prop("pageYOffset")||a(b).scrollTop(),d=o.hasClass(s.bottom)?j.top+(i-g)-c:j.top-c;o.css({position:"fixed",top:d,left:j.left,width:h-e.scrollBarWidth})}else o.css({top:l})},unStick:function(){o.css({top:""})},dismiss:function(a){e.storageMethod&&n.storage.set(e.storedKey,e.storedValue),n.hide(),a.stopImmediatePropagation(),a.preventDefault()},should:{show:function(){return e.persist||n.storage.get(e.storedKey)!=e.storedValue?!0:!1},stick:function(){return k=q.prop("pageYOffset")||q.scrollTop(),l=o.hasClass(s.bottom)?i-o.outerHeight()+k:k,l>c.top?!0:"fixed"==e.position?!0:!1}},storage:{set:function(c,f){"local"==e.storageMethod&&b.store!==d?b.store.set(c,f):a.cookie!==d?a.cookie(c,f):n.error(e.errors.noStorage)},get:function(c){return"local"==e.storageMethod&&b.store!==d?b.store.get(c):a.cookie!==d?a.cookie(c):(n.error(e.errors.noStorage),void 0)}},event:{scroll:function(){m!==d&&clearTimeout(m),m=setTimeout(function(){n.should.stick()?t(n.stick):n.unStick()},e.lag)}},error:function(a){console.log("Nag Module:"+a)},invoke:function(b,c,f){var g;return f=f||Array.prototype.slice.call(arguments,2),"string"==typeof b&&r!==d&&(b=b.split("."),a.each(b,function(b,c){return a.isPlainObject(r[c])?(r=r[c],!0):a.isFunction(r[c])?(g=r[c],!0):(n.error(e.errors.method),!1)})),a.isFunction(g)?g.apply(c,f):g}},r!==d&&f?("invoke"==f[0]&&(f=Array.prototype.slice.call(f,1)),n.invoke(f[0],this,Array.prototype.slice.call(f,1))):(n.initialize(),void 0)}),this},a.fn.nag.settings={persist:!1,displayTime:0,position:"fixed",scrollBarWidth:18,storageMethod:"cookie",storedKey:"nag",storedValue:"dismiss",sticky:!1,lag:0,context:b,errors:{noStorage:"Neither $.cookie or store is defined. A storage solution is required for storing state"},className:{bottom:"bottom",fixed:"fixed"},selector:{close:".icon.close"},speed:500,easing:"easeOutQuad",onHide:function(){}}}(jQuery,window,document);
|