datamad2017/js/default.js

17 lines
No EOL
7.7 KiB
JavaScript

!function(a){a.fn.appear=function(h,d){var c=a.extend({data:void 0,one:!0,accX:0,accY:0},d);return this.each(function(){var e=a(this);if(e.appeared=!1,!h)return void e.trigger("appear",c.data);var k=a(window),f=function(){if(!e.is(":visible"))return void(e.appeared=!1);var f=k.scrollLeft(),b=k.scrollTop(),a=e.offset(),h=a.left,a=a.top,d=c.accX,g=c.accY,E=e.height(),F=k.height(),G=e.width(),z=k.width();b>a+E+g||a>b+F+g||f>h+G+d||h>f+z+d?e.appeared=!1:e.appeared||e.trigger("appear",c.data)},b=function(){if(e.appeared=
!0,c.one){k.unbind("scroll",f);var b=a.inArray(f,a.fn.appear.checks);0>b||a.fn.appear.checks.splice(b,1)}h.apply(this,arguments)};c.one?e.one("appear",c.data,b):e.bind("appear",c.data,b);k.scroll(f);a.fn.appear.checks.push(f);f()})};a.extend(a.fn.appear,{checks:[],timeout:null,checkAll:function(){var h=a.fn.appear.checks.length;if(0<h)for(;h--;)a.fn.appear.checks[h]()},run:function(){a.fn.appear.timeout&&clearTimeout(a.fn.appear.timeout);a.fn.appear.timeout=setTimeout(a.fn.appear.checkAll,20)}});
a.each("append prepend after before attr removeAttr addClass removeClass toggleClass remove css show hide".split(" "),function(h,d){var c=a.fn[d];c&&(a.fn[d]=function(){var e=c.apply(this,arguments);return a.fn.appear.run(),e})})}(jQuery);
!function(a){a.fn.countTo=function(h){return h=h||{},a(this).each(function(){function d(k){k=c.formatter.call(f,k,c);b.text(k)}var c=a.extend({},a.fn.countTo.defaults,{from:a(this).data("from"),to:a(this).data("to"),speed:a(this).data("speed"),refreshInterval:a(this).data("refresh-interval"),decimals:a(this).data("decimals")},h),e=Math.ceil(c.speed/c.refreshInterval),k=(c.to-c.from)/e,f=this,b=a(this),y=0,n=c.from,l=b.data("countTo")||{};b.data("countTo",l);l.interval&&clearInterval(l.interval);l.interval=
setInterval(function(){n+=k;y++;d(n);"function"==typeof c.onUpdate&&c.onUpdate.call(f,n);e>y||(b.removeData("countTo"),clearInterval(l.interval),n=c.to,"function"==typeof c.onComplete&&c.onComplete.call(f,n))},c.refreshInterval);d(n)})};a.fn.countTo.defaults={from:0,to:0,speed:1E3,refreshInterval:100,decimals:0,formatter:function(a,d){return a.toFixed(d.decimals)},onUpdate:null,onComplete:null}}(jQuery);
(function(){var a,h;a=this.jQuery||window.jQuery;h=a(window);a.fn.stick_in_parent=function(d){var c,e,k,f,b,y,n,l,p,r;null==d&&(d={});n=d.sticky_class;e=d.inner_scrolling;y=d.recalc_every;b=d.parent;f=d.offset_top;k=d.spacer;c=d.bottoming;null==f&&(f=0);null==b&&(b=void 0);null==e&&(e=!0);null==n&&(n="is_stuck");null==c&&(c=!0);l=function(g,d,l,p,z,w,v){var x,r,u,C,q,s,D,A,B,t,m;if(!g.data("sticky_kit")){g.data("sticky_kit",!0);s=g.parent();null!=b&&(s=s.closest(b));if(!s.length)throw"failed to find stick parent";
x=u=!1;(t=null!=k?k&&g.closest(k):a("<div />"))&&t.css("position",g.css("position"));D=function(){var b,a,e;b=parseInt(s.css("border-top-width"),10);a=parseInt(s.css("padding-top"),10);d=parseInt(s.css("padding-bottom"),10);l=s.offset().top+b+a;p=s.height();u&&(x=u=!1,null==k&&(g.insertAfter(t),t.detach()),g.css({position:"",top:"",width:"",bottom:""}).removeClass(n),e=!0);z=g.offset().top-parseInt(g.css("margin-top"),10)-f;w=g.outerHeight(!0);v=g.css("float");t&&t.css({width:g.outerWidth(!0),height:w,
display:g.css("display"),"vertical-align":g.css("vertical-align"),"float":v});if(e)return m()};D();if(w!==p)return C=void 0,q=f,B=y,m=function(){var b,a,m,r;null!=B&&(--B,0>=B&&(B=y,D()));m=h.scrollTop();null!=C&&(a=m-C);C=m;u?(c&&(r=m+w+q>p+l,x&&!r&&(x=!1,g.css({position:"fixed",bottom:"",top:q}).trigger("sticky_kit:unbottom"))),m<z&&(u=!1,q=f,null==k&&("left"!==v&&"right"!==v||g.insertAfter(t),t.detach()),b={position:"",width:"",top:""},g.css(b).removeClass(n).trigger("sticky_kit:unstick")),e&&
(b=h.height(),w>b&&!x&&(q-=a,q=Math.max(b-w,q),q=Math.min(f,q),u&&g.css({top:q+"px"})))):m>z&&(u=!0,b={position:"fixed",top:q},b.width="border-box"===g.css("box-sizing")?g.outerWidth()+"px":g.width()+"px",g.css(b).addClass(n),null==k&&(g.after(t),"left"!==v&&"right"!==v||t.append(g)),g.trigger("sticky_kit:stick"));if(u&&c&&(null==r&&(r=m+w+q>p+l),!x&&r))return x=!0,"static"===s.css("position")&&s.css({position:"relative"}),g.css({position:"absolute",bottom:d,top:"auto"}).trigger("sticky_kit:bottom")},
A=function(){D();return m()},r=function(){h.off("touchmove",m);h.off("scroll",m);h.off("resize",A);a(document.body).off("sticky_kit:recalc",A);g.off("sticky_kit:detach",r);g.removeData("sticky_kit");g.css({position:"",bottom:"",top:""});s.position("position","");if(u)return null==k&&("left"!==v&&"right"!==v||g.insertAfter(t),t.remove()),g.removeClass(n)},h.on("touchmove",m),h.on("scroll",m),h.on("resize",A),a(document.body).on("sticky_kit:recalc",A),g.on("sticky_kit:detach",r),setTimeout(m,0)}};p=
0;for(r=this.length;p<r;p++)d=this[p],l(a(d));return this}}).call(this);
!function(a){function h(k){var a="",b;for(b in k)k.hasOwnProperty(b)&&(a+=b+":"+k[b]+";");return a}var d=d||{},c=document.querySelectorAll.bind(document),e={duration:500,show:function(a){if(2===a.button)return!1;var f=document.createElement("div");f.className="waves-ripple";this.appendChild(f);var b,c,d,l={top:0,left:0};b=this&&this.ownerDocument;b=(c=b.documentElement,"undefined"!=typeof this.getBoundingClientRect&&(l=this.getBoundingClientRect()),d=null!==b&&b===b.window?b:9===b.nodeType&&b.defaultView,
{top:l.top+d.pageYOffset-c.clientTop,left:l.left+d.pageXOffset-c.clientLeft});d=a.pageY-b.top-45;l=a.pageX-b.left-45;c="scale("+this.clientWidth/100*2.5+")";"touches"in a&&(d=a.touches[0].pageY-b.top-45,l=a.touches[0].pageX-b.left-45);f.setAttribute("data-hold",Date.now());f.setAttribute("data-scale",c);f.setAttribute("data-x",l);f.setAttribute("data-y",d);a={top:d+"px",left:l+"px"};f.className+=" waves-notransition";f.setAttribute("style",h(a));f.className=f.className.replace("waves-notransition",
"");a["-webkit-transform"]=c;a["-moz-transform"]=c;a["-ms-transform"]=c;a["-o-transform"]=c;a.transform=c;a.opacity="1";a["-webkit-transition-duration"]=e.duration+"ms";a["-moz-transition-duration"]=e.duration+"ms";a["-o-transition-duration"]=e.duration+"ms";a["transition-duration"]=e.duration+"ms";f.setAttribute("style",h(a))},hide:function(){for(var a=this,f=(1.4*a.clientWidth,null),b=a.children.length,c=0;b>c;c++)-1===a.children[c].className.indexOf("waves-ripple")||(f=a.children[c]);if(!f)return!1;
var d=f.getAttribute("data-x"),l=f.getAttribute("data-y"),p=f.getAttribute("data-scale"),b=500-(Date.now()-Number(f.getAttribute("data-hold")));0>b&&(b=0);setTimeout(function(){f.setAttribute("style",h({top:l+"px",left:d+"px",opacity:"0","-webkit-transition-duration":e.duration+"ms","-moz-transition-duration":e.duration+"ms","-o-transition-duration":e.duration+"ms","transition-duration":e.duration+"ms","-webkit-transform":p,"-moz-transform":p,"-ms-transform":p,"-o-transform":p,transform:p}));setTimeout(function(){try{a.removeChild(f)}catch(b){return!1}},
e.duration)},b)},wrapInput:function(a){for(var f=0;f<a.length;f++){var b=a[f];if("input"===b.tagName.toLowerCase()){var c=b.parentNode;if("i"===c.tagName.toLowerCase()&&-1!==c.className.indexOf("waves-effect"))return!1;var e=document.createElement("i");e.className=b.className+" waves-input-wrapper";var d=b.getAttribute("style"),h="width:"+b.offsetWidth+"px;height:"+b.clientHeight+"px;";d||(d="");e.setAttribute("style",h+d);b.className="waves-button-input";b.removeAttribute("style");c.replaceChild(e,
b);e.appendChild(b)}}}};d.displayEffect=function(d){d=d||{};"duration"in d&&(e.duration=d.duration);e.wrapInput(c(".waves-effect"));Array.prototype.forEach.call(c(".waves-effect"),function(c){"ontouchstart"in a?(c.addEventListener("touchstart",e.show,!1),c.addEventListener("touchend",e.hide,!1),c.addEventListener("touchcancel",e.hide,!1)):(c.addEventListener("mousedown",e.show,!1),c.addEventListener("mouseup",e.hide,!1),c.addEventListener("mouseleave",e.hide,!1))})};a.Waves=d}(window);