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.2 KiB
1 lines
3.2 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("mouseenter mouseleave",n.event.hover).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.followLink&&o.on("mouseenter mouseleave",n.event.hover).on("click",n.followLink),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)},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(){e.storageMethod&&n.storage.set(e.storedKey,e.storedValue),n.hide()},should:{show:function(){return n.storage.get(e.storedKey)==e.storedValue?!1:!0},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}},followLink:function(){a.fn.followLink!==d&&o.followLink()},storage:{set:function(b,c){"local"==e.storageMethod&&store!==d?store.set(b,c):a.cookie!==d?a.cookie(b,c):n.error(e.errors.noStorage)},get:function(b){return"local"==e.storageMethod&&store!==d?store.get(b):a.cookie!==d?a.cookie(b):(n.error(e.errors.noStorage),void 0)}},event:{hover:function(){a(this).toggleClass(s.hover)},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={displayTime:0,followLink:!0,position:"fixed",scrollBarWidth:18,storageMethod:"cookie",storedKey:"nag",storedValue:"dismiss",sticky:!0,lag:0,context:b,errors:{noStorage:"Neither $.cookie or store is defined. A storage solution is required for storing state",followLink:"Follow link is set but the plugin is not included"},className:{bottom:"bottom",hover:"hover",fixed:"fixed"},selector:{close:".icon.close"},speed:500,easing:"easeOutQuad"}}(jQuery,window,document);
|