Changes

MediaWiki:Common.js

2,557 bytes added, 12:47, 9 March 2017
no edit summary
$( createCollapseButtons );
 
 
/*!
* @preserve
* riveted.js | v0.6.1
* Copyright (c) 2016 Rob Flaherty (@robflaherty)
* Licensed under the MIT license
*/
!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof module&&module.exports?module.exports=n():e.riveted=n()}(this,function(){var e=function(){function e(e){e=e||{},p=parseInt(e.reportInterval,10)||5,g=parseInt(e.idleTimeout,10)||30,k=e.gaGlobal||"ga","function"==typeof window[k]&&(w=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(I=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(h=!0),T="gaTracker"in e&&"string"==typeof e.gaTracker?e.gaTracker+".send":"send","function"==typeof e.eventHandler&&(s=e.eventHandler),"function"==typeof e.userTimingHandler&&(m=e.userTimingHandler),y="nonInteraction"in e&&(e.nonInteraction===!1||"false"===e.nonInteraction)?!1:!0,t(document,"keydown",v),t(document,"click",v),t(window,"mousemove",n(v,500)),t(window,"scroll",n(v,500)),t(document,"visibilitychange",o),t(document,"webkitvisibilitychange",o)}function n(e,n){var t,i,o,a=null,r=0,u=function(){r=new Date,a=null,o=e.apply(t,i)};return function(){var c=new Date;r||(r=c);var d=n-(c-r);return t=this,i=arguments,0>=d?(clearTimeout(a),a=null,r=c,o=e.apply(t,i)):a||(a=setTimeout(u,d)),o}}function t(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent?e.attachEvent("on"+n,t):e["on"+n]=t}function i(){clearTimeout(H),r()}function o(){(document.hidden||document.webkitHidden)&&i()}function a(){_+=1,_>0&&_%p===0&&s(_)}function r(){b=!0,clearInterval(E)}function u(){i(),L=!0}function c(){L=!1}function d(){b=!1,clearInterval(E),E=setInterval(a,1e3)}function l(){var e=new Date,n=e-D;R=!0,m(n),E=setInterval(a,1e3)}function f(){D=new Date,_=0,R=!1,b=!1,clearInterval(E),clearTimeout(H)}function v(){L||(R||l(),b&&d(),clearTimeout(H),H=setTimeout(i,1e3*g+100))}var s,m,p,g,y,w,I,T,h,k,R=!1,b=!1,L=!1,_=0,D=new Date,E=null,H=null;return m=function(e){h?dataLayer.push({event:"RivetedTiming",eventCategory:"Riveted",timingVar:"First Interaction",timingValue:e}):(w&&window[k](T,"timing","Riveted","First Interaction",e),I&&_gaq.push(["_trackTiming","Riveted","First Interaction",e,null,100]))},s=function(e){h?dataLayer.push({event:"Riveted",eventCategory:"Riveted",eventAction:"Time Spent",eventLabel:e,eventValue:p,eventNonInteraction:y}):(w&&window[k](T,"event","Riveted","Time Spent",e.toString(),p,{nonInteraction:y}),I&&_gaq.push(["_trackEvent","Riveted","Time Spent",e.toString(),p,y]))},{init:e,trigger:v,setIdle:i,on:c,off:u,reset:f}}();return e});
4,913
edits