MediaWiki:Vector.js

$(function{if($("a[href*=#]:not([href=#])").click(function{if(location.pathname.replace(/^\//,"")==this.pathname.replace(/^\//,"")&&location.hostname==this.hostname){var t=$(this.hash);if(t=t.length?t:$("[name="+this.hash.slice(1)+"]"),t.length)return $("html,body").animate({scrollTop:t.offset.top-150},1e3),!1}}),$(location.href.split("#")[1])){var t=$("#"+location.href.split("#")[1]);if(t.length)return $("html,body").animate({scrollTop:t.offset.top-125},1e3),!1}Waves.attach("#mw-navigation li"),Waves.attach(".editButtons input"),Waves.attach(".editButtons span"),Waves.attach(".vectorMenu li"),Waves.attach(".toctoggle"),Waves.attach(".toc li"),Waves.attach(".thumb",["waves-image"]),Waves.attach(".thumbinner",["waves-image"]),Waves.attach(".infobox-table-img",["waves-image"]),Waves.attach(".mw-editsection a",["waves-circle"]),Waves.attach(".oo-ui-buttonElement-button",["waves-light"]),Waves.attach(".suggestions"),Waves.attach(".mw-ui-button",["waves-light"]),Waves.init}),$(window).load(function{}),function(t,e){"use strict";"function"==typeof define&&define.amd?define([],function{return e.apply(t)}):"object"==typeof exports?module.exports=e.call(t):t.Waves=e.call(t)}("object"==typeof global?global:this,function{"use strict";function t(t){return null!==t&&t===t.window}function e(e){return t(e)?e:9===e.nodeType&&e.defaultView}function n(t){var e=typeof t;return"function"===e||"object"===e&&!!t}function a(t){return n(t)&&t.nodeType>0}function o(t){var e=f.call(t);return"[object String]"===e?d(t):n(t)&&/^\[object (Array|HTMLCollection|NodeList|Object)\]$/.test(e)&&t.hasOwnProperty("length")?t:a(t)?[t]:[]}function i(t){var n,a,o={top:0,left:0},i=t&&t.ownerDocument;return n=i.documentElement,"undefined"!=typeof t.getBoundingClientRect&&(o=t.getBoundingClientRect),a=e(i),{top:o.top+a.pageYOffset-n.clientTop,left:o.left+a.pageXOffset-n.clientLeft}}function r(t){var e="";for(var n in t)t.hasOwnProperty(n)&&(e+=n+":"+t[n]+";");return e}function s(t,e,n){if(n){n.classList.remove("waves-rippling");var a=n.getAttribute("data-x"),o=n.getAttribute("data-y"),i=n.getAttribute("data-scale"),s=n.getAttribute("data-translate"),u=Date.now-Number(n.getAttribute("data-hold")),c=350-u;0>c&&(c=0),"mousemove"===t.type&&(c=150);var l="mousemove"===t.type?2500:m.duration;setTimeout(function{var t={top:o+"px",left:a+"px",opacity:"0","-webkit-transition-duration":l+"ms","-moz-transition-duration":l+"ms","-o-transition-duration":l+"ms","transition-duration":l+"ms","-webkit-transform":i+" "+s,"-moz-transform":i+" "+s,"-ms-transform":i+" "+s,"-o-transform":i+" "+s,transform:i+" "+s};n.setAttribute("style",r(t)),setTimeout(function{try{e.removeChild(n)}catch(t){return!1}},l)},c)}}function u(t){if(p.allowEvent(t)===!1)return null;for(var e=null,n=t.target||t.srcElement;n.parentElement;){if(!(n instanceof SVGElement)&&n.classList.contains("waves-effect")){e=n;break}n=n.parentElement}return e}function c(t){var e=u(t);if(null!==e){if(e.disabled||e.getAttribute("disabled")||e.classList.contains("disabled"))return;if(p.registerEvent(t),"touchstart"===t.type&&m.delay){var n=!1,a=setTimeout(function{a=null,m.show(t,e)},m.delay),o=function(o){a&&(clearTimeout(a),a=null,m.show(t,e)),n||(n=!0,m.hide(o,e)),r},i=function(t){a&&(clearTimeout(a),a=null),o(t),r};e.addEventListener("touchmove",i,!1),e.addEventListener("touchend",o,!1),e.addEventListener("touchcancel",o,!1);var r=function{e.removeEventListener("touchmove",i),e.removeEventListener("touchend",o),e.removeEventListener("touchcancel",o)}}else m.show(t,e),v&&(e.addEventListener("touchend",m.hide,!1),e.addEventListener("touchcancel",m.hide,!1)),e.addEventListener("mouseup",m.hide,!1),e.addEventListener("mouseleave",m.hide,!1)}}var l=l||{},d=document.querySelectorAll.bind(document),f=Object.prototype.toString,v="ontouchstart"in window,m={duration:750,delay:200,show:function(t,e,n){if(2===t.button)return!1;e=e||this;var a=document.createElement("div");a.className="waves-ripple waves-rippling",e.appendChild(a);var o=i(e),s=0,u=0;"touches"in t&&t.touches.length?(s=t.touches[0].pageY-o.top,u=t.touches[0].pageX-o.left):(s=t.pageY-o.top,u=t.pageX-o.left),u=u>=0?u:0,s=s>=0?s:0;var c="scale("+e.clientWidth/100*3+")",l="translate(0,0)";n&&(l="translate("+n.x+"px, "+n.y+"px)"),a.setAttribute("data-hold",Date.now),a.setAttribute("data-x",u),a.setAttribute("data-y",s),a.setAttribute("data-scale",c),a.setAttribute("data-translate",l);var d={top:s+"px",left:u+"px"};a.classList.add("waves-notransition"),a.setAttribute("style",r(d)),a.classList.remove("waves-notransition"),d["-webkit-transform"]=c+" "+l,d["-moz-transform"]=c+" "+l,d["-ms-transform"]=c+" "+l,d["-o-transform"]=c+" "+l,d.transform=c+" "+l,d.opacity="1";var f="mousemove"===t.type?2500:m.duration;d["-webkit-transition-duration"]=f+"ms",d["-moz-transition-duration"]=f+"ms",d["-o-transition-duration"]=f+"ms",d["transition-duration"]=f+"ms",a.setAttribute("style",r(d))},hide:function(t,e){e=e||this;for(var n=e.getElementsByClassName("waves-rippling"),a=0,o=n.length;o>a;a++)s(t,e,n[a]);v&&(e.removeEventListener("touchend",m.hide),e.removeEventListener("touchcancel",m.hide)),e.removeEventListener("mouseup",m.hide),e.removeEventListener("mouseleave",m.hide)}},h={input:function(t){var e=t.parentNode;if("i"!==e.tagName.toLowerCase||!e.classList.contains("waves-effect")){var n=document.createElement("i");n.className=t.className+" waves-input-wrapper",t.className="waves-button-input",e.replaceChild(n,t),n.appendChild(t);var a=window.getComputedStyle(t,null),o=a.color,i=a.backgroundColor;n.setAttribute("style","color:"+o+";background:"+i),t.setAttribute("style","background-color:rgba(0,0,0,0);")}},img:function(t){var e=t.parentNode;if("i"!==e.tagName.toLowerCase||!e.classList.contains("waves-effect")){var n=document.createElement("i");e.replaceChild(n,t),n.appendChild(t)}}},p={touches:0,allowEvent:function(t){var e=!0;return/^(mousedown|mousemove)$/.test(t.type)&&p.touches&&(e=!1),e},registerEvent:function(t){var e=t.type;"touchstart"===e?p.touches+=1:/^(touchend|touchcancel)$/.test(e)&&setTimeout(function{p.touches&&(p.touches-=1)},500)}};return l.init=function(t){var e=document.body;t=t||{},"duration"in t&&(m.duration=t.duration),"delay"in t&&(m.delay=t.delay),v&&(e.addEventListener("touchstart",c,!1),e.addEventListener("touchcancel",p.registerEvent,!1),e.addEventListener("touchend",p.registerEvent,!1)),e.addEventListener("mousedown",c,!1)},l.attach=function(t,e){t=o(t),"[object Array]"===f.call(e)&&(e=e.join(" ")),e=e?" "+e:"";for(var n,a,i=0,r=t.length;r>i;i++)n=t[i],a=n.tagName.toLowerCase,-1!==["input","img"].indexOf(a)&&(h[a](n),n=n.parentElement),-1===n.className.indexOf("waves-effect")&&(n.className+=" waves-effect"+e)},l.ripple=function(t,e){t=o(t);var n=t.length;if(e=e||{},e.wait=e.wait||0,e.position=e.position||null,n)for(var a,r,s,u={},c=0,l={type:"mousedown",button:1},d=function(t,e){return function{m.hide(t,e)}};n>c;c++)if(a=t[c],r=e.position||{x:a.clientWidth/2,y:a.clientHeight/2},s=i(a),u.x=s.left+r.x,u.y=s.top+r.y,l.pageX=u.x,l.pageY=u.y,m.show(l,a),e.wait>=0&&null!==e.wait){var f={type:"mouseup",button:1};setTimeout(d(f,a),e.wait)}},l.calm=function(t){t=o(t);for(var e={type:"mouseup",button:1},n=0,a=t.length;a>n;n++)m.hide(e,t[n])},l.displayEffect=function(t){console.error("Waves.displayEffect has been deprecated and will be removed in future version. Please use Waves.init to initialize Waves effect"),l.init(t)},l});