").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n});
// Coded to Microsoft XDR spec: http://msdn.microsoft.com/en-us/library/cc288060(v=vs.85).aspx
(function($) {
"use strict";
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
$.ajaxSettings.xdr = function() {
return (window.XDomainRequest ? new window.XDomainRequest() : null);
};
// Determine support properties
(function(xdr) {
$.extend($.support, { iecors: !!xdr });
})(window.XDomainRequest);
// Create transport if the browser can provide an xdr (and fails $.support.cors)
if ($.support.iecors) {
//console.log("Adding support for iecors");
$.ajaxTransport(function(options, originalOptions, jqXHR) {
var xdr;
return {
send: function(headers, complete) {
xdr = options.xdr();
// XDR does not support custom headers
// Seems that xdr requests can get hung up indefinitely without a timeout.
xdr.timeout = options.timeout || 10000;
// IE9 has a bug that requires the xdr.onprogress method to be set. We'll just set them all, just in case.
// (http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/30ef3add-767c-4436-b8a9-f1ca19b4812e)
xdr.onload = xdr.onerror = xdr.ontimeout = xdr.onprogress = $.noop;
xdr.onload = function() {
//console.log("XDR load");
var headers = {
'Content-Type': xdr.contentType
};
complete(200, 'OK', { text: xdr.responseText }, headers);
};
if (options.xhrFields) {
if (options.xhrFields.progress) xhr.onprogress = options.xhrFields.progress;
if (options.xhrFields.error) xhr.onerror = options.xhrFields.error;
if (options.xhrFields.timeout) xhr.ontimeout = options.xhrFields.timeout;
// XDR does not support withCredentials
} else {
xdr.onprogress = function() {
//console.log("XDR progress");
};
xdr.onerror = function() {
//console.log("XDR error");
complete(404, "Not Found");
};
xdr.ontimeout = function() {
//console.log("XDR timeout");
complete(408, "Request Timeout");
};
}
// TODO: If you're getting "Aborted" requests in IE9, try uncommenting this block.
// A few people reported 'jQuery.noop' wasn't good enough, but I can't figure out why.
xdr.onprogress = function() {
//console.log("XDR progress");
};
xdr.open(options.type, options.url);
if (options.hasContent && options.data) {
xdr.send(options.data);
} else {
xdr.send();
}
},
abort: function () {
//console.log("XDR abort");
return xdr && xdr.abort();
}
};
});
}
})(jQuery);/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
*/
;window.mx_Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d',a,""].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return J("flexWrap")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){return!!a.WebGLRenderingContext},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var L in s)C(s,L)&&(x=L.toLowerCase(),e[x]=s[L](),v.push((e[x]?"":"no-")+x));return e.input||K(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},D(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;fa?Math.ceil(a):Math.floor(a)}function l(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.lengthd;d++)(c&&a[d]!==b[d]||!c&&t(a[d])!==t(b[d]))&&g++;return g+f}function q(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=Zb[a]||$b[b]||b}return a}function r(a){var b,c,d={};for(c in a)a.hasOwnProperty(c)&&(b=q(c),b&&(d[b]=a[c]));return d}function s(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}ib[b]=function(e,f){var g,h,i=ib.fn._lang[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=ib().utc().set(d,a);return i.call(ib.fn._lang,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function t(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function u(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function v(a,b,c){return $(ib([a,11,31+b-c]),b,c).week}function w(a){return x(a)?366:365}function x(a){return a%4===0&&a%100!==0||a%400===0}function y(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[pb]<0||a._a[pb]>11?pb:a._a[qb]<1||a._a[qb]>u(a._a[ob],a._a[pb])?qb:a._a[rb]<0||a._a[rb]>23?rb:a._a[sb]<0||a._a[sb]>59?sb:a._a[tb]<0||a._a[tb]>59?tb:a._a[ub]<0||a._a[ub]>999?ub:-1,a._pf._overflowDayOfYear&&(ob>b||b>qb)&&(b=qb),a._pf.overflow=b)}function z(a){return null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}function A(a){return a?a.toLowerCase().replace("_","-"):a}function B(a,b){return b._isUTC?ib(a).zone(b._offset||0):ib(a).local()}function C(a,b){return b.abbr=a,vb[a]||(vb[a]=new f),vb[a].set(b),vb[a]}function D(a){delete vb[a]}function E(a){var b,c,d,e,f=0,g=function(a){if(!vb[a]&&xb)try{require("./lang/"+a)}catch(b){}return vb[a]};if(!a)return ib.fn._lang;if(!n(a)){if(c=g(a))return c;a=[a]}for(;f0;){if(c=g(e.slice(0,b).join("-")))return c;if(d&&d.length>=b&&p(e,d,!0)>=b-1)break;b--}f++}return ib.fn._lang}function F(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function G(a){var b,c,d=a.match(Bb);for(b=0,c=d.length;c>b;b++)d[b]=cc[d[b]]?cc[d[b]]:F(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function H(a,b){return a.isValid()?(b=I(b,a.lang()),_b[b]||(_b[b]=G(b)),_b[b](a)):a.lang().invalidDate()}function I(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Cb.lastIndex=0;d>=0&&Cb.test(a);)a=a.replace(Cb,c),Cb.lastIndex=0,d-=1;return a}function J(a,b){var c,d=b._strict;switch(a){case"Q":return Nb;case"DDDD":return Pb;case"YYYY":case"GGGG":case"gggg":return d?Qb:Fb;case"Y":case"G":case"g":return Sb;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?Rb:Gb;case"S":if(d)return Nb;case"SS":if(d)return Ob;case"SSS":if(d)return Pb;case"DDD":return Eb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Ib;case"a":case"A":return E(b._l)._meridiemParse;case"X":return Lb;case"Z":case"ZZ":return Jb;case"T":return Kb;case"SSSS":return Hb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?Ob:Db;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Db;case"Do":return Mb;default:return c=new RegExp(R(Q(a.replace("\\","")),"i"))}}function K(a){a=a||"";var b=a.match(Jb)||[],c=b[b.length-1]||[],d=(c+"").match(Xb)||["-",0,0],e=+(60*d[1])+t(d[2]);return"+"===d[0]?-e:e}function L(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[pb]=3*(t(b)-1));break;case"M":case"MM":null!=b&&(e[pb]=t(b)-1);break;case"MMM":case"MMMM":d=E(c._l).monthsParse(b),null!=d?e[pb]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[qb]=t(b));break;case"Do":null!=b&&(e[qb]=t(parseInt(b,10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=t(b));break;case"YY":e[ob]=ib.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[ob]=t(b);break;case"a":case"A":c._isPm=E(c._l).isPM(b);break;case"H":case"HH":case"h":case"hh":e[rb]=t(b);break;case"m":case"mm":e[sb]=t(b);break;case"s":case"ss":e[tb]=t(b);break;case"S":case"SS":case"SSS":case"SSSS":e[ub]=t(1e3*("0."+b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=K(b);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":a=a.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=b)}}function M(a){var b,c,d,e,f,g,h,i,j,k,l=[];if(!a._d){for(d=O(a),a._w&&null==a._a[qb]&&null==a._a[pb]&&(f=function(b){var c=parseInt(b,10);return b?b.length<3?c>68?1900+c:2e3+c:c:null==a._a[ob]?ib().weekYear():a._a[ob]},g=a._w,null!=g.GG||null!=g.W||null!=g.E?h=_(f(g.GG),g.W||1,g.E,4,1):(i=E(a._l),j=null!=g.d?X(g.d,i):null!=g.e?parseInt(g.e,10)+i._week.dow:0,k=parseInt(g.w,10)||1,null!=g.d&&jw(e)&&(a._pf._overflowDayOfYear=!0),c=W(e,0,a._dayOfYear),a._a[pb]=c.getUTCMonth(),a._a[qb]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=l[b]=d[b];for(;7>b;b++)a._a[b]=l[b]=null==a._a[b]?2===b?1:0:a._a[b];l[rb]+=t((a._tzm||0)/60),l[sb]+=t((a._tzm||0)%60),a._d=(a._useUTC?W:V).apply(null,l)}}function N(a){var b;a._d||(b=r(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],M(a))}function O(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function P(a){a._a=[],a._pf.empty=!0;var b,c,d,e,f,g=E(a._l),h=""+a._i,i=h.length,j=0;for(d=I(a._f,g).match(Bb)||[],b=0;b0&&a._pf.unusedInput.push(f),h=h.slice(h.indexOf(c)+c.length),j+=c.length),cc[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),L(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=i-j,h.length>0&&a._pf.unusedInput.push(h),a._isPm&&a._a[rb]<12&&(a._a[rb]+=12),a._isPm===!1&&12===a._a[rb]&&(a._a[rb]=0),M(a),y(a)}function Q(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function R(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function S(a){var c,d,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;fg)&&(e=g,d=c));i(a,d||c)}function T(a){var b,c,d=a._i,e=Tb.exec(d);if(e){for(a._pf.iso=!0,b=0,c=Vb.length;c>b;b++)if(Vb[b][1].exec(d)){a._f=Vb[b][0]+(e[6]||" ");break}for(b=0,c=Wb.length;c>b;b++)if(Wb[b][1].exec(d)){a._f+=Wb[b][0];break}d.match(Jb)&&(a._f+="Z"),P(a)}else ib.createFromInputFallback(a)}function U(b){var c=b._i,d=yb.exec(c);c===a?b._d=new Date:d?b._d=new Date(+d[1]):"string"==typeof c?T(b):n(c)?(b._a=c.slice(0),M(b)):o(c)?b._d=new Date(+c):"object"==typeof c?N(b):"number"==typeof c?b._d=new Date(c):ib.createFromInputFallback(b)}function V(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function W(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function X(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function Y(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function Z(a,b,c){var d=nb(Math.abs(a)/1e3),e=nb(d/60),f=nb(e/60),g=nb(f/24),h=nb(g/365),i=45>d&&["s",d]||1===e&&["m"]||45>e&&["mm",e]||1===f&&["h"]||22>f&&["hh",f]||1===g&&["d"]||25>=g&&["dd",g]||45>=g&&["M"]||345>g&&["MM",nb(g/30)]||1===h&&["y"]||["yy",h];return i[2]=b,i[3]=a>0,i[4]=c,Y.apply({},i)}function $(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=ib(a).add("d",f),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function _(a,b,c,d,e){var f,g,h=W(a,0,1).getUTCDay();return c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:w(a-1)+g}}function ab(b){var c=b._i,d=b._f;return null===c||d===a&&""===c?ib.invalid({nullInput:!0}):("string"==typeof c&&(b._i=c=E().preparse(c)),ib.isMoment(c)?(b=j(c),b._d=new Date(+c._d)):d?n(d)?S(b):P(b):U(b),new g(b))}function bb(a,b){var c;return"string"==typeof b&&(b=a.lang().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),u(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function cb(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function db(a,b,c){return"Month"===b?bb(a,c):a._d["set"+(a._isUTC?"UTC":"")+b](c)}function eb(a,b){return function(c){return null!=c?(db(this,a,c),ib.updateOffset(this,b),this):cb(this,a)}}function fb(a){ib.duration.fn[a]=function(){return this._data[a]}}function gb(a,b){ib.duration.fn["as"+a]=function(){return+this/b}}function hb(a){"undefined"==typeof ender&&(jb=mb.moment,mb.moment=a?c("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",ib):ib)}for(var ib,jb,kb,lb="2.6.0",mb="undefined"!=typeof global?global:this,nb=Math.round,ob=0,pb=1,qb=2,rb=3,sb=4,tb=5,ub=6,vb={},wb={_isAMomentObject:null,_i:null,_f:null,_l:null,_strict:null,_isUTC:null,_offset:null,_pf:null,_lang:null},xb="undefined"!=typeof module&&module.exports,yb=/^\/?Date\((\-?\d+)/i,zb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Ab=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Bb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,Cb=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,Db=/\d\d?/,Eb=/\d{1,3}/,Fb=/\d{1,4}/,Gb=/[+\-]?\d{1,6}/,Hb=/\d+/,Ib=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Jb=/Z|[\+\-]\d\d:?\d\d/gi,Kb=/T/i,Lb=/[\+\-]?\d+(\.\d{1,3})?/,Mb=/\d{1,2}/,Nb=/\d/,Ob=/\d\d/,Pb=/\d{3}/,Qb=/\d{4}/,Rb=/[+-]?\d{6}/,Sb=/[+-]?\d+/,Tb=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ub="YYYY-MM-DDTHH:mm:ssZ",Vb=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],Wb=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Xb=/([\+\-]|\d\d)/gi,Yb=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),Zb={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},$b={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},_b={},ac="DDD w W M D d".split(" "),bc="M D H h m s w W".split(" "),cc={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return l(this.year()%100,2)},YYYY:function(){return l(this.year(),4)},YYYYY:function(){return l(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+l(Math.abs(a),6)},gg:function(){return l(this.weekYear()%100,2)},gggg:function(){return l(this.weekYear(),4)},ggggg:function(){return l(this.weekYear(),5)},GG:function(){return l(this.isoWeekYear()%100,2)},GGGG:function(){return l(this.isoWeekYear(),4)},GGGGG:function(){return l(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return t(this.milliseconds()/100)},SS:function(){return l(t(this.milliseconds()/10),2)},SSS:function(){return l(this.milliseconds(),3)},SSSS:function(){return l(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+l(t(a/60),2)+":"+l(t(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";return 0>a&&(a=-a,b="-"),b+l(t(a/60),2)+l(t(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},dc=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];ac.length;)kb=ac.pop(),cc[kb+"o"]=e(cc[kb],kb);for(;bc.length;)kb=bc.pop(),cc[kb+kb]=d(cc[kb],2);for(cc.DDDD=d(cc.DDD,3),i(f.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=ib.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=new RegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=ib([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"==typeof c?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return $(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),ib=function(c,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=c,g._f=d,g._l=e,g._strict=f,g._isUTC=!1,g._pf=b(),ab(g)},ib.suppressDeprecationWarnings=!1,ib.createFromInputFallback=c("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i)}),ib.utc=function(c,d,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=c,g._f=d,g._strict=f,g._pf=b(),ab(g).utc()},ib.unix=function(a){return ib(1e3*a)},ib.duration=function(a,b){var c,d,e,f=a,g=null;return ib.isDuration(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(f={},b?f[b]=a:f.milliseconds=a):(g=zb.exec(a))?(c="-"===g[1]?-1:1,f={y:0,d:t(g[qb])*c,h:t(g[rb])*c,m:t(g[sb])*c,s:t(g[tb])*c,ms:t(g[ub])*c}):(g=Ab.exec(a))&&(c="-"===g[1]?-1:1,e=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*c},f={y:e(g[2]),M:e(g[3]),d:e(g[4]),h:e(g[5]),m:e(g[6]),s:e(g[7]),w:e(g[8])}),d=new h(f),ib.isDuration(a)&&a.hasOwnProperty("_lang")&&(d._lang=a._lang),d},ib.version=lb,ib.defaultFormat=Ub,ib.momentProperties=wb,ib.updateOffset=function(){},ib.lang=function(a,b){var c;return a?(b?C(A(a),b):null===b?(D(a),a="en"):vb[a]||E(a),c=ib.duration.fn._lang=ib.fn._lang=E(a),c._abbr):ib.fn._lang._abbr},ib.langData=function(a){return a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr),E(a)},ib.isMoment=function(a){return a instanceof g||null!=a&&a.hasOwnProperty("_isAMomentObject")},ib.isDuration=function(a){return a instanceof h},kb=dc.length-1;kb>=0;--kb)s(dc[kb]);ib.normalizeUnits=function(a){return q(a)},ib.invalid=function(a){var b=ib.utc(0/0);return null!=a?i(b._pf,a):b._pf.userInvalidated=!0,b},ib.parseZone=function(){return ib.apply(null,arguments).parseZone()},ib.parseTwoDigitYear=function(a){return t(a)+(t(a)>68?1900:2e3)},i(ib.fn=g.prototype,{clone:function(){return ib(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=ib(this).utc();return 00:!1},parsingFlags:function(){return i({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(a){var b=H(this,a||ib.defaultFormat);return this.lang().postformat(b)},add:function(a,b){var c;return c="string"==typeof a?ib.duration(+b,a):ib.duration(a,b),m(this,c,1),this},subtract:function(a,b){var c;return c="string"==typeof a?ib.duration(+b,a):ib.duration(a,b),m(this,c,-1),this},diff:function(a,b,c){var d,e,f=B(a,this),g=6e4*(this.zone()-f.zone());return b=q(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+f.daysInMonth()),e=12*(this.year()-f.year())+(this.month()-f.month()),e+=(this-ib(this).startOf("month")-(f-ib(f).startOf("month")))/d,e-=6e4*(this.zone()-ib(this).startOf("month").zone()-(f.zone()-ib(f).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:k(e)},from:function(a,b){return ib.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(ib(),a)},calendar:function(){var a=B(ib(),this).startOf("day"),b=this.diff(a,"days",!0),c=-6>b?"sameElse":-1>b?"lastWeek":0>b?"lastDay":1>b?"sameDay":2>b?"nextDay":7>b?"nextWeek":"sameElse";return this.format(this.lang().calendar(c,this))},isLeapYear:function(){return x(this.year())},isDST:function(){return this.zone()+ib(a).startOf(b)},isBefore:function(a,b){return b="undefined"!=typeof b?b:"millisecond",+this.clone().startOf(b)<+ib(a).startOf(b)},isSame:function(a,b){return b=b||"ms",+this.clone().startOf(b)===+B(a,this).startOf(b)},min:function(a){return a=ib.apply(null,arguments),this>a?this:a},max:function(a){return a=ib.apply(null,arguments),a>this?this:a},zone:function(a,b){var c=this._offset||0;return null==a?this._isUTC?c:this._d.getTimezoneOffset():("string"==typeof a&&(a=K(a)),Math.abs(a)<16&&(a=60*a),this._offset=a,this._isUTC=!0,c!==a&&(!b||this._changeInProgress?m(this,ib.duration(c-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,ib.updateOffset(this,!0),this._changeInProgress=null)),this)},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.zone(this._tzm):"string"==typeof this._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){return a=a?ib(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){return u(this.year(),this.month())},dayOfYear:function(a){var b=nb((ib(this).startOf("day")-ib(this).startOf("year"))/864e5)+1;return null==a?b:this.add("d",a-b)},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=$(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?b:this.add("y",a-b)},isoWeekYear:function(a){var b=$(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=$(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return v(this.year(),1,4)},weeksInYear:function(){var a=this._lang._week;return v(this.year(),a.dow,a.doy)},get:function(a){return a=q(a),this[a]()},set:function(a,b){return a=q(a),"function"==typeof this[a]&&this[a](b),this},lang:function(b){return b===a?this._lang:(this._lang=E(b),this)}}),ib.fn.millisecond=ib.fn.milliseconds=eb("Milliseconds",!1),ib.fn.second=ib.fn.seconds=eb("Seconds",!1),ib.fn.minute=ib.fn.minutes=eb("Minutes",!1),ib.fn.hour=ib.fn.hours=eb("Hours",!0),ib.fn.date=eb("Date",!0),ib.fn.dates=c("dates accessor is deprecated. Use date instead.",eb("Date",!0)),ib.fn.year=eb("FullYear",!0),ib.fn.years=c("years accessor is deprecated. Use year instead.",eb("FullYear",!0)),ib.fn.days=ib.fn.day,ib.fn.months=ib.fn.month,ib.fn.weeks=ib.fn.week,ib.fn.isoWeeks=ib.fn.isoWeek,ib.fn.quarters=ib.fn.quarter,ib.fn.toJSON=ib.fn.toISOString,i(ib.duration.fn=h.prototype,{_bubble:function(){var a,b,c,d,e=this._milliseconds,f=this._days,g=this._months,h=this._data;h.milliseconds=e%1e3,a=k(e/1e3),h.seconds=a%60,b=k(a/60),h.minutes=b%60,c=k(b/60),h.hours=c%24,f+=k(c/24),h.days=f%30,g+=k(f/30),h.months=g%12,d=k(g/12),h.years=d},weeks:function(){return k(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*t(this._months/12)},humanize:function(a){var b=+this,c=Z(b,!a,this.lang());return a&&(c=this.lang().pastFuture(b,c)),this.lang().postformat(c)},add:function(a,b){var c=ib.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=ib.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=q(a),this[a.toLowerCase()+"s"]()},as:function(a){return a=q(a),this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:ib.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}});for(kb in Yb)Yb.hasOwnProperty(kb)&&(gb(kb,Yb[kb]),fb(kb.toLowerCase()));gb("Weeks",6048e5),ib.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},ib.lang("en",{ordinal:function(a){var b=a%10,c=1===t(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),function(a){a(ib)}(function(a){return a.lang("ar-ma",{months:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),monthsShort:"يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),weekdays:"الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){return a.lang("ar",{months:"يناير/ كانون الثاني_فبراير/ شباط_مارس/ آذار_أبريل/ نيسان_مايو/ أيار_يونيو/ حزيران_يوليو/ تموز_أغسطس/ آب_سبتمبر/ أيلول_أكتوبر/ تشرين الأول_نوفمبر/ تشرين الثاني_ديسمبر/ كانون الأول".split("_"),monthsShort:"يناير/ كانون الثاني_فبراير/ شباط_مارس/ آذار_أبريل/ نيسان_مايو/ أيار_يونيو/ حزيران_يوليو/ تموز_أغسطس/ آب_سبتمبر/ أيلول_أكتوبر/ تشرين الأول_نوفمبر/ تشرين الثاني_ديسمبر/ كانون الأول".split("_"),weekdays:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysShort:"الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),weekdaysMin:"ح_ن_ث_ر_خ_ج_س".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[اليوم على الساعة] LT",nextDay:"[غدا على الساعة] LT",nextWeek:"dddd [على الساعة] LT",lastDay:"[أمس على الساعة] LT",lastWeek:"dddd [على الساعة] LT",sameElse:"L"},relativeTime:{future:"في %s",past:"منذ %s",s:"ثوان",m:"دقيقة",mm:"%d دقائق",h:"ساعة",hh:"%d ساعات",d:"يوم",dd:"%d أيام",M:"شهر",MM:"%d أشهر",y:"سنة",yy:"%d سنوات"},week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){return a.lang("bg",{months:"януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),monthsShort:"янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),weekdays:"неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),weekdaysShort:"нед_пон_вто_сря_чет_пет_съб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"H:mm",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Днес в] LT",nextDay:"[Утре в] LT",nextWeek:"dddd [в] LT",lastDay:"[Вчера в] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[В изминалата] dddd [в] LT";case 1:case 2:case 4:case 5:return"[В изминалия] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"след %s",past:"преди %s",s:"няколко секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дни",M:"месец",MM:"%d месеца",y:"година",yy:"%d години"},ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(b){function c(a,b,c){var d={mm:"munutenn",MM:"miz",dd:"devezh"};return a+" "+f(d[c],a)}function d(a){switch(e(a)){case 1:case 3:case 4:case 5:case 9:return a+" bloaz";default:return a+" vloaz"}}function e(a){return a>9?e(a%10):a}function f(a,b){return 2===b?g(a):a}function g(b){var c={m:"v",b:"v",d:"z"};return c[b.charAt(0)]===a?b:c[b.charAt(0)]+b.substring(1)}return b.lang("br",{months:"Genver_C'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),monthsShort:"Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),weekdays:"Sul_Lun_Meurzh_Merc'her_Yaou_Gwener_Sadorn".split("_"),weekdaysShort:"Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),weekdaysMin:"Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),longDateFormat:{LT:"h[e]mm A",L:"DD/MM/YYYY",LL:"D [a viz] MMMM YYYY",LLL:"D [a viz] MMMM YYYY LT",LLLL:"dddd, D [a viz] MMMM YYYY LT"},calendar:{sameDay:"[Hiziv da] LT",nextDay:"[Warc'hoazh da] LT",nextWeek:"dddd [da] LT",lastDay:"[Dec'h da] LT",lastWeek:"dddd [paset da] LT",sameElse:"L"},relativeTime:{future:"a-benn %s",past:"%s 'zo",s:"un nebeud segondennoù",m:"ur vunutenn",mm:c,h:"un eur",hh:"%d eur",d:"un devezh",dd:c,M:"ur miz",MM:c,y:"ur bloaz",yy:d},ordinal:function(a){var b=1===a?"añ":"vet";return a+b},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";
case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}return a.lang("bs",{months:"januar_februar_mart_april_maj_juni_juli_avgust_septembar_oktobar_novembar_decembar".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:b,mm:b,h:b,hh:b,d:"dan",dd:b,M:"mjesec",MM:b,y:"godinu",yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("ca",{months:"gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),monthsShort:"gen._febr._mar._abr._mai._jun._jul._ag._set._oct._nov._des.".split("_"),weekdays:"diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),weekdaysShort:"dg._dl._dt._dc._dj._dv._ds.".split("_"),weekdaysMin:"Dg_Dl_Dt_Dc_Dj_Dv_Ds".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:function(){return"[avui a "+(1!==this.hours()?"les":"la")+"] LT"},nextDay:function(){return"[demà a "+(1!==this.hours()?"les":"la")+"] LT"},nextWeek:function(){return"dddd [a "+(1!==this.hours()?"les":"la")+"] LT"},lastDay:function(){return"[ahir a "+(1!==this.hours()?"les":"la")+"] LT"},lastWeek:function(){return"[el] dddd [passat a "+(1!==this.hours()?"les":"la")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"fa %s",s:"uns segons",m:"un minut",mm:"%d minuts",h:"una hora",hh:"%d hores",d:"un dia",dd:"%d dies",M:"un mes",MM:"%d mesos",y:"un any",yy:"%d anys"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a){return a>1&&5>a&&1!==~~(a/10)}function c(a,c,d,e){var f=a+" ";switch(d){case"s":return c||e?"pár sekund":"pár sekundami";case"m":return c?"minuta":e?"minutu":"minutou";case"mm":return c||e?f+(b(a)?"minuty":"minut"):f+"minutami";break;case"h":return c?"hodina":e?"hodinu":"hodinou";case"hh":return c||e?f+(b(a)?"hodiny":"hodin"):f+"hodinami";break;case"d":return c||e?"den":"dnem";case"dd":return c||e?f+(b(a)?"dny":"dní"):f+"dny";break;case"M":return c||e?"měsíc":"měsícem";case"MM":return c||e?f+(b(a)?"měsíce":"měsíců"):f+"měsíci";break;case"y":return c||e?"rok":"rokem";case"yy":return c||e?f+(b(a)?"roky":"let"):f+"lety"}}var d="leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"),e="led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_");return a.lang("cs",{months:d,monthsShort:e,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(d,e),weekdays:"neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),weekdaysShort:"ne_po_út_st_čt_pá_so".split("_"),weekdaysMin:"ne_po_út_st_čt_pá_so".split("_"),longDateFormat:{LT:"H.mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd D. MMMM YYYY LT"},calendar:{sameDay:"[dnes v] LT",nextDay:"[zítra v] LT",nextWeek:function(){switch(this.day()){case 0:return"[v neděli v] LT";case 1:case 2:return"[v] dddd [v] LT";case 3:return"[ve středu v] LT";case 4:return"[ve čtvrtek v] LT";case 5:return"[v pátek v] LT";case 6:return"[v sobotu v] LT"}},lastDay:"[včera v] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulou neděli v] LT";case 1:case 2:return"[minulé] dddd [v] LT";case 3:return"[minulou středu v] LT";case 4:case 5:return"[minulý] dddd [v] LT";case 6:return"[minulou sobotu v] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"před %s",s:c,m:c,mm:c,h:c,hh:c,d:c,dd:c,M:c,MM:c,y:c,yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("cv",{months:"кăрлач_нарăс_пуш_ака_май_çĕртме_утă_çурла_авăн_юпа_чӳк_раштав".split("_"),monthsShort:"кăр_нар_пуш_ака_май_çĕр_утă_çур_ав_юпа_чӳк_раш".split("_"),weekdays:"вырсарникун_тунтикун_ытларикун_юнкун_кĕçнерникун_эрнекун_шăматкун".split("_"),weekdaysShort:"выр_тун_ытл_юн_кĕç_эрн_шăм".split("_"),weekdaysMin:"вр_тн_ыт_юн_кç_эр_шм".split("_"),longDateFormat:{LT:"HH:mm",L:"DD-MM-YYYY",LL:"YYYY [çулхи] MMMM [уйăхĕн] D[-мĕшĕ]",LLL:"YYYY [çулхи] MMMM [уйăхĕн] D[-мĕшĕ], LT",LLLL:"dddd, YYYY [çулхи] MMMM [уйăхĕн] D[-мĕшĕ], LT"},calendar:{sameDay:"[Паян] LT [сехетре]",nextDay:"[Ыран] LT [сехетре]",lastDay:"[Ĕнер] LT [сехетре]",nextWeek:"[Çитес] dddd LT [сехетре]",lastWeek:"[Иртнĕ] dddd LT [сехетре]",sameElse:"L"},relativeTime:{future:function(a){var b=/сехет$/i.exec(a)?"рен":/çул$/i.exec(a)?"тан":"ран";return a+b},past:"%s каялла",s:"пĕр-ик çеккунт",m:"пĕр минут",mm:"%d минут",h:"пĕр сехет",hh:"%d сехет",d:"пĕр кун",dd:"%d кун",M:"пĕр уйăх",MM:"%d уйăх",y:"пĕр çул",yy:"%d çул"},ordinal:"%d-мĕш",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("cy",{months:"Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),monthsShort:"Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),weekdays:"Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),weekdaysShort:"Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),weekdaysMin:"Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Heddiw am] LT",nextDay:"[Yfory am] LT",nextWeek:"dddd [am] LT",lastDay:"[Ddoe am] LT",lastWeek:"dddd [diwethaf am] LT",sameElse:"L"},relativeTime:{future:"mewn %s",past:"%s yn àl",s:"ychydig eiliadau",m:"munud",mm:"%d munud",h:"awr",hh:"%d awr",d:"diwrnod",dd:"%d diwrnod",M:"mis",MM:"%d mis",y:"blwyddyn",yy:"%d flynedd"},ordinal:function(a){var b=a,c="",d=["","af","il","ydd","ydd","ed","ed","ed","fed","fed","fed","eg","fed","eg","eg","fed","eg","eg","fed","eg","fed"];return b>20?c=40===b||50===b||60===b||80===b||100===b?"fed":"ain":b>0&&(c=d[b]),a+c},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("da",{months:"januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"søn_man_tir_ons_tor_fre_lør".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D. MMMM, YYYY LT"},calendar:{sameDay:"[I dag kl.] LT",nextDay:"[I morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[I går kl.] LT",lastWeek:"[sidste] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"%s siden",s:"få sekunder",m:"et minut",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dage",M:"en måned",MM:"%d måneder",y:"et år",yy:"%d år"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?d[c][0]:d[c][1]}return a.lang("de",{months:"Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),weekdaysShort:"So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mo_Di_Mi_Do_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm [Uhr]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Heute um] LT",sameElse:"L",nextDay:"[Morgen um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gestern um] LT",lastWeek:"[letzten] dddd [um] LT"},relativeTime:{future:"in %s",past:"vor %s",s:"ein paar Sekunden",m:b,mm:"%d Minuten",h:b,hh:"%d Stunden",d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("el",{monthsNominativeEl:"Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),monthsGenitiveEl:"Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),months:function(a,b){return/D/.test(b.substring(0,b.indexOf("MMMM")))?this._monthsGenitiveEl[a.month()]:this._monthsNominativeEl[a.month()]},monthsShort:"Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),weekdays:"Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),weekdaysShort:"Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),weekdaysMin:"Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),meridiem:function(a,b,c){return a>11?c?"μμ":"ΜΜ":c?"πμ":"ΠΜ"},longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendarEl:{sameDay:"[Σήμερα {}] LT",nextDay:"[Αύριο {}] LT",nextWeek:"dddd [{}] LT",lastDay:"[Χθες {}] LT",lastWeek:"[την προηγούμενη] dddd [{}] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendarEl[a],d=b&&b.hours();return c.replace("{}",d%12===1?"στη":"στις")},relativeTime:{future:"σε %s",past:"%s πριν",s:"δευτερόλεπτα",m:"ένα λεπτό",mm:"%d λεπτά",h:"μία ώρα",hh:"%d ώρες",d:"μία μέρα",dd:"%d μέρες",M:"ένας μήνας",MM:"%d μήνες",y:"ένας χρόνος",yy:"%d χρόνια"},ordinal:function(a){return a+"η"},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("en-au",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("en-ca",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"h:mm A",L:"YYYY-MM-DD",LL:"D MMMM, YYYY",LLL:"D MMMM, YYYY LT",LLLL:"dddd, D MMMM, YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}})}),function(a){a(ib)}(function(a){return a.lang("en-gb",{months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("eo",{months:"januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec".split("_"),weekdays:"Dimanĉo_Lundo_Mardo_Merkredo_Ĵaŭdo_Vendredo_Sabato".split("_"),weekdaysShort:"Dim_Lun_Mard_Merk_Ĵaŭ_Ven_Sab".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Ĵa_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D[-an de] MMMM, YYYY",LLL:"D[-an de] MMMM, YYYY LT",LLLL:"dddd, [la] D[-an de] MMMM, YYYY LT"},meridiem:function(a,b,c){return a>11?c?"p.t.m.":"P.T.M.":c?"a.t.m.":"A.T.M."},calendar:{sameDay:"[Hodiaŭ je] LT",nextDay:"[Morgaŭ je] LT",nextWeek:"dddd [je] LT",lastDay:"[Hieraŭ je] LT",lastWeek:"[pasinta] dddd [je] LT",sameElse:"L"},relativeTime:{future:"je %s",past:"antaŭ %s",s:"sekundoj",m:"minuto",mm:"%d minutoj",h:"horo",hh:"%d horoj",d:"tago",dd:"%d tagoj",M:"monato",MM:"%d monatoj",y:"jaro",yy:"%d jaroj"},ordinal:"%da",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){var b="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),c="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_");return a.lang("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(a,d){return/-MMM-/.test(d)?c[a.month()]:b[a.month()]},weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"Do_Lu_Ma_Mi_Ju_Vi_Sá".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [del] YYYY",LLL:"D [de] MMMM [del] YYYY LT",LLLL:"dddd, D [de] MMMM [del] YYYY LT"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c,d){var e={s:["mõne sekundi","mõni sekund","paar sekundit"],m:["ühe minuti","üks minut"],mm:[a+" minuti",a+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[a+" tunni",a+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[a+" kuu",a+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[a+" aasta",a+" aastat"]};return b?e[c][2]?e[c][2]:e[c][1]:d?e[c][0]:e[c][1]}return a.lang("et",{months:"jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),monthsShort:"jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),weekdays:"pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),weekdaysShort:"P_E_T_K_N_R_L".split("_"),weekdaysMin:"P_E_T_K_N_R_L".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Täna,] LT",nextDay:"[Homme,] LT",nextWeek:"[Järgmine] dddd LT",lastDay:"[Eile,] LT",lastWeek:"[Eelmine] dddd LT",sameElse:"L"},relativeTime:{future:"%s pärast",past:"%s tagasi",s:b,m:b,mm:b,h:b,hh:b,d:b,dd:"%d päeva",M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("eu",{months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] LT",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] LT",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] LT",llll:"ddd, YYYY[ko] MMM D[a] LT"},calendar:{sameDay:"[gaur] LT[etan]",nextDay:"[bihar] LT[etan]",nextWeek:"dddd LT[etan]",lastDay:"[atzo] LT[etan]",lastWeek:"[aurreko] dddd LT[etan]",sameElse:"L"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){var b={1:"۱",2:"۲",3:"۳",4:"۴",5:"۵",6:"۶",7:"۷",8:"۸",9:"۹",0:"۰"},c={"۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","۰":"0"};return a.lang("fa",{months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},meridiem:function(a){return 12>a?"قبل از ظهر":"بعد از ظهر"},calendar:{sameDay:"[امروز ساعت] LT",nextDay:"[فردا ساعت] LT",nextWeek:"dddd [ساعت] LT",lastDay:"[دیروز ساعت] LT",lastWeek:"dddd [پیش] [ساعت] LT",sameElse:"L"},relativeTime:{future:"در %s",past:"%s پیش",s:"چندین ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"},preparse:function(a){return a.replace(/[۰-۹]/g,function(a){return c[a]}).replace(/،/g,",")},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]}).replace(/,/g,"،")},ordinal:"%dم",week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){function b(a,b,d,e){var f="";switch(d){case"s":return e?"muutaman sekunnin":"muutama sekunti";case"m":return e?"minuutin":"minuutti";case"mm":f=e?"minuutin":"minuuttia";break;case"h":return e?"tunnin":"tunti";case"hh":f=e?"tunnin":"tuntia";break;case"d":return e?"päivän":"päivä";case"dd":f=e?"päivän":"päivää";break;case"M":return e?"kuukauden":"kuukausi";case"MM":f=e?"kuukauden":"kuukautta";break;case"y":return e?"vuoden":"vuosi";case"yy":f=e?"vuoden":"vuotta"}return f=c(a,e)+" "+f}function c(a,b){return 10>a?b?e[a]:d[a]:a}var d="nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "),e=["nolla","yhden","kahden","kolmen","neljän","viiden","kuuden",d[7],d[8],d[9]];return a.lang("fi",{months:"tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),monthsShort:"tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),weekdays:"sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),weekdaysShort:"su_ma_ti_ke_to_pe_la".split("_"),weekdaysMin:"su_ma_ti_ke_to_pe_la".split("_"),longDateFormat:{LT:"HH.mm",L:"DD.MM.YYYY",LL:"Do MMMM[ta] YYYY",LLL:"Do MMMM[ta] YYYY, [klo] LT",LLLL:"dddd, Do MMMM[ta] YYYY, [klo] LT",l:"D.M.YYYY",ll:"Do MMM YYYY",lll:"Do MMM YYYY, [klo] LT",llll:"ddd, Do MMM YYYY, [klo] LT"},calendar:{sameDay:"[tänään] [klo] LT",nextDay:"[huomenna] [klo] LT",nextWeek:"dddd [klo] LT",lastDay:"[eilen] [klo] LT",lastWeek:"[viime] dddd[na] [klo] LT",sameElse:"L"},relativeTime:{future:"%s päästä",past:"%s sitten",s:b,m:b,mm:b,h:b,hh:b,d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("fo",{months:"januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),weekdaysShort:"sun_mán_týs_mik_hós_frí_ley".split("_"),weekdaysMin:"su_má_tý_mi_hó_fr_le".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D. MMMM, YYYY LT"},calendar:{sameDay:"[Í dag kl.] LT",nextDay:"[Í morgin kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[Í gjár kl.] LT",lastWeek:"[síðstu] dddd [kl] LT",sameElse:"L"},relativeTime:{future:"um %s",past:"%s síðani",s:"fá sekund",m:"ein minutt",mm:"%d minuttir",h:"ein tími",hh:"%d tímar",d:"ein dagur",dd:"%d dagar",M:"ein mánaði",MM:"%d mánaðir",y:"eitt ár",yy:"%d ár"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("fr-ca",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(a){return a+(1===a?"er":"")}})}),function(a){a(ib)}(function(a){return a.lang("fr",{months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Aujourd'hui à] LT",nextDay:"[Demain à] LT",nextWeek:"dddd [à] LT",lastDay:"[Hier à] LT",lastWeek:"dddd [dernier à] LT",sameElse:"L"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(a){return a+(1===a?"er":"")},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("gl",{months:"Xaneiro_Febreiro_Marzo_Abril_Maio_Xuño_Xullo_Agosto_Setembro_Outubro_Novembro_Decembro".split("_"),monthsShort:"Xan._Feb._Mar._Abr._Mai._Xuñ._Xul._Ago._Set._Out._Nov._Dec.".split("_"),weekdays:"Domingo_Luns_Martes_Mércores_Xoves_Venres_Sábado".split("_"),weekdaysShort:"Dom._Lun._Mar._Mér._Xov._Ven._Sáb.".split("_"),weekdaysMin:"Do_Lu_Ma_Mé_Xo_Ve_Sá".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:function(){return"[hoxe "+(1!==this.hours()?"ás":"á")+"] LT"},nextDay:function(){return"[mañá "+(1!==this.hours()?"ás":"á")+"] LT"},nextWeek:function(){return"dddd ["+(1!==this.hours()?"ás":"a")+"] LT"},lastDay:function(){return"[onte "+(1!==this.hours()?"á":"a")+"] LT"},lastWeek:function(){return"[o] dddd [pasado "+(1!==this.hours()?"ás":"a")+"] LT"},sameElse:"L"},relativeTime:{future:function(a){return"uns segundos"===a?"nuns segundos":"en "+a},past:"hai %s",s:"uns segundos",m:"un minuto",mm:"%d minutos",h:"unha hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un ano",yy:"%d anos"},ordinal:"%dº",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("he",{months:"ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),monthsShort:"ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),weekdays:"ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),weekdaysShort:"א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),weekdaysMin:"א_ב_ג_ד_ה_ו_ש".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [ב]MMMM YYYY",LLL:"D [ב]MMMM YYYY LT",LLLL:"dddd, D [ב]MMMM YYYY LT",l:"D/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY LT",llll:"ddd, D MMM YYYY LT"},calendar:{sameDay:"[היום ב־]LT",nextDay:"[מחר ב־]LT",nextWeek:"dddd [בשעה] LT",lastDay:"[אתמול ב־]LT",lastWeek:"[ביום] dddd [האחרון בשעה] LT",sameElse:"L"},relativeTime:{future:"בעוד %s",past:"לפני %s",s:"מספר שניות",m:"דקה",mm:"%d דקות",h:"שעה",hh:function(a){return 2===a?"שעתיים":a+" שעות"},d:"יום",dd:function(a){return 2===a?"יומיים":a+" ימים"},M:"חודש",MM:function(a){return 2===a?"חודשיים":a+" חודשים"},y:"שנה",yy:function(a){return 2===a?"שנתיים":a+" שנים"}}})}),function(a){a(ib)}(function(a){var b={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},c={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};return a.lang("hi",{months:"जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),monthsShort:"जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),weekdays:"रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[आज] LT",nextDay:"[कल] LT",nextWeek:"dddd, LT",lastDay:"[कल] LT",lastWeek:"[पिछले] dddd, LT",sameElse:"L"},relativeTime:{future:"%s में",past:"%s पहले",s:"कुछ ही क्षण",m:"एक मिनट",mm:"%d मिनट",h:"एक घंटा",hh:"%d घंटे",d:"एक दिन",dd:"%d दिन",M:"एक महीने",MM:"%d महीने",y:"एक वर्ष",yy:"%d वर्ष"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return c[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]})},meridiem:function(a){return 4>a?"रात":10>a?"सुबह":17>a?"दोपहर":20>a?"शाम":"रात"},week:{dow:0,doy:6}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d=a+" ";switch(c){case"m":return b?"jedna minuta":"jedne minute";case"mm":return d+=1===a?"minuta":2===a||3===a||4===a?"minute":"minuta";case"h":return b?"jedan sat":"jednog sata";case"hh":return d+=1===a?"sat":2===a||3===a||4===a?"sata":"sati";case"dd":return d+=1===a?"dan":"dana";case"MM":return d+=1===a?"mjesec":2===a||3===a||4===a?"mjeseca":"mjeseci";case"yy":return d+=1===a?"godina":2===a||3===a||4===a?"godine":"godina"}}return a.lang("hr",{months:"sječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_"),monthsShort:"sje._vel._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),weekdays:"nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),weekdaysShort:"ned._pon._uto._sri._čet._pet._sub.".split("_"),weekdaysMin:"ne_po_ut_sr_če_pe_su".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedjelju] [u] LT";case 3:return"[u] [srijedu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[jučer u] LT",lastWeek:function(){switch(this.day()){case 0:case 3:return"[prošlu] dddd [u] LT";case 6:return"[prošle] [subote] [u] LT";case 1:case 2:case 4:case 5:return"[prošli] dddd [u] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"prije %s",s:"par sekundi",m:b,mm:b,h:b,hh:b,d:"dan",dd:b,M:"mjesec",MM:b,y:"godinu",yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a,b,c,d){var e=a;switch(c){case"s":return d||b?"néhány másodperc":"néhány másodperce";case"m":return"egy"+(d||b?" perc":" perce");case"mm":return e+(d||b?" perc":" perce");case"h":return"egy"+(d||b?" óra":" órája");case"hh":return e+(d||b?" óra":" órája");case"d":return"egy"+(d||b?" nap":" napja");case"dd":return e+(d||b?" nap":" napja");case"M":return"egy"+(d||b?" hónap":" hónapja");case"MM":return e+(d||b?" hónap":" hónapja");case"y":return"egy"+(d||b?" év":" éve");case"yy":return e+(d||b?" év":" éve")}return""}function c(a){return(a?"":"[múlt] ")+"["+d[this.day()]+"] LT[-kor]"}var d="vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");return a.lang("hu",{months:"január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),monthsShort:"jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),weekdays:"vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),weekdaysShort:"vas_hét_kedd_sze_csüt_pén_szo".split("_"),weekdaysMin:"v_h_k_sze_cs_p_szo".split("_"),longDateFormat:{LT:"H:mm",L:"YYYY.MM.DD.",LL:"YYYY. MMMM D.",LLL:"YYYY. MMMM D., LT",LLLL:"YYYY. MMMM D., dddd LT"},meridiem:function(a,b,c){return 12>a?c===!0?"de":"DE":c===!0?"du":"DU"},calendar:{sameDay:"[ma] LT[-kor]",nextDay:"[holnap] LT[-kor]",nextWeek:function(){return c.call(this,!0)},lastDay:"[tegnap] LT[-kor]",lastWeek:function(){return c.call(this,!1)},sameElse:"L"},relativeTime:{future:"%s múlva",past:"%s",s:b,m:b,mm:b,h:b,hh:b,d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a,b){var c={nominative:"հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_"),accusative:"հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_")},d=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function c(a){var b="հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_");return b[a.month()]}function d(a){var b="կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_");return b[a.day()]}return a.lang("hy-am",{months:b,monthsShort:c,weekdays:d,weekdaysShort:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),weekdaysMin:"կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY թ.",LLL:"D MMMM YYYY թ., LT",LLLL:"dddd, D MMMM YYYY թ., LT"},calendar:{sameDay:"[այսօր] LT",nextDay:"[վաղը] LT",lastDay:"[երեկ] LT",nextWeek:function(){return"dddd [օրը ժամը] LT"},lastWeek:function(){return"[անցած] dddd [օրը ժամը] LT"},sameElse:"L"},relativeTime:{future:"%s հետո",past:"%s առաջ",s:"մի քանի վայրկյան",m:"րոպե",mm:"%d րոպե",h:"ժամ",hh:"%d ժամ",d:"օր",dd:"%d օր",M:"ամիս",MM:"%d ամիս",y:"տարի",yy:"%d տարի"},meridiem:function(a){return 4>a?"գիշերվա":12>a?"առավոտվա":17>a?"ցերեկվա":"երեկոյան"},ordinal:function(a,b){switch(b){case"DDD":case"w":case"W":case"DDDo":return 1===a?a+"-ին":a+"-րդ";default:return a}},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("id",{months:"Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),monthsShort:"Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des".split("_"),weekdays:"Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),weekdaysShort:"Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),weekdaysMin:"Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] LT",LLLL:"dddd, D MMMM YYYY [pukul] LT"},meridiem:function(a){return 11>a?"pagi":15>a?"siang":19>a?"sore":"malam"
},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Besok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kemarin pukul] LT",lastWeek:"dddd [lalu pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lalu",s:"beberapa detik",m:"semenit",mm:"%d menit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a){return a%100===11?!0:a%10===1?!1:!0}function c(a,c,d,e){var f=a+" ";switch(d){case"s":return c||e?"nokkrar sekúndur":"nokkrum sekúndum";case"m":return c?"mínúta":"mínútu";case"mm":return b(a)?f+(c||e?"mínútur":"mínútum"):c?f+"mínúta":f+"mínútu";case"hh":return b(a)?f+(c||e?"klukkustundir":"klukkustundum"):f+"klukkustund";case"d":return c?"dagur":e?"dag":"degi";case"dd":return b(a)?c?f+"dagar":f+(e?"daga":"dögum"):c?f+"dagur":f+(e?"dag":"degi");case"M":return c?"mánuður":e?"mánuð":"mánuði";case"MM":return b(a)?c?f+"mánuðir":f+(e?"mánuði":"mánuðum"):c?f+"mánuður":f+(e?"mánuð":"mánuði");case"y":return c||e?"ár":"ári";case"yy":return b(a)?f+(c||e?"ár":"árum"):f+(c||e?"ár":"ári")}}return a.lang("is",{months:"janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),monthsShort:"jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),weekdays:"sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),weekdaysShort:"sun_mán_þri_mið_fim_fös_lau".split("_"),weekdaysMin:"Su_Má_Þr_Mi_Fi_Fö_La".split("_"),longDateFormat:{LT:"H:mm",L:"DD/MM/YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] LT",LLLL:"dddd, D. MMMM YYYY [kl.] LT"},calendar:{sameDay:"[í dag kl.] LT",nextDay:"[á morgun kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[í gær kl.] LT",lastWeek:"[síðasta] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"eftir %s",past:"fyrir %s síðan",s:c,m:c,mm:c,h:"klukkustund",hh:c,d:c,dd:c,M:c,MM:c,y:c,yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("it",{months:"Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settembre_Ottobre_Novembre_Dicembre".split("_"),monthsShort:"Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic".split("_"),weekdays:"Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato".split("_"),weekdaysShort:"Dom_Lun_Mar_Mer_Gio_Ven_Sab".split("_"),weekdaysMin:"D_L_Ma_Me_G_V_S".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Oggi alle] LT",nextDay:"[Domani alle] LT",nextWeek:"dddd [alle] LT",lastDay:"[Ieri alle] LT",lastWeek:"[lo scorso] dddd [alle] LT",sameElse:"L"},relativeTime:{future:function(a){return(/^[0-9].+$/.test(a)?"tra":"in")+" "+a},past:"%s fa",s:"alcuni secondi",m:"un minuto",mm:"%d minuti",h:"un'ora",hh:"%d ore",d:"un giorno",dd:"%d giorni",M:"un mese",MM:"%d mesi",y:"un anno",yy:"%d anni"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("ja",{months:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),weekdaysShort:"日_月_火_水_木_金_土".split("_"),weekdaysMin:"日_月_火_水_木_金_土".split("_"),longDateFormat:{LT:"Ah時m分",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日LT",LLLL:"YYYY年M月D日LT dddd"},meridiem:function(a){return 12>a?"午前":"午後"},calendar:{sameDay:"[今日] LT",nextDay:"[明日] LT",nextWeek:"[来週]dddd LT",lastDay:"[昨日] LT",lastWeek:"[前週]dddd LT",sameElse:"L"},relativeTime:{future:"%s後",past:"%s前",s:"数秒",m:"1分",mm:"%d分",h:"1時間",hh:"%d時間",d:"1日",dd:"%d日",M:"1ヶ月",MM:"%dヶ月",y:"1年",yy:"%d年"}})}),function(a){a(ib)}(function(a){function b(a,b){var c={nominative:"იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),accusative:"იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს".split("_")},d=/D[oD] *MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function c(a,b){var c={nominative:"კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),accusative:"კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_")},d=/(წინა|შემდეგ)/.test(b)?"accusative":"nominative";return c[d][a.day()]}return a.lang("ka",{months:b,monthsShort:"იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),weekdays:c,weekdaysShort:"კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),weekdaysMin:"კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),longDateFormat:{LT:"h:mm A",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[დღეს] LT[-ზე]",nextDay:"[ხვალ] LT[-ზე]",lastDay:"[გუშინ] LT[-ზე]",nextWeek:"[შემდეგ] dddd LT[-ზე]",lastWeek:"[წინა] dddd LT-ზე",sameElse:"L"},relativeTime:{future:function(a){return/(წამი|წუთი|საათი|წელი)/.test(a)?a.replace(/ი$/,"ში"):a+"ში"},past:function(a){return/(წამი|წუთი|საათი|დღე|თვე)/.test(a)?a.replace(/(ი|ე)$/,"ის წინ"):/წელი/.test(a)?a.replace(/წელი$/,"წლის წინ"):void 0},s:"რამდენიმე წამი",m:"წუთი",mm:"%d წუთი",h:"საათი",hh:"%d საათი",d:"დღე",dd:"%d დღე",M:"თვე",MM:"%d თვე",y:"წელი",yy:"%d წელი"},ordinal:function(a){return 0===a?a:1===a?a+"-ლი":20>a||100>=a&&a%20===0||a%100===0?"მე-"+a:a+"-ე"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("km",{months:"មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),monthsShort:"មករា_កុម្ភៈ_មិនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),weekdays:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysShort:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),weekdaysMin:"អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[ថ្ងៃនៈ ម៉ោង] LT",nextDay:"[ស្អែក ម៉ោង] LT",nextWeek:"dddd [ម៉ោង] LT",lastDay:"[ម្សិលមិញ ម៉ោង] LT",lastWeek:"dddd [សប្តាហ៍មុន] [ម៉ោង] LT",sameElse:"L"},relativeTime:{future:"%sទៀត",past:"%sមុន",s:"ប៉ុន្មានវិនាទី",m:"មួយនាទី",mm:"%d នាទី",h:"មួយម៉ោង",hh:"%d ម៉ោង",d:"មួយថ្ងៃ",dd:"%d ថ្ងៃ",M:"មួយខែ",MM:"%d ខែ",y:"មួយឆ្នាំ",yy:"%d ឆ្នាំ"},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("ko",{months:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),monthsShort:"1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),weekdays:"일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),weekdaysShort:"일_월_화_수_목_금_토".split("_"),weekdaysMin:"일_월_화_수_목_금_토".split("_"),longDateFormat:{LT:"A h시 mm분",L:"YYYY.MM.DD",LL:"YYYY년 MMMM D일",LLL:"YYYY년 MMMM D일 LT",LLLL:"YYYY년 MMMM D일 dddd LT"},meridiem:function(a){return 12>a?"오전":"오후"},calendar:{sameDay:"오늘 LT",nextDay:"내일 LT",nextWeek:"dddd LT",lastDay:"어제 LT",lastWeek:"지난주 dddd LT",sameElse:"L"},relativeTime:{future:"%s 후",past:"%s 전",s:"몇초",ss:"%d초",m:"일분",mm:"%d분",h:"한시간",hh:"%d시간",d:"하루",dd:"%d일",M:"한달",MM:"%d달",y:"일년",yy:"%d년"},ordinal:"%d일",meridiemParse:/(오전|오후)/,isPM:function(a){return"오후"===a}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],dd:[a+" Deeg",a+" Deeg"],M:["ee Mount","engem Mount"],MM:[a+" Méint",a+" Méint"],y:["ee Joer","engem Joer"],yy:[a+" Joer",a+" Joer"]};return b?d[c][0]:d[c][1]}function c(a){var b=a.substr(0,a.indexOf(" "));return g(b)?"a "+a:"an "+a}function d(a){var b=a.substr(0,a.indexOf(" "));return g(b)?"viru "+a:"virun "+a}function e(){var a=this.format("d");return f(a)?"[Leschte] dddd [um] LT":"[Leschten] dddd [um] LT"}function f(a){switch(a=parseInt(a,10)){case 0:case 1:case 3:case 5:case 6:return!0;default:return!1}}function g(a){if(a=parseInt(a,10),isNaN(a))return!1;if(0>a)return!0;if(10>a)return a>=4&&7>=a?!0:!1;if(100>a){var b=a%10,c=a/10;return g(0===b?c:b)}if(1e4>a){for(;a>=10;)a/=10;return g(a)}return a/=1e3,g(a)}return a.lang("lb",{months:"Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),monthsShort:"Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),weekdays:"Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),weekdaysShort:"So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),weekdaysMin:"So_Mé_Dë_Më_Do_Fr_Sa".split("_"),longDateFormat:{LT:"H:mm [Auer]",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[Haut um] LT",sameElse:"L",nextDay:"[Muer um] LT",nextWeek:"dddd [um] LT",lastDay:"[Gëschter um] LT",lastWeek:e},relativeTime:{future:c,past:d,s:"e puer Sekonnen",m:b,mm:"%d Minutten",h:b,hh:"%d Stonnen",d:b,dd:b,M:b,MM:b,y:b,yy:b},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c,d){return b?"kelios sekundės":d?"kelių sekundžių":"kelias sekundes"}function c(a,b,c,d){return b?e(c)[0]:d?e(c)[1]:e(c)[2]}function d(a){return a%10===0||a>10&&20>a}function e(a){return h[a].split("_")}function f(a,b,f,g){var h=a+" ";return 1===a?h+c(a,b,f[0],g):b?h+(d(a)?e(f)[1]:e(f)[0]):g?h+e(f)[1]:h+(d(a)?e(f)[1]:e(f)[2])}function g(a,b){var c=-1===b.indexOf("dddd HH:mm"),d=i[a.weekday()];return c?d:d.substring(0,d.length-2)+"į"}var h={m:"minutė_minutės_minutę",mm:"minutės_minučių_minutes",h:"valanda_valandos_valandą",hh:"valandos_valandų_valandas",d:"diena_dienos_dieną",dd:"dienos_dienų_dienas",M:"mėnuo_mėnesio_mėnesį",MM:"mėnesiai_mėnesių_mėnesius",y:"metai_metų_metus",yy:"metai_metų_metus"},i="pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis_sekmadienis".split("_");return a.lang("lt",{months:"sausio_vasario_kovo_balandžio_gegužės_biržėlio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),monthsShort:"sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),weekdays:g,weekdaysShort:"Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),weekdaysMin:"S_P_A_T_K_Pn_Š".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"YYYY [m.] MMMM D [d.]",LLL:"YYYY [m.] MMMM D [d.], LT [val.]",LLLL:"YYYY [m.] MMMM D [d.], dddd, LT [val.]",l:"YYYY-MM-DD",ll:"YYYY [m.] MMMM D [d.]",lll:"YYYY [m.] MMMM D [d.], LT [val.]",llll:"YYYY [m.] MMMM D [d.], ddd, LT [val.]"},calendar:{sameDay:"[Šiandien] LT",nextDay:"[Rytoj] LT",nextWeek:"dddd LT",lastDay:"[Vakar] LT",lastWeek:"[Praėjusį] dddd LT",sameElse:"L"},relativeTime:{future:"po %s",past:"prieš %s",s:b,m:c,mm:f,h:c,hh:f,d:c,dd:f,M:c,MM:f,y:c,yy:f},ordinal:function(a){return a+"-oji"},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d=a.split("_");return c?b%10===1&&11!==b?d[2]:d[3]:b%10===1&&11!==b?d[0]:d[1]}function c(a,c,e){return a+" "+b(d[e],a,c)}var d={mm:"minūti_minūtes_minūte_minūtes",hh:"stundu_stundas_stunda_stundas",dd:"dienu_dienas_diena_dienas",MM:"mēnesi_mēnešus_mēnesis_mēneši",yy:"gadu_gadus_gads_gadi"};return a.lang("lv",{months:"janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),monthsShort:"jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),weekdays:"svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),weekdaysShort:"Sv_P_O_T_C_Pk_S".split("_"),weekdaysMin:"Sv_P_O_T_C_Pk_S".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"YYYY. [gada] D. MMMM",LLL:"YYYY. [gada] D. MMMM, LT",LLLL:"YYYY. [gada] D. MMMM, dddd, LT"},calendar:{sameDay:"[Šodien pulksten] LT",nextDay:"[Rīt pulksten] LT",nextWeek:"dddd [pulksten] LT",lastDay:"[Vakar pulksten] LT",lastWeek:"[Pagājušā] dddd [pulksten] LT",sameElse:"L"},relativeTime:{future:"%s vēlāk",past:"%s agrāk",s:"dažas sekundes",m:"minūti",mm:c,h:"stundu",hh:c,d:"dienu",dd:c,M:"mēnesi",MM:c,y:"gadu",yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("mk",{months:"јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),monthsShort:"јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),weekdays:"недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),weekdaysShort:"нед_пон_вто_сре_чет_пет_саб".split("_"),weekdaysMin:"нe_пo_вт_ср_че_пе_сa".split("_"),longDateFormat:{LT:"H:mm",L:"D.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Денес во] LT",nextDay:"[Утре во] LT",nextWeek:"dddd [во] LT",lastDay:"[Вчера во] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[Во изминатата] dddd [во] LT";case 1:case 2:case 4:case 5:return"[Во изминатиот] dddd [во] LT"}},sameElse:"L"},relativeTime:{future:"после %s",past:"пред %s",s:"неколку секунди",m:"минута",mm:"%d минути",h:"час",hh:"%d часа",d:"ден",dd:"%d дена",M:"месец",MM:"%d месеци",y:"година",yy:"%d години"},ordinal:function(a){var b=a%10,c=a%100;return 0===a?a+"-ев":0===c?a+"-ен":c>10&&20>c?a+"-ти":1===b?a+"-ви":2===b?a+"-ри":7===b||8===b?a+"-ми":a+"-ти"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("ml",{months:"ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),monthsShort:"ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),weekdays:"ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),weekdaysShort:"ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),weekdaysMin:"ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),longDateFormat:{LT:"A h:mm -നു",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[ഇന്ന്] LT",nextDay:"[നാളെ] LT",nextWeek:"dddd, LT",lastDay:"[ഇന്നലെ] LT",lastWeek:"[കഴിഞ്ഞ] dddd, LT",sameElse:"L"},relativeTime:{future:"%s കഴിഞ്ഞ്",past:"%s മുൻപ്",s:"അൽപ നിമിഷങ്ങൾ",m:"ഒരു മിനിറ്റ്",mm:"%d മിനിറ്റ്",h:"ഒരു മണിക്കൂർ",hh:"%d മണിക്കൂർ",d:"ഒരു ദിവസം",dd:"%d ദിവസം",M:"ഒരു മാസം",MM:"%d മാസം",y:"ഒരു വർഷം",yy:"%d വർഷം"},meridiem:function(a){return 4>a?"രാത്രി":12>a?"രാവിലെ":17>a?"ഉച്ച കഴിഞ്ഞ്":20>a?"വൈകുന്നേരം":"രാത്രി"}})}),function(a){a(ib)}(function(a){var b={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},c={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};return a.lang("mr",{months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),longDateFormat:{LT:"A h:mm वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[आज] LT",nextDay:"[उद्या] LT",nextWeek:"dddd, LT",lastDay:"[काल] LT",lastWeek:"[मागील] dddd, LT",sameElse:"L"},relativeTime:{future:"%s नंतर",past:"%s पूर्वी",s:"सेकंद",m:"एक मिनिट",mm:"%d मिनिटे",h:"एक तास",hh:"%d तास",d:"एक दिवस",dd:"%d दिवस",M:"एक महिना",MM:"%d महिने",y:"एक वर्ष",yy:"%d वर्षे"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return c[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]})},meridiem:function(a){return 4>a?"रात्री":10>a?"सकाळी":17>a?"दुपारी":20>a?"सायंकाळी":"रात्री"},week:{dow:0,doy:6}})}),function(a){a(ib)}(function(a){return a.lang("ms-my",{months:"Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),monthsShort:"Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),weekdays:"Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),weekdaysShort:"Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),weekdaysMin:"Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),longDateFormat:{LT:"HH.mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [pukul] LT",LLLL:"dddd, D MMMM YYYY [pukul] LT"},meridiem:function(a){return 11>a?"pagi":15>a?"tengahari":19>a?"petang":"malam"},calendar:{sameDay:"[Hari ini pukul] LT",nextDay:"[Esok pukul] LT",nextWeek:"dddd [pukul] LT",lastDay:"[Kelmarin pukul] LT",lastWeek:"dddd [lepas pukul] LT",sameElse:"L"},relativeTime:{future:"dalam %s",past:"%s yang lepas",s:"beberapa saat",m:"seminit",mm:"%d minit",h:"sejam",hh:"%d jam",d:"sehari",dd:"%d hari",M:"sebulan",MM:"%d bulan",y:"setahun",yy:"%d tahun"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("nb",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"),weekdays:"søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),weekdaysShort:"sø._ma._ti._on._to._fr._lø.".split("_"),weekdaysMin:"sø_ma_ti_on_to_fr_lø".split("_"),longDateFormat:{LT:"H.mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY [kl.] LT",LLLL:"dddd D. MMMM YYYY [kl.] LT"},calendar:{sameDay:"[i dag kl.] LT",nextDay:"[i morgen kl.] LT",nextWeek:"dddd [kl.] LT",lastDay:"[i går kl.] LT",lastWeek:"[forrige] dddd [kl.] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"for %s siden",s:"noen sekunder",m:"ett minutt",mm:"%d minutter",h:"en time",hh:"%d timer",d:"en dag",dd:"%d dager",M:"en måned",MM:"%d måneder",y:"ett år",yy:"%d år"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){var b={1:"१",2:"२",3:"३",4:"४",5:"५",6:"६",7:"७",8:"८",9:"९",0:"०"},c={"१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","०":"0"};return a.lang("ne",{months:"जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),monthsShort:"जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),weekdays:"आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),weekdaysShort:"आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),weekdaysMin:"आइ._सो._मङ्_बु._बि._शु._श.".split("_"),longDateFormat:{LT:"Aको h:mm बजे",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},preparse:function(a){return a.replace(/[१२३४५६७८९०]/g,function(a){return c[a]})},postformat:function(a){return a.replace(/\d/g,function(a){return b[a]})},meridiem:function(a){return 3>a?"राती":10>a?"बिहान":15>a?"दिउँसो":18>a?"बेलुका":20>a?"साँझ":"राती"},calendar:{sameDay:"[आज] LT",nextDay:"[भोली] LT",nextWeek:"[आउँदो] dddd[,] LT",lastDay:"[हिजो] LT",lastWeek:"[गएको] dddd[,] LT",sameElse:"L"},relativeTime:{future:"%sमा",past:"%s अगाडी",s:"केही समय",m:"एक मिनेट",mm:"%d मिनेट",h:"एक घण्टा",hh:"%d घण्टा",d:"एक दिन",dd:"%d दिन",M:"एक महिना",MM:"%d महिना",y:"एक बर्ष",yy:"%d बर्ष"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){var b="jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"),c="jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_");return a.lang("nl",{months:"januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),monthsShort:function(a,d){return/-MMM-/.test(d)?c[a.month()]:b[a.month()]},weekdays:"zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),weekdaysShort:"zo._ma._di._wo._do._vr._za.".split("_"),weekdaysMin:"Zo_Ma_Di_Wo_Do_Vr_Za".split("_"),longDateFormat:{LT:"HH:mm",L:"DD-MM-YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[vandaag om] LT",nextDay:"[morgen om] LT",nextWeek:"dddd [om] LT",lastDay:"[gisteren om] LT",lastWeek:"[afgelopen] dddd [om] LT",sameElse:"L"},relativeTime:{future:"over %s",past:"%s geleden",s:"een paar seconden",m:"één minuut",mm:"%d minuten",h:"één uur",hh:"%d uur",d:"één dag",dd:"%d dagen",M:"één maand",MM:"%d maanden",y:"één jaar",yy:"%d jaar"},ordinal:function(a){return a+(1===a||8===a||a>=20?"ste":"de")},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("nn",{months:"januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),monthsShort:"jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),weekdays:"sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),weekdaysShort:"sun_mån_tys_ons_tor_fre_lau".split("_"),weekdaysMin:"su_må_ty_on_to_fr_lø".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[I dag klokka] LT",nextDay:"[I morgon klokka] LT",nextWeek:"dddd [klokka] LT",lastDay:"[I går klokka] LT",lastWeek:"[Føregåande] dddd [klokka] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"for %s sidan",s:"nokre sekund",m:"eit minutt",mm:"%d minutt",h:"ein time",hh:"%d timar",d:"ein dag",dd:"%d dagar",M:"ein månad",MM:"%d månader",y:"eit år",yy:"%d år"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a){return 5>a%10&&a%10>1&&~~(a/10)%10!==1}function c(a,c,d){var e=a+" ";switch(d){case"m":return c?"minuta":"minutę";case"mm":return e+(b(a)?"minuty":"minut");case"h":return c?"godzina":"godzinę";case"hh":return e+(b(a)?"godziny":"godzin");case"MM":return e+(b(a)?"miesiące":"miesięcy");case"yy":return e+(b(a)?"lata":"lat")}}var d="styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"),e="stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_");return a.lang("pl",{months:function(a,b){return/D MMMM/.test(b)?e[a.month()]:d[a.month()]},monthsShort:"sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),weekdays:"niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),weekdaysShort:"nie_pon_wt_śr_czw_pt_sb".split("_"),weekdaysMin:"N_Pn_Wt_Śr_Cz_Pt_So".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Dziś o] LT",nextDay:"[Jutro o] LT",nextWeek:"[W] dddd [o] LT",lastDay:"[Wczoraj o] LT",lastWeek:function(){switch(this.day()){case 0:return"[W zeszłą niedzielę o] LT";case 3:return"[W zeszłą środę o] LT";case 6:return"[W zeszłą sobotę o] LT";default:return"[W zeszły] dddd [o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"%s temu",s:"kilka sekund",m:c,mm:c,h:c,hh:c,d:"1 dzień",dd:"%d dni",M:"miesiąc",MM:c,y:"rok",yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("pt-br",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sáb".split("_"),weekdaysMin:"dom_2ª_3ª_4ª_5ª_6ª_sáb".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY [às] LT",LLLL:"dddd, D [de] MMMM [de] YYYY [às] LT"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:"%dº"})}),function(a){a(ib)}(function(a){return a.lang("pt",{months:"janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro".split("_"),monthsShort:"jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez".split("_"),weekdays:"domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado".split("_"),weekdaysShort:"dom_seg_ter_qua_qui_sex_sáb".split("_"),weekdaysMin:"dom_2ª_3ª_4ª_5ª_6ª_sáb".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY LT",LLLL:"dddd, D [de] MMMM [de] YYYY LT"},calendar:{sameDay:"[Hoje às] LT",nextDay:"[Amanhã às] LT",nextWeek:"dddd [às] LT",lastDay:"[Ontem às] LT",lastWeek:function(){return 0===this.day()||6===this.day()?"[Último] dddd [às] LT":"[Última] dddd [às] LT"},sameElse:"L"},relativeTime:{future:"em %s",past:"%s atrás",s:"segundos",m:"um minuto",mm:"%d minutos",h:"uma hora",hh:"%d horas",d:"um dia",dd:"%d dias",M:"um mês",MM:"%d meses",y:"um ano",yy:"%d anos"},ordinal:"%dº",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},e=" ";return(a%100>=20||a>=100&&a%100===0)&&(e=" de "),a+e+d[c]}return a.lang("ro",{months:"ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),monthsShort:"ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),weekdays:"duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),weekdaysShort:"Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),weekdaysMin:"Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY H:mm",LLLL:"dddd, D MMMM YYYY H:mm"},calendar:{sameDay:"[azi la] LT",nextDay:"[mâine la] LT",nextWeek:"dddd [la] LT",lastDay:"[ieri la] LT",lastWeek:"[fosta] dddd [la] LT",sameElse:"L"},relativeTime:{future:"peste %s",past:"%s în urmă",s:"câteva secunde",m:"un minut",mm:b,h:"o oră",hh:b,d:"o zi",dd:b,M:"o lună",MM:b,y:"un an",yy:b},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function c(a,c,d){var e={mm:c?"минута_минуты_минут":"минуту_минуты_минут",hh:"час_часа_часов",dd:"день_дня_дней",MM:"месяц_месяца_месяцев",yy:"год_года_лет"};return"m"===d?c?"минута":"минуту":a+" "+b(e[d],+a)}function d(a,b){var c={nominative:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),accusative:"января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_")},d=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function e(a,b){var c={nominative:"янв_фев_мар_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),accusative:"янв_фев_мар_апр_мая_июня_июля_авг_сен_окт_ноя_дек".split("_")},d=/D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function f(a,b){var c={nominative:"воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),accusative:"воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_")},d=/\[ ?[Вв] ?(?:прошлую|следующую)? ?\] ?dddd/.test(b)?"accusative":"nominative";return c[d][a.day()]}return a.lang("ru",{months:d,monthsShort:e,weekdays:f,weekdaysShort:"вс_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"вс_пн_вт_ср_чт_пт_сб".split("_"),monthsParse:[/^янв/i,/^фев/i,/^мар/i,/^апр/i,/^ма[й|я]/i,/^июн/i,/^июл/i,/^авг/i,/^сен/i,/^окт/i,/^ноя/i,/^дек/i],longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY г.",LLL:"D MMMM YYYY г., LT",LLLL:"dddd, D MMMM YYYY г., LT"},calendar:{sameDay:"[Сегодня в] LT",nextDay:"[Завтра в] LT",lastDay:"[Вчера в] LT",nextWeek:function(){return 2===this.day()?"[Во] dddd [в] LT":"[В] dddd [в] LT"},lastWeek:function(){switch(this.day()){case 0:return"[В прошлое] dddd [в] LT";case 1:case 2:case 4:return"[В прошлый] dddd [в] LT";case 3:case 5:case 6:return"[В прошлую] dddd [в] LT"}},sameElse:"L"},relativeTime:{future:"через %s",past:"%s назад",s:"несколько секунд",m:c,mm:c,h:"час",hh:c,d:"день",dd:c,M:"месяц",MM:c,y:"год",yy:c},meridiem:function(a){return 4>a?"ночи":12>a?"утра":17>a?"дня":"вечера"},ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":return a+"-й";case"D":return a+"-го";case"w":case"W":return a+"-я";default:return a}},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){function b(a){return a>1&&5>a}function c(a,c,d,e){var f=a+" ";switch(d){case"s":return c||e?"pár sekúnd":"pár sekundami";case"m":return c?"minúta":e?"minútu":"minútou";case"mm":return c||e?f+(b(a)?"minúty":"minút"):f+"minútami";break;case"h":return c?"hodina":e?"hodinu":"hodinou";case"hh":return c||e?f+(b(a)?"hodiny":"hodín"):f+"hodinami";break;case"d":return c||e?"deň":"dňom";case"dd":return c||e?f+(b(a)?"dni":"dní"):f+"dňami";break;case"M":return c||e?"mesiac":"mesiacom";case"MM":return c||e?f+(b(a)?"mesiace":"mesiacov"):f+"mesiacmi";break;case"y":return c||e?"rok":"rokom";case"yy":return c||e?f+(b(a)?"roky":"rokov"):f+"rokmi"}}var d="január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"),e="jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");return a.lang("sk",{months:d,monthsShort:e,monthsParse:function(a,b){var c,d=[];for(c=0;12>c;c++)d[c]=new RegExp("^"+a[c]+"$|^"+b[c]+"$","i");return d}(d,e),weekdays:"nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),weekdaysShort:"ne_po_ut_st_št_pi_so".split("_"),weekdaysMin:"ne_po_ut_st_št_pi_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD.MM.YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd D. MMMM YYYY LT"},calendar:{sameDay:"[dnes o] LT",nextDay:"[zajtra o] LT",nextWeek:function(){switch(this.day()){case 0:return"[v nedeľu o] LT";case 1:case 2:return"[v] dddd [o] LT";case 3:return"[v stredu o] LT";case 4:return"[vo štvrtok o] LT";case 5:return"[v piatok o] LT";case 6:return"[v sobotu o] LT"}},lastDay:"[včera o] LT",lastWeek:function(){switch(this.day()){case 0:return"[minulú nedeľu o] LT";case 1:case 2:return"[minulý] dddd [o] LT";case 3:return"[minulú stredu o] LT";case 4:case 5:return"[minulý] dddd [o] LT";case 6:return"[minulú sobotu o] LT"}},sameElse:"L"},relativeTime:{future:"za %s",past:"pred %s",s:c,m:c,mm:c,h:c,hh:c,d:c,dd:c,M:c,MM:c,y:c,yy:c},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){function b(a,b,c){var d=a+" ";switch(c){case"m":return b?"ena minuta":"eno minuto";case"mm":return d+=1===a?"minuta":2===a?"minuti":3===a||4===a?"minute":"minut";case"h":return b?"ena ura":"eno uro";case"hh":return d+=1===a?"ura":2===a?"uri":3===a||4===a?"ure":"ur";case"dd":return d+=1===a?"dan":"dni";case"MM":return d+=1===a?"mesec":2===a?"meseca":3===a||4===a?"mesece":"mesecev";case"yy":return d+=1===a?"leto":2===a?"leti":3===a||4===a?"leta":"let"}}return a.lang("sl",{months:"januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),monthsShort:"jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),weekdays:"nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),weekdaysShort:"ned._pon._tor._sre._čet._pet._sob.".split("_"),weekdaysMin:"ne_po_to_sr_če_pe_so".split("_"),longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danes ob] LT",nextDay:"[jutri ob] LT",nextWeek:function(){switch(this.day()){case 0:return"[v] [nedeljo] [ob] LT";case 3:return"[v] [sredo] [ob] LT";case 6:return"[v] [soboto] [ob] LT";case 1:case 2:case 4:case 5:return"[v] dddd [ob] LT"}},lastDay:"[včeraj ob] LT",lastWeek:function(){switch(this.day()){case 0:case 3:case 6:return"[prejšnja] dddd [ob] LT";case 1:case 2:case 4:case 5:return"[prejšnji] dddd [ob] LT"}},sameElse:"L"},relativeTime:{future:"čez %s",past:"%s nazaj",s:"nekaj sekund",m:b,mm:b,h:b,hh:b,d:"en dan",dd:b,M:"en mesec",MM:b,y:"eno leto",yy:b},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("sq",{months:"Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),monthsShort:"Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),weekdays:"E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),weekdaysShort:"Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),weekdaysMin:"D_H_Ma_Më_E_P_Sh".split("_"),meridiem:function(a){return 12>a?"PD":"MD"},longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[Sot në] LT",nextDay:"[Nesër në] LT",nextWeek:"dddd [në] LT",lastDay:"[Dje në] LT",lastWeek:"dddd [e kaluar në] LT",sameElse:"L"},relativeTime:{future:"në %s",past:"%s më parë",s:"disa sekonda",m:"një minutë",mm:"%d minuta",h:"një orë",hh:"%d orë",d:"një ditë",dd:"%d ditë",M:"një muaj",MM:"%d muaj",y:"një vit",yy:"%d vite"},ordinal:"%d.",week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){var b={words:{m:["један минут","једне минуте"],mm:["минут","минуте","минута"],h:["један сат","једног сата"],hh:["сат","сата","сати"],dd:["дан","дана","дана"],MM:["месец","месеца","месеци"],yy:["година","године","година"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]
},translate:function(a,c,d){var e=b.words[d];return 1===d.length?c?e[0]:e[1]:a+" "+b.correctGrammaticalCase(a,e)}};return a.lang("sr-cyr",{months:["јануар","фебруар","март","април","мај","јун","јул","август","септембар","октобар","новембар","децембар"],monthsShort:["јан.","феб.","мар.","апр.","мај","јун","јул","авг.","сеп.","окт.","нов.","дец."],weekdays:["недеља","понедељак","уторак","среда","четвртак","петак","субота"],weekdaysShort:["нед.","пон.","уто.","сре.","чет.","пет.","суб."],weekdaysMin:["не","по","ут","ср","че","пе","су"],longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[данас у] LT",nextDay:"[сутра у] LT",nextWeek:function(){switch(this.day()){case 0:return"[у] [недељу] [у] LT";case 3:return"[у] [среду] [у] LT";case 6:return"[у] [суботу] [у] LT";case 1:case 2:case 4:case 5:return"[у] dddd [у] LT"}},lastDay:"[јуче у] LT",lastWeek:function(){var a=["[прошле] [недеље] [у] LT","[прошлог] [понедељка] [у] LT","[прошлог] [уторка] [у] LT","[прошле] [среде] [у] LT","[прошлог] [четвртка] [у] LT","[прошлог] [петка] [у] LT","[прошле] [суботе] [у] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"за %s",past:"пре %s",s:"неколико секунди",m:b.translate,mm:b.translate,h:b.translate,hh:b.translate,d:"дан",dd:b.translate,M:"месец",MM:b.translate,y:"годину",yy:b.translate},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){var b={words:{m:["jedan minut","jedne minute"],mm:["minut","minute","minuta"],h:["jedan sat","jednog sata"],hh:["sat","sata","sati"],dd:["dan","dana","dana"],MM:["mesec","meseca","meseci"],yy:["godina","godine","godina"]},correctGrammaticalCase:function(a,b){return 1===a?b[0]:a>=2&&4>=a?b[1]:b[2]},translate:function(a,c,d){var e=b.words[d];return 1===d.length?c?e[0]:e[1]:a+" "+b.correctGrammaticalCase(a,e)}};return a.lang("sr",{months:["januar","februar","mart","april","maj","jun","jul","avgust","septembar","oktobar","novembar","decembar"],monthsShort:["jan.","feb.","mar.","apr.","maj","jun","jul","avg.","sep.","okt.","nov.","dec."],weekdays:["nedelja","ponedeljak","utorak","sreda","četvrtak","petak","subota"],weekdaysShort:["ned.","pon.","uto.","sre.","čet.","pet.","sub."],weekdaysMin:["ne","po","ut","sr","če","pe","su"],longDateFormat:{LT:"H:mm",L:"DD. MM. YYYY",LL:"D. MMMM YYYY",LLL:"D. MMMM YYYY LT",LLLL:"dddd, D. MMMM YYYY LT"},calendar:{sameDay:"[danas u] LT",nextDay:"[sutra u] LT",nextWeek:function(){switch(this.day()){case 0:return"[u] [nedelju] [u] LT";case 3:return"[u] [sredu] [u] LT";case 6:return"[u] [subotu] [u] LT";case 1:case 2:case 4:case 5:return"[u] dddd [u] LT"}},lastDay:"[juče u] LT",lastWeek:function(){var a=["[prošle] [nedelje] [u] LT","[prošlog] [ponedeljka] [u] LT","[prošlog] [utorka] [u] LT","[prošle] [srede] [u] LT","[prošlog] [četvrtka] [u] LT","[prošlog] [petka] [u] LT","[prošle] [subote] [u] LT"];return a[this.day()]},sameElse:"L"},relativeTime:{future:"za %s",past:"pre %s",s:"nekoliko sekundi",m:b.translate,mm:b.translate,h:b.translate,hh:b.translate,d:"dan",dd:b.translate,M:"mesec",MM:b.translate,y:"godinu",yy:b.translate},ordinal:"%d.",week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("sv",{months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),longDateFormat:{LT:"HH:mm",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[Idag] LT",nextDay:"[Imorgon] LT",lastDay:"[Igår] LT",nextWeek:"dddd LT",lastWeek:"[Förra] dddd[en] LT",sameElse:"L"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"},ordinal:function(a){var b=a%10,c=1===~~(a%100/10)?"e":1===b?"a":2===b?"a":3===b?"e":"e";return a+c},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("ta",{months:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),monthsShort:"ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),weekdays:"ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),weekdaysShort:"ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),weekdaysMin:"ஞா_தி_செ_பு_வி_வெ_ச".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, LT",LLLL:"dddd, D MMMM YYYY, LT"},calendar:{sameDay:"[இன்று] LT",nextDay:"[நாளை] LT",nextWeek:"dddd, LT",lastDay:"[நேற்று] LT",lastWeek:"[கடந்த வாரம்] dddd, LT",sameElse:"L"},relativeTime:{future:"%s இல்",past:"%s முன்",s:"ஒரு சில விநாடிகள்",m:"ஒரு நிமிடம்",mm:"%d நிமிடங்கள்",h:"ஒரு மணி நேரம்",hh:"%d மணி நேரம்",d:"ஒரு நாள்",dd:"%d நாட்கள்",M:"ஒரு மாதம்",MM:"%d மாதங்கள்",y:"ஒரு வருடம்",yy:"%d ஆண்டுகள்"},ordinal:function(a){return a+"வது"},meridiem:function(a){return a>=6&&10>=a?" காலை":a>=10&&14>=a?" நண்பகல்":a>=14&&18>=a?" எற்பாடு":a>=18&&20>=a?" மாலை":a>=20&&24>=a?" இரவு":a>=0&&6>=a?" வைகறை":void 0},week:{dow:0,doy:6}})}),function(a){a(ib)}(function(a){return a.lang("th",{months:"มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),monthsShort:"มกรา_กุมภา_มีนา_เมษา_พฤษภา_มิถุนา_กรกฎา_สิงหา_กันยา_ตุลา_พฤศจิกา_ธันวา".split("_"),weekdays:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),weekdaysShort:"อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),weekdaysMin:"อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),longDateFormat:{LT:"H นาฬิกา m นาที",L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY เวลา LT",LLLL:"วันddddที่ D MMMM YYYY เวลา LT"},meridiem:function(a){return 12>a?"ก่อนเที่ยง":"หลังเที่ยง"},calendar:{sameDay:"[วันนี้ เวลา] LT",nextDay:"[พรุ่งนี้ เวลา] LT",nextWeek:"dddd[หน้า เวลา] LT",lastDay:"[เมื่อวานนี้ เวลา] LT",lastWeek:"[วัน]dddd[ที่แล้ว เวลา] LT",sameElse:"L"},relativeTime:{future:"อีก %s",past:"%sที่แล้ว",s:"ไม่กี่วินาที",m:"1 นาที",mm:"%d นาที",h:"1 ชั่วโมง",hh:"%d ชั่วโมง",d:"1 วัน",dd:"%d วัน",M:"1 เดือน",MM:"%d เดือน",y:"1 ปี",yy:"%d ปี"}})}),function(a){a(ib)}(function(a){return a.lang("tl-ph",{months:"Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),monthsShort:"Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),weekdays:"Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),weekdaysShort:"Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),weekdaysMin:"Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),longDateFormat:{LT:"HH:mm",L:"MM/D/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM DD, YYYY LT"},calendar:{sameDay:"[Ngayon sa] LT",nextDay:"[Bukas sa] LT",nextWeek:"dddd [sa] LT",lastDay:"[Kahapon sa] LT",lastWeek:"dddd [huling linggo] LT",sameElse:"L"},relativeTime:{future:"sa loob ng %s",past:"%s ang nakalipas",s:"ilang segundo",m:"isang minuto",mm:"%d minuto",h:"isang oras",hh:"%d oras",d:"isang araw",dd:"%d araw",M:"isang buwan",MM:"%d buwan",y:"isang taon",yy:"%d taon"},ordinal:function(a){return a},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){var b={1:"'inci",5:"'inci",8:"'inci",70:"'inci",80:"'inci",2:"'nci",7:"'nci",20:"'nci",50:"'nci",3:"'üncü",4:"'üncü",100:"'üncü",6:"'ncı",9:"'uncu",10:"'uncu",30:"'uncu",60:"'ıncı",90:"'ıncı"};return a.lang("tr",{months:"Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),monthsShort:"Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),weekdays:"Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),weekdaysShort:"Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),weekdaysMin:"Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd, D MMMM YYYY LT"},calendar:{sameDay:"[bugün saat] LT",nextDay:"[yarın saat] LT",nextWeek:"[haftaya] dddd [saat] LT",lastDay:"[dün] LT",lastWeek:"[geçen hafta] dddd [saat] LT",sameElse:"L"},relativeTime:{future:"%s sonra",past:"%s önce",s:"birkaç saniye",m:"bir dakika",mm:"%d dakika",h:"bir saat",hh:"%d saat",d:"bir gün",dd:"%d gün",M:"bir ay",MM:"%d ay",y:"bir yıl",yy:"%d yıl"},ordinal:function(a){if(0===a)return a+"'ıncı";var c=a%10,d=a%100-c,e=a>=100?100:null;return a+(b[c]||b[d]||b[e])},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("tzm-la",{months:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),monthsShort:"innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),weekdays:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysShort:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),weekdaysMin:"asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[asdkh g] LT",nextDay:"[aska g] LT",nextWeek:"dddd [g] LT",lastDay:"[assant g] LT",lastWeek:"dddd [g] LT",sameElse:"L"},relativeTime:{future:"dadkh s yan %s",past:"yan %s",s:"imik",m:"minuḍ",mm:"%d minuḍ",h:"saɛa",hh:"%d tassaɛin",d:"ass",dd:"%d ossan",M:"ayowr",MM:"%d iyyirn",y:"asgas",yy:"%d isgasn"},week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){return a.lang("tzm",{months:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),monthsShort:"ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),weekdays:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysShort:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),weekdaysMin:"ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"dddd D MMMM YYYY LT"},calendar:{sameDay:"[ⴰⵙⴷⵅ ⴴ] LT",nextDay:"[ⴰⵙⴽⴰ ⴴ] LT",nextWeek:"dddd [ⴴ] LT",lastDay:"[ⴰⵚⴰⵏⵜ ⴴ] LT",lastWeek:"dddd [ⴴ] LT",sameElse:"L"},relativeTime:{future:"ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",past:"ⵢⴰⵏ %s",s:"ⵉⵎⵉⴽ",m:"ⵎⵉⵏⵓⴺ",mm:"%d ⵎⵉⵏⵓⴺ",h:"ⵙⴰⵄⴰ",hh:"%d ⵜⴰⵙⵙⴰⵄⵉⵏ",d:"ⴰⵙⵙ",dd:"%d oⵙⵙⴰⵏ",M:"ⴰⵢoⵓⵔ",MM:"%d ⵉⵢⵢⵉⵔⵏ",y:"ⴰⵙⴳⴰⵙ",yy:"%d ⵉⵙⴳⴰⵙⵏ"},week:{dow:6,doy:12}})}),function(a){a(ib)}(function(a){function b(a,b){var c=a.split("_");return b%10===1&&b%100!==11?c[0]:b%10>=2&&4>=b%10&&(10>b%100||b%100>=20)?c[1]:c[2]}function c(a,c,d){var e={mm:"хвилина_хвилини_хвилин",hh:"година_години_годин",dd:"день_дні_днів",MM:"місяць_місяці_місяців",yy:"рік_роки_років"};return"m"===d?c?"хвилина":"хвилину":"h"===d?c?"година":"годину":a+" "+b(e[d],+a)}function d(a,b){var c={nominative:"січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_"),accusative:"січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_")},d=/D[oD]? *MMMM?/.test(b)?"accusative":"nominative";return c[d][a.month()]}function e(a,b){var c={nominative:"неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),accusative:"неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),genitive:"неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")},d=/(\[[ВвУу]\]) ?dddd/.test(b)?"accusative":/\[?(?:минулої|наступної)? ?\] ?dddd/.test(b)?"genitive":"nominative";return c[d][a.day()]}function f(a){return function(){return a+"о"+(11===this.hours()?"б":"")+"] LT"}}return a.lang("uk",{months:d,monthsShort:"січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),weekdays:e,weekdaysShort:"нд_пн_вт_ср_чт_пт_сб".split("_"),weekdaysMin:"нд_пн_вт_ср_чт_пт_сб".split("_"),longDateFormat:{LT:"HH:mm",L:"DD.MM.YYYY",LL:"D MMMM YYYY р.",LLL:"D MMMM YYYY р., LT",LLLL:"dddd, D MMMM YYYY р., LT"},calendar:{sameDay:f("[Сьогодні "),nextDay:f("[Завтра "),lastDay:f("[Вчора "),nextWeek:f("[У] dddd ["),lastWeek:function(){switch(this.day()){case 0:case 3:case 5:case 6:return f("[Минулої] dddd [").call(this);case 1:case 2:case 4:return f("[Минулого] dddd [").call(this)}},sameElse:"L"},relativeTime:{future:"за %s",past:"%s тому",s:"декілька секунд",m:c,mm:c,h:"годину",hh:c,d:"день",dd:c,M:"місяць",MM:c,y:"рік",yy:c},meridiem:function(a){return 4>a?"ночі":12>a?"ранку":17>a?"дня":"вечора"},ordinal:function(a,b){switch(b){case"M":case"d":case"DDD":case"w":case"W":return a+"-й";case"D":return a+"-го";default:return a}},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("uz",{months:"январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),monthsShort:"янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),weekdays:"Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),weekdaysShort:"Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),weekdaysMin:"Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY LT",LLLL:"D MMMM YYYY, dddd LT"},calendar:{sameDay:"[Бугун соат] LT [да]",nextDay:"[Эртага] LT [да]",nextWeek:"dddd [куни соат] LT [да]",lastDay:"[Кеча соат] LT [да]",lastWeek:"[Утган] dddd [куни соат] LT [да]",sameElse:"L"},relativeTime:{future:"Якин %s ичида",past:"Бир неча %s олдин",s:"фурсат",m:"бир дакика",mm:"%d дакика",h:"бир соат",hh:"%d соат",d:"бир кун",dd:"%d кун",M:"бир ой",MM:"%d ой",y:"бир йил",yy:"%d йил"},week:{dow:1,doy:7}})}),function(a){a(ib)}(function(a){return a.lang("vi",{months:"tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),monthsShort:"Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12".split("_"),weekdays:"chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),weekdaysShort:"CN_T2_T3_T4_T5_T6_T7".split("_"),weekdaysMin:"CN_T2_T3_T4_T5_T6_T7".split("_"),longDateFormat:{LT:"HH:mm",L:"DD/MM/YYYY",LL:"D MMMM [năm] YYYY",LLL:"D MMMM [năm] YYYY LT",LLLL:"dddd, D MMMM [năm] YYYY LT",l:"DD/M/YYYY",ll:"D MMM YYYY",lll:"D MMM YYYY LT",llll:"ddd, D MMM YYYY LT"},calendar:{sameDay:"[Hôm nay lúc] LT",nextDay:"[Ngày mai lúc] LT",nextWeek:"dddd [tuần tới lúc] LT",lastDay:"[Hôm qua lúc] LT",lastWeek:"dddd [tuần rồi lúc] LT",sameElse:"L"},relativeTime:{future:"%s tới",past:"%s trước",s:"vài giây",m:"một phút",mm:"%d phút",h:"một giờ",hh:"%d giờ",d:"một ngày",dd:"%d ngày",M:"một tháng",MM:"%d tháng",y:"một năm",yy:"%d năm"},ordinal:function(a){return a},week:{dow:1,doy:4}})}),function(a){a(ib)}(function(a){return a.lang("zh-cn",{months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),longDateFormat:{LT:"Ah点mm",L:"YYYY-MM-DD",LL:"YYYY年MMMD日",LLL:"YYYY年MMMD日LT",LLLL:"YYYY年MMMD日ddddLT",l:"YYYY-MM-DD",ll:"YYYY年MMMD日",lll:"YYYY年MMMD日LT",llll:"YYYY年MMMD日ddddLT"},meridiem:function(a,b){var c=100*a+b;return 600>c?"凌晨":900>c?"早上":1130>c?"上午":1230>c?"中午":1800>c?"下午":"晚上"},calendar:{sameDay:function(){return 0===this.minutes()?"[今天]Ah[点整]":"[今天]LT"},nextDay:function(){return 0===this.minutes()?"[明天]Ah[点整]":"[明天]LT"},lastDay:function(){return 0===this.minutes()?"[昨天]Ah[点整]":"[昨天]LT"},nextWeek:function(){var b,c;return b=a().startOf("week"),c=this.unix()-b.unix()>=604800?"[下]":"[本]",0===this.minutes()?c+"dddAh点整":c+"dddAh点mm"},lastWeek:function(){var b,c;return b=a().startOf("week"),c=this.unix()c?"早上":1130>c?"上午":1230>c?"中午":1800>c?"下午":"晚上"},calendar:{sameDay:"[今天]LT",nextDay:"[明天]LT",nextWeek:"[下]ddddLT",lastDay:"[昨天]LT",lastWeek:"[上]ddddLT",sameElse:"L"},ordinal:function(a,b){switch(b){case"d":case"D":case"DDD":return a+"日";case"M":return a+"月";case"w":case"W":return a+"週";default:return a}},relativeTime:{future:"%s內",past:"%s前",s:"幾秒",m:"一分鐘",mm:"%d分鐘",h:"一小時",hh:"%d小時",d:"一天",dd:"%d天",M:"一個月",MM:"%d個月",y:"一年",yy:"%d年"}})}),ib.lang("en"),xb?module.exports=ib:"function"==typeof define&&define.amd?(define("moment",function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(mb.moment=jb),ib}),hb(!0)):hb()}).call(this);/*! jstz - v1.0.4 - 2012-12-12 */
(function(e){var t=function(){"use strict";var e="s",n=function(e){var t=-e.getTimezoneOffset();return t!==null?t:0},r=function(e,t,n){var r=new Date;return e!==undefined&&r.setFullYear(e),r.setDate(n),r.setMonth(t),r},i=function(e){return n(r(e,0,2))},s=function(e){return n(r(e,5,2))},o=function(e){var t=e.getMonth()>7?s(e.getFullYear()):i(e.getFullYear()),r=n(e);return t-r!==0},u=function(){var t=i(),n=s(),r=i()-s();return r<0?t+",1":r>0?n+",1,"+e:t+",0"},a=function(){var e=u();return new t.TimeZone(t.olson.timezones[e])};return{determine:a,date_is_dst:o}}();t.TimeZone=function(e){"use strict";var n=null,r=function(){return n},i=function(){var e=t.olson.ambiguity_list[n],r=e.length,i=0,s=e[0];for(;i0;){if(i=t.filter("[data-jcarousel]"),i.length>0)return i;if(i=t.find("[data-jcarousel]"),i.length>0)return i;t=t.parent()}return null},i.base=function(s){return{version:i.version,_options:{},_element:null,_carousel:null,_init:t.noop,_create:t.noop,_destroy:t.noop,_reload:t.noop,create:function(){return this._element.attr("data-"+s.toLowerCase(),!0).data(s,this),!1===this._trigger("create")?this:(this._create(),this._trigger("createend"),this)},destroy:function(){return!1===this._trigger("destroy")?this:(this._destroy(),this._trigger("destroyend"),this._element.removeData(s).removeAttr("data-"+s.toLowerCase()),this)},reload:function(t){return!1===this._trigger("reload")?this:(t&&this.options(t),this._reload(),this._trigger("reloadend"),this)},element:function(){return this._element},options:function(i,s){if(0===arguments.length)return t.extend({},this._options);if("string"==typeof i){if(s===void 0)return this._options[i]===void 0?null:this._options[i];this._options[i]=s}else this._options=t.extend({},this._options,i);return this},carousel:function(){return this._carousel||(this._carousel=i.detectCarousel(this.options("carousel")||this._element),this._carousel||t.error('Could not detect carousel for plugin "'+s+'"')),this._carousel},_trigger:function(i,e,r){var n,o=!1;return r=[this].concat(r||[]),(e||this._element).each(function(){n=t.Event((s+":"+i).toLowerCase()),t(this).trigger(n,r),n.isDefaultPrevented()&&(o=!0)}),!o}}},i.plugin=function(s,e){var r=t[s]=function(i,s){this._element=t(i),this.options(s),this._init(),this.create()};return r.fn=r.prototype=t.extend({},i.base(s),e),t.fn[s]=function(i){var e=Array.prototype.slice.call(arguments,1),n=this;return"string"==typeof i?this.each(function(){var r=t(this).data(s);if(!r)return t.error("Cannot call methods on "+s+" prior to initialization; "+'attempted to call method "'+i+'"');if(!t.isFunction(r[i])||"_"===i.charAt(0))return t.error('No such method "'+i+'" for '+s+" instance");var o=r[i].apply(r,e);return o!==r&&o!==void 0?(n=o,!1):void 0}):this.each(function(){var e=t(this).data(s);e instanceof r?e.reload(i):new r(this,i)}),n},r}})(jQuery),function(t,i){"use strict";var s=function(t){return parseFloat(t)||0};t.jCarousel.plugin("jcarousel",{animating:!1,tail:0,inTail:!1,resizeTimer:null,lt:null,vertical:!1,rtl:!1,circular:!1,underflow:!1,relative:!1,_options:{list:function(){return this.element().children().eq(0)},items:function(){return this.list().children()},animation:400,transitions:!1,wrap:null,vertical:null,rtl:null,center:!1},_list:null,_items:null,_target:null,_first:null,_last:null,_visible:null,_fullyvisible:null,_init:function(){var t=this;return this.onWindowResize=function(){t.resizeTimer&&clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout(function(){t.reload()},100)},this},_create:function(){this._reload(),t(i).on("resize.jcarousel",this.onWindowResize)},_destroy:function(){t(i).off("resize.jcarousel",this.onWindowResize)},_reload:function(){this.vertical=this.options("vertical"),null==this.vertical&&(this.vertical=this.list().height()>this.list().width()),this.rtl=this.options("rtl"),null==this.rtl&&(this.rtl=function(i){if("rtl"===(""+i.attr("dir")).toLowerCase())return!0;var s=!1;return i.parents("[dir]").each(function(){return/rtl/i.test(t(this).attr("dir"))?(s=!0,!1):void 0}),s}(this._element)),this.lt=this.vertical?"top":"left",this.relative="relative"===this.list().css("position"),this._list=null,this._items=null;var i=this._target&&this.index(this._target)>=0?this._target:this.closest();this.circular="circular"===this.options("wrap"),this.underflow=!1;var s={left:0,top:0};return i.length>0&&(this._prepare(i),this.list().find("[data-jcarousel-clone]").remove(),this._items=null,this.underflow=this._fullyvisible.length>=this.items().length,this.circular=this.circular&&!this.underflow,s[this.lt]=this._position(i)+"px"),this.move(s),this},list:function(){if(null===this._list){var i=this.options("list");this._list=t.isFunction(i)?i.call(this):this._element.find(i)}return this._list},items:function(){if(null===this._items){var i=this.options("items");this._items=(t.isFunction(i)?i.call(this):this.list().find(i)).not("[data-jcarousel-clone]")}return this._items},index:function(t){return this.items().index(t)},closest:function(){var i,e=this,r=this.list().position()[this.lt],n=t(),o=!1,l=this.vertical?"bottom":this.rtl&&!this.relative?"left":"right";return this.rtl&&this.relative&&!this.vertical&&(r+=this.list().width()-this.clipping()),this.items().each(function(){if(n=t(this),o)return!1;var a=e.dimension(n);if(r+=a,r>=0){if(i=a-s(n.css("margin-"+l)),!(0>=Math.abs(r)-a+i/2))return!1;o=!0}}),n},target:function(){return this._target},first:function(){return this._first},last:function(){return this._last},visible:function(){return this._visible},fullyvisible:function(){return this._fullyvisible},hasNext:function(){if(!1===this._trigger("hasnext"))return!0;var t=this.options("wrap"),i=this.items().length-1;return i>=0&&!this.underflow&&(t&&"first"!==t||i>this.index(this._last)||this.tail&&!this.inTail)?!0:!1},hasPrev:function(){if(!1===this._trigger("hasprev"))return!0;var t=this.options("wrap");return this.items().length>0&&!this.underflow&&(t&&"last"!==t||this.index(this._first)>0||this.tail&&this.inTail)?!0:!1},clipping:function(){return this._element["inner"+(this.vertical?"Height":"Width")]()},dimension:function(t){return t["outer"+(this.vertical?"Height":"Width")](!0)},scroll:function(i,s,e){if(this.animating)return this;if(!1===this._trigger("scroll",null,[i,s]))return this;t.isFunction(s)&&(e=s,s=!0);var r=t.jCarousel.parseTarget(i);if(r.relative){var n,o,l,a,h,u,c,f,d=this.items().length-1,_=Math.abs(r.target),p=this.options("wrap");if(r.target>0){var v=this.index(this._last);if(v>=d&&this.tail)this.inTail?"both"===p||"last"===p?this._scroll(0,s,e):t.isFunction(e)&&e.call(this,!1):this._scrollTail(s,e);else if(n=this.index(this._target),this.underflow&&n===d&&("circular"===p||"both"===p||"last"===p)||!this.underflow&&v===d&&("both"===p||"last"===p))this._scroll(0,s,e);else if(l=n+_,this.circular&&l>d){for(f=d,h=this.items().get(-1);l>f++;)h=this.items().eq(0),u=this._visible.index(h)>=0,u&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(h),u||(c={},c[this.lt]=this.dimension(h),this.moveBy(c)),this._items=null;this._scroll(h,s,e)}else this._scroll(Math.min(l,d),s,e)}else if(this.inTail)this._scroll(Math.max(this.index(this._first)-_+1,0),s,e);else if(o=this.index(this._first),n=this.index(this._target),a=this.underflow?n:o,l=a-_,0>=a&&(this.underflow&&"circular"===p||"both"===p||"first"===p))this._scroll(d,s,e);else if(this.circular&&0>l){for(f=l,h=this.items().get(0);0>f++;){h=this.items().eq(-1),u=this._visible.index(h)>=0,u&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().prepend(h),this._items=null;var g=this.dimension(h);c={},c[this.lt]=-g,this.moveBy(c)}this._scroll(h,s,e)}else this._scroll(Math.max(l,0),s,e)}else this._scroll(r.target,s,e);return this._trigger("scrollend"),this},moveBy:function(t,i){var e=this.list().position(),r=1,n=0;return this.rtl&&!this.vertical&&(r=-1,this.relative&&(n=this.list().width()-this.clipping())),t.left&&(t.left=e.left+n+s(t.left)*r+"px"),t.top&&(t.top=e.top+n+s(t.top)*r+"px"),this.move(t,i)},move:function(i,s){s=s||{};var e=this.options("transitions"),r=!!e,n=!!e.transforms,o=!!e.transforms3d,l=s.duration||0,a=this.list();if(!r&&l>0)return a.animate(i,s),void 0;var h=s.complete||t.noop,u={};if(r){var c=a.css(["transitionDuration","transitionTimingFunction","transitionProperty"]),f=h;h=function(){t(this).css(c),f.call(this)},u={transitionDuration:(l>0?l/1e3:0)+"s",transitionTimingFunction:e.easing||s.easing,transitionProperty:l>0?function(){return n||o?"all":i.left?"left":"top"}():"none",transform:"none"}}o?u.transform="translate3d("+(i.left||0)+","+(i.top||0)+",0)":n?u.transform="translate("+(i.left||0)+","+(i.top||0)+")":t.extend(u,i),r&&l>0&&a.one("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",h),a.css(u),0>=l&&a.each(function(){h.call(this)})},_scroll:function(i,s,e){if(this.animating)return t.isFunction(e)&&e.call(this,!1),this;if("object"!=typeof i?i=this.items().eq(i):i.jquery===void 0&&(i=t(i)),0===i.length)return t.isFunction(e)&&e.call(this,!1),this;this.inTail=!1,this._prepare(i);var r=this._position(i),n=this.list().position()[this.lt];if(r===n)return t.isFunction(e)&&e.call(this,!1),this;var o={};return o[this.lt]=r+"px",this._animate(o,s,e),this},_scrollTail:function(i,s){if(this.animating||!this.tail)return t.isFunction(s)&&s.call(this,!1),this;var e=this.list().position()[this.lt];this.rtl&&this.relative&&!this.vertical&&(e+=this.list().width()-this.clipping()),this.rtl&&!this.vertical?e+=this.tail:e-=this.tail,this.inTail=!0;var r={};return r[this.lt]=e+"px",this._update({target:this._target.next(),fullyvisible:this._fullyvisible.slice(1).add(this._visible.last())}),this._animate(r,i,s),this},_animate:function(i,s,e){if(e=e||t.noop,!1===this._trigger("animate"))return e.call(this,!1),this;this.animating=!0;var r=this.options("animation"),n=t.proxy(function(){this.animating=!1;var t=this.list().find("[data-jcarousel-clone]");t.length>0&&(t.remove(),this._reload()),this._trigger("animateend"),e.call(this,!0)},this),o="object"==typeof r?t.extend({},r):{duration:r},l=o.complete||t.noop;return s===!1?o.duration=0:t.fx.speeds[o.duration]!==void 0&&(o.duration=t.fx.speeds[o.duration]),o.complete=function(){n(),l.call(this)},this.move(i,o),this},_prepare:function(i){var e,r,n,o,l=this.index(i),a=l,h=this.dimension(i),u=this.clipping(),c=this.vertical?"bottom":this.rtl?"left":"right",f=this.options("center"),d={target:i,first:i,last:i,visible:i,fullyvisible:u>=h?i:t()};if(f&&(h/=2,u/=2),u>h)for(;;){if(e=this.items().eq(++a),0===e.length){if(!this.circular)break;if(e=this.items().eq(0),i.get(0)===e.get(0))break;if(r=this._visible.index(e)>=0,r&&e.after(e.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(e),!r){var _={};_[this.lt]=this.dimension(e),this.moveBy(_)}this._items=null}if(o=this.dimension(e),0===o)break;if(h+=o,d.last=e,d.visible=d.visible.add(e),n=s(e.css("margin-"+c)),u>=h-n&&(d.fullyvisible=d.fullyvisible.add(e)),h>=u)break}if(!this.circular&&!f&&u>h)for(a=l;;){if(0>--a)break;if(e=this.items().eq(a),0===e.length)break;if(o=this.dimension(e),0===o)break;if(h+=o,d.first=e,d.visible=d.visible.add(e),n=s(e.css("margin-"+c)),u>=h-n&&(d.fullyvisible=d.fullyvisible.add(e)),h>=u)break}return this._update(d),this.tail=0,f||"circular"===this.options("wrap")||"custom"===this.options("wrap")||this.index(d.last)!==this.items().length-1||(h-=s(d.last.css("margin-"+c)),h>u&&(this.tail=h-u)),this},_position:function(t){var i=this._first,s=i.position()[this.lt],e=this.options("center"),r=e?this.clipping()/2-this.dimension(i)/2:0;return this.rtl&&!this.vertical?(s-=this.relative?this.list().width()-this.dimension(i):this.clipping()-this.dimension(i),s+=r):s-=r,!e&&(this.index(t)>this.index(i)||this.inTail)&&this.tail?(s=this.rtl&&!this.vertical?s-this.tail:s+this.tail,this.inTail=!0):this.inTail=!1,-s},_update:function(i){var s,e=this,r={target:this._target||t(),first:this._first||t(),last:this._last||t(),visible:this._visible||t(),fullyvisible:this._fullyvisible||t()},n=this.index(i.first||r.first)r[s].index(this)&&o.push(this)}),r[s].each(function(){0>i[s].index(this)&&l.push(this)}),n?o=o.reverse():l=l.reverse(),e._trigger(s+"in",t(o)),e._trigger(s+"out",t(l)),e["_"+s]=i[s]};for(s in i)o(s);return this}})}(jQuery,window),function(t){"use strict";t.jcarousel.fn.scrollIntoView=function(i,s,e){var r,n=t.jCarousel.parseTarget(i),o=this.index(this._fullyvisible.first()),l=this.index(this._fullyvisible.last());if(r=n.relative?0>n.target?Math.max(0,o+n.target):l+n.target:"object"!=typeof n.target?n.target:this.index(n.target),o>r)return this.scroll(r,s,e);if(r>=o&&l>=r)return t.isFunction(e)&&e.call(this,!1),this;for(var a,h=this.items(),u=this.clipping(),c=this.vertical?"bottom":this.rtl?"left":"right",f=0;;){if(a=h.eq(r),0===a.length)break;if(f+=this.dimension(a),f>=u){var d=parseFloat(a.css("margin-"+c))||0;f-d!==u&&r++;break}if(0>=r)break;r--}return this.scroll(r,s,e)}}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselControl",{_options:{target:"+=1",event:"click",method:"scroll"},_active:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onEvent=t.proxy(function(i){i.preventDefault();var s=this.options("method");t.isFunction(s)?s.call(this):this.carousel().jcarousel(this.options("method"),this.options("target"))},this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend jcarousel:scrollend",this.onReload),this._element.on(this.options("event")+".jcarouselcontrol",this.onEvent),this._reload()},_destroy:function(){this._element.off(".jcarouselcontrol",this.onEvent),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend jcarousel:scrollend",this.onReload)},_reload:function(){var i,s=t.jCarousel.parseTarget(this.options("target")),e=this.carousel();if(s.relative)i=e.jcarousel(s.target>0?"hasNext":"hasPrev");else{var r="object"!=typeof s.target?e.jcarousel("items").eq(s.target):s.target;i=e.jcarousel("target").index(r)>=0}return this._active!==i&&(this._trigger(i?"active":"inactive"),this._active=i),this}})}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselPagination",{_options:{perPage:null,item:function(t){return''+t+""},event:"click",method:"scroll"},_pages:{},_items:{},_currentPage:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onScroll=t.proxy(this._update,this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend",this.onReload).on("jcarousel:scrollend",this.onScroll),this._reload()},_destroy:function(){this._clear(),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend",this.onReload).off("jcarousel:scrollend",this.onScroll)},_reload:function(){var i=this.options("perPage");if(this._pages={},this._items={},t.isFunction(i)&&(i=i.call(this)),null==i)this._pages=this._calculatePages();else for(var s,e=parseInt(i,10)||0,r=this.carousel().jcarousel("items"),n=1,o=0;;){if(s=r.eq(o++),0===s.length)break;this._pages[n]=this._pages[n]?this._pages[n].add(s):s,0===o%e&&n++}this._clear();var l=this,a=this.carousel().data("jcarousel"),h=this._element,u=this.options("item");t.each(this._pages,function(i,s){var e=l._items[i]=t(u.call(l,i,s));e.on(l.options("event")+".jcarouselpagination",t.proxy(function(){var t=s.eq(0);if(a.circular){var e=a.index(a.target()),r=a.index(t);parseFloat(i)>parseFloat(l._currentPage)?e>r&&(t="+="+(a.items().length-e+r)):r>e&&(t="-="+(e+(a.items().length-r)))}a[this.options("method")](t)},l)),h.append(e)}),this._update()},_update:function(){var i,s=this.carousel().jcarousel("target");t.each(this._pages,function(t,e){return e.each(function(){return s.is(this)?(i=t,!1):void 0}),i?!1:void 0}),this._currentPage!==i&&(this._trigger("inactive",this._items[this._currentPage]),this._trigger("active",this._items[i])),this._currentPage=i},items:function(){return this._items},_clear:function(){this._element.empty(),this._currentPage=null},_calculatePages:function(){for(var t,i=this.carousel().data("jcarousel"),s=i.items(),e=i.clipping(),r=0,n=0,o=1,l={};;){if(t=s.eq(n++),0===t.length)break;l[o]=l[o]?l[o].add(t):t,r+=i.dimension(t),r>=e&&(o++,r=0)}return l}})}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselAutoscroll",{_options:{target:"+=1",interval:3e3,autostart:!0},_timer:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onAnimateEnd=t.proxy(this.start,this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy),this.options("autostart")&&this.start()},_destroy:function(){this.stop(),this.carousel().off("jcarousel:destroy",this.onDestroy)},start:function(){return this.stop(),this.carousel().one("jcarousel:animateend",this.onAnimateEnd),this._timer=setTimeout(t.proxy(function(){this.carousel().jcarousel("scroll",this.options("target"))},this),this.options("interval")),this},stop:function(){return this._timer&&(this._timer=clearTimeout(this._timer)),this.carousel().off("jcarousel:animateend",this.onAnimateEnd),this}})}(jQuery);
var $enetpulse = (jQuery).noConflict(true);
(function($){
"use strict";
var dnc = false;
var wrapper = "#mx-wrapper";
var prefix = "mx-";
var mx_settings = {
name: "mx_livescore",
rewrites: {
events: function(params){
return "/page/xhr/events/" + params.type + "/" + params.eventfk + "/" + params.hash;
}
},
snippet: "page",
params: {theme: "livescore"},
gateway_url: "/[SNIPPET]",
rewrite_method: "canonical",
gateway_parameters: ["theme", "title", "params", "hash"],
preload_label: "Loading",
snippet_autoload_snippets: true,
timezone: "auto",
use_logos: "",
use_browser_time_offset: "",
time_zone_selector: "",
date_format_long: "",
date_format_short: ""
};
var mxf_settings = {
use_timer : false,
breakpoints : {"micro":"240","small":"485","medium":"600","large":"720", "wide":"760"}
};
// MX FlexContainer methods
// These methods detects size changes to element containers based on window-resize events
// Breakpoints are defined in a json style object in settings.
// Each individual widget can have its own set of breakpoints defined in a data-breakpoints attribute.
//set MX FlexContainer variable
var mxf;
//Main MinisiteX Class
var MXF = function(settings){
//settings
this.settings = $.extend({
use_timer: false,
binder: "."+prefix+"inline-widget",
breakpoints: {"small":"379","medium":"485","large":"720", "wide":"760"} // "micro":"240" removed! breakpoint keynames will be translated into classnames. Ie small becomes mx-widget-small
}, settings);
};
MXF.prototype.startFlexContainers = function(){
// run a check on start
mxf.checkFlexContainerWidth();
// then run a check on resize of window
$(window).on("resize", mxf.checkFlexContainerWidth);
};
// check the width of widgets to see if we are crossing breakpoints defined in settings or a data-breakpoints object on the individual widget.
MXF.prototype.checkFlexContainerWidth = function(){
// loop widgets on page
$(mxf.settings.binder).each(function(){
var width = parseInt(this.offsetWidth);
var breakpoints = $(this).data("breakpoints") || mxf.settings.breakpoints;
var maxBreakVal = -1;
var closest = null;
var useBreak = undefined;
// get breakpoint closest to width
for(var b in breakpoints){
// if there is a match between the breakpoints, then set that class
if (breakpoints[b]-width >= 0 && Math.abs(breakpoints[b] - width) <= Math.abs(closest - width)) {
closest = breakpoints[b];
useBreak = b;
}
}
// if width is larger than any breakpoint, set the largest breakpoint class available
if(useBreak === undefined){
for(var b in breakpoints){
if (breakpoints[b] < width){
maxBreakVal = breakpoints[b];
useBreak = b;
}
}
}
// is the breakpoint class not allready set?
if(!$(this).hasClass(prefix+"widget-"+useBreak)){
for(var remove in breakpoints){
$(this).removeClass(prefix+"widget-"+remove);
}
$(this).addClass(prefix+"widget-"+useBreak);
$(this).trigger("breakpoint_crossed");
}
});
};
// The script is self executing once the entire page has loaded.
// It is not bound to any specific widget, and will only affect widgets with the binder class.
$(document).ready(function(){
//Check for settings in (var mxf_settings)
var settings = typeof(mxf_settings)==="object" ? mxf_settings : null;
if(typeof mx_user_breakpoints === "object") {
$.extend(settings, mx_user_breakpoints);
}
window.mxf = mxf = new MXF(settings);
mxf.startFlexContainers();
});// Add ECMA262-5 method binding if not supported natively
if (!("bind" in Function.prototype)) {
Function.prototype.bind= function(owner) {
var that= this;
if (arguments.length<=1) {
return function() {
return that.apply(owner, arguments);
};
} else {
var args= Array.prototype.slice.call(arguments, 1);
return function() {
return that.apply(owner, arguments.length===0? args : args.concat(Array.prototype.slice.call(arguments)));
};
}
};
}
// Add ECMA262-5 string trim if not supported natively
if (!("trim" in String.prototype)) {
String.prototype.trim= function() {
return this.replace(/^\s+/, '').replace(/\s+$/, '');
};
}
// Add ECMA262-5 Array methods if not supported natively
if (!("indexOf" in Array.prototype)) {
Array.prototype.indexOf= function(find, i /*opt*/) {
if (i===undefined) { i= 0; }
if (i<0) { i+= this.length; }
if (i<0) { i= 0; }
for (var n= this.length; ithis.length-1) { i= this.length-1; }
/* i++ because from-argument is sadly inclusive */
for (i++; i-->0;) {
if (i in this && this[i]===find) {
return i;
}
}
return -1;
};
}
if (!("forEach" in Array.prototype)) {
Array.prototype.forEach= function(action, that /*opt*/) {
for (var i= 0, n= this.length; i 0) {
var snippet_data = $.extend({}, parent_snippet.data(), current_snippet.data());
} else {
var snippet_data = current_snippet.data();
}
var needs_timezone = this.doesSnippetNeedTimezone(options.snippet, params); // used back in 2014 for WC, not used any more
var data_parameters = mx.getDataParameters(snippet_data, needs_timezone);
if (data_parameters.length > 0) {
params["params"] += String.fromCharCode(1) + data_parameters + String.fromCharCode(1);
}
}
var url = mx.snippetUrl(options.snippet, params);
// if there is an external domain in the settings,
// snippets should be fetched from that domain
if (typeof this.settings.api_domain != "undefined") {
url = this.settings.api_domain + url;
}
//console.log("Load Snippet", options.dom, options.snippet, options.params, url);
var self = this;
$.get(url)
.done(function(data) {
// possibly rewrite the HTML before it is shown
var translations = mx.getTranslations(data, options);
if (translations) {
data = self.translate(data, translations);
}
/*
This feature is severely undocumented, and therefore disabled at this point.
The two called functions has been copied to the stuff_not_used file for safe keeping
if(mx.shouldUseClientPlayerImage(params)) {
data = mx.useClientPlayerImage(data);
}
*/
// show the HTML
this.dom && this.dom.html(data);
// update the DOM and execute callbacks
options.done && options.done(data);
options.dom.addClass("mx-snippet-root"); // it should be possible to find the snippet root element using the closest-method
mx.snippet_autoload(options.dom);
mx.init_snippet_auto_reload(options.dom);
mx.applyTimeZoneOffset();
mx.initGamecenter(options.dom);
mx.initLivescore(options.dom);
mx.initLiveStats(options.dom);
mx.initMatchStats(options.dom);
mx.initCalendar(options.dom);
mx.update_snippet_links(options.dom);
mx.wsDisplayShowAllButton();
if (translations) {
mx.translateAttributes(options.dom, translations);
}
if (typeof(mxf) !== "undefined" && mxf !== null) {
mxf.checkFlexContainerWidth();
}
$(options.dom).trigger("snippet_load_done");
$(options.dom).trigger("breakpoint_crossed");
}.bind(options))
.fail(options.fail || function() {
$(options.dom).trigger("snippet_load_done");
$(options.dom).trigger("breakpoint_crossed");
})
.always(options.always || function() {});
};
// function will change parameters in widgets based on a client provided map of the url.
// this map goes in mx_user_settings.dynamic_widgets.path_pattern
// one the params with matching url_path parts will be replaced.
MX.prototype.dynamic_widgets = function() {
var me = this;
var settings = this.settings.dynamic_widgets;
var url_array = this.url_path_as_array();
var page_name = "default";
var path_pattern = "";
// Final security check. if there are no path_pattern or page_name in mx_user_settings.dynamic_widgets then halt execution
/*** if(typeof settings.path_pattern == "undefined" || settings.page_name == "undefined") ***/
if (typeof settings.path_pattern == "undefined") {
return false;
}
//page_name = settings.page_name;
path_pattern = settings.path_pattern.split("/");
// process all widgets on page
$("." + prefix + "inline-widget" + "." + prefix + "ajax-snippet").each(function() {
var widget_title = $(this).data("params")["title"];
var widget_params = $(this).data("params")["params"].split("/");
var widget_param_map = me.widget_param_map(widget_title);
var path_index;
for (var param_index in widget_param_map) {
path_index = path_pattern.indexOf(widget_param_map[param_index]);
if (path_index > -1 && typeof url_array[path_index] != "undefined") {
widget_params[param_index] = url_array[path_index];
}
}
// inject new paramset
if ($(this).data("params")["params"] != widget_params.join("/")) {
$(this).data("params")["params"] = widget_params.join("/");
if (!$(this).hasClass(prefix + "load-snippet")) {
$(this).addClass(prefix + "load-snippet")
}
}
});
};
// return the url path as as array (everything after the domain name).
MX.prototype.url_path_as_array = function() {
var p = document.location.pathname;
if (p == "/" || p == "undefined" || p == "") {
return false;
}
p = p.substr(1); // strip of the preceeding slash
return p.split("/");
};
// contains a map of widget parameters. Keep it up to date please!
MX.prototype.widget_param_map = function(widget_title) {
var map = {
"actionzone": "[eventid]/[version]",
"commentaries": "[eventid]/[version]",
"h2h": "[eventid]/[version]",
"lineup": "[eventid]/[version]",
"livescore": "[sportid]/[date]/[version]/[show_odds]/[show_selected]",
"match_center": "[eventid]/[version]",
"match_center_plus": "[eventid]/[version]",
"match_center_with_selectors": "[sportid]/[countryid]/[templateid]/[tournamentid]/[stageid]/[eventid]",
"match_incidents": "[eventid]/[version]",
"odds": "[eventid]/[version]",
"performance_stage": "[stageid]/[limit]/[use_header]/[show_dropdown]/[performance_type]/[use_pager]/[page]/[teamid]/[playerid]",
"performance_stage_player": "[stageFK]/[teamFK]/[performance_type]/[highlight_first_place]/[highlight_playerFK]/[show_header]/[show_team_selector]/[filter_performance_type]/[limit]/[page]",
"performance_tournament": "[tournamentid]/[limit]/[use_header]/[show_dropdown]/[performance_type]/[use_pager]/[page]",
"performance_compound": "[countryid]/[limit]/[use_pager]/[page]",
"player": "[playerid]/[tournamentid]/[show_stats]/[version]",
"sport_events": "[sportid]/[date]/[version]",
"squad_stats": "[teamid]/[tournamentid]/[icon_version]",
"stage_events_listing": "[stageid]/[active_tab]",
"stage_fixtures": "[stageid]/[version]/[limit]/[page]",
"stage_results": "[stageid]/[version]/[limit]/[page]",
"stage_standing": "[stageid]/[version]/[icon_version]",
"stages": "[stageid]",
"standings": "[sportid]/[countryid]/[templateid]/[tournamentid]/[stageid]/[eventid]/[version]/[form_order]",
"team": "[teamid]/[tournamentid]/[show_stats]/[version]",
"team_profile": "[teamid]/[tournamentid]/[show_stats]/[version]",
"tournament_ranking": "[standingid]/[standing_name]/[version]/[limit]/[page]",
"race_results": "[tournamentid]/[stageid]/[eventid]/[version]/[pagesize]/[page]",
"cycling_classement": "[stageid]/[standing_type]/[limit]/[page]",
"stage_jerseys": "[eventid]/[version]",
"stage_profile": "[eventid]/[version]",
"stage_ranking": "[eventid]/[version]/[limit]/[page]",
"world_ranking": "[version]/[sportid]/[standingid]/[limit]/[page]",
"ranking": "[sportid]/[standingid]/[limit]/[page]/[icon_version]",
"team_events_list": "[teamid]/[events_type]/[tournamentid]/[limit]/[page]",
"stage_livescore": "[stageFK]/[date]/[version]/[show_odds]/[show_selected]",
"medal_table": "[tournamentid]/[limit]/[page]",
"wc_group_events": "[tournamentid]/[stageid]",
"wc_schedule": "[tournamentid]/[date]",
"wc_livescore": "[tournamentid]/[date]",
"wc_group_standing": "[stageid]",
"wc_group_standings": "[tournamentid]/[stageid]",
"ws_event": "[eventid]/[limit]/[page]",
"current_stages": "[sportid]",
"current_events": "[sportid]/[version]/[templateid]"
};
if (typeof widget_title == "undefined") {
return map;
} else {
if (typeof map[widget_title] != "undefined") {
return map[widget_title].split("/");
} else {
return false;
}
}
};
MX.prototype.table_sort_control = function(e) {
e.preventDefault();
var clickReciever = $(this);
var sort = clickReciever.data("sort");
var column = clickReciever.data("column");
var xhr_container = clickReciever.closest("." + prefix + "sorting-container");
var parampos = xhr_container.data("sortparampos");
var xhr_params = xhr_container.data("params").params.split("/");
var t_col, t_sort, newsort;
// switch sort direction
switch (sort) {
case "asc":
newsort = "desc";
break;
case "desc":
newsort = "asc";
break;
default:
newsort = "desc";
}
//xhr_params[parampos] = table_columns.join("_");
xhr_params[parampos] = column + "_" + newsort.charAt(0);
xhr_container.data("params").params = xhr_params.join("/");
e.data.me.snippet_autoload(xhr_container, "self");
};
MX.prototype.snippet_autoload = function(dom, autoload) {
if (autoload || mx.settings.snippet_autoload_snippets) {
if (autoload == "self") {
// set autoload to "self" to load the provided snippet
mx.snippet({
dom: $(dom)
});
} else {
$(dom).find("." + prefix + "load-snippet").each(function() {
mx.snippet({
dom: $(this)
});
});
}
}
};
MX.prototype.snippet_auto_reload = function(dom, timer, timeout) {
timer = clearTimeout(timer);
mx.snippet({
dom: dom,
always: function() {
timer = setTimeout(function() {
mx.snippet_auto_reload($(dom), timer, timeout);
}, timeout);
}
}); // load snippet
};
// init an autoreload of a widget width mx-snippet-auto-reload somewhere in the dom.
// On the same element it expects a data-reloadtime set in milliseconds.
MX.prototype.init_snippet_auto_reload = function(dom) {
if ($(dom).find("." + prefix + "snippet-auto-reload").hasClass(prefix + "snippet-auto-reload")) {
if (!$(dom).hasClass(prefix + "initialized")) {
var timeout = parseInt($(dom).find("." + prefix + "snippet-auto-reload").data("reloadtime"));
$(dom).addClass(prefix + "initialized");
var timer = setTimeout(function() {
mx.snippet_auto_reload($(dom), timer, timeout);
}, timeout); // set timer
} else {
// dont init again
}
}
};
//function to force snipped reload
MX.prototype.snippet_force_reload = function(dom) {
//prevent multiple reload
try {
cleartTimeout(window.mxrl_timer);
} catch ($e) {}
window.mxrl_timer = setTimeout(function() {
mx.snippet({
dom: $(dom)
}); // load snippet
}, 5000); //set timer
};
// function handles event filtering in livescore compound widget
// basically its a copy of the code from livescore.js.
// Its all been moved here to prevent events being fired across instances of jquery which doesnt work.
MX.prototype.filter_events = function(e) {
//apply the timezone logic every time a filter is changed
mx.applyTimeZoneOffset();
var widget = $(this).closest(".mx-is-widget-container"); // this is the container for the widget
// Hide messsage if tab is not "Show selected" .
if (mx.activeTab() != "selected") {
mx.noMatchesSelected(false);
}
switch (e.type) {
case "click":
// respons to a click from the filter interface
if ($(this).hasClass(prefix + "active")) {
return false;
}
var filter = $(this).data("filter");
// removes and sets mx-active on clicked element
$(this).addClass(prefix + "active").siblings().removeClass(prefix + "active");
// sets correct dropdown or button
if ($(this).hasClass(prefix + "dropdown-option")) {
$(this)
.closest("." + prefix + "snippet-root")
.find("." + prefix + "livescore-top")
.find("." + prefix + "button[data-filter=" + filter + "]").addClass(prefix + "active")
.siblings().removeClass(prefix + "active");
} else {
$(this)
.closest("." + prefix + "snippet-root")
.find("." + prefix + "dropdown" + "." + prefix + "livescore-filters").addClass(prefix + "display-dropdown")
.find("." + prefix + "filter[data-filter=" + filter + "]").trigger("click");
}
// triggers filtering
$(this).closest("." + prefix + "snippet-root").find("." + prefix + "widget-livescore").trigger({
type: "filter_events",
filter: filter
});
break;
case "filter_events":
// responds to a custom event and does the real filtering by adding classnames to the mx-widget-livescore container
var filter = e.filter;
if (!filter) {
return false;
}
$(this)
// clear current filters
.removeClass(
function(index, css) {
return (["filter-all", "filter-inprogress", "filter-finished", "filter-notstarted", "filter-selected"]
.map(function(item) {
return prefix + item;
}).join(" "));
}
// add the new filter
).addClass(prefix + "filter-" + filter);
// hide stage headers with no visible events under the current filter
widget.find(".mx-default-header").each(function() {
var has_visible_events = $(this).next().children("div").is(":visible");
//console.log("parent", $(this).parent());
if (has_visible_events) {
$(this).show();
//fix for RMX design
$(this).next().attr("style", "");
$(this).parent().attr("style", "");
} else {
$(this).hide();
//fix for RMX design
$(this).next().attr("style", "padding-bottom: 0px");
$(this).parent().attr("style", "margin-bottom: 0px");
}
});
//for multisport livescore - extend filters behaviour
var j_compound_cont = $(this).parents('.mx-compound-livescore');
if (j_compound_cont.hasClass("mx-multisport")) {
var active_sportFK = j_compound_cont.data("active_sportfk");
if (filter == "selected") {
j_compound_cont.find(".mx-group-by-sport").each(function() {
var sport_container = $(this);
var nbr_selected = 0;
sport_container.find(".mx-event-chk").each(function() {
if ($(this).is(":checked")) {
nbr_selected++;
}
});
if ((nbr_selected > 0) && (sport_container.hasClass("mx-hide"))) {
sport_container.removeClass("mx-hide");
} else if ((nbr_selected == 0) && (!sport_container.hasClass("mx-hide"))) {
sport_container.addClass("mx-hide");
}
//hide header checkboxes
sport_container.find(".mx-event-group-chk-cont").each(function() {
$(this).hide();
});
});
} else {
j_compound_cont.find(".mx-group-by-sport").each(function() {
var sport_container = $(this);
var sport_id = sport_container.data("sport_id");
if ((sport_id == active_sportFK) && (sport_container.hasClass("mx-hide"))) {
sport_container.removeClass("mx-hide");
} else if ((sport_id != active_sportFK) && (!sport_container.hasClass("mx-hide"))) {
sport_container.addClass("mx-hide");
}
});
}
}
break;
default:
return false;
}
};
MX.prototype.get_timezone = function() {
if (typeof mx.timezone == "undefined") {
if (typeof jstz == "undefined") {
// if JSTZ is not included, fallback to the GMT offset (which PHP will accept)
var now = new Date();
var timezone_offset = now.getTimezoneOffset() / 60;
if (timezone_offset >= 0) {
timezone_offset = "+" + timezone_offset;
}
var timezone_name = "Etc/GMT" + timezone_offset;
} else {
// get an estimate of the timezone from JSTZ
var timezone = jstz.determine();
var timezone_name = timezone.name();
// do not localize timezones for CET (for cache performance reasons), since CEST starts on the same dates in all CET using countries
/*
// improve localization of the timezone name
if(timezone_name == "Europe/Berlin") {
// do not bother looking at the country (if set), just use the language
var language = window.navigator.userLanguage || window.navigator.language;
if(language) {
language = language.substr(0, 2);
var capital = {
"da": "Copenhagen", "es": "Madrid", "fr": "Paris", "hr": "Zagreb", "hu": "Budapest", "it": "Rome",
"nl": "Amsterdam", "no": "Oslo", "pl": "Warsaw", "se": "Stockholm", "sr": "Belgrade"
};
if(typeof capital[language] != "undefined") {
timezone_name = "Europe/" + capital[language];
}
}
}
*/
}
mx.timezone = timezone_name;
}
return mx.timezone;
};
//Height polling (for apps inside an iframe)
MX.prototype.heightPolling = function() {
//Precaution to prevent several height polling timers
clearTimeout(this.heightPollingTimer);
//postMessage to parent indicating current height if it has changed
this.height = typeof(this.height) === "undefined" ? 0 : this.height;
var currentHeight = $(document.body).height();
if (currentHeight !== this.height) {
this.height = currentHeight;
//If global callParentMethod exists call it
if (typeof(window.callParentMethod) === "function") {
window.callParentMethod("resize", {
child: this.settings.name,
height: this.height
});
}
}
this.heightPollingTimer = setTimeout(this.heightPolling.bind(this), 1500);
};
//Do DOM event Binds
MX.prototype.doBinds = function() {
//Loop through selectors
for (var selector in this.settings.binds) {
if (!this.settings.binds.hasOwnProperty(selector)) {
continue;
}
//Loop through events
for (var eventType in this.settings.binds[selector]) {
if (!this.settings.binds[selector].hasOwnProperty(eventType)) {
continue;
}
this.DOM.on(eventType, selector, {
me: this
}, this.settings.binds[selector][eventType]);
}
}
};
//Remove DOM event Binds
MX.prototype.removeBinds = function() {
//Loop through selectors
for (var selector in this.settings.binds) {
if (!this.settings.binds.hasOwnProperty(selector)) {
continue;
}
//Loop through events
for (var eventType in this.settings.binds[selector]) {
if (!this.settings.binds[selector].hasOwnProperty(eventType)) {
continue;
}
this.DOM.off(eventType, selector);
}
};
};
//Add Highlight Class to Dom Element and remove again after an interval
MX.prototype.highlightDOM = function($element, interval) {
if ($element.data("hp")) {
$element = $element.parent();
}
var timer = $element.data("timer");
clearTimeout(timer);
$element.addClass(prefix + "highlight");
timer = setTimeout(function() {
$element.removeClass(prefix + "highlight");
}.bind($element), interval || 5000);
$element.data("timer", timer);
};
MX.prototype.event_loadUrlInParent = function(e) {
// Add class mx-loadUrlInParent to any element that should respond to a clickevent firing this method.
// The browser will redirect the top window to the url/uri specified by the url parameter "clickurl".
// If the url parameter is not set, nothing will happen.
// WARNING: There is no validation on the parameter input. The browser will strictly redirect.
var urldata;
if (mx.queryString("clickurl")) {
urldata = mx.queryString("clickurl");
window.top.location.href = urldata;
}
};
MX.prototype.event_showall = function(e) {
// Expects a data-params set like this {"total_count":"[MAX ITEMS COUNT]"}
var pager = $(this);
var content = pager.parent().parent();
var content_params = content.data("params");
// fail if xhr settings arent found on the container
if (content_params === undefined) {
return false;
}
var content_params_array = content_params.params.split("/");
var page_params = pager.data("params");
content_params_array[3] = page_params.total_count; // modify param set
content_params.params = content_params_array.join("/"); // applay modified params
if (content.hasClass(prefix + "ajax-snippet")) {
e.data.me.snippet({
dom: content,
always: function() {
e.data.me.heightPolling.bind(e.data.me);
}.bind(this)
});
}
};
MX.prototype.event_pager = function(e) {
// Expects a data-params set like this {"load_page":"[PAGE]", "size": "[MAX PAGE COUNT]"}
var pager = $(this);
// get the container. Searcing for mx-paging-content-container class
if ($(pager).closest("." + prefix + "snippet-root").hasClass(prefix + "snippet-root")) {
var content = $(pager).closest("." + prefix + "snippet-root");
} else {
var content = pager.parent().parent(); // this is to facilitate compatibility with danskespil
}
// get container params
var content_params = content.data("params");
// alert error if xhr settings arent found on the container
if (content_params === undefined) {
return false;
}
var content_params_array = content_params.params.split("/");
var page_params = pager.data("params");
if (pager.hasClass(prefix + "showall")) {
// this is limit
var load_page = page_params.total_count;
} else {
// this is pager
var load_page = page_params.load_page;
}
// params takes an array
// newpage takes a number/string
// separator takes a string
var change_params = function(params, newpage, separator) {
params.pop();
params.reverse();
params.unshift(newpage);
params.reverse();
return params.join(separator);
};
content_params.params = change_params(content_params_array, load_page, "/"); // create new param set
content.data("params", content_params); // apply new params
if ((typeof(content.data("snippet")) != "undefined") || content.hasClass(prefix + "ajax-snippet")) {
e.data.me.snippet({
dom: content,
always: function() {
e.data.me.heightPolling.bind(e.data.me);
}.bind(this)
});
}
};
// return the top-most parent snippet of the given snippet
MX.prototype.get_root_snippet = function(snippet_element) {
var root_snippet = snippet_element;
do {
var parent_snippet = root_snippet.parent().closest(".mx-snippet-root");
if (parent_snippet.size() > 0) {
root_snippet = parent_snippet;
}
} while (parent_snippet.size() > 0);
return root_snippet;
};
MX.prototype.auto_click = function(e) {
var dom = $(e.target);
var triggerclass = prefix + "trigger-click";
dom.find("." + triggerclass).each(function() {
//mx.console.log("auto triggering");
$(this).trigger("click");
$(this).removeClass(triggerclass);
});
};
//Console Commands
MX.prototype.console = {
debug: function() {},
log: function() {
if (typeof(console) !== "object" || typeof(console.log) !== "function") {
return false;
}
console.log.apply(console, arguments);
},
info: function() {
if (typeof(console) !== "object" || typeof(console.info) !== "function") {
return false;
}
console.info.apply(console, arguments);
},
warn: function() {
if (typeof(console) !== "object" || typeof(console.warn) !== "function") {
return false;
}
console.warn.apply(console, arguments);
},
error: function() {
if (typeof(console) !== "object" || typeof(console.error) !== "function") {
return false;
}
console.error.apply(console, arguments);
}
};
// method controls the widget preloaders
// it decides when to show and when to hide
MX.prototype.preloader_control = function(e) {
var widget = $(e.target).parents("." + prefix + "is-widget-container");
if (!widget.hasClass(prefix + "is-widget-container")) {
widget = $(e.target).closest("." + prefix + "is-widget-container");
}
var preloader_html = "
";
switch (e.type) {
case "snippet_load_start":
//console.log(e.type,$(widget).attr("class"),$(widget).data("running_timers"));
// increment or initialize the counter
if (typeof($(widget).data("running_timers")) == "number" && $(widget).data("running_timers") >= 0) {
$(widget).data("running_timers", ($(widget).data("running_timers") + 1));
} else {
$(widget).data("running_timers", 1);
}
// decide if a preloader should be added to the dom
if ($(widget).data("running_timers") && $(widget).find(".mx-widget-preload").length < 1) {
$(widget).append("
");
$(widget).addClass(prefix + "displaying-preloader");
// initialize update timer
if ($(widget).data("running_timers") == 1) {
var timerid = Math.random().toString().replace("0.", "");
$(widget).data("preload_timer_id", timerid);
e.data.me.update_preloader(widget, "widget-preload", timerid);
}
}
break;
case "snippet_load_done":
//console.log(e.type,$(widget).attr("class"),$(widget).data("running_timers"));
// decrement the counter
$(widget).data("running_timers", ($(widget).data("running_timers") - 1));
// clear the preloader if we are completely done loading widget content
if ($(widget).data("running_timers") == 0) {
clearTimeout(e.data.me.update_preload_timer[$(widget).data("preload_timer_id")]);
if ($(".mx-widget-preload").length > -1) {
$(widget).find(".mx-widget-preload").fadeOut(500, function() {
$(this).remove();
$(widget).removeClass(prefix + "displaying-preloader");
});
}
}
break;
}
};
// updates a preloader as content is loaded
MX.prototype.update_preloader = function(widget, preload_class, timerid, max_line_height) {
if (this.update_preload_timer[timerid]) {
clearTimeout(this.update_preload_timer[timerid]);
}
if ($(widget).height() > max_line_height) {
var widget_line_height = max_line_height;
} else {
var widget_line_height = $(widget).height();
}
$(widget).find("." + prefix + preload_class).css({
"line-height": widget_line_height + "px",
"height": $(widget).height()
});
this.update_preload_timer[timerid] = setTimeout(function() {
mx.update_preloader(widget, preload_class, timerid);
}, 50);
};
// function tries to decide if the snippet dom is not inside another snippet
// and then will be considered the "outer snippet" - the html part the client inserts on the page
MX.prototype.detect_outer_snippet = function(snippet, classname) {
if ($(snippet).parent().closest("." + prefix + classname).hasClass(prefix + classname)) {
// the snippet is not an outer snippet
} else {
$(snippet).addClass(prefix + "is-widget-container");
}
};
// checks mx_user_settings for property color_theme and then converts it to a MX class name and adds it to the embed dom
MX.prototype.check_color_theme = function(options) {
if (typeof this.settings.color_theme == "string" && this.settings.color_theme.length && options.dom.length) {
var theme_class = prefix + "colortheme-" + this.settings.color_theme;
options.dom.addClass(theme_class);
}
};
//Parse data parameters at the end of "params", if any
MX.prototype.doesSnippetNeedTimezone = function(snippet, params) {
var needs_timezone = false;
if (snippet == "page" && typeof params["theme"] != "undefined" && params["theme"] == "xhr" && typeof params["title"] != "undefined") {
if (typeof mx.settings.timezone_whitelist !== "undefined") {
var timezone_whitelist = mx.settings.timezone_whitelist;
} else {
// The WC sites used to whitelist: match_center, tournament_events, venue_events and fixtures_and_results_data
var timezone_whitelist = {};
}
needs_timezone = typeof timezone_whitelist[params["title"]] != "undefined";
}
return needs_timezone;
};
//Parse data parameters at the end of "params", if any
MX.prototype.getDataParameters = function(data_params, needs_timezone) {
var url = "";
// for modern widgets the needs_timezone will be false.
// this was used for wc2014
if (!needs_timezone) {
delete data_params.xhrTimezone;
} else {
// if the snippet has an "xhr-timezone" setting, use it by default
var timezone = false;
if (mx.settings.hasOwnProperty("timezone")) {
var timezone = mx.settings.timezone;
}
// if the snippet has a "timezone" data attribute, it will override the default timezone
if (data_params.hasOwnProperty("xhrTimezone")) {
var timezone = data_params.xhrTimezone;
}
if (timezone !== false) {
// if the timezone is set to "auto",
// the snippet will instead receive the browser's timezone
if (timezone == "auto") {
timezone = mx.get_timezone();
}
data_params.xhrTimezone = timezone;
}
}
// if the snippet has a "settings" data attribute,
// a "site_domain" data attribute will automatically be set
// if found in the javascript settings
if (data_params.hasOwnProperty("xhrSettings")) {
var enable_settings = data_params.xhrSettings;
delete data_params.xhrSettings;
if (enable_settings) {
data_params.xhrSite = window.location.host;
// TODO: is the following necessary?
/*
if(mx.settings.hasOwnProperty("site_domain")) {
var site_domain = mx.settings.site_domain;
if(site_domain && site_domain.length > 0){
data_params.xhrSite = site_domain;
}
}
*/
}
}
if (!!mx_user_settings.language) {
data_params['xhrLanguagefk'] = mx_user_settings.language;
}
var delimiter = "/";
for (var key in data_params) {
if (data_params.hasOwnProperty(key)) {
if (key.length >= 4 && key.substr(0, 3) == "xhr") {
url += delimiter + key.substr(3, 1).toLowerCase() + key.substr(4) + delimiter + encodeURIComponent(data_params[key]);
}
}
}
return url;
};
var timezone;
//Timezone related functions
MX.prototype.getTimezoneInfo = function(offset) {
var tz_info = {
"offset": offset,
"label": ""
};
if (typeof(offset) == "number") {
var sign = (offset < 0) ? "-" : "+";
var offsetHours = Math.round(offset / 60);
if (offsetHours < 0) {
offsetHours *= -1;
}
if (offsetHours < 10) {
offsetHours = "0" + offsetHours;
}
var offsetMinutes = offset % 60;
if (offsetMinutes < 10) {
offsetMinutes = "0" + offsetMinutes;
}
var label = "GMT " + sign + offsetHours + ":" + offsetMinutes;
tz_info = {
"offset": offset,
"label": label
};
}
return tz_info;
};
MX.prototype.getBrowserTimeZoneOffset = function(tzDate) {
if (typeof(tzDate) == "string") {
var aDates = tzDate.split(" ");
if (aDates.length == 2) {
var ymd = aDates[0].split("-");
if (ymd.length == 3) {
tzDate = new Date(ymd[0], ymd[1] - 1, ymd[2]);
}
}
}
if (typeof(tzDate) != "object") {
tzDate = new Date();
}
var offset = tzDate.getTimezoneOffset();
offset *= (-1);
return offset;
};
MX.prototype.setSelectedTimeZone = function(offset, store) {
if (this.settings.time_zone_selector == "js") {
timezone = offset;
var tz_info = this.getTimezoneInfo(offset);
$("#mx-tz_type_js .mx-dropdown-start .mx-dropdown-button-text span").data("value", offset);
$("#mx-tz_type_js .mx-dropdown-start .mx-dropdown-button-text span").attr("data-value", offset);
$("#mx-tz_type_js .mx-dropdown-start .mx-dropdown-button-text span").text(tz_info.label);
//note: we store and use the time zone from cache only if timezone selector is present
if (store) {
var selected_timezone = {
"offset": offset
};
mx.saveArrayToLocalStorage("mx-selected-timezone", selected_timezone);
}
}
};
MX.prototype.getStoredTimeZoneOffset = function() {
var offset = false;
//note: we store and use the time zone from cache only if time zone selector is present
if (this.settings.time_zone_selector == "js") {
var selected_tz = mx.getArrayFromLocalStorage("mx-selected-timezone");
if (selected_tz && typeof(selected_tz) == "object" && typeof(selected_tz.offset) == "number") {
offset = selected_tz.offset;
return offset;
}
}
return false;
};
MX.prototype.timezoneChanged = function(selectedTimeZoneOffset) {
mx.setSelectedTimeZone(selectedTimeZoneOffset, true);
mx.applyTimeZoneOffset();
};
MX.prototype.applyTimeZoneOffset = function() {
var date_format_long = this.settings.date_format_long;
var date_format_short = this.settings.date_format_short;
if(!date_format_long) { date_format_long = "d/m/Y"; }
if(!date_format_short) { date_format_short = "d/m"; }
var startdate_utc;
var offset;
var offset_hours;
var offset_minutes;
var set_hours;
var set_minutes;
var utc_date;
var utc_time;
var event_date;
var utc_year;
var utc_month;
var utc_day;
var utc_hours;
var utc_minutes;
var year;
var month;
var day;
var hours;
var minutes;
var date_long;
var date_short;
var time;
//NOTE: both dates should be of the same format YYYY-MM-DD
var selectedDate;
var eventDate;
var lang = "";
if ($('.mx-selected-day').find('.mx-calendar-date')[0]) {
selectedDate = $($('.mx-selected-day').find('[data-date]')[0]).attr('data-date');
}
//check stored time zone offset if present we apply timezone from selector
var stored_offset = mx.getStoredTimeZoneOffset();
if (typeof(stored_offset) == "number") {
mx.setSelectedTimeZone(stored_offset, true);
}
//if no stored offset check the settings if we should apply the browser time offset
if ((typeof(stored_offset) != "number") && (mx.settings.use_browser_time_offset == 0)) {
return false;
}
//skip if no date formats found
if(!date_format_long || !date_format_short) {
return false;
}
//update timezone selector if present with browser offset without storage
if ((typeof(stored_offset) != "number") && mx.settings.use_browser_time_offset) {
offset = mx.getBrowserTimeZoneOffset();
mx.setSelectedTimeZone(offset, false);
}
$(".mx-datetime-container").each(function(index, element) {
startdate_utc = $(this).data('startdate_utc');
if (startdate_utc) {
//if not stored offset we use the broswer offset depending of the event date
offset = stored_offset;
if (typeof(offset) != "number") {
offset = mx.getBrowserTimeZoneOffset(startdate_utc);
}
utc_date = startdate_utc.split(" ")[0];
utc_time = startdate_utc.split(" ")[1];
utc_date = startdate_utc.split(" ")[0];
utc_time = startdate_utc.split(" ")[1];
utc_year = parseInt(utc_date.split("-")[0]);
utc_month = parseInt(utc_date.split("-")[1]);
utc_day = parseInt(utc_date.split("-")[2]);
utc_hours = parseInt(utc_time.split(":")[0]);
utc_minutes = parseInt(utc_time.split(":")[1]);
offset_hours = Math.round(offset / 60);
offset_minutes = offset % 60;
set_hours = parseInt(utc_hours + (offset_hours));
set_minutes = parseInt(utc_minutes + (offset_minutes));
event_date = new Date(utc_year, utc_month - 1, utc_day, set_hours, set_minutes);
year = event_date.getFullYear();
month = event_date.getMonth() + 1;
day = event_date.getDate();
hours = event_date.getHours();
minutes = event_date.getMinutes();
if (month < 10) {
month = "0" + month;
}
if (day < 10) {
day = "0" + day;
}
if (hours < 10) {
hours = "0" + hours;
}
if (minutes < 10) {
minutes = "0" + minutes;
}
//build event date
eventDate = year + "-" + month + "-" + day;
//long date format
date_long = date_format_long;
date_long = date_long.replace("Y", year);
date_long = date_long.replace("m", month);
date_long = date_long.replace("d", day);
//short date format
date_short = date_format_short;
date_short = date_short.replace("Y", year);
date_short = date_short.replace("m", month);
date_short = date_short.replace("d", day);
//set lang code if missing
if( lang == "")
{
var lang_container = $(this).closest("*[lang]");
if( typeof(lang_container) != "undefined" )
{
if( (typeof(lang_container.attr("lang")) != "undefined") && (lang_container.attr("lang") != "") )
{
lang = mx.setLang( lang_container.attr("lang") );
}
}
//try to get lang from settings
if( lang == "" )
{
lang = mx.setLang( mx.settings.language );
}
}
if( (lang != "") && ( typeof(moment) != "undefined" ) )
{
//try quick solution for https://pariurix.com/livescore
//Deprecation warning: moment.lang is deprecated. Use moment.locale instead
if( (typeof(moment.lang) === "undefined") && ( typeof(moment.locale) === "function") )
{
moment.locale(lang);
}
else
{
moment.lang(lang);
}
var name_of_months = moment.monthsShort();
var jm = event_date.getMonth();
var month_name = name_of_months[jm];
date_long = date_long.replace("M", month_name);
date_short = date_short.replace("M", month_name);
}
//time
time = hours + ":" + minutes;
//check if the selected date from the calendar is the same as the date (+ the timezone diff) for each event
if (typeof selectedDate != 'undefined' && selectedDate != eventDate) {
var eventRow = $(element).parent().parent().parent().parent();
if (!$(element).parent().parent().parent().parent().hasClass('mx-inprogress')) {
//if it is different then the event should not be displayed for this date
$(element).parent().parent().parent().parent().css('display', 'none');
}
var widget = $(this).closest(".mx-is-widget-container"); // this is the container for the widget
//double row events
if (widget.find(".mx-event-doublerow-header").length > 0) {
// hide stage headers with no visible events under the current filter
widget.find(".mx-event-doublerow-header").each(function(hIndex, hElement) {
var has_visible_events = $($(this).next()[0].firstElementChild.firstElementChild).is(":visible");
if (has_visible_events) {
$(hElement).show();
} else {
$(hElement).hide();
$(hElement).parent().prev().hide();
}
});
//single row events
} else {
// hide stage headers with no visible events under the current filter
widget.find(".mx-default-header").each(function() {
var has_visible_events = $(this).next().children("div").is(":visible");
if (widget.find(".mx-multirow-sport-event").length > 0) {
has_visible_events = $($(this).next().children("div")[0].firstElementChild.firstElementChild).is(":visible");
}
if (has_visible_events) {
$(this).show();
//fix for RMX design
$(this).next().attr("style", "");
$(this).parent().attr("style", "");
} else {
$(this).hide();
//fix for RMX design
$(this).next().attr("style", "padding-bottom: 0px");
$(this).parent().attr("style", "margin-bottom: 0px");
}
});
}
}
//long date
$(element).find(".mx-time-startdate").text(date_long);
//short date for medium and small view
$(element).find(".mx-time-startdate.mx-show-medium").text(date_short);
$(element).find(".mx-time-startdate.mx-show-small").text(date_short);
//time
$(element).find(".mx-time-starttime").text(time);
$(element).find(".mx-time-startdatetime").text(date_long + " " + time);
//var tz_info = mx.getTimezoneInfo(offset);
//console.log(startdate_utc, tz_info.label, set_hours, set_minutes, date_long + " " + time);
}
});
};
//NOTE: use also to setup lang code by ID to cover the widget solutions to be extended
MX.prototype.setLang = function(lang) {
//some of our language codes differ from the ones used by Moment.js
//this switch will convert them for moment
switch(lang)
{
case 1:
lang = "da";//Danish
break;
case "hy" :
lang = "hy-am";
break;
case "heb" :
lang = "he";
break;
case "no" :
lang = "nb";
break;
case "se" :
lang = "sv";
break;
case "gr" :
lang = "el";
break;
case "cz" :
lang = "cs";
break;
case "tc" :
lang = "zh-tw"; // traditional chinese
break;
case "sc" :
lang = "zh-cn"; // simple chinese
break;
case "in" :
lang = "id";
break;
case "ge" :
lang = "ka"; // georgian
break;
case "al" :
lang = "sq"; // Albanian
break;
case "mn" :
lang = "me"; // Montenegrin
break;
case "ee" :
lang = "et"; // Estonian
break;
case "en_us" :
lang = "en"; // US English
break;
case "ron" :
lang = "ro"; // Romanian
break;
}
return lang;
};
//Initialize livescore
MX.prototype.initLivescore = function(dom) {
$(dom).find("." + prefix + "widget-livescore").each(function() {
switch (dom.data("defaultfilter")) {
case "live":
var default_filter = "inprogress";
break;
default:
default_filter = dom.data("defaultfilter");
}
var data = $(this).data();
//mx.console.log("livescore Init:",data);
//Set UID if not set
data.uid = data.uid || Math.random().toString().replace(".", "");
data.dom = this;
//mx.console.log("livescore Init set uid:",data);
mx.widgets["livescore_" + data.uid] = {};
mx.widgets["livescore_" + data.uid] = new LiveScore(data);
mx.widgets["livescore_" + data.uid].init();
mx.widgets["livescore_" + data.uid].parent = mx;
$(this).addClass(prefix + "livescore-" + data.uid);
mx.showSelectedEvents(this);
$(this).trigger({
type: "filter_events",
filter: default_filter
})
});
};
// init action zone
MX.prototype.initLiveStats = function(dom) {
$(dom).find("." + prefix + "livestat-service").each(function() {
// set a uid if not set
var data = $(this).data();
data.uid = data.uid || Math.random().toString().replace(".", "");
data.dom = this;
mx.widgets["livestats_" + data.uid] = {};
mx.widgets["livestats_" + data.uid] = new LiveStats(data);
mx.widgets["livestats_" + data.uid].init();
mx.widgets["livestats_" + data.uid].parent = mx;
$(this).addClass(prefix + "livestats-" + data.uid);
});
};
// init matchstats service
MX.prototype.initMatchStats = function(dom) {
$(dom).find("." + prefix + "match-stats-service").each(function() {
// set a uid if not set
var data = $(this).data();
data.uid = data.uid || Math.random().toString().replace(".", "");
data.dom = this;
mx.widgets["matchstats_" + data.uid] = {};
mx.widgets["matchstats_" + data.uid] = new MatchStats(data);
mx.widgets["matchstats_" + data.uid].init();
mx.widgets["matchstats_" + data.uid].parent = mx;
$(this).addClass(prefix + "match-stats-" + data.uid);
});
};
//Init calendar
MX.prototype.initCalendar = function(dom) {
var settings = {
"wrapper": $(dom)
};
$(dom).find("." + prefix + "calendar-matrix").each(function() {
var uid = Math.random().toString().replace(".", "");
mx.widgets["calendar_" + uid] = {};
mx.widgets["calendar_" + uid] = new MXcal(settings);
mx.widgets["calendar_" + uid].init($(this));
$(this).parent().addClass(prefix + "calendar-container");
});
};
//Initialize a gamecenter widget after snippet has loaded
MX.prototype.initGamecenter = function(dom) {
$(dom).find("." + prefix + "widget-gamecenter").each(function() {
var data = $(this).data();
//mx.console.log(data);
//Set UID if not set
data.uid = data.uid || Math.random().toString().replace(".", "");
data.type = "gamecenter";
data.dom = this;
mx.widgets["gamecenter_" + data.uid] = {};
mx.widgets["gamecenter_" + data.uid] = new LiveScore(data);
mx.widgets["gamecenter_" + data.uid].init();
mx.widgets["gamecenter_" + data.uid].parent = mx;
$(this).addClass(prefix + "livescore-" + data.uid);
if (typeof gc === "undefined") {
gc = new GameCenter();
gc.init();
gc.tipRotator();
}
//use browser time zone offset - NOTE: disable when this setting is set to "no"
// if(mx.settings.use_browser_time_offset != "no")
// {
// mx.setEventStartTime(this);
// }
});
// rotating livetips for notstarted matches
};
MX.prototype.empty = function(p) {
return p == 0 || !p || (typeof(p) == 'object' && $.isEmptyObject(p));
};
//Produce Snippet URL
MX.prototype.snippetUrl = function(snippet, params) {
//Check DNC
if (dnc) {
params.developer_nocache = true;
}
return this.url_rewriter.getSnippetUrl(snippet, params);
};
//Cookie functions
MX.prototype.createCookie = function(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
} else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
};
MX.prototype.readCookie = function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
};
MX.prototype.eraseCookie = function(name) {
createCookie(name, "", -1);
};
//Common Functions
//Get querystring
MX.prototype.queryString = function(key, defaultValue) {
key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + key + "=([^]*)"),
results = regex.exec(location.search);
return results == null ? (defaultValue || "") : decodeURIComponent(results[1].replace(/\+/g, " "));
};
//Rewrite URLs according to the "gateway" method.
//This means GET parameters will be separated by slashes,
//and that the parameters will be set in the order they are defined to the call to the snippet-method.
MX.prototype.gateway = function(gateway_url, rewrite_method, gateway_parameters) {
if (!gateway_parameters) {
var gateway_parameters = false;
}
this.url_rewriter.gateway(gateway_url, rewrite_method, gateway_parameters);
};
MX.prototype.starEventGroup = function(event) {
var j_el = $(event.target);
var is_checked = j_el.is(":checked");
var j_header_cont = j_el.parents('.mx-default-header');
var table = j_header_cont.next('.mx-table');
table.find(".mx-event-chk").each(function() {
if ($(this).is(":visible")) {
if (is_checked) {
$(this).prop("checked", true);
} else {
$(this).prop("checked", false);
}
mx.starEvent(this, 'clickGroup');
}
});
// Only hide group header on "Show selected"
if (mx.activeTab() == "selected") {
j_header_cont.hide();
}
};
MX.prototype.starEventClick = function(event) {
mx.starEvent(event.target, 'clickEvent');
};
MX.prototype.starEvent = function(el, source) {
var j_el = $(el);
var j_compound_cont = j_el.parents('.mx-compound-livescore');
var j_date_cont = j_compound_cont.find(".mx-calendar-matrix");
var date_value = j_date_cont.data('showdate');
var event_fk = j_el.data('event-fk');
var is_checked = j_el.is(":checked");
if (typeof date_value === "string" && date_value.length > 1) {
var myMoment = moment(date_value, "YYYY-MM-DD");
} else {
var myMoment = moment(); // get current moment if no date is supplied
}
var formated_date = myMoment.format("YYYY-MM-DD");
var selected_events = mx.getArrayFromLocalStorage("mx-selected-events");
if (!selected_events) {
selected_events = {};
}
if (is_checked) {
if (!selected_events[formated_date]) {
selected_events[formated_date] = {};
}
selected_events[formated_date][event_fk] = 1;
j_compound_cont.find('.' + prefix + 'event-' + event_fk).addClass(prefix + 'selected');
j_compound_cont.find('div[data-event-id="' + event_fk + '"] .' + prefix + 'enable-sound').css({
"display": "block"
});
} else {
delete selected_events[formated_date][event_fk];
j_compound_cont.find('.' + prefix + 'event-' + event_fk).removeClass(prefix + 'selected');
j_compound_cont.find('div[data-event-id="' + event_fk + '"] .' + prefix + 'enable-sound').css({
"display": "none"
});
}
if (source == "clickEvent") {
var event_group = j_el.parents(".mx-group-by-stage");
if (!!event_group[0]) {
mx.selectedGroupCheck(event_group[0]);
}
}
// Show messsage if tab is "Show selected" and there are events to save for this date
if (mx.activeTab() == "selected") {
mx.noMatchesSelected(Object.getOwnPropertyNames(selected_events[formated_date]).length === 0);
}
mx.saveArrayToLocalStorage("mx-selected-events", selected_events);
//update selected counter
mx.updateSelectCounter();
};
MX.prototype.showSelectedEvents = function(el) {
var j_el = $(el);
var j_compound_cont = j_el.parents('.mx-compound-livescore');
var j_date_cont = j_compound_cont.find(".mx-calendar-matrix");
var date_value = j_date_cont.data('showdate');
var today_formatted = moment().format("YYYY-MM-DD");
if (typeof date_value === "string" && date_value.length > 1) {
var myMoment = moment(date_value, "YYYY-MM-DD");
} else {
var myMoment = moment(); // get current moment if no date is supplied
}
var formated_date = myMoment.format("YYYY-MM-DD");
if (is_vagrant) {
today_formatted = "2014-06-15";
}
if (formated_date < today_formatted) {
//j_compound_cont.find(".mx-event-chk-cont").addClass(prefix + "hidden");
//j_compound_cont.find(".mx-event-group-chk-cont").addClass(prefix + "hidden");
} else {
var selected_events = mx.getArrayFromLocalStorage("mx-selected-events");
if (!!selected_events) {
// clear old selected events
for (var date in selected_events) {
if (date < today_formatted) {
delete selected_events[date];
}
}
mx.saveArrayToLocalStorage("mx-selected-events", selected_events);
// end of clear old selected events
if (!!selected_events[formated_date]) {
for (var i in selected_events[formated_date]) {
var event_cont = j_el.find('.mx-event-' + i);
event_cont.addClass('mx-selected');
event_cont.find('.mx-event-chk').prop("checked", true);
}
// if all events in event group are checked, make the group also checked
j_compound_cont.find(".mx-group-by-stage").each(function() {
mx.selectedGroupCheck(this);
});
}
//update selected counter
mx.updateSelectCounter();
}
}
};
MX.prototype.selectedGroupCheck = function(group_cont) {
var checked_count = 0;
var has_unchecked = false;
$(group_cont).find(".mx-event-chk").each(function() {
if ($(this).is(":visible")) {
if ($(this).is(":checked")) {
checked_count++
} else {
has_unchecked = true;
}
}
});
if (checked_count > 0 && !has_unchecked) {
$(group_cont).prev(".mx-default-header").find(".mx-event-group-chk").prop("checked", true);
}
if (checked_count === 0) {
$(group_cont).prev(".mx-default-header").find(".mx-event-group-chk").prop("checked", false);
// Only hide group header on "Show selected"
if (mx.activeTab() == "selected") {
$(group_cont).prev(".mx-default-header").hide();
}
}
};
MX.prototype.activeTab = function() {
var active_tab = $("." + prefix + "active");
if (active_tab && active_tab.data("filter")) {
return active_tab.data("filter");
}
return false;
};
MX.prototype.noMatchesSelected = function(noMatches) {
if (noMatches) {
$('.mx-js-sport-event-no-matches-selected').show();
} else {
$('.mx-js-sport-event-no-matches-selected').hide();
}
};
MX.prototype.saveArrayToLocalStorage = function(key, data) {
if (typeof(Storage) !== "undefined") {
localStorage.setItem(key, JSON.stringify(data));
}
};
MX.prototype.getArrayFromLocalStorage = function(key) {
if (typeof(Storage) !== "undefined") {
var value = localStorage.getItem(key);
return value && JSON.parse(value);
} else {
return {};
}
};
MX.prototype.updateSelectCounter = function() {
var select_count = $enetpulse('.mx-event-chk-cont').find(".mx-event-chk:checked").length;
if (select_count > 0) {
$enetpulse(".mx-selected-counter").html(select_count);
$enetpulse(".mx-selected-counter").show();
} else {
$enetpulse(".mx-selected-counter").html("");
$enetpulse(".mx-selected-counter").hide();
}
};
MX.prototype.selectEvent = function(event_fk) {
//get selected date
var selected_date = $(".mx-selected-day > div").attr('data-date');
//get selected events
var selected_events = mx.getArrayFromLocalStorage("mx-selected-events");
//init selected event for the selected date if needed
if (!selected_events) {
selected_events = {};
}
if (!selected_events[selected_date]) {
selected_events[selected_date] = {};
}
//add selected event
selected_events[selected_date][event_fk] = 1;
//mark selected event
$(".mx-event-" + event_fk).addClass('mx-selected');
$(".mx-event-chk[data-event-fk='" + event_fk + "']").prop("checked", true);
//store selected events
mx.saveArrayToLocalStorage("mx-selected-events", selected_events);
//update selected counter
mx.updateSelectCounter();
};
MX.prototype.wsDisplayShowAllButton = function() {
if (mx.settings.ws_btn_show && mx.settings.ws_limit > 0) {
$(".mx-ws_show_all").each(function() {
$(this).removeClass("mx-hide")
});
}
};
MX.prototype.wsShowAll = function(e) {
if (e.type == "click") {
mx.wsShow('all');
}
};
MX.prototype.wsShowLess = function(e) {
if (e.type == "click") {
mx.wsShow('less');
}
};
MX.prototype.wsShow = function(type) {
$(".mx-widget-gamecenter.mx-event-widget.mx-winter-sport").each(function() {
if (type == "all") {
$(this).find(".mx-ws_show_all").addClass("mx-hide");
$(this).find(".mx-ws_show_less").removeClass("mx-hide");
} else {
$(this).find(".mx-ws_show_all").removeClass("mx-hide");
$(this).find(".mx-ws_show_less").addClass("mx-hide");
}
});
$(".mx-table.mx-matches-table > tbody").each(function() {
var i_row = 0;
$(this).find("tr:not('.mx-js_row')").each(function() {
i_row++;
if (type == "all") {
$(this).removeClass("mx-hide");
} else if (i_row > mx.settings.ws_limit) {
$(this).addClass("mx-hide");
}
});
});
};
//check whether there are selected events or not and show the sound option even after page reload
$(window).load(function() {
var showSoundOptionForSelectedEvents = setInterval(function() {
if ($(".mx-enable-sound").length > 0) {
var selected_events = mx.getArrayFromLocalStorage("mx-selected-events");
if (selected_events !== null && selected_events !== undefined) {
var event_keys = Object.keys(selected_events);
if (event_keys.length > 0) {
event_keys.forEach(function(entry) {
for (var i = 0; i < Object.keys(selected_events[entry]).length; i++) {
var selected_event_fk = Object.keys(selected_events[entry])[i];
var event_dom = $(".mx-event-" + selected_event_fk);
//show only the sound options of the previously selected events
$(event_dom).find(".mx-enable-sound").css("display", "block");
}
});
}
}
clearInterval(showSoundOptionForSelectedEvents);
}
}, 1000);
});
/*
hscrol - horrisontal scrolling
This methods in this file handles the horisontal scrolling used by the
Tour de France Match Center widget to show the breakaway groups
*/
// Function controls the scrolling of the horisontally scrolling menu mx-hscroll-menu
MX.prototype.hscroll_menu = function(e){
var clickReciever = $(this);
var direction = clickReciever.data("scroll"); // forward or backward
var scrollable = $(this).closest("."+prefix+"hscroll-menu").find("."+prefix+"hscroll-main");
if(scrollable.length < 1){
scrollable = $(this).closest("."+prefix+"hscroll-main-container").find("."+prefix+"hscroll-main");
}
var scroll_items = scrollable.children();
var scroll_items_count = scroll_items.length;
var scrolled = prefix+"hscrolled";
var scrolled_init = prefix+"hscrolled-init";
var unscrolled = prefix+"un-hscrolled";
var unscrolled_init = prefix+"un-hscrolled-init";
switch(direction){
case "forward" :
var item = 1;
var slots_available = e.data.me.hscroll_get_slots(e);
scroll_items.each(function(){
if(!$(this).hasClass(scrolled) && !$(this).hasClass(scrolled_init) && (scroll_items_count-item) >= slots_available){
$(this).addClass(scrolled).removeClass(unscrolled).removeClass(unscrolled_init);
return false;
}
item ++;
});
break;
case "backward" :
scroll_items.each(function(){
if(($(this).hasClass(scrolled) || $(this).hasClass(scrolled_init)) && (!$(this).next().hasClass(scrolled) && !$(this).next().hasClass(scrolled_init)) ){
$(this).addClass(unscrolled).removeClass(scrolled).removeClass(scrolled_init);
return false;
}
});
break;
}
};
MX.prototype.hscroll_event = function(e){
var clickReciever = $(this);
var target = clickReciever.data("view");
var buffer_element = clickReciever.closest("."+prefix+"inline-widget");
var buffer_element_class = prefix+"hscroll-buffer";
var selected_class_prefix = prefix+"hscroll-selected-";
var hscroll_count = clickReciever.closest("."+prefix+"hscroll-menu").find("."+prefix+"hscroll-item").length;
//if no buffer element is selected we need to do this
//the buffer element "stores" the selected element on a container outside a reloading snippet
//this way we can reselect the current item after reload simply by having a classname added to the buffer element
if(!buffer_element.hasClass(buffer_element_class)){
buffer_element.addClass(buffer_element_class);
}
//clear possible selections
var max_items = 10;
while(max_items > 0){
var tmp_group = max_items;
buffer_element.removeClass(selected_class_prefix+tmp_group);
max_items--;
}
//add identifying class to buffer element
buffer_element.addClass(selected_class_prefix+target).data("hscrolltarget",target).data("hscrollcount",hscroll_count);
//cleanup from possible initiation
clickReciever.removeClass(prefix+"js-viewing");
};
// figure out the current count of menu items there is room for
MX.prototype.hscroll_get_slots = function(e){
if($(e.target).hasClass(prefix+"inline-widget")){
var dom = $(e.target);
} else {
var dom = $(e.target).closest("."+prefix+"inline-widget")
}
if(typeof $(e.target).data("slotsavailable") == "object"){
e.data.me.settings.slotsavailable = $(e.target).data("slotsavailable");
}
if(typeof e.data.me.settings.slotsavailable == "object"){
if(dom.hasClass(prefix+"widget-small") || dom.hasClass(prefix+"widget-micro")){
var num_of_slots = e.data.me.settings.slotsavailable.small;
} else if(dom.hasClass(prefix+"widget-medium")){
var num_of_slots = e.data.me.settings.slotsavailable.medium;
} else if(dom.hasClass(prefix+"widget-large")){
var num_of_slots = e.data.me.settings.slotsavailable.large;
} else {
var num_of_slots = e.data.me.settings.slotsavailable.wide;
}
} else {
if(dom.hasClass(prefix+"widget-small") || dom.hasClass(prefix+"widget-micro")){
var num_of_slots = 2;
} else if(dom.hasClass(prefix+"widget-medium")){
var num_of_slots = 3;
} else {
var num_of_slots = 4;
}
}
return num_of_slots;
};
// function resets scroll on mx-hscroll-menu, triggered by breakpoint cross event
MX.prototype.hscroll_reset = function(e){
var container = $(this);
var selected_class_prefix = prefix+"hscroll-selected-";
var hscrolls = container.find("."+prefix+"hscroll-menu").find("."+prefix+"hscroll-item");
var slots_available = e.data.me.hscroll_get_slots(e);
var scrolled = prefix+"hscrolled";
var unscrolled = prefix+"un-hscrolled";
var scrolled_init = prefix+"hscrolled-init";
var unscrolled_init = prefix+"un-hscrolled-init";
var active_slot = 0;
var hscroll_count = hscrolls.length;
// find buffer element
var buffer_element = container.find("."+prefix+"hscroll-menu").closest("."+prefix+"inline-widget");
if(!buffer_element.hasClass(prefix+"inline-widget")){
return false;
}
// are there an active buffer element
if(buffer_element.hasClass(prefix+"hscroll-buffer") && hscroll_count == parseInt(buffer_element.data("hscrollcount"))){
active_slot = buffer_element.data("hscrolltarget");
} else {
// are any currently selected with mx-js-viewing
var tmp_slot = 0;
hscrolls.each(function(){
tmp_slot ++;
if($(this).hasClass(prefix+"js-viewing")){
active_slot = tmp_slot;
$(this).trigger("click");
return false;
}
});
}
// make sure the selected item is visible by hiding suficient amout of items
if(slots_available < active_slot){
var hide_slot_count = active_slot-slots_available;
hscrolls.each(function(){
if(hide_slot_count){
hide_slot_count--;
$(this).addClass(scrolled_init).removeClass(unscrolled).removeClass(unscrolled_init).removeClass(scrolled);
} else {
$(this).removeClass(scrolled_init).removeClass(scrolled).removeClass(unscrolled).addClass(unscrolled_init);
}
});
} else {
hscrolls.removeClass(scrolled).removeClass(unscrolled).removeClass(scrolled_init).removeClass(unscrolled_init);
}
};
/*
dropdowns
This methods in this file handles the different dropdowns we have available
*/
//controls dropdowns
//set data-view on dropdown-buttons with name of dropdown to show
//set id of the dropdown to the same as data-view on dropdown-buttons
MX.prototype.dropdown = function(e){
e.stopPropagation();
var target = e.currentTarget;
var dropdown_container = $(target).closest("."+prefix+"dropdown-container"); // dropdown container
var viewtarget = prefix+"dropdown"; // the dropdown classname to show
var dropdown = $(dropdown_container).find("."+viewtarget); // the dropdown;
var target_coords = target.getBoundingClientRect();
function getDocHeight() {
var D = document;
return Math.max(
D.body.scrollHeight, D.documentElement.scrollHeight,
D.body.offsetHeight, D.documentElement.offsetHeight,
D.body.clientHeight, D.documentElement.clientHeight
);
// http://james.padolsey.com/javascript/get-document-height-cross-browser/
}
$(dropdown).css({height:"auto"});
var dropdown_coords = dropdown[0].getBoundingClientRect();
//are the dropdown too high to show full length on the screen, then add scrollbars and adjust height
if(dropdown_coords.height+target_coords.top > getDocHeight()){
$(dropdown).css({"overflow":"scroll","overflow-y":"scroll","overflow-x":"hidden","height":(window.innerHeight-target_coords.top)+"px"});
}
//set showing class
//$(dropdown).css({left:0,top:33});
//toggle the dropdowns visiblity
e.data.me.dropdown_visibility(dropdown);
};
//recieves the click from the dropdown option
// targetElement is the element that the option targets (for display or snippet load)
MX.prototype.dropdown_option = function(e){
e.stopPropagation();
var do_snippet_load = function(targetElement, widget_container, e){
e.data.me.snippet({dom:targetElement,always:function(){
$(widget_container).find("."+prefix+"dropdown-target").removeClass(prefix+"viewing"); // hide other showing collapabels. We only show the one selected.
$(targetElement).addClass(prefix+"viewing"); // show the collapsable element
}});
};
if($(this).hasClass(prefix+"redir")){
// redirects user to a url via linnk
} else {
// dropdown-option loads content into a container via xhr
var target = e.currentTarget;
var widget_container = e.data.me.getContainer(target); // widget container
var dropdown_container = $(target).closest("."+prefix+"dropdown-container"); // dropdown container
var dropdown = $(target).closest("."+prefix+"dropdown"); // the dropdown
var dropdown_button_text = $(dropdown_container).find("."+prefix+"dropdown-button-text").html($(target).html());
// target of action
switch($(target).data("view")){
case "pagelink":
document.location.href = $(target).data("href");
break;
case "widget-container":
// if data-view is set to widget-container the target element becomes the parent widget container itself (mx-inline-widget)
var targetElement = $(target).closest("."+prefix+"inline-widget."+prefix+"ajax-snippet");
break;
case "collapsable-content":
// if data-view is set to widget-container the target element becomes the parent widget container itself (mx-inline-widget)
var targetElement = $(target).closest("."+prefix+"collapsable-content."+prefix+"ajax-snippet");
break;
case "mx-site-tz-selector":
var targetElement = $(widget_container).find("."+prefix+$(target).data("view"));
break;
default:
//console.log("view", $(target).data("view"), $(target));
// the target element is found within the widget
var targetElement = $(widget_container).find("."+prefix+$(target).data("view"));
if(!targetElement.hasClass(prefix+$(target).data("view"))){
widget_container.parents("."+prefix+"inline-widget").each(function(){
if($(this).find("."+prefix+$(target).data("view")).length){
targetElement = $(this).find("."+prefix+$(target).data("view"));
}
});
}
}
e.data.me.dropdown_visibility(dropdown); // remove the dropdown from screen
//if its an ajax snippet, then load the content before showing it
if($(targetElement).hasClass(prefix+"ajax-snippet")){
// HACK
//is this an odds-filter-dropdown then set data-params of the loading xhr container
if($(target).data("snippetparams") != undefined && widget_container.hasClass(prefix+"dropdown-filter-container")){
var tmp_params = widget_container.data("params");
tmp_params["params"] = $(target).data("snippetparams")["params"];
widget_container.data("params",tmp_params);
}
//if the dropdown option has data-snippetparams use those as ajax snippet params for the dropdown target
if($(target).data("snippetparams") != undefined){
targetElement.data("params",$(target).data("snippetparams"));
do_snippet_load(targetElement, widget_container, e);
} else {
//if not try to use params attached to the dropdown target itself
do_snippet_load(targetElement, widget_container, e);
}
} else {
// if not an ajax-snippet then just show the target element
$(widget_container).find("."+prefix+"dropdown-target").removeClass(prefix+"viewing"); // hide other showing collapabels. We only show the one selected.
$(targetElement).addClass(prefix+"viewing"); // show the collapsable element
}
if(targetElement && targetElement.offset())
{
var top = targetElement.offset().top;
var doc = (document.documentElement || document.body.parentNode || document.body);
if( doc && (top >= 30) && ( targetElement.hasClass("mx-h2h-teams_performance") || targetElement.hasClass("mx-h2h-players_performance") ) )
{
$(doc).scrollTop(top - 30);
}
}
}
};
//hides or shows a dropdown
MX.prototype.dropdown_visibility = function(dom){
//method only accepts NON jquery object. Convert if one is handed over.
if(dom.jquery){
dom = dom[0];
}
var container = mx.getContainer(dom);
//show dropdown if not visible by adding class "mx-display-dropdown"
if(dom.className.indexOf(prefix+"display-dropdown") == -1){
if(dom.className != ""){
dom.className += " "+prefix+"display-dropdown";
} else {
dom.className += prefix+"display-dropdown";
}
$(container).prepend(""); // show sitecover
//remove dropdown if visible by removing the class again.
} else {
if(dom.className.indexOf(prefix+"display-dropdown") == 0){
dom.className = dom.className.replace(prefix+"display-dropdown", "");
} else {
dom.className = dom.className.replace(" "+prefix+"display-dropdown", "");
}
dom.setAttribute("style", ""); // clear the inline styles
$("."+prefix+"cover-for-dropdowns").remove(); // remove sitecover
}
};
// clears all showing dropdowns and sitecovers
MX.prototype.dropdown_clearall = function(e){
$("."+prefix+"display-dropdown").each(function(){
mx.dropdown_visibility($(this));
});
$("."+prefix+"cover-for-dropdowns").remove(); // remove sitecover
};
/*
Popups
This methods in this file handles the different popups we have available
Internal documentation here
https://admin.mx.enetscores.com/umsitari/documentation/frontend/tooltips/
https://admin.mx.enetscores.com/umsitari/documentation/frontend/htmlpopup/
*/
// this method recieves the click event calling for a popup
// param E = the jquery event object
MX.prototype.popup_control = function(e){
if($("."+prefix+"cover-for-popup").length){
e.data.me.cover(e);
}
// prevent default actions
e.preventDefault();
// stop the click event from bubbling
e.stopPropagation();
// variables used
var clickReciever = $(this);
var popup_type = clickReciever.attr("class").match(/mx\-show\-([a-z0-9\-]*)\-popup/ig)[0].substring("mx-show-".length);
var generatorData = $(this).data("popup") || $(this).attr("title");
var mouseLocation = {"Y": "", "X": "", "orientation": "bottom", "arrow": "left"};
// then we create the popup
var container = mx.getContainer(clickReciever);
var popup = mx.buildPopup(generatorData, popup_type, clickReciever);
if(!popup){
return false;
}
var pointer = mx.getPosition(e,clickReciever);
var cssData = mx.adjustDisplayPosition(pointer.X, pointer.Y, mouseLocation, popup.offset.X, popup.offset.Y, popup.content);
// show the popup
mx.showPopup(cssData,mouseLocation,container,popup.content);
};
// Method clears any site or widget cover along with any popups showing
MX.prototype.cover = function(e){
$("."+prefix+"cover-for-popup").remove();
$("."+prefix+"popup").remove();
};
// method is used to get the containing element for popups
MX.prototype.getContainer = function(eventTarget){
/*if($(eventTarget).closest("."+prefix+"widget").hasClass(prefix+"widget")){
var container = $(eventTarget).closest("."+prefix+"widget");
} else {
var container = $(eventTarget).closest("."+prefix+"inline-widget");
}*/
var parent_elements = {"collapsable":prefix+"collapsable-content","widget":prefix+"widget", "inline-widget":prefix+"inline-widget", "site":prefix+"site"};
for(var elem in parent_elements){
if($(eventTarget).closest("."+parent_elements[elem]).hasClass(parent_elements[elem])){
var container = $(eventTarget).closest("."+parent_elements[elem]);
break;
}
}
return container;
};
//return html for popups based on class name
MX.prototype.buildPopup = function(generatorData,popupClassName,clickReciever){
switch(popupClassName){
case "leagueinfo-popup":
// popup in leaguetables
var popupid = $(clickReciever).data("stage");
var top = '
';
var bottom = '
';
var row = $(clickReciever).closest("."+prefix+"inline-widget").find("."+prefix+"league-info-popup-template").first().clone().removeClass(prefix+"league-info-popup-template");
if(row.hasClass(prefix+"showing")){
return false;
}
// ugly hack to get the height of the invisible element we are cloning
// we require the hack to calc the position of the popup.
var previousCss = $(row).attr("style");
var tmprow = $(clickReciever).closest("."+prefix+"inline-widget").find("."+prefix+"league-info-popup-template");
$(tmprow)
.css({
position: 'absolute', // Optional if #myDiv is already absolute
visibility: 'hidden',
display: 'block'
});
var optionHeight = $(tmprow).height();
$(tmprow).attr("style", previousCss ? previousCss : "");
if(clickReciever.width()/2 < 16){
var offset = {"X":(clickReciever.width()/2), "Y":-(optionHeight-20)};
} else {
var offset_temp = (clickReciever.width()/2)-16;
var offset = {"X":-Math.abs(offset_temp), "Y":-(optionHeight-20)};
}
break;
case "form-popup":
var popupid = $(clickReciever).data("eventfk");
// html for the form popup
var top = '
';
var row = '
[date]
[reshome][home]
[resaway][away]
';
var bottom = '
';
for(var key in generatorData){
row = row.replace("["+key+"]", generatorData[key]);
}
if(clickReciever.width()/2 < 16){
var offset = {"X":(clickReciever.width()/2), "Y":-50};
} else {
var offset_temp = (clickReciever.width()/2)-16;
var offset = {"X":-Math.abs(offset_temp), "Y":-50};
}
break;
default:
var popupid = $(clickReciever).data("eventfk");
// default popup - also the tool-tip popup
var top = '
';
var row = '
[line]
';
var bottom = '
';
row = row.replace("[line]", generatorData);
// set an offset
// in order to center the arrow on the target, we need to look at the width of the target,
// and then if its less than 16 we deduct from the offset. If its larger we add the difference-16.
// 16 = the pixels from left egde to center of bottom arrow.
if(clickReciever.width()/2 < 16){
var offset = {"X":(clickReciever.width()/2), "Y":0};
} else {
var offset_temp = (clickReciever.width()/2)-16;
var offset = {"X":-Math.abs(offset_temp), "Y":0};
}
}
$("body").prepend(top+bottom); // create shell
$("."+prefix+popupClassName).find("."+prefix+"dropdown-table-container").prepend(row); // add the row
return {content:$("."+prefix+"popup-"+popupid),offset:offset};
};
// function gets the location of the touch or mouseclick on the screen
// instead of the mouseclick we are actually using the position of the clicked element
// Note: only "touchstart" events return coordinates on touchdevices
MX.prototype.getPosition = function(e,clickReciever){
var pointer = {};
var target_coords = clickReciever.offset();
pointer.X = target_coords.left;
pointer.Y = target_coords.top;
/*if(e.type == "touchstart"){
pointer.X = e.originalEvent.touches[0].clientX;
pointer.Y = e.originalEvent.touches[0].clientY;
} else {
pointer.X = e.clientX;
pointer.Y = e.clientY;
}*/
return pointer;
};
// method adjusts the popup to display within the viewport, avoiding clipping or scolling
MX.prototype.adjustDisplayPosition = function(pointerX, pointerY, mouseLocation, offsetX, offsetY, content, static_position){
// static_position contains a string telling the script which way to align the popup.
// values are "left", "right" or "default" to let the script decide based on overflow.
if(static_position){
var static_position = static_position;
} else {
var static_position = "default";
}
// for stuf like tooltips popup we force a "rotation" of the popup
if($(content).data("rotate")){
var rotate = true;
} else {
var rotate = false;
}
// workaround to get older browsers and IE to return the right scrollsizes
// Scroll is not applied since we are using the position of the clicked element instead of the mouse click.
var scrollX = (window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
var scrollY = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
// make sure the dropdown is not too large for the window
var windowAvailableHeight = $(window).height() - pointerY;
var windowAvailableWidth = $(window).width() - pointerX;
switch(static_position){
case "right" :
pointerX = pointerX - content.width() + (offsetX*4.5) ;
break;
case "left " :
pointerX = offsetX+5;
break;
default :
// prevent right overflow
if(windowAvailableWidth < (content.width() + (offsetX*4.5))){
pointerX = pointerX - content.width() + (offsetX*4.5) ;
mouseLocation.arrow = "right";
//mx.console.debug("prevent right overflow");
}
// prevent left overflow
if(pointerX < offsetX){
pointerX = offsetX+5;
//mx.console.debug("prevent left overflow");
}
}
// some popups wants a "rotation" 180 degress
if(rotate){
pointerY = pointerY - (offsetY*3) - content.height() ;
mouseLocation.orientation = "bottom";
//mx.console.debug("preveting bottom flow "+ scrollY);
}
// configure location
// Scroll is not applied since we are using the position of the clicked element instead of the mouse click.
mouseLocation.Y = pointerY + offsetY /*+ scrollY*/ +"px";
mouseLocation.X = pointerX - offsetX /*+ scrollX*/ +"px";
//var cssData = '{"left" : "'+mouseLocation.X+'", "top" : "'+mouseLocation.Y+'"}'; // set the css
var cssData = {"left" : mouseLocation.X, "top" : mouseLocation.Y}; // set the css
return cssData;
};
// method displays a popup
MX.prototype.showPopup = function(cssData,mouseLocation,container,content){
// do not show empty popups for leagueinfo
if($(content).hasClass("mx-leagueinfo-popup") && !$(content).find("TABLE").children().length){
return false;
}
// apply css - turn on the little arrow - fade in the popup
content.css(cssData);
$("."+prefix+"dropdown-"+mouseLocation.orientation+"-arrow").css({'background-position-x' : mouseLocation.arrow, 'display' : 'block'});
content.fadeIn(150, function(){});
content.addClass(prefix+"viewing");
// turn on the mx-widgetcover to limit input. If the user clicks on the cover, the dropdown closes and cover is removed.
$(container).prepend("");
};
MX.prototype.event_html_popup = function(e){
// this method controls the viewstate, content loading and position of the mx-html-popup
// when a popup is showing, a detection routine starts to look for resizing of the popup content and wiewport.
var data_link_value = $(e.currentTarget).data('link');
var widget_container = $("."+prefix+"compound-livescore");
// stop click event from bubling
e.stopPropagation();
e.preventDefault();
// inject the popup base html to the dom if it isnt already there
if(!$("body").find("#"+prefix+"popup-1").hasClass(prefix+"html-popup"))
{
$("body").prepend(
'
");
widget_container.addClass(prefix+'displaying-preloader');
}
//remove the loader animation when the popup appears
if(popup1.content.ready())
{
widget_container.find('.'+prefix+'widget-preload').fadeOut(500, function()
{
$(this).remove();
});
widget_container.removeClass(prefix+'displaying-preloader');
}
// here we detect data-attributes of the clicked element and apply them to the popup content for snippet load
if($(this).data("snippet")){popup1.content.data("snippet", $(this).data("snippet"));}
if($(this).data("params")){popup1.content.data("params", $(this).data("params"));}
if($(this).data("hash")){popup1.content.data("hash", $(this).data("hash"));}
if($(this).closest('*[data-translation-group]').data("translation-group")){popup1.content.data("translation-group", $(this).closest('*[data-translation-group]').data("translation-group"));}
if($(this).data("type")){popup1.dom.addClass($(this).data("type"));}
if( $(popup1.dom).hasClass(prefix+"viewing") )
{
if($(this).data("snippet")){popup2.content.data("snippet", $(this).data("snippet"));}
if($(this).data("params")){popup2.content.data("params", $(this).data("params"));}
if($(this).data("hash")){popup2.content.data("hash", $(this).data("hash"));}
if($(this).closest('*[data-translation-group]').data("translation-group")){popup2.content.data("translation-group", $(this).closest('*[data-translation-group]').data("translation-group"));}
if($(this).data("type")){popup2.dom.addClass($(this).data("type"));}
}
// the viewport
var viewport = {};
viewport.height;
viewport.width;
// delay for resize detection
var delay = 10;
var timer1;
var timer2;
var time_counter = 0;
// method detects if the browser viewport changes sizes
// and moves the popup accordingly
var detectResize = function(currentViewportWidth, currentViewportHeight, currentDomWidth, currentDomHeight)
{
var do_display = false;
if($(window).width() != currentViewportWidth){
//mx.console.debug("viewport change width");
currentViewportWidth = $(window).width();
do_display = true;
}
if($(window).height() != currentViewportHeight){
//mx.console.debug("viewport change height");
currentViewportHeight = $(window).height();
do_display = true;
}
if($(popup1.content).width() != currentDomWidth || $(popup2.content).width() != currentDomWidth) {
//mx.console.debug("popup change width");
currentDomWidth = $(popup1.content).width();
do_display = true;
}
if($(popup1.content).height() != currentDomHeight) {
//mx.console.debug("popup change height "+$(popup1.content).height());
currentDomHeight = $(popup1.content).height();
do_display = true;
}
if( do_display )
{
displayPopup();
}
startTimer(delay);
};
// this method starts the timer used to resize detection
var startTimer = function(param_delay)
{
if( time_counter >= 10 )
{
stopTimer();
return;
}
time_counter++;
stopTimer();
// only start the timer if the popup is being shown and has class mx-viewing
if( $(popup1.dom).hasClass(prefix+"viewing") )
{
timer1 = setTimeout(function(){detectResize(viewport.width, viewport.height, popup1.width, popup1.height)}, param_delay)
}
if( $(popup1.dom).hasClass(prefix+"viewing") && $(popup2.dom).hasClass(prefix+"viewing") )
{
timer2 = setTimeout(function(){detectResize(viewport.width, viewport.height, popup2.width, popup2.height)}, param_delay)
}
};
// this method stops the timer
var stopTimer = function()
{
try
{
clearTimeout(timer1);
}
catch( e ){};
try
{
clearTimeout(timer2);
}
catch( e ){};
};
// this method applies the positions
var positionPopup = function(cssTop, cssLeft, popup)
{
//if(popup1.height > 0){$(popup1.content).css("height",popup1.height)}
//alert(popup1.height);
if ( window.location !== window.parent.location )
{
// The page is in an iframe and the popup is shown at the top of the iframe
// the reason is that in some cases the iframe has full height and the popup would be shown too low when clicked
cssTop = 50;
} else {
// The page is not in an iframe
}
$(popup.dom).css("left", cssLeft+"px");
$(popup.dom).css("top", cssTop+"px");
};
// this method calculates the top and left values for the popup
var calcPosition = function(viewWidth, viewHeight, popWidth, popHeight)
{
popup1.cssleft = (viewWidth / 2) - (popWidth / 2);
popup1.csstop = (viewHeight / 2) - (popHeight / 2);
popup2.cssleft = (viewWidth / 2) - (popWidth / 2);
popup2.csstop = (viewHeight / 2) - (popHeight / 2);
};
// this method gets the values needed to place the popup
var acquire = function( popup_param )
{
popup_param.width = $( popup_param.dom ).outerWidth();
popup_param.height = $( popup_param.dom ).outerHeight();
viewport.height = window.innerHeight;
viewport.width = window.innerWidth;
};
// this method display the popup
var displayPopup = function()
{
//try to stop endless call of displayPopup function
// if(typeof(timer) != "undefined")
// {
// stopTimer();
// return false;
// console.log("displayPopup", timer);
// }
//resolve the case when popup1.height is null
if(popup1.height == null)
{
popup1.height = $(popup1.content).height();
}
//test if we need to add scrollbars on popup1
if((popup1.height + popup1.csstop) > (viewport.height*0.90))
{
$(popup1.dom).addClass(prefix+"scrollbars");
$(popup1.content_container).css("max-height",(viewport.height*0.85)-($(popup1.dom).outerWidth()-$(popup1.dom).width())+"px");
acquire(popup1);
}
else
{
$(popup1.dom).removeClass(prefix+"scrollbars");
$(popup1.content_container).css("max-height","");
acquire(popup1);
}
calcPosition(viewport.width, viewport.height, popup1.width, popup1.height);
positionPopup(popup1.csstop, popup1.cssleft, popup1);
if( $(popup2.dom).hasClass(prefix+"viewing") )
{
//test if we need to add scrollbars on popup2
if((popup2.height+popup2.csstop) > (viewport.height*0.90))
{
$(popup2.dom).addClass(prefix+"scrollbars");
$(popup2.content_container).css("max-height",(viewport.height*0.85)-($(popup2.dom).outerWidth()-$(popup2.dom).width())+"px");
acquire(popup2);
}
else
{
$(popup2.dom).removeClass(prefix+"scrollbars");
$(popup2.content_container).css("max-height","");
acquire(popup2);
}
calcPosition(viewport.width, viewport.height, popup2.width, popup2.height);
positionPopup(popup1.csstop+50, popup1.cssleft+30, popup2);
}
// check viewport size and set responsive classes
mxf.checkFlexContainerWidth();
//add class to reflect popup is being viewed
//$(popup1.dom).addClass(prefix+"viewing");
};
$( window ).resize( function(){
time_counter = 0;
startTimer(1);
});
// this method removes the popup
var hidePopup = function()
{
if( $(e.currentTarget).data('popup-id') === 'mx-popup-1' )
{
// remove all other popups
$(popup1.dom).removeClass(prefix+"viewing");
$("."+prefix+"html-popup").remove();
stopTimer();
}
if( $("#"+prefix+"popup-2").size() === 1 )
{
$(popup2.dom).fadeOut("fast", function()
{
$(popup2.dom).removeClass(prefix+"viewing");
$(popup2.dom).remove();
});
stopTimer();
}
else
{
if($("#"+prefix+"popup-1").size() === 1)
{
$(popup1.dom).fadeOut("fast", function()
{
$(popup1.dom).removeClass(prefix+"viewing");
$(popup1.dom).remove();
});
}
$(".cover-for-popup").fadeOut("fast", function(){
$(".cover-for-popup").remove()
});
widget_container.css({'overflow': 'visible', 'height': 'unset'});
stopTimer();
}
};
// should we show or hide the popup
// here are several cases that cover the show-hide popups logic
// this way it is working fine, otherwise it isn't! :(
if( !$(popup1.dom).hasClass(prefix+"viewing") && !$(popup2.dom).hasClass(prefix+"viewing") )
{
//load snippet content
e.data.me.snippet({dom:popup1.content, always:function(){
// now show content
$("body").append(""); // add the sitecover
$(popup1.dom).addClass(prefix+"viewing"); // add class viewing
displayPopup();
//@remove startTimer(delay);
time_counter = 0;
startTimer(1);
$(popup1.dom).fadeIn("fast", function(){
// fade in the popup
});
}.bind(this)});
widget_container.css({'overflow': 'hidden', 'height': '-webkit-fill-available'});
}
else
{
if( data_link_value !== undefined && !$(popup2.dom).hasClass(prefix+"viewing") )
{
//load snippet content
e.data.me.snippet({dom:popup2.content, always:function(){
$(popup2.dom).addClass(prefix+"viewing"); // add class viewing
displayPopup();
//startTimer(delay);
time_counter = 0;
startTimer(1);
$(popup2.dom).fadeIn("fast", function(){
// fade in the popup
});
}.bind(this)});
}
else
{
hidePopup();
}
}
if( data_link_value === undefined && $(popup1.dom).hasClass(prefix+"viewing") && $(popup2.dom).hasClass(prefix+"viewing") )
{
hidePopup();
}
if( data_link_value === undefined && $(popup1.dom).hasClass(prefix+"viewing") && !$(popup2.dom).hasClass(prefix+"viewing") )
{
hidePopup();
}
};
// controls a collapsable button container
MX.prototype.collapsable_button_container = function(e){
e.preventDefault();
var clickReciever = $(this);
var container = clickReciever.closest("."+prefix+"button-collapsable-container");
if(clickReciever.hasClass("mx-close-collapsable-button")){
container.removeClass(prefix+"viewing");
return true;
}
if(container.hasClass(prefix+"viewing")){
container.removeClass(prefix+"viewing");
} else {
container.addClass(prefix+"viewing");
}
};
MX.prototype.lineup_incidents_popup = function(e){
// prevent default actions
e.preventDefault();
// stop the click event from bubbling
//e.stopPropagation();
// variables used
var clickReciever = $(this);
var content;
var domSource = $(this).find("."+prefix+"lineup-incidents-popup-source");
var mouseLocation = {"Y": "", "X": "", "orientation": "bottom", "arrow": "left"};
var buildPopup = function(popupClassName,domSource,eventfk){
var top = '
';
var rows = $(domSource).clone().html();
var bottom = '
';
$("body").prepend(top+rows+bottom);
return $("."+prefix+"popup-"+eventfk);
};
// then we create the popup
var container = mx.getContainer(clickReciever);
var content = buildPopup("lineup-incidents-popup", domSource, $(clickReciever).data("eventfk"));
var pointer = mx.getPosition(e,clickReciever);
// set an offset
var offset = {"X":(20-Math.floor(clickReciever.width()/2)), "Y":0};
var cssData = mx.adjustDisplayPosition(pointer.X, pointer.Y, mouseLocation, offset.X, offset.Y, content);
// show the popup
mx.showPopup(cssData,mouseLocation,container,content);
};
MX.prototype.incidents_popup = function(e){
// prevent default actions
e.preventDefault();
// stop the click event from bubbling
e.stopPropagation();
// variables used
var clickReciever = $(this);
var content;
var generatorData = $(this).data("popup") || $(this).attr("title");
var mouseLocation = {"Y": "", "X": "", "orientation": "bottom", "arrow": "left"};
// if the click reciever is tagged as invisible - skip the method
if(clickReciever.hasClass(prefix+"element-invisible")){
return false;
}
var buildPopup = function(generatorData,popupClassName,eventfk,el){
if(typeof generatorData === "object"){
var top = '
';
}
}
for(var key in generatorData){
var tmprow = row.replace("[line]", generatorData[key]);
// add special class names to some lines
switch(key){
case "line2" :
tmprow = tmprow.replace("[class]", prefix+"popup-line2");
break;
case "incident_name" :
tmprow = tmprow.replace("[class]", prefix+"popup-incident-name");
break;
default :
tmprow = tmprow.replace("[class]", "");
}
rows += tmprow;
}
$("body").prepend(top+elapsed+rows+bottom);
return $("."+prefix+"popup-"+eventfk);
} else {
var top = '
';
var row = '
'+generatorData+'
';
var bottom = '
';
var elapsed = '
'+el+'
';
$("body").prepend(top+row+bottom);
return $("."+prefix+"popup-"+eventfk);
}
};
// then we create the popup
var container = mx.getContainer(clickReciever);
var content = buildPopup(generatorData, "incidents-popup", $(clickReciever).data("eventfk"),$(clickReciever).data('el'));
var pointer = mx.getPosition(e,clickReciever);
// set an offset
var offset = {"X":(20-Math.floor(clickReciever.width()/2)), "Y":0};
var cssData = mx.adjustDisplayPosition(pointer.X, pointer.Y, mouseLocation, offset.X, offset.Y, content);
// show the popup
mx.showPopup(cssData,mouseLocation,container,content);
};
MX.prototype.actionzone_corner_popup = function(e){
e.preventDefault();
var clickReciever = $(this);
var generatorData = $.parseJSON(clickReciever.data("popup"));
var eventfk = clickReciever.data("eventfk");
var mouseLocation = {"Y": "", "X": "", "orientation": "bottom", "arrow": "left"};
// if the click reciever is tagged as invisible - skip the method
if(clickReciever.hasClass(prefix+"element-invisible")){
return false;
}
var buildPopup = function(){
var top = '
';
var row = '
[line]
';
var bottom = '
';
var rows = "
"+generatorData[0].incident_name+"
";
//var elapsed = '
'+el+'
';
for(var key in generatorData){
var tmprow = row.replace("[line]", ""+generatorData[key].el+" "+generatorData[key].player);
rows += tmprow;
}
$("body").prepend(top+rows+bottom);
return $("."+prefix+"popup-"+eventfk);
};
// then we create the popup
var container = mx.getContainer(clickReciever);
var content = buildPopup();
var pointer = mx.getPosition(e,clickReciever);
// set an offset
var offset = {"X":(20-Math.floor(clickReciever.width()/2)), "Y":0};
var cssData = mx.adjustDisplayPosition(pointer.X, pointer.Y, mouseLocation, offset.X, offset.Y, content);
// show the popup
mx.showPopup(cssData,mouseLocation,container,content);
};
/*
Links
This methods in this file handles the dynamic DOM insertion of client defined links
Read the proper client documentation on where the client can add updated translations
http://releases.mx.enetscores.com/admin_console/documentation/#links
Internal documentation here
https://admin.mx.enetscores.com/umsitari/documentation/frontend/basics/
*/
// updates the href-attribute of all mx-link elements in the given snippet element.
// param SNIPPET_ELEMENT = snippet DOM
MX.prototype.update_snippet_links = function(snippet_element){
var root_snippet = mx.get_root_snippet(snippet_element);
// get the link settings
var settings = mx.settings;
// find the link group of the snippet
if(root_snippet.size() > 0 && typeof root_snippet.data("link-group") !== "undefined") {
var link_group = root_snippet.data("link-group");
} else {
var link_group = "default";
}
// match the link_group to links or fall back to default if default exists
if(typeof settings.links != "undefined" && typeof settings.links[link_group] == "undefined"){
if(typeof settings.links["default"] != "undefined"){
link_group = "default";
}
}
if(typeof settings.links != "undefined" && settings.links[link_group] != "undefined") {
$("a.mx-link", snippet_element).each(function(index, dom_node) {
var link_element = $(dom_node);
//var old_url = link_element.attr("href");
//if(typeof old_url == "undefined" || old_url == "#") {
var parts = mx.get_link_url(settings, link_group, link_element);
var link_url = parts[0];
if(parts[1] == "_mxpopup"){
mx.link_to_htmlpopup(link_element,parts);
}
if(!mx.empty(link_url)) {
link_element.attr("href", link_url);
link_element.attr("target", parts[1]);
if(link_element.hasClass(prefix+"hide")){
link_element.removeClass(prefix+"hide");
} else if(link_element.parent().hasClass(prefix+"hide")){
link_element.parent().removeClass(prefix+"hide");
}
}
//}
});
}
};
// get the URL of the given mx-link element
MX.prototype.get_link_url = function(settings, link_group, link_element){
var url = false;
var target = false;
// figure out what kind of link it is
var link_type = link_element.data("link");
if(typeof link_type == "undefined"){
link_type = "default";
}
if(typeof settings.links[link_group] != "undefined" && typeof settings.links[link_group][link_type] != "undefined") {
var link_settings = settings.links[link_group][link_type];
var parts = mx.parse_link(link_element, link_settings);
url = parts[0];
target = parts[1];
}
return [url, target];
};
MX.prototype.parse_link = function(element, link_settings){
if(typeof link_settings == "string") {
link_settings = {href: link_settings};
}
// the user specified an array with link settings
if(typeof element.data("href") != "undefined"){
var source = element.data("href");
} else {
var source = link_settings.href;
// if there is no data-attribute and no href setting,
// try to fallback to the href-attribute
if(typeof source == "undefined"){
source = element.attr("href");
}
}
var parts = window.mx.get_link_parameters(source);
var href = parts[0];
var target = parts[1];
if(typeof element.attr("target") != "undefined"){
target = element.attr("target");
}
if(typeof element.data("target") != "undefined"){
target = element.data("target");
}
var parameters = parts[2];
var url = window.mx.generate_link_url(href, parameters, link_settings, element);
return [url, target];
};
MX.prototype.generate_link_url = function(link_template, parameters, link_settings, element){
var url = link_template;
for(var i = 0; i < parameters.length; ++i) {
var parameter = parameters[i];
var value = window.mx.get_link_setting(link_settings, element, parameter.substr(1), "");
url = url.replace(parameter, value);
}
return url;
};
MX.prototype.get_link_parameters = function(link_template){
// get the link target
var target = "_self";
var space_index = link_template.indexOf(" ");
if(space_index >= 0) {
target = link_template.substr(space_index + 1);
link_template = link_template.substr(0, space_index);
}
// get the link parameters
var parameters = link_template.match(/(:\w+)/g);
if(parameters == null){
parameters = [];
}
return [link_template, target, parameters];
};
MX.prototype.get_link_setting = function(link_settings, link_element, key, default_value){
var result = default_value;
if(typeof link_element.data(key) != "undefined") {
result = link_element.data(key);
} else if(typeof link_settings[key] != "undefined"){
result = link_settings[key];
} else if(typeof link_element.attr(key) != "undefined") {
result = link_element.attr(key);
} else if(window[key]) {
result = window[key];
}
/*
replace symbols that are problematic in url such as space, point, / , etc.
return string acceptable to be used in page url
NOTE: use only for names
*/
if( typeof(result) === "string" ) {
switch(key) {
case 'player_name':
case 'player_name_short':
case 'team_name':
case 'team_name_short':
case 'event_name':
case 'event_name_short':
//replace " " with "+"
result = result.replace(/\s/g, "+");
result = result.replace(/\./g, "");
result = result.replace("/", "|");
//NOTE: make sure that we always put something when the text is empty to avoid cases like double "//" in the url
if(result == "") {
result = "-";
}
break;
default:
//leave it like it is
//console.log("get_link_setting", key, result, typeof(result));
break;
}
}
return result;
};
// convert a link href into a html_popup param set
MX.prototype.link_to_htmlpopup = function(dom,linkdata){
if(linkdata[0].indexOf("/page/xhr/") != -1){
var xhr_params_array = linkdata[0].substring("/page/xhr/".length).split("/");
} else {
if(linkdata[0].charAt(0) == "/"){
var xhr_params_array = linkdata[0].substring(1).split("/");
} else {
var xhr_params_array = linkdata[0].split("/");
}
}
var xhr_params_string = JSON.stringify({"theme":"xhr","title":xhr_params_array.splice(0,1).toString(),"params":xhr_params_array.join("/")});
$(dom).data("snippet","page")
.data("params",JSON.parse(xhr_params_string))
.addClass(prefix+"show-html-popup")
.removeClass(prefix+"link"); // for safety we remove the mx-link to avoid any script confusion
};
// updates links from the body of the page and NOT from a snippet.
// This is used on the minisites
MX.prototype.update_body_links = function() {
var link_group = "default";
var settings = mx.settings;
if(typeof settings.links != "undefined" && settings.links[link_group] != "undefined") {
$("a.mx-link").each(function(index, dom_node) {
var link_element = $(dom_node);
var snippet_element = link_element.closest(".mx-snippet-root");
if(snippet_element.size() == 0) {
var old_url = link_element.attr("href");
if(typeof old_url == "undefined" || old_url == "#") {
var parts = mx.get_link_url(settings, link_group, link_element);
var link_url = parts[0];
if(link_url !== false && link_url != "") {
link_element.attr("href", link_url);
link_element.attr("target", parts[1]);
}
}
}
});
}
};
MX.prototype.link_clicked = function(e){
e.preventDefault();
e.stopPropagation();
// find the closest mx-link the user clicked.
// the clicked element is not necessarily the mx-link because of bubbling.
var element = $(e.target);
if(!element.hasClass("mx-link")) {
element = element.closest(".mx-link");
}
// exit method if A.mx-link doesnt have a hreff attribute
if(!element.attr("href")){
return false;
}
// figure out what kind of link it is
var link_type = element.data("link");
if(typeof link_type == "undefined"){
link_type = "default";
}
// this is the link target
var url = false;
var target = false;
// get the link settings
var settings = e.data.me.settings;
if(typeof settings.links != "undefined"){
// find the link group of the snippet
var snippet = element.closest("[data-link-group]");
if(snippet.size() > 0 && typeof snippet.data("link-group") !== "undefined") {
var link_group = snippet.data("link-group");
// if the link group does not exist, fall back on the default
if(typeof settings.links[link_group] == "undefined") {
link_group = "default";
}
} else {
var link_group = "default";
}
if(typeof settings.links[link_group] != "undefined") {
var parts = mx.get_link_url(settings, link_group, element);
var url = parts[0];
var target = parts[1];
}
}
// fallback on the anchor attributes
if(url === false || url == "" || url == "#") {
url = element.attr("href");
target = element.attr("target");
}
// follow the link, if any
if(url !== false && url != "" && url != "#") {
// navigate to the link
if(target == "_blank" || e.ctrlKey){
window.open(url, "_blank");
} else if(target == "_popup"){
window.open(url, "_popup","width=320,height=200")
} else {
window.location.href = url;
}
}
return false;
};
/*
MX_labels
This methods in this file handles the dynamic DOM insertion of client translated labels.
Read the proper client documentation on where the client can add updated translations
http://releases.mx.enetscores.com/admin_console/documentation/#translations
*/
//Return client translations defined in the user settings,
//or false if there are no such translations
// param OPTIONS = the xhr options from the embedcode
// param DATA = returned data by the xhr loaded snippet
MX.prototype.getTranslations = function(data, options){
//There must be client translations in the settings
var translations = false;
if(typeof this.settings.translate != "undefined"){
var root_snippet = mx.get_root_snippet(options.dom);
//There must be client translations for the selected translation group
var translation_group = root_snippet.data("translation-group");
if(typeof translation_group == "undefined"){
translation_group = "default";
}
translations = this.settings.translate[translation_group];
if(mx.empty(translations) && !mx.empty(this.settings.translate.default) && translation_group != "default") {
translations = this.settings.translate.default;
}
if(typeof translations == "undefined"){
translations = false;
}else{
//If there is a translation observer,
//never disable scanning for translations
if(typeof mx.settings.translation_observer == "undefined"){
//If the array does not have any translations,
//return false so snippet AJAX results do not have to be scanned for translation attributes
if(typeof translations == "object"){
var has_translations = false;
for(var k in translations){
if(translations.hasOwnProperty(k)){
has_translations = true;
break;
}
}
if(!has_translations){
translations = false;
}
}
}
}
}
if(typeof mx.settings.translation_observer != "undefined" && translations == false){
translations = {};
}
return translations;
};
//Given the response of a snippet call,
//returns the translated response
// param DATA = returned data by the xhr loaded snippet
// param TRANSLATIONS = translations added by client in mx_user_settings
MX.prototype.translate = function(data, translations){
var has_observer = (typeof mx.settings.translation_observer != "undefined"); // this is used in admin_console only
var index = data.indexOf(" data-translate=");
while(index >= 0){
var label_start = index + 17;
var quote = data.substr(label_start - 1, 1);
index = data.indexOf(quote, label_start);
var label = data.substr(label_start, index - label_start);
//Report that a label was found
// this is used in admin_console only to auto update translations
// as they are entered into the test fields
if(has_observer){
mx.settings.translation_observer(label);
}
//Check if there is a client translation of the label
if(typeof translations[label] != "undefined"){
index = data.indexOf(">", index) + 1;
var default_end_index = data.indexOf("<", index);
data = data.substr(0, index) + translations[label] + data.substr(default_end_index);
index += translations[label].length;
}
index = data.indexOf(" data-translate=", index);
}
return data;
};
MX.prototype.translateAttribute = function(element_data, translations, translation){
var has_observer = (typeof mx.settings.translation_observer != "undefined");
do{
var pos1 = translation.indexOf("[");
if(pos1 != -1){
var pos2 = translation.indexOf("]", pos1);
if(pos2 != -1){
var first_part = translation.substr(0, pos1);
var label = translation.substr(pos1 + 1, pos2 - pos1 - 1);
var second_part = translation.substr(pos2 + 1);
//Report that a label was found
if(has_observer){
mx.settings.translation_observer(label);
}
//Replace [CODE]'s with either labels or data attributes
if(typeof element_data[label] != "undefined"){
label = element_data[label];
}else if(typeof translations[label] != "undefined"){
label = translations[label];
}else{
//If one or more labels are not translated,
//fallback to the default text.
return false;
}
//If the label contains codes, they have to be replaced
label = mx.translateAttribute(element_data, translations, label);
translation = first_part + label + second_part;
}else{
pos1 = -1;
}
}
}while(pos1 != -1);
return translation;
};
// replaces labels in html attributes like "title"
MX.prototype.translateAttributes = function(snippet_element, translations){
$(".mx-translate-attributes", snippet_element).each(function(index, dom_node) {
var element = $(dom_node);
var title = element.data("title");
if(typeof title != "undefined"){
var translation = mx.translateAttribute(element.data(), translations, title);
if(translation !== false){
element.attr("title", translation);
}
}
});
};
/*
Buttons and Collapsables
The methods in this file handle the events cast by clicking buttons and collapsable bars.
Below are links to internal documentation how to use it.
https://admin.mx.enetscores.com/umsitari/documentation/frontend/buttons/
https://admin.mx.enetscores.com/umsitari/documentation/frontend/collapsables/
*/
//
// BUTTONS
//
// This method recieved the click event from the button
// mx-buttons refactored code, "this" refers to the event passed
// param E = the jQuery event (click type, usually)
MX.prototype.button_control = function(e){
var me = e.data.me;
var button = $(this);
var target = button.data("view");
var context = button.closest("."+prefix+"inline-widget");
var process_click = function(target,button,context,me){
var content = context.find("."+prefix+"collapsable-content."+prefix+target);
if(content.hasClass(prefix+"ajax-snippet")){
me.snippet({dom:content, always:function(){
me.button_display_content(button,context,content);
}});
} else {
me.button_display_content(button,context,content);
}
};
if(button.hasClass(prefix+"viewing") || typeof target === "undefined" ){
return false; // if the button is already active then skip out here, no need to do more.
}
if(typeof target == "object"){
for(var item in target){
process_click(target[item],button,context,me);
}
} else if(target == "href") {
document.location.href = $("A",button).attr("href");
} else {
process_click(target,button,context,me);
}
};
// displays the content refered to by the button
// param BUTTON = the button
// param CONTEXT = the closest outer "mx-inline-widget" class
// param CONTENT = the target being handled (usually displayed or hidden)
MX.prototype.button_display_content = function(button,context,content){
var container = button.closest("."+prefix+"button-container");
var useclass = $(button).data("useclass");
var process = function(button,target,context,useclass){
var tmp_content = $(context).find("."+prefix+"collapsable-content."+prefix+target);
if(useclass){
tmp_content.removeClass(prefix+"visible").addClass(prefix+"hide").removeAttr("style");
} else {
tmp_content.hide();
}
button.removeClass(prefix+"viewing");
};
// disable currently active buttons belonging to the same container
$(button).siblings().each(function(){
var target = $(this).data("view");
if(typeof target == "object"){
for(var item in target){
process($(this),target[item],context,useclass);
}
} else {
process($(this),target,context,useclass);
}
});
if(useclass){
$(content).removeClass(prefix+"hide").addClass(prefix+"visible");
} else {
$(content).show();
}
$(button).addClass(prefix+"viewing");
};
//
// COLLAPSABLES
//
// This method recieved the click event from the collapsable bar
// mx-collapsable refactored code, "this" refers to the click event
// param E = the jQuery event (click type, usually)
MX.prototype.collapsable_control = function(e){
var me = e.data.me;
var collapsable = $(this);
// if the collapsable is disabled, dont proceed
if(collapsable.hasClass(prefix+"collapsable-disabled")){
return false;
}
// due to a different structure in multirow livescores the content and collapsable has different locations
if(collapsable.hasClass(prefix+"is-multirow")){
var content = collapsable.closest("."+prefix+"livescore-row").find("."+prefix+"collapsable-content");
collapsable = collapsable.closest("."+prefix+"livescore-row").find("."+prefix+"collapsable");
} else {
if(collapsable.next("."+prefix+"collapsable-content").length){
var content = collapsable.next("."+prefix+"collapsable-content");
} else {
var content = collapsable.nextAll("."+prefix+"collapsable-content");
}
}
// should we open or close
if(collapsable.first().hasClass(prefix+"collapsed")){
// open
if(content.hasClass(prefix+"ajax-snippet")){
me.snippet({dom:content, always:function(){
me.collapsable_content("open",collapsable,content);
}});
} else {
me.collapsable_content("open",collapsable,content);
}
} else {
// close
me.collapsable_content("close",collapsable,content);
}
};
// showing or hiding the content affected by a click on the collapsable bar
// param ACTION = What should the content do (open or close)
// param COLLAPSABLE = the collapsable bar
// param CONTENT = the content thats opening or closing
MX.prototype.collapsable_content = function(action,collapsable,content){
var speed = "fast";
if(action == "open"){
// Before opening the collapsable content we first decide if the content has snippets
// inside that need to finish loading first by checking for mx-snippet-root.
// If there are snippets still loading we listen for the custom event before opening the collapsable.
if($(content).find("."+prefix+"load-snippet").length && !$(content).find("."+prefix+"load-snippet").hasClass(prefix+"snippet-root")){
$(content).find("."+prefix+"load-snippet").on("snippet_load_done",function(){
if($(content).hasClass(prefix+"use-class")){
$(content).slideDown(speed, function(){
$(collapsable).removeClass(prefix+"collapsed");
$(content).attr("style","").removeClass(prefix+"content-collapsed");
});
} else {
$(content).slideDown(speed, function(){
$(collapsable).removeClass(prefix+"collapsed");
});
}
});
} else {
$(content).slideDown(speed, function(){
$(collapsable).removeClass(prefix+"collapsed");
});
//check if the collapsable if opened in a popup
if(typeof($(collapsable).closest(".mx-html-popup").attr("id")) != "undefined")
{
if($(content).html() != "")
{
$(window).trigger('resize');
}
}
}
}
if(action == "close"){
if($(content).hasClass(prefix+"use-class")){
$(content).slideUp(speed, function(){
$(collapsable).addClass(prefix+"collapsed");
$(content).attr("style","").addClass(prefix+"content-collapsed");
});
} else {
$(content).slideUp(speed, function(){
$(collapsable).addClass(prefix+"collapsed");
});
}
}
};//Main Class Constructor
var LiveScore = function(settings){
//Settings
this.settings = $.extend({
//Unique Identifier
uid: "",
//Widget Type
type: "livescore",
//Livescore Dom
dom: "",
//Which events are shown. Today (+ day days)
day: false,
//Sport Foreign Key
sportfk: 0,
//Sport Name key
sport: "",
//Livescore Update Interval (ms)
updateInterval: 15000,
//Elapsed update intervan (ms)
update_elapsed_interval: 60000,
//Livescore Update Data URL
livescoreUrl: "/live_data/livescore/[sportfk]/[n]/",
//Elapsed Update Data URL
elapsedUrl: "/live_data/elapsed/[sportfk]/",
//Event Update Data URL (gamecenter)
eventUrl: "/live_data/event/[eventfk]/[n]",
//jQuery Ajax Settings for update (see jquery ajax options)
ajaxSettings: {cache: false, dataType: "json", ifModified:false, isLocal:false, type: "GET", headers:{SITE:"MinisiteX"}}
}, settings);
//LiveScore DOM
this.DOM = $(this.settings.dom);
//References to the xmlhttp object used in class
this.xmlhttp = {
livescore: null,
elapsed: null
};
//Timers
this.timer = {livescore:null, elapsed:null};
//Dom binds
//this.binds();
};
//Initialize LiveScore
LiveScore.prototype.init = function(){
//Stop LiveScore Update
this.stop();
//Set Update Inc (n)
//this.n = {livescore: this.DOM.data("n")||0};
this.n = {livescore: 0};
//Empty Event rows cache
this.event_rows = {};
//Check if sport is today and is live enabled - today = (day=0)
if(this.settings.day===0 && this.sport().liveupdate){
this.timer.livescore = setTimeout(this.update.bind(this), 250);
//Check if sport has elasped data
if(this.sport().elapsed){
this.timer.elapsed = setTimeout(this.updateElapsed.bind(this), 250);
}
}
};
//Stop LiveScore (Clear timers and abort current xmlhttp request if any)
LiveScore.prototype.stop = function(){
try{this.xmlhttp.livescore.abort();}catch(e){}
try{this.xmlhttp.elapsed.abort();}catch(e){}
try{clearTimeout(this.timer.livescore);}catch(e){}
try{clearTimeout(this.timer.elapsed);}catch(e){}
};
//Event Row Cache
LiveScore.prototype.eventRow = function(eventFK){
if(typeof(this.event_rows[eventFK]) !== 'undefined'){return this.event_rows[eventFK];}
if($(this.DOM).find("."+prefix+"event-"+eventFK).hasClass(prefix+"event-"+eventFK)){
// use Classname if exists
this.event_rows[eventFK] = $(this.DOM).find("."+prefix+"event-"+eventFK);
//ad uid
$(this.event_rows[eventFK]).addClass(prefix+"livescore-"+this.settings.uid);
$(this.event_rows[eventFK]).data("uid",this.settings.uid);
} else {
// use ID as fallback or return false
var tmp = document.getElementById(prefix+'event-'+eventFK);
if(!tmp){
this.event_rows[eventFK] = false;
} else {
this.event_rows[eventFK] = $(tmp);
}
}
return this.event_rows[eventFK];
};
LiveScore.prototype.getJsonUrl = function(){
var json_url = "";
if(typeof(window.mx.settings.json_url) != "undefined") {
json_url = window.mx.settings.json_url;
} else {
if(typeof window.mx.settings.api_domain != "undefined") {
json_url = window.mx.settings.api_domain;
}
}
return json_url;
};
// check if recieved score is not undefined ( not set )
LiveScore.prototype.is_score_set = function(score){
if(score){
return score;
} else {
return 0;
}
};
//Check for pre update function
LiveScore.prototype.preUpdate = function(event_row, event_data){
if(typeof(this.sport().preUpdate)==="function"){
this.sport().preUpdate(event_row, event_data);
}
};
//Update Event
LiveScore.prototype.updateEvent = function(event_data, i){
//Get Event Row DOM
var event_row = this.eventRow(event_data.eventfk);
//Exit if event_row does not exist in DOM
if(!event_row){
//mx.console.debug("event_row not found", event_row);
return;
}
// calculate results, such as the main score (which must be shown differently for different sports)
event_data = this.injectCalculatedResults(event_row, event_data);
this.preUpdate(event_row, event_data);
// all of the methods below can be found in
// the file modules/results.js
this.updateCardList(event_row, event_data);
this.updateStatus(event_row, event_data);
this.updateIncidents(event_row, event_data);
this.updateLineup(event_row, event_data);
this.updateResults(event_row, event_data);
this.updateTimeline(event_row, event_data);
this.updateGoalIncidents(event_row, event_data);
this.updateStats(event_row, event_data);
this.updateProperties(event_row, event_data);
this.motorsportUpdateInfo(event_row, event_data);
this.updateLapbylap(event_row, event_data);
this.updateTournamentResults(event_row, event_data);
this.updatePeriodWinner(event_row, event_data);
this.markCurrentPeriod(event_row, event_data);
this.markEventWinner(event_row, event_data);
this.updateCyclingData(event_row, event_data);
this.updateTennisServeIndicator(event_row, event_data);
this.updateWinterSport(event_row, event_data);
this.postUpdate(event_row, event_data);
return;
};
//Check for post update function
LiveScore.prototype.postUpdate = function(event_row, event_data){
if(typeof(this.sport().postUpdate)==="function"){
this.sport().postUpdate(event_row, event_data);
}
};
//Get sport
LiveScore.prototype.sport = function(){
//Extend Sport with default values
return $.extend({
//Properties
//Does the sport have two event participants who are opponents, each having their own score?
one_on_one: true,
//Does sport have incidents
incidents: false,
//Should the sport show a list of cards for each team
card_list: false,
//Does sport have lineup
lineup: false,
//Does the sport need result updating. (for example tennis has 3-5 sets).
results: false,
//Does sport have livestats
livestats: false,
//Does sport have a gamecenter
gamecenter:true,
//Is sport live updated
liveupdate:true,
//Does sport containe elapsed data (min:sec played) - Is an array of status_descfk's that define which status'es elapsed data is available
elapsed:false,
//Defines the format of elapsed data. Supported formats are: "minutes" or "percent".
elapsed_units: "minutes",
//If false, the timeline will not be reloaded.
//If an array, it defines when the timeline should be extended or reduced.
elapsed_extends_timeline: false, //The timeline should be 90 minutes wide, but be extended if there is extra time.
//special penalty shootout display
penalty_shootout_display: null,
//Functions
//Returns the "main" score. The "main" score depends on the sport, and may be the running score, ordinary time + extra time, etc.
calculateMainScore: LiveScore.prototype.calculateRunningScore,
//Custom function to execute before update (gets 2 params: event_row DOM, event_data)
preUpdate: null,
//Custom function to execute after update (gets 2 params: event_row DOM, event_data)
postUpdate: null
}, this.sports[this.settings.sport]||{});
};
//The default highlight duration is 3000
LiveScore.prototype.results = {
"10001": {"class": "", "highlight_duration": 20000, "sound": "score"}, // main score
"1": {"class": "ordinarytime"},
"2": {"class": "extratime"},
"3": {"class": "penaltyshootout", "highlight_duration": 0, "sound": "score"},
"4": {"class": "finalresult"},
"5": {"class": "halftime"},
"6": {"class": "runningscore"},
"51": {"class": "period1"},
"52": {"class": "period2"},
"53": {"class": "period3"},
"60": {"class": "quarter1"},
"61": {"class": "quarter2"},
"62": {"class": "quarter3"},
"63": {"class": "quarter4"},
"80": {"class": "set1"},
"81": {"class": "set2"},
"82": {"class": "set3"},
"83": {"class": "set4"},
"84": {"class": "set5"},
"85": {"class": "setswon"},
"86": {"class": "tiebreak1"},
"87": {"class": "tiebreak2"},
"88": {"class": "tiebreak3"},
"89": {"class": "tiebreak4"},
"90": {"class": "tiebreak5"},
"91": {"class": "gamescore"},
"301": {"class": "inning1"},
"302": {"class": "inning2"},
"303": {"class": "inning3"},
"304": {"class": "inning4"},
"305": {"class": "inning5"},
"306": {"class": "inning6"},
"307": {"class": "inning7"},
"308": {"class": "inning8"},
"309": {"class": "inning9"},
"310": {"class": "extra-inning"},
"311": {"class": "hits"},
"312": {"class": "errors"},
"504": {"class": "tries"},
"102": {"class": "points"},
"510": {"class": "secondpoints"},
"509": {"class": "wickets"},
"513": {"class": "secondwickets"},
"507": {"class": "overs"},
"511": {"class": "secondovers"},
"282": {"class": "end_1"},
"283": {"class": "end_2"},
"284": {"class": "end_3"},
"285": {"class": "end_4"},
"286": {"class": "end_5"},
"287": {"class": "end_6"},
"288": {"class": "end_7"},
"289": {"class": "end_8"},
"290": {"class": "end_9"},
"291": {"class": "end_10"},
"292": {"class": "end_extra"}
};
//Sport Definitions
LiveScore.prototype.sports = {
//sportfk = 1
soccer: {
elapsed: [2,3,8,9],
elapsed_extends_timeline: [90, 120],
incidents: true,
card_list: true,
lineup: true,
results: true,
livestats: true,
penalty_shootout_display: {"home": "([pen_res])[main_res]", "away": "[main_res]([pen_res])"},
calculateMainScore: LiveScore.prototype.calculateSoccerScore
},
//sportfk = 20
handball: {
elapsed: true,
elapsed_extends_timeline: [60, 70],
results: true
},
//sportfk == 22
motorsport: {
lapbylap: true,
preUpdate: LiveScore.prototype.motorsportUpdateInfo
},
//sportfk = 24
football: {
elapsed:true,
elapsed_units: "minutes",
elapsed_extends_timeline: [60, 75],
results: true,
incidents: true,
lineup: true,
liveupdate:true
},
//sportfk = 5
icehockey: {
results: true,
incidents: true
},
//sportfk = 10
curling: {
results: true
},
baseball: {
results: true
},
volleyball: {
results: true,
mark_period: true
},
//sportfk = 2
tennis: {
results: true,
mark_period: true,
postUpdate: LiveScore.prototype.tennisUpdateServe
},
//sportfk = 33
badminton: {
results: true,
mark_period: true,
//postUpdate: LiveScore.prototype.tennisUpdateServe
},
//sportfk = 73
cricket: {
results: true,
properties: true,
//The batting team will get the serve indicator
postUpdate: LiveScore.prototype.updateCricket
},
//sportfk = 30
cycling: {
one_on_one: false,
elapsed: ["inprogress"],
elapsed_units: "percent",
update_elapsed_interval: 60000, /* every 60 seconds */
update_interval: 60000 /* every 60 seconds */
},
//sportfk = 3
golf: {
one_on_one: false,
update_elapsed_interval: 60000, /* every 60 seconds */
update_interval: 60000 /* every 60 seconds */
},
//sportfk = 23
basketball: {
results: true
},
rugbyunion: {
results: true,
incidents: true,
notstarted_empty_results: ["ordinarytime"]
},
rugbyleague: {
results: true,
incidents: true,
notstarted_empty_results: ["ordinarytime"]
}
// =================================
// Not ready
// =================================
};
/*
Livescore Update
These methods handes the update of livescore data pulled via XHR service.
*/
//Update LiveScore
// function is called by timed setTimeout call at intervals specified in settings
LiveScore.prototype.update = function(){
//Safety precaution to prevent several update processes from occuring
clearTimeout(this.timer.livescore);
//Create URL by insering [sportfk] and [n]
//this is the url that we are going to be polling from
var url;
if(this.settings.type==="gamecenter"){
url = this.settings.eventUrl.replace("[eventfk]", this.settings.eventfk).replace("[n]", this.n.livescore);
}else{
url = this.settings.livescoreUrl.replace("[sportfk]", this.settings.sportfk).replace("[n]", this.n.livescore);
}
// the livescore has to be "visible" in the DOM in order for the update to run
// :visible is a jQuery term where it establishes if the element has a width and a height
// if not then the element is not deemed "visible"
if(!$(this.settings.dom).is(":visible")){
return false;
}
// if configured, send AJAX requests to a particular domain
var ajax_settings = this.settings.ajaxSettings;
var json_url = this.getJsonUrl();
if(json_url.length > 0) {
url = json_url + url;
delete ajax_settings.headers;
}
// link to jQuery ajax documentation
// http://api.jquery.com/jquery.ajax/
this.xmlhttp.livescore = $.ajax(url, ajax_settings)
.done(this.update_done.bind(this))
.always(this.update_always.bind(this))
.fail(this.update_fail.bind(this));
};
//Update Livescore Error
LiveScore.prototype.update_fail = function(){
return false;
};
// Update Livescore Complete
// this will run after the update_done function, and will always run. Even after errors.
LiveScore.prototype.update_always = function(data){
var interval = this.settings.updateInterval;
// reset update interval
//if sport have a special update interval, use that instead of default
if(this.sport().update_interval !== undefined){
interval = this.sport().update_interval;
}
// If widget type is gamecenter and event is not inpreogress increase interval to 1 minute
// there is no reason to update too frequently for not inprogress events
// the reason to keep updating a finished event is that data corrections could occur right after an event has finished
if(this.settings.type === "gamecenter" && (this.DOM.data("status")==="finished" || this.DOM.data("status")==="notstarted")){
interval = 60000; // milliseconds
}
// if there are items in the current dataset, set a low interval to poll quickly for more
// the reason for this is to make sure we always have the latest data in the widget
// as long as we keep recieving updates this will skip the regular intervals
if(typeof(data.t) === "number" && data.t > 0 && this.settings.sportfk != 30){
interval = 50;
}
// set the next timeout
this.timer.livescore = setTimeout(this.update.bind(this), interval);
return;
};
//Update Livescore Success
// this will run on successful data retrievals
// param DATA = the data returned by XHR call
LiveScore.prototype.update_done = function(data)
{
var show_debug = false;
// Validate Data
// it should be an object and ALWAYS have a value for n.
// Code executed within this statement will take any data for granted, and will fail if there are missing elements
if(typeof(data)==="object" && data.n)
{
this.n.livescore = data.n; // store the current n value
var inprogress_count = data.inprogress_count ? parseInt(data.inprogress_count,10) : null;
var widget_container = this.DOM.closest("."+prefix+"is-widget-container");
var live_now_counter_cont = widget_container.find("." + prefix + "live-now-counter");
//check if this is a winter sport
var is_ws = false;
if((typeof(widget_container.find(".mx-sport-ws")) !== "undefined") && (typeof(widget_container.find(".mx-sport-ws").html()) !== "undefined"))
{
is_ws = true;
}
if(show_debug) { console.log ("update_done is_ws", is_ws); }
//check if this is a listing sport
var is_ls = false;
if((typeof(widget_container.find(".mx-sport-ls")) !== "undefined") && (typeof(widget_container.find(".mx-sport-ls").html()) !== "undefined"))
{
is_ls = true;
}
if(show_debug) { console.log ("update_done is_ls", is_ls); }
if(inprogress_count !== null && live_now_counter_cont.length > 0) {
if (inprogress_count > 0) {
live_now_counter_cont.html(inprogress_count);
} else {
live_now_counter_cont.html("");
}
}
//Run update event for each event data
//update the dom
for(var e in data.i){
this.updateEvent(data.i[e])
}
// count live events and display in counter box in the filters
// this check is limited to its own "instance" or DOM of livescore.
// runs after each xhr poll to service, and after the DOM update so the result is always correct
var livecount = $(this.DOM).find(".mx-inprogress").length;
if(is_ws)
{
livecount = widget_container.find(".mx-ws_livescore_row.mx-inprogress").length;
if(show_debug) { console.log ("update_done livecount", livecount); }
}
if(is_ls)
{
livecount = widget_container.find(".mx-ls_livescore_row.mx-inprogress").length;
if(show_debug) { console.log ("update_done livecount", livecount); }
}
var display = $(this.DOM).closest(".mx-compound-livescore").find(".mx-live-now-counter");
if(livecount > 0){
display.show().html(livecount) // show the counter box and update number
} else {
display.hide() // if there is no events, hide the counter box
}
}
return;
};
/*
Livescore Update Elapsed
These methods handes the update of livescore elapsed service data pulled via XHR.
The Elapsed service sends event elapsed times to display in event centers, to give the impression that the event is live.
There is an update every minute.
*/
//Update Elapsed
// called via setTimeout each minute
LiveScore.prototype.updateElapsed = function(){
//Safety precaution to prevent several update processes from occuring
clearTimeout(this.timer.elapsed);
//Create URL by insering [sportfk]
var url = this.settings.elapsedUrl.replace("[sportfk]", this.settings.sportfk);
// prevent CDN caching issues
url += new Date().getTime().toString().substring(0,8);
//if widget type is gamecenter and event is not inprogress there is no need to update elapsed
if(this.settings.type === "gamecenter" && this.DOM.data("status") !== "inprogress"){
return false;
}
// if sport is 22 (motorsport) dont update elapsed
if(this.settings.sportfk == 22){
return false;
}
if(!$(this.settings.dom).is(":visible")){
//mx.console.log("Elapsed disabled",this.settings.dom);
return false;
}
// if configured, send AJAX requests to a particular domain
var ajax_settings = this.settings.ajaxSettings;
var json_url = this.getJsonUrl();
if(json_url.length > 0) {
url = json_url + url;
delete ajax_settings.headers;
}
this.xmlhttp.elapsed = $.ajax(url, ajax_settings)
.done(this.updateElapsed_done.bind(this))
.always(this.updateElapsed_always.bind(this))
.fail(this.updateElapsed_fail.bind(this));
};
//Elapsed Update Success
LiveScore.prototype.updateElapsed_done = function(elapsed_data){
// check the returned data is an object, if not cancel out
if(!typeof(elapsed_data)==="object"){
return;
}
// loop each event in the data, update the elapsed time
for(var eventfk in elapsed_data){
// check that property is present or cancel out
if(!elapsed_data.hasOwnProperty(eventfk)){
continue;
}
// capture the event rows
var event_row = this.eventRow(eventfk);
// if there are no eventrows then cancel out
if(!event_row){
return;
}
event_row.each(function(){
if(elapsed_data[eventfk].it){
if(elapsed_data[eventfk].itel > 0){
// if it is 1 and itel is larger than 0 we show itel and the ping
var itel = elapsed_data[eventfk].itel;
$(this).find("."+prefix+"elapsed").removeClass(prefix+"no-el-ping");
} else {
// if it is 1 and itel is 0 we dont show the 0 and remove the ping
var itel = "";
$(this).find("."+prefix+"elapsed").addClass(prefix+"no-el-ping");
}
} else {
// when it goes away, add the ping to the elapsed again
$(this).find("."+prefix+"elapsed").removeClass(prefix+"no-el-ping");
}
// update all elapsed containers
$(this).find("."+prefix+"elapsed").html(elapsed_data[eventfk].el + (elapsed_data[eventfk].it?"+"+itel:""));
// update all elapsed percentage containers (I think this is only used in the TDF widgets)
$(this).find("."+prefix+"elapsed-percent").css("width", elapsed_data[eventfk].el + (elapsed_data[eventfk].it?"+":"") + "%");
// update timelines (match centers)
$(this).find("."+prefix+"timeline-container").trigger({type:"el", el:elapsed_data[eventfk].el});
// update kilometers (I think this is only used for TDF and Formula one widgets)
if($(event_row).find("."+prefix+"js-kilometers").length){
var completedKM = parseFloat($(event_row).find("."+prefix+"js-kilometers").data("stagekm")) * (elapsed_data[eventfk].el/100);
$(event_row).find("."+prefix+"js-kilometers").html(completedKM.toFixed(2)+" KM");
}
});
}
return;
};
//Elapsed Update Error
LiveScore.prototype.updateElapsed_fail = function(){
return;
};
//Update Elapsed Complete
LiveScore.prototype.updateElapsed_always = function(data){
//Set timer for next update
this.timer.elapsed = setTimeout(this.updateElapsed.bind(this), this.settings.update_elapsed_interval);
return;
};
//Elapsed Timeline Change
LiveScore.prototype.timelineChange = function(e){
//if widget type is gamecenter and event is not inprogress there is no need to update elapsed
if(e.data.me.settings.type === "gamecenter" && e.data.me.DOM.data("status") !== "inprogress"){
return false;
}
var self = e.data.me;
var pre_el = parseInt($(this).data("el"), 10);
var el = parseInt(e.el, 10) || pre_el;
if(el !== pre_el){
$(this).data("el", el);
var elapsed_extends_timeline = self.sport().elapsed_extends_timeline;
if(elapsed_extends_timeline !== false){
//TODO: get these values from the sport settings
if((pre_el<=self.sport().elapsed_extends_timeline[0] && el > self.sport().elapsed_extends_timeline[0]) || (pre_el>self.sport().elapsed_extends_timeline[0] && el <= self.sport().elapsed_extends_timeline[0])){
//mx.console.debug("Timeline Reload");
mx.snippet({dom:$(this), done:function(){
this.trigger({type:"el"});
}.bind($(this))});
return false;
}
}
}
var elapsed_units = self.sport().elapsed_units;
if(elapsed_units == "percent"){
var percent = el;
}else{
//TODO: get these values from the sport settings
if($(this).closest("."+prefix+"status-14").hasClass(prefix+"status-14") || el>self.sport().elapsed_extends_timeline[0]){
var max = self.sport().elapsed_extends_timeline[1];
} else {
var max = self.sport().elapsed_extends_timeline[0];
}
//if(el>90){max = 120;}
var percent = el/max*100;
if(percent<0){percent = 0;}
if(percent>100){percent = 100;}
}
$(this).find("."+prefix+"timeline-active").css("width", percent+"%");
return false;
};
/*
Livescore Status updates
These methods handes the update of livescore status updates
*/
//Check if Status of event has changed
LiveScore.prototype.updateStatus = function(event_row, event_data) {
var show_debug = false;
var statusfk = parseInt(event_data.status_descfk, 10);
if(show_debug) { console.log("updateStatus", "sport_type", this.settings.sport_type, this.settings); }
//HACK for winter and listing sports the other sports logic does not work as expected for them
if((this.settings.sport_type == "ws") || (this.settings.sport_type == "ls"))
{
var st = this.settings.sport_type;
var old_status = event_row.data("statusfk");
var new_status = statusfk;
var status_container = event_row.find(".mx-" + st + "-status");
var old_status_type = status_container.data("status_type");
var new_status_type = event_data.status_type;
var old_status_fk = event_row.data("statusfk");
var new_status_fk = event_data.status_descfk;
if(show_debug)
{
console.log("old_status_type", old_status_type, "new_status_type", new_status_type);
console.log("old statusfk", event_row.data("statusfk"), "new statusfk", event_data.status_descfk);
}
if((old_status_fk !== new_status_fk) || (old_status_type !== new_status_type))
{
var status_definitions = this.DOM.find("." + prefix + "js-status-desc");
status_container.removeClass("mx-" + old_status_type);
status_container.addClass("mx-" + new_status_type);
status_container.removeClass("mx-" + st + "-" + old_status_type);
status_container.addClass("mx-" + st + "-" + new_status_type);
status_container.data("status_type", new_status_type);
status_container.attr("data-status_type", new_status_type);
event_row.data("status_type", new_status_type);
event_row.attr("data-status_type", new_status_type);
event_row.data("statusfk", event_data.status_descfk);
event_row.attr("data-statusfk", event_data.status_descfk);
event_row.removeClass("mx-" + old_status_type);
event_row.addClass("mx-" + new_status_type);
event_row.removeClass("mx-status-" + old_status_fk);
event_row.addClass("mx-status-" + new_status_fk);
if(typeof(status_definitions) != "undefined")
{
var new_status_html = status_definitions.find(".mx-status_desc_" + new_status_fk).html();
if(typeof(new_status_html) != "undefined")
{
status_container.html(new_status_html);
}
else
{
status_container.html(event_data.status_desc_name);
}
}
else
{
status_container.html(event_data.status_desc_name);
}
}
return true;
}
if(event_row.data("statusfk") !== statusfk)
{
this.dynamicallyInsertStatusDefinitions(event_row);
//If type is gamecenter set status data on Main DOM
var old_status = this.DOM.data("status");
if(this.settings.type==="gamecenter"){
this.DOM.data("status", event_data.status_type);
//If new status is 'inprogress' start elapsed update service
if(old_status !== "inprogress" && event_data.status_type === "inprogress"){
this.updateElapsed();
}
}
event_row
.data("statusfk", statusfk)
.removeClass(function(index, css){return (css.match(new RegExp("\\b"+prefix+"status-\\S+","g")) || []).join(" ");})
.addClass(prefix+"status-" + event_data.status_descfk)
.removeClass(function(index, css){return (["notstarted","inprogress","finished","cancelled","interrupted","unknown"].map(function(item){return prefix+item;}).join(" "));})
.addClass(prefix+event_data.status_type)
.find("."+prefix+"status-short").html(event_data.status_desc_short).attr("title", event_data.status_desc_name);
//Possibly play a sound and flash the status
this.notifyStatusChanged(old_status, event_row, event_data);
//Refilter events
if(typeof this.filterEvents != "undefined" && this.settings.type==="livescore"){
setTimeout(this.filterEvents.bind(this), 10);
}
}
};
//Dynamically insert all the status type columns, if necessary
LiveScore.prototype.dynamicallyInsertStatusDefinitions = function(event_row) {
if(event_row.data("status-inserted")){
return;
}
event_row.data("status-inserted", true);
var last_fixed_status_row = event_row.find("." + prefix + "js-last-static");
if(last_fixed_status_row.size() > 0){
if(!this.status_definitions){
this.status_definitions = this.DOM.find("." + prefix + "js-status-desc").html();
}
last_fixed_status_row.removeClass(prefix + "js-last-static").next().remove();
last_fixed_status_row.after(this.status_definitions);
}
};
LiveScore.prototype.notifyStatusChanged = function(old_status, event_row, event_data){
var new_status = event_data.status_type;
if(old_status !== "finished" && new_status === "finished"){
mx.sounds(event_data, event_row, "status");
}
if(old_status !== "inprogress" && new_status === "inprogress"){
mx.sounds(event_data, event_row, "status");
}
//Highlight the status
mx.highlightDOM(event_row.find("."+prefix+"status"), 12000);
};
/*
Livescore Results updates
These methods handles the update of livescore result updates
Note that there are may result types and ways to update them, so the number of methods are quite high
*/
// updates red/yellow cards for sport where this matters
// Soccer and handball
LiveScore.prototype.updateCardList = function(event_row, event_data){
if(this.sport().card_list){
if($(event_row).closest("."+prefix+"widget-livescore").hasClass(prefix+"show-running-cards")){
// do running cards if class mx-show-running-cards i present on the top dom
try {
var cards_1 = event_data.cards[1];
var cards_2 = event_data.cards[2];
var cards_1_dom = event_row.find("."+prefix+"home-card");
var cards_2_dom = event_row.find("."+prefix+"away-card");
// method gets card dom from a hidden part of the dom
// card_type is expected to be an id (itfk)
var get_card = function(card_type,event_row){
var card_holder = $(event_row).closest("."+prefix+"widget-livescore").find("."+prefix+"ml-cards");
var card_yellow = $(card_holder).find("."+prefix+"matchlist-card-2yellow");
var card_2yellow = $(card_holder).find("."+prefix+"matchlist-card-2yellow");
var card_red = $(card_holder).find("."+prefix+"matchlist-card-red");
switch(card_type){
/*case 14:
return card_yellow;
break;*/
case 15:
return card_2yellow;
break;
case 16:
return card_red;
break;
default:
return false;
}
};
//run homecards
for(var card_type in cards_1){
var card_count = cards_1[card_type];
var datafield = "c"+card_type;
var cards_in_dom = cards_1_dom.data(datafield);
// if cards are different in the dom, update the cards
for(var c = cards_in_dom; c < card_count; c++){
if(typeof get_card(parseInt(card_type),event_row) === "object"){
$(get_card(parseInt(card_type),event_row)).clone().appendTo(cards_1_dom);
//$(cards_1_dom).clone().append(get_card(card_type,event_row));
}
}
cards_1_dom.data(datafield,card_count);
}
//run awaycards
for(var card_type in cards_2){
var card_count = cards_2[card_type];
var datafield = "c"+card_type;
var cards_in_dom = cards_2_dom.data(datafield);
// if cards are different in the dom, update the cards
for(var c = cards_in_dom; c < card_count; c++){
if(typeof get_card(parseInt(card_type),event_row) === "object"){
$(get_card(parseInt(card_type),event_row)).clone().appendTo(cards_2_dom);
//$(cards_2_dom).clone().append(get_card(parseInt(card_type),event_row));
}
}
cards_2_dom.data(datafield,card_count);
}
//mx.console.log("Cards: ",event_data.cards);
} catch(err) {
//mx.console.log("Cards array misformat: ",event_data.cards);
//mx.console.log("Error:",err);
}
}
}
};
//Update Incidents Hash (end reload incidents dom if visible)
// this is used in the match center where we update the incidents (when visible) when the hash updates
LiveScore.prototype.updateIncidents = function(event_row, event_data){
if(this.sport().incidents){
//Update Incidents
var incidents_dom = event_row.next("."+prefix+"incidents");
if(!incidents_dom.length){
if(event_row.find("."+prefix+"incidents").data("hash") !== undefined){
incidents_dom = event_row.find("."+prefix+"incidents");
} else {
incidents_dom = event_row.find("."+prefix+"incidents").closest("."+prefix+"snippet-root");
}
}
if(incidents_dom.length){
if(incidents_dom.data("hash") !== event_data.incidents_hash){
incidents_dom.data("hash", event_data.incidents_hash);
if(incidents_dom.is(":visible")){
mx.snippet({dom: incidents_dom});
}
}
}
}
};
//Update goal incidents
LiveScore.prototype.updateGoalIncidents = function(event_row, event_data){
if(this.sport().incidents){
$(event_row).each(function(){
var goalIncidents_dom = $(this).find("."+prefix+"goal-incidents-container");
if(goalIncidents_dom.length){
if(goalIncidents_dom.data("hash") !== event_data.incidents_hash){
goalIncidents_dom.data("hash", event_data.incidents_hash);
if(goalIncidents_dom.is(":visible")){
mx.snippet({dom: goalIncidents_dom});
}
//update the timeline, since there was a new incident
//this.updateTimeline(event_row, event_data);
}
}
});
}
};
//Update gamestats
LiveScore.prototype.updateStats = function(event_row, event_data){
if(this.sport().livestats){
$(event_row).each(function(){
var gamestats_dom = $(this).find("."+prefix+"stats");
if(gamestats_dom.find("."+prefix+"livestat-service").hasClass(prefix+"livestat-service")){
return false; // dont update - livestat js running
}
// this is kept here for some older versions that might still run this.
// As of march 2017 I am not risking to delete this yet - Morten
if(gamestats_dom.length){
if(gamestats_dom.data("hash") !== event_data.stats_hash){
gamestats_dom.data("hash", event_data.stats_hash);
if(gamestats_dom.is(":visible")){
mx.snippet({dom: gamestats_dom});
}
}
}
});
}
};
//Update timeline, if available
LiveScore.prototype.updateTimeline = function(event_row, event_data){
$(event_row).each(function(){
var timeline_dom = $(this).find("."+prefix+"timeline-container");
if(timeline_dom.length){
if(timeline_dom.data("hash") !== event_data.incidents_hash){
timeline_dom.data("hash", event_data.incidents_hash);
mx.snippet({dom: timeline_dom, done:function(){
timeline_dom.trigger("el");
}.bind(timeline_dom)});
}
}
});
};
//Update properties
LiveScore.prototype.updateProperties = function(event_row, event_data){
if(this.sport().properties){
for(var property_name in event_data.properties){
if(!event_data.properties.hasOwnProperty(property_name)){continue;}
event_row.find("." + prefix + "js-property-" + property_name).html(event_data.properties[property_name]);
}
}
};
//Update Lineup Hash (end reload lineup dom if visible)
// this is used in the match center where we update the lineup (when visible) when the hash updates
LiveScore.prototype.updateLineup = function(event_row, event_data){
if(this.sport().lineup){
var lineup_dom = event_row.find("."+prefix+"lineup");
if(lineup_dom.length){
if(lineup_dom.data("hash") !== event_data.lineups_hash){
lineup_dom.data("hash", event_data.lineups_hash);
if(lineup_dom.is(":visible")){
mx.snippet({dom: lineup_dom});
}
}
}
}
};
//Update Other Results (sets, periods, quarters, halftime etc...)
LiveScore.prototype.updateResults = function(event_row, event_data){
var sport_settings = this.sport();
if(sport_settings.results) {
var participant_nr = 1;
while(typeof(event_data.results[participant_nr]) != "undefined")
{
var readable_team = participant_nr;
if(sport_settings.one_on_one){
if(participant_nr == "1"){
readable_team = "home";
} else if(participant_nr == "2"){
readable_team = "away";
}
}
var participant_results = event_data.results[participant_nr].r;
//special display of Penalty Shootout results in livescore rows
if(event_row.hasClass("mx-stage-events") && (sport_settings.penalty_shootout_display != null) && typeof(sport_settings.penalty_shootout_display[readable_team] !== "undefined") && ( (event_data.status_descfk == 4) || (event_data.status_descfk == 13) ))
{
var res_tpl = sport_settings.penalty_shootout_display[readable_team];
var main_res = 0;
//add ordinary time result
if(typeof(participant_results[1]) != "undefined") { main_res += parseInt(participant_results[1]); }
//add extra time result
if(typeof(participant_results[2]) != "undefined") { main_res += parseInt(participant_results[2]); }
//set penalty result
var pen_res = 0;
if(typeof(participant_results[3]) != "undefined") { pen_res = parseInt(participant_results[3]); }
//build result
var res = res_tpl;
res = res.replace("[main_res]", main_res);
res = res.replace("[pen_res]", pen_res);
var selector = "." + prefix + "js-res-" + readable_team;
var cell = event_row.find(selector);
if(cell.html() != res)
{
cell.data("res", res);
this.notifyResultChanged(sport_settings, this.results[10001], cell, event_row, event_data);
cell.html(res);
}
}
else
{
for(var type in participant_results)
{
if(!participant_results.hasOwnProperty(type)){continue;}
if(typeof(this.results[type]) == "undefined"){
var readable_type = type;
}else{
var readable_type = this.results[type].class;
}
//leave empty some score boxes for not started events depending of sport config
if((event_data.status_type == "notstarted") && (typeof(sport_settings.notstarted_empty_results) == "object") && sport_settings.notstarted_empty_results.includes(readable_type))
{
participant_results[type] = "";
}
if(typeof(participant_results[type]) != "undefined" && participant_results[type] !== ""){
var res = participant_results[type];
}else{
var res = "";
}
if(readable_type != ""){
readable_type = "-" + readable_type;
}
if(typeof event_data.properties != "undefined" && event_data.properties.EventTypeName == "Team to Team") {
readable_type = "-main-score"
}
var selector = "."+prefix+"js-res-"+readable_team+readable_type;
var cell = event_row.find(selector);
if(!cell.length){continue;}
/* old version
if(res && cell.html() != res) {
cell.data("res", res);
this.notifyResultChanged(sport_settings, this.results[type], cell, event_row, event_data);
}
cell.html(res);
*/
if(cell.html() != res)
{
cell.data("res", res);
this.notifyResultChanged(sport_settings, this.results[type], cell, event_row, event_data);
cell.html(res);
}
}
}
++participant_nr;
}
}
};
//NOTE: this function should be called on postUpdate, but does not seems so => updateTennisServeIndicator created instead
//Update serve indicator.
LiveScore.prototype.tennisUpdateServe = function(event_row, event_data){
//Check whether the serve indicator needs to be changed
var selector = "." + prefix + "js-serve-indicator";
var serve_indicator = event_row.find(selector);
if(serve_indicator.size() == 0){
serve_indicator = event_row.closest(selector);
}
var participant_nr = ((event_data.cards && event_data.cards.serv) ? event_data.cards.serv : 0);
var class_name = prefix + "p" + participant_nr + "-serve";
if(!serve_indicator.hasClass(class_name)){
//Update the serve indicator
var p1_serve = prefix + "p1-serve";
var p2_serve = prefix + "p2-serve";
serve_indicator
.removeClass(p1_serve + " " + p2_serve)
.addClass(class_name);
}
};
//Tennis Update Serve Indicator (remade for direct call)
LiveScore.prototype.updateTennisServeIndicator = function(event_row, event_data){
if(this.settings.sport == "tennis")
{
var selector = "." + prefix + "js-serve-indicator";
var serve_indicator = event_row.find(selector);
if(serve_indicator.size() == 0)
{
serve_indicator = event_row.closest(selector);
}
if(event_data.status_type == "inprogress")
{
var participant_nr = ((event_data.cards && event_data.cards.serv) ? event_data.cards.serv : 0);
var class_name = prefix + "p" + participant_nr + "-serve";
if(!serve_indicator.hasClass(class_name))
{
//Update the serve indicator
var p1_serve = prefix + "p1-serve";
var p2_serve = prefix + "p2-serve";
serve_indicator
.removeClass(p1_serve + " " + p2_serve)
.addClass(class_name);
}
}
else
{
serve_indicator.removeClass(prefix + "p1-serve");
serve_indicator.removeClass(prefix + "p2-serve");
}
}
};
//Cricket specific livescore update.
//TODO: can this be made more generic somehow? Maybe the serve indicator can share code with tennis, etc.
LiveScore.prototype.updateCricket = function(event_row, event_data){
//Update the serve indicator, if necessary
var selector = "." + prefix + "js-serve-indicator";
var serve_indicator = event_row.find(selector);
if(serve_indicator.size() == 0){
serve_indicator = event_row.closest(selector);
}
if(event_data.cards){
//Update the serve indicator (shows which team is in its innings)
if(typeof(event_data.cards.serv) != "undefined"){
var participant_nr = event_data.cards.serv;
var class_name = prefix + "p" + participant_nr + "-serve";
if(!serve_indicator.hasClass(class_name)){
//Update the serve indicator
var p0_serve = prefix + "p0-serve";
var p1_serve = prefix + "p1-serve";
var p2_serve = prefix + "p2-serve";
serve_indicator
.removeClass(p0_serve + " " + p1_serve + " " + p2_serve)
.addClass(class_name);
}
}
}
if(event_data.properties){
//Show the english comment
if(typeof(event_data.properties.english) != "undefined"){
event_row.find("." + prefix + "js-english").html(event_data.properties.english);
}
//Show the toss winner and decision
if(typeof(event_data.properties.show_toss) != "undefined"){
var winnerFK = event_data.properties.toss_participantFK;
var decision = event_data.properties.toss_choose;
var team_name = event_row.data("team-" + winnerFK);
var label_class = "js-won-toss-choose-" + decision;
var snippet_root = event_row.closest("." + prefix + "snippet-root");
var translation = snippet_root.find("." + prefix + label_class).html();
translation = translation.replace("[TEAM]", team_name);
event_row.find("." + prefix + "js-cricket-toss").html(translation);
} else {
event_row.find("." + prefix + "js-cricket-toss").html("");
}
//Show the outcome, if any
if(typeof(event_data.properties.outcome_label) != "undefined"){
var properties = event_data.properties;
var label_name = properties.outcome_label;
var snippet_root = event_row.closest("." + prefix + "snippet-root");
var labels = snippet_root.find("." + prefix + "js-labels");
var label = labels.find("." + prefix + "js-" + label_name).html();
if(label) {
if(properties.outcome_winner) {
var team_name = event_row.data("team-" + properties.outcome_winner);
label = label.replace("[TEAM]", team_name);
}
if(properties.outcome_value != "") {
label = label.replace("[NUMBER]", properties.outcome_value);
}
if(properties.outcome_dl) {
var label_dl = labels.find("." + prefix + "js-dl").html();
label += " " + label_dl;
}
}
event_row.find("." + prefix + "js-outcome").html(label);
}
//Show which innings is being played
if(typeof(event_data.properties.innings) != "undefined"){
//Show the current innings as a message
var innings = event_data.properties.innings;
var current_innings = event_row.find("." + prefix + "js-innings" + innings);
if(current_innings.hasClass(prefix + "hide")){
event_row.find("." + prefix + "js-innings1, " + "." + prefix + "js-innings2").addClass(prefix + "hide");
current_innings.removeClass(prefix + "hide");
}
//Show or hide results for the second innings
var selector = event_row.find("." + prefix + "js-innings2-row");
if(innings == 2){
selector.removeClass(prefix + "hide");
}else if(innings == 1){
selector.addClass(prefix + "hide");
}
}
}
};
LiveScore.prototype.updateCyclingData = function(event_row,event_data){
// TODO: 30 minutes after the status changes to finished, this method can be run less frequently
if((this.settings.sport == "cycling") && (event_data.status_type == "inprogress" || event_data.status_type == "finished")){
if(event_row.find("."+prefix+"stage-ranking-results").length){
mx.snippet_autoload(event_row.find("."+prefix+"stage-ranking-results"),"self");
mx.snippet_autoload(event_row.find("."+prefix+"stage-ranking-checkpoints"),"self");
//console.log("UPDATE stage-ranking-results");
//console.log("UPDATE stage-ranking-checkpoints");
}
// search jersey ranking for displaying standings and refresh only that one
event_row.find("."+prefix+"jersey-ranking").find("."+prefix+"load-snippet").each(function(){
if($(this).css("display") == "block"){
mx.snippet_autoload($(this),"self");
//console.log("UPDATE jersey-ranking");
}
});
}
};
// method uses data to mark the current period in the dom
LiveScore.prototype.markCurrentPeriod = function(event_row, event_data){
var winners = event_data.winners;
var current_period = $(event_row).data("current");
var period = winners.cur;
var current_period_class = prefix+"current-period";
if(event_data.status_type == "finished"){
if(current_period){
var current_box = $(event_row).find("."+current_period_class);
if(current_box.length){
$(current_box).each(function(){
$(this).removeClass(current_period_class);
});
}
}
return false;
} else {
if(event_data.status_type == "notstarted" || period == undefined){
return false;
}
if(period == current_period){
return false;
}
}
$(event_row).data("current",period);
// this is the current period class name
var period_class_home = prefix+"js-box-home-"+this.results[period].class;
var period_class_away = prefix+"js-box-away-"+this.results[period].class;
var period_class_header = prefix+"js-box-header-"+this.results[period].class;
// find the boxes for each participant
var box = Array;
box[1] = $(event_row).find("."+period_class_home);
box[2] = $(event_row).find("."+period_class_away);
box[3] = $(event_row).find("."+period_class_header);
if(box[1].length){
//first reset
var current_box = $(event_row).find("."+current_period_class);
if(current_box.length){
$(current_box).each(function(){
$(this).removeClass(current_period_class);
});
}
// then add boxes
for(var participant in box){
// the set the current box
var tmp_box = box[participant];
$(tmp_box).addClass(current_period_class);
}
}
};
// method sets the winner of each period based on data
LiveScore.prototype.updatePeriodWinner = function(event_row, event_data){
var sport_settings = this.sport();
if(!sport_settings.mark_period){
return false;
}
// event widgets with this class name has boxed scores, and are the only ones eligible
var box_class = prefix+"boxed-scores";
var winners = event_data.winners;
if(winners == undefined || winners.length == 0){
return false;
}
if(!$(event_row).find("."+box_class).hasClass(box_class)){
return false;
}
for(var period in winners){
if(period == "cur"){
continue;
}
if(winners[period] == 1){
var participant = "home";
} else if(winners[period] == 2) {
var participant = "away";
} else {
continue;
}
var needle = prefix+"js-box-"+participant+"-"+this.results[period].class;
$(event_row).find("."+needle).addClass(prefix+"box-winner");
}
};
// method marks the winner of the event
LiveScore.prototype.markEventWinner = function(event_row,event_data){
if(event_data.winner > 0 && event_data.winner != ""){
if(event_data.winner == 1){
var participant = "home";
} else {
var participant = "away";
}
} else {
return false;
}
var winner = prefix+participant+"-main-score";
$(event_row).find("."+winner).addClass(prefix+"box-winner");
};
// update motorsport event info
LiveScore.prototype.motorsportUpdateInfo = function(event_row, event_data){
if( event_data.sportfk != 22 ) {
return false;
}
var containers = {
"current_lap" : "js-current-lap",
"laps" : "js-laps",
"weather" : "js-event-info-weather",
"track_condition" : "js-event-info-track-condition",
"fastest_lap" : "js-event-info-fastest-lap",
"safety_car" : "js-safety-car",
"flag" : "js-red-flag",
};
// creates a valid class name by replacing spaces with dash
var compose_class = function(input){
var needle = " ";
var replace = "-";
var output = input.toLowerCase().replace(needle, replace);
return output;
};
var clone_content = function(dom,needle,haystack){
if(!haystack){
var haystack = "dom-clone-container";
}
var container = dom.find("."+prefix+"js-"+haystack);
if(container.length){
var clone = container.find("."+prefix+"js-clone-"+needle).clone();
if(clone.length){
return clone.children();
} else {
return false;
}
} else {
return false;
}
};
if( typeof(event_data.properties) == "object") {
// current laps
if(event_data.properties.hasOwnProperty("current_lap") && event_row.find("."+prefix+containers.current_lap).length){
event_row.find("."+prefix+containers.current_lap).html(event_data.properties.current_lap);
event_row.find("."+prefix+containers.laps).html(event_data.properties.Laps);
}
// weather
if(event_data.properties.hasOwnProperty("weather") && event_row.find("."+prefix+containers.weather).length){
// compose class name
var class_name = "weather-"+compose_class(event_data.properties.weather);
// clone from dom
var cloned_element = clone_content(event_row,class_name);
// replace in dom
event_row.find("."+prefix+containers.weather).html(cloned_element);
}
// track condition
if(event_data.properties.hasOwnProperty("track_condition") && event_row.find("."+prefix+containers.track_condition).length){
// compose class name
var class_name = "condition-"+compose_class(event_data.properties.track_condition);
// clone from dom
var cloned_element = clone_content(event_row,class_name);
// replace in dom
event_row.find("."+prefix+containers.track_condition).html(cloned_element);
}
// fastest lap
if(event_data.properties.hasOwnProperty("fastest_lap_time") && event_data.properties.hasOwnProperty("fastest_lap_participantFK") && event_row.find("."+prefix+containers.fastest_lap).length){
event_row.find("."+prefix+containers.fastest_lap).find("."+prefix+"js-fastest-lap-time").html(event_data.properties.fastest_lap_time);
var cloned_element = clone_content(event_row,event_data.properties.fastest_lap_participantFK);
event_row.find("."+prefix+containers.fastest_lap).find("."+prefix+"js-fastest-lap-participant").html(cloned_element);
}
// safety car
if(event_data.properties.hasOwnProperty("safety_car") && event_row.find("."+prefix+containers.safety_car).length){
var data = event_data.properties.safety_car;
var dom = event_row.find("."+prefix+containers.safety_car);
if(data == "yes" && dom.hasClass(prefix+"hide")){
dom.removeClass(prefix+"hide");
}
if(data == "no" && dom.hasClass(prefix+"hide") == false){
dom.addClass(prefix+"hide");
}
}
// red flag (yellow not avail in data)
if(event_data.properties.hasOwnProperty("flag") && event_row.find("."+prefix+containers.flag).length){
if(event_data.properties.flag == "Red"){
event_row.find("."+prefix+containers.flag).removeClass(prefix+"hide");
} else {
event_row.find("."+prefix+containers.flag).addClass(prefix+"hide");
}
} else {
if(!event_row.find("."+prefix+containers.flag).hasClass(prefix+"hide")){
event_row.find("."+prefix+containers.flag).addClass(prefix+"hide");
}
}
}
};
LiveScore.prototype.calculateSoccerScore = function(results){
var type_ordinary_time = 1;
var type_extra_time = 2;
var result_ordinary_time = LiveScore.prototype.is_score_set(parseInt(results[type_ordinary_time], 10));
var result_extra_time = LiveScore.prototype.is_score_set(parseInt(results[type_extra_time], 10));
return result_ordinary_time + result_extra_time;
};
LiveScore.prototype.calculateRunningScore = function(results){
var type_running = "6";
var result = 0;
if((typeof(results) == "object") && (typeof(results[type_running]) != "undefined"))
{
result = LiveScore.prototype.is_score_set(parseInt(results[type_running], 10));
}
return result;
};
LiveScore.prototype.injectCalculatedResults = function(event_row, event_data){
var sport = this.sport();
if(sport.one_on_one && sport.calculateMainScore){
var type_score = "10001";
var participant_nr = 1;
while(typeof(event_data.results[participant_nr]) != "undefined"){
var score = sport.calculateMainScore(event_data.results[participant_nr].r);
event_data.results[participant_nr].r[type_score] = score;
++participant_nr;
}
}
return event_data;
};
//Update lapbylap Hash
LiveScore.prototype.updateLapbylap = function(event_row, event_data){
if(this.sport().lapbylap){
//Update lapbylap
var lapbylap_dom = event_row.next("."+prefix+"lapbylap");
if(!lapbylap_dom.length){
if(event_row.find("."+prefix+"lapbylap").data("hash") !== undefined){
lapbylap_dom = event_row.find("."+prefix+"lapbylap");
} else {
lapbylap_dom = event_row.find("."+prefix+"lapbylap").closest("."+prefix+"snippet-root");
}
}
if(lapbylap_dom.length){
if(lapbylap_dom.data("hash") !== event_data.scopes_hash){
lapbylap_dom.data("hash", event_data.scopes_hash);
if(lapbylap_dom.is(":visible")){
mx.snippet({dom: lapbylap_dom});
}
}
}
}
};
LiveScore.prototype.updateTournamentResults = function(event_row, event_data){
var widget_name = "golf-live-event";
var results_dom = event_row.next("."+prefix+widget_name);
if(!results_dom.length){
results_dom = event_row.find("."+prefix+widget_name);
}
if(results_dom.length && results_dom.is(":visible")){
mx.snippet({dom: results_dom});
}
};
LiveScore.prototype.notifyResultChanged = function(settings, result_type, element, event_row, event_data){
var old_result = element.html();
var new_result = element.data("res");
var score_increased = new_result > old_result;
if(settings.one_on_one && score_increased){
//Play a sound, if one has been configured
var sound_type = false;
if(element.data("sound")){
sound_type = element.data("sound");
}else if(typeof(result_type.sound) != "undefined"){
sound_type = result_type.sound;
}
if(sound_type){
mx.sounds(event_data, event_row, sound_type);
}
}
//Flash the result
var highlight_duration = 3000;
if(score_increased && typeof(result_type.highlight_duration) != "undefined"){
highlight_duration = result_type.highlight_duration;
}
if(highlight_duration > 0){
mx.highlightDOM(element, highlight_duration);
}
};
//WINTER SPORTS UPDATE
LiveScore.prototype.updateWinterSport = function(event_row, event_data) {
if((this.settings.sport_type == "ws") && (this.settings.type == "gamecenter"))
{
var show_debug = false;
if(show_debug) { console.log("LiveScore.prototype.updateWinterSport", event_data.status_type, this.settings.type); }
if(!event_data.status_type) { return false; }
//get main settings
var sport = this.settings.sport;
var eventFK = event_data.eventfk;
var update_type = this.settings.update_type;
var current_scope = (typeof(event_data.current_scope) != "undefined") ? event_data.current_scope : "results";
var participant_type = event_data.custom_sport_data.participant_type;
var discipline_type = event_data.custom_sport_data.discipline_type;
if(show_debug) { console.log("sport", sport, "update_type", update_type, "participant_type", participant_type, "discipline_type", discipline_type, "current_scope", current_scope); }
//get main html elements
var root_snippet = event_row.closest(".mx-snippet-root");
var selected_scope = event_row.find(".mx-checkpoint.mx-viewing").data("view");
if(show_debug) { console.log("current_scope", current_scope, "selected_scope", selected_scope); }
//UPDATE STATUS
var status_update = this.updateWinterSportStatus(event_row, event_data, root_snippet);
if(!status_update) { this.applyWsLimit(event_row, event_data); return false; }
if(event_data.status_type == "finished") { this.applyWsLimit(event_row, event_data); return false; }
//APPLY UPDATE depending of update_type, sport, participant_type and discipline
//NOTE: the if checks are added mostly to provide information how each sport discipline is updated
var update_function = "";
switch(update_type)
{
case "scope_by_player":
if(participant_type == "player")
{
if(sport == "alpine") { update_function = "updateScopeByPlayerIndividual"; }
if(sport == "skijump") { update_function = "updateScopeByPlayerIndividual"; }
if((sport == "nordiccombined") && (discipline_type == "skijump"))
{
update_function = "updateScopeByPlayerIndividual";
}
}
break;
case "scope_by_scope":
if(participant_type == "player")
{
if(sport == "crosscountry") { update_function = "updateScopeByScopeIndividual"; }
if(sport == "speedskating") { update_function = "updateScopeByScopeIndividual"; }
if(sport == "biathlon") { update_function = "updateScopeByScopeIndividual"; }
if((sport == "nordiccombined") && (discipline_type == "crosscountry"))
{
update_function = "updateScopeByScopeIndividual";
}
}
else if(participant_type == "team")
{
if(sport == "crosscountry") { update_function = "updateScopeByScopeTeam"; }
if(sport == "skijump") { update_function = "updateScopeByScopeTeam"; }
if(sport == "biathlon") { update_function = "updateScopeByScopeTeam"; }
if(sport == "speedskating") { update_function = "updateScopeByScopeTeam"; }
if(sport == "nordiccombined") { update_function = "updateScopeByScopeTeam"; }
if(sport == "alpine") { update_function = "updateScopeByScopeTeam"; }
}
break;
}
switch(update_function)
{
case "updateScopeByPlayerIndividual":
this.updateScopeByPlayerIndividual(event_row, event_data);
break;
case "updateScopeByScopeIndividual":
this.updateScopeByScopeIndividual(event_row, event_data);
break;
case "updateScopeByScopeTeam":
this.updateScopeByScopeTeam(event_row, event_data);
break;
default:
update_function = "UNDEFINED";
break;
}
this.applyWsLimit(event_row, event_data);
if(show_debug)
{
console.log(update_function + " Update Function for", "sport", sport, "update_type", update_type, "participant_type", participant_type, "discipline_type", discipline_type, "current_scope", current_scope);
}
}
};
//SCOPE BY SCOPE TEAM
LiveScore.prototype.updateScopeByScopeTeam = function(event_row, event_data) {
var sport = this.settings.sport;
var eventFK = event_data.eventfk;
var participant_type = event_data.custom_sport_data.participant_type;
var discipline_type = event_data.custom_sport_data.discipline_type;
var selected_scope = event_row.find(".mx-checkpoint.mx-viewing").data("view");
var selected_scope_id = event_row.find(".mx-checkpoint.mx-viewing").data("id");
var root_snippet = event_row.closest(".mx-snippet-root");
//update current participant
LiveScore.prototype.updateCurrentPlayerInfo(event_row, event_data);
switch(sport)
{
case 'alpine':
//LiveScore.prototype.updateCurrentPlayerDataAlpine(event_row, event_data);
break;
case 'skijump':
LiveScore.prototype.updateCurrentPlayerDataSkijump(event_row, event_data);
break;
case 'nordiccombined':
if(discipline_type == "skijump")
{
LiveScore.prototype.updateCurrentPlayerDataSkijump(event_row, event_data);
}
break;
}
//set result types
var cell_types = ["team_number", "rank", "duration", "duration_full_time", "comment"];
//update scope_results rows
$.each(event_data.scope_results, function(checkpoint, data) {
var checkpoint_id = data["id"];
var checkpoint_container = event_row.find(".mx-collapsable-content.mx-checkpoint_" + eventFK + "_" + checkpoint_id);
var checkpoint_tab = event_row.find(".mx-button.mx-checkpoint.mx-checkpoint-" + checkpoint);
var thead = checkpoint_container.find(".mx-table.mx-" + sport + " > thead");
var tbody = checkpoint_container.find(".mx-table.mx-" + sport + " > tbody");
//make sure that the checkpoint tab and container are loaded
if((event_data.status_type == "inprogress") && (typeof(checkpoint_tab.html()) == "undefined"))
{
mx.snippet_force_reload(root_snippet);
return false;
}
//collect previous participants FKs and remove all rows
var visible_cells = new Array();
var prevFKs = new Array();
tbody.find("tr:not('.mx-js_row')").each(function() {
prevFKs.push($(this).data("pfk"));
$(this).remove();
});
if(typeof(data.lineup) != "undefined")
{
$.each(data.lineup, function(key, data_row) {
//fill row data and collect cells that should be visible
visible_cells = LiveScore.prototype.fillNewParticipantRow(sport, eventFK, event_row, checkpoint, checkpoint_id, data_row, visible_cells, participant_type);
});
}
//speed skating
else if(typeof(data.participants) != "undefined")
{
$.each(data.participants, function(key, data_row) {
//fill row data and collect cells that should be visible
visible_cells = LiveScore.prototype.fillNewParticipantRow(sport, eventFK, event_row, checkpoint, checkpoint_id, data_row, visible_cells, participant_type);
});
}
//set visible elements
LiveScore.prototype.setVisibleElements(visible_cells, thead, tbody);
//mark new rows
var flash_new_rows = false;
if(typeof(event_data.current_teamFKs) == "object")
{
//speed skating specific - we mark in-progress only the teams that are currently on the run
flash_new_rows = true;
}
tbody.find("tr:not('.mx-js_row')").each(function() {
var pfk = $(this).data("pfk");
if($.inArray(pfk, prevFKs) < 0)
{
$(this).addClass("mx-ws-inprogress");
//flash the tabs with new rows
var highlight_duration = 3000;
mx.highlightDOM(checkpoint_tab, highlight_duration);
}
//speed skating specific
if(typeof(event_data.current_teamFKs) == "object")
{
var str_pfk = pfk.toString();
var current_teamFKs = Object.values(event_data.current_teamFKs);
if($.inArray(str_pfk, current_teamFKs) >= 0)
{
//mark only the current players
$(this).addClass("mx-ws-inprogress");
}
else
{
//only flash new rows
$(this).removeClass("mx-ws-inprogress");
var highlight_duration = 3000;
mx.highlightDOM($(this), highlight_duration);
}
}
});
});
//update results rows
var checkpoint = "results_list";
var checkpoint_id = "results_list";
var checkpoint_container = event_row.find(".mx-collapsable-content.mx-checkpoint_" + eventFK + "_" + checkpoint_id);
var checkpoint_tab = event_row.find(".mx-button.mx-checkpoint.mx-checkpoint-" + checkpoint);
var thead = checkpoint_container.find(".mx-table.mx-" + sport + " > thead");
var tbody = checkpoint_container.find(".mx-table.mx-" + sport + " > tbody");
//collect previous participants FKs and remove all rows
var visible_cells = new Array();
var prevFKs = new Array();
tbody.find("tr:not('.mx-js_row')").each(function() {
prevFKs.push($(this).data("pfk"));
$(this).remove();
});
$.each(event_data.results, function(key, data_row) {
//fill row data and collect cells that should be visible
visible_cells = LiveScore.prototype.fillNewParticipantRow(sport, eventFK, event_row, checkpoint, checkpoint_id, data_row, visible_cells, participant_type);
});
//set visible elements
LiveScore.prototype.setVisibleElements(visible_cells, thead, tbody);
//mark new rows
tbody.find("tr:not('.mx-js_row')").each(function() {
var pfk = $(this).data("pfk");
if($.inArray(pfk, prevFKs) < 0)
{
$(this).addClass("mx-ws-inprogress");
//flash the tabs with new rows
var highlight_duration = 3000;
mx.highlightDOM(checkpoint_tab, highlight_duration);
}
});
//mark and switch to current scope tab
var switch_tab = true;
if((sport == "crosscountry") || (discipline_type == "crosscountry"))
{
//switch only if there are no records in selected tab
var check_selector = ".mx-checkpoint_" + eventFK + "_" + selected_scope_id + ".mx-collapsable-content tbody";
var check_body = event_row.find(check_selector);
if(!check_body.hasClass("mx-hide"))
{
//switch_tab = false;
}
}
if(switch_tab)
{
event_row.find(".mx-button-container > .mx-button.mx-checkpoint").each(function() {
if($(this).data("id") == event_data.current_scope_id)
{
$(this).addClass("mx-inprogress");
//switch to current checkpoint tab if there are records
var check_selector = ".mx-checkpoint_" + eventFK + "_" + $(this).data("id") + ".mx-collapsable-content tbody";
var check_body = event_row.find(check_selector);
if(!check_body.hasClass("mx-hide"))
{
$(this).click();
}
}
else
{
$(this).removeClass("mx-inprogress");
}
});
}
};
//SCOPE BY SCOPE INDIVIDUAL
LiveScore.prototype.updateScopeByScopeIndividual = function(event_row, event_data) {
var sport = this.settings.sport;
var eventFK = event_data.eventfk;
var participant_type = event_data.custom_sport_data.participant_type;
var discipline_type = event_data.custom_sport_data.discipline_type;
var selected_scope = event_row.find(".mx-checkpoint.mx-viewing").data("view");
var selected_scope_id = event_row.find(".mx-checkpoint.mx-viewing").data("id");
var root_snippet = event_row.closest(".mx-snippet-root");
//update current participant
LiveScore.prototype.updateCurrentPlayerInfo(event_row, event_data);
switch(sport)
{
case 'alpine':
LiveScore.prototype.updateCurrentPlayerDataAlpine(event_row, event_data);
break;
case 'skijump':
LiveScore.prototype.updateCurrentPlayerDataSkijump(event_row, event_data);
break;
case 'nordiccombined':
if(discipline_type == "skijump")
{
LiveScore.prototype.updateCurrentPlayerDataSkijump(event_row, event_data);
}
break;
}
//set result types
var cell_types = ["team_number", "rank", "duration", "duration_full_time", "comment"];
//update scope_results rows
$.each(event_data.scope_results, function(checkpoint, data) {
var checkpoint_id = data["id"];
var checkpoint_container = event_row.find(".mx-collapsable-content.mx-checkpoint_" + eventFK + "_" + checkpoint_id);
var checkpoint_tab = event_row.find(".mx-button.mx-checkpoint.mx-checkpoint-" + checkpoint);
var thead = checkpoint_container.find(".mx-table.mx-" + sport + " > thead");
var tbody = checkpoint_container.find(".mx-table.mx-" + sport + " > tbody");
//make sure that the checkpoint tab and container are loaded
if((event_data.status_type == "inprogress") && (typeof(checkpoint_tab.html()) == "undefined"))
{
mx.snippet_force_reload(root_snippet);
return false;
}
//collect previous participants FKs and remove all rows
var visible_cells = new Array();
var prevFKs = new Array();
tbody.find("tr:not('.mx-js_row')").each(function() {
prevFKs.push($(this).data("pfk"));
$(this).remove();
});
$.each(data.participants, function(key, data_row) {
//fill row data and collect cells that should be visible
visible_cells = LiveScore.prototype.fillNewParticipantRow(sport, eventFK, event_row, checkpoint, checkpoint_id, data_row, visible_cells, participant_type);
});
//set visible elements
LiveScore.prototype.setVisibleElements(visible_cells, thead, tbody);
//mark new rows
tbody.find("tr:not('.mx-js_row')").each(function() {
var pfk = $(this).data("pfk");
if($.inArray(pfk, prevFKs) < 0)
{
$(this).addClass("mx-ws-inprogress");
//flash the tabs with new rows
var highlight_duration = 3000;
mx.highlightDOM(checkpoint_tab, highlight_duration);
}
//mark current players (Speed Skating)
if((typeof(event_data.current_playerFKs) == "object") && $.inArray(pfk, event_data.current_playerFKs) >= 0)
{
$(this).addClass("mx-ws-inprogress");
}
});
});
//update results rows
var checkpoint = "results_list";
var checkpoint_id = "results_list";
var checkpoint_container = event_row.find(".mx-collapsable-content.mx-checkpoint_" + eventFK + "_" + checkpoint_id);
var checkpoint_tab = event_row.find(".mx-button.mx-checkpoint.mx-checkpoint-" + checkpoint);
var thead = checkpoint_container.find(".mx-table.mx-" + sport + " > thead");
var tbody = checkpoint_container.find(".mx-table.mx-" + sport + " > tbody");
//collect previous participants FKs and remove all rows
var visible_cells = new Array();
var prevFKs = new Array();
tbody.find("tr:not('.mx-js_row')").each(function() {
prevFKs.push($(this).data("pfk"));
$(this).remove();
});
$.each(event_data.results, function(key, data_row) {
//fill row data and collect cells that should be visible
visible_cells = LiveScore.prototype.fillNewParticipantRow(sport, eventFK, event_row, checkpoint, checkpoint_id, data_row, visible_cells, participant_type);
});
//set visible elements
LiveScore.prototype.setVisibleElements(visible_cells, thead, tbody);
//mark new rows
tbody.find("tr:not('.mx-js_row')").each(function() {
var pfk = $(this).data("pfk");
if($.inArray(pfk, prevFKs) < 0)
{
$(this).addClass("mx-ws-inprogress");
//flash the tabs with new rows
var highlight_duration = 3000;
mx.highlightDOM(checkpoint_tab, highlight_duration);
}
});
//mark and switch to current scope tab
var switch_tab = true;
if((sport == "crosscountry") || (discipline_type == "crosscountry"))
{
//switch only if there are no records in selected tab
var check_selector = ".mx-checkpoint_" + eventFK + "_" + selected_scope_id + ".mx-collapsable-content tbody";
var check_body = event_row.find(check_selector);
if(!check_body.hasClass("mx-hide"))
{
//switch_tab = false;
}
}
if(switch_tab)
{
event_row.find(".mx-button-container > .mx-button.mx-checkpoint").each(function() {
if($(this).data("id") == event_data.current_scope_id)
{
$(this).addClass("mx-inprogress");
//switch to current checkpoint tab if there are records
var check_selector = ".mx-checkpoint_" + eventFK + "_" + $(this).data("id") + ".mx-collapsable-content tbody";
var check_body = event_row.find(check_selector);
if(!check_body.hasClass("mx-hide"))
{
$(this).click();
}
}
else
{
$(this).removeClass("mx-inprogress");
}
});
}
};
//SCOPE BY PLAYER INDIVIDUAL
LiveScore.prototype.updateScopeByPlayerIndividual = function(event_row, event_data) {
var sport = this.settings.sport;
var eventFK = event_data.eventfk;
var participant_type = event_data.custom_sport_data.participant_type;
var discipline_type = event_data.custom_sport_data.discipline_type;
var root_snippet = event_row.closest(".mx-snippet-root");
//update current participant
LiveScore.prototype.updateCurrentPlayerInfo(event_row, event_data);
switch(sport)
{
case 'alpine':
LiveScore.prototype.updateCurrentPlayerDataAlpine(event_row, event_data);
break;
case 'skijump':
LiveScore.prototype.updateCurrentPlayerDataSkijump(event_row, event_data);
break;
case 'nordiccombined':
if(discipline_type == "skijump")
{
LiveScore.prototype.updateCurrentPlayerDataSkijump(event_row, event_data);
}
break;
}
//update scope_results rows
$.each(event_data.scope_results, function(checkpoint, data) {
var checkpoint_id = data["id"];
var checkpoint_container = event_row.find(".mx-collapsable-content.mx-checkpoint_" + eventFK + "_" + checkpoint_id);
var checkpoint_tab = event_row.find(".mx-button.mx-checkpoint.mx-checkpoint-" + checkpoint);
var thead = checkpoint_container.find(".mx-table.mx-" + sport + " > thead");
var tbody = checkpoint_container.find(".mx-table.mx-" + sport + " > tbody");
//make sure that the checkpoint tab and container are loaded
if((sport == "alpine") && (event_data.status_type == "inprogress") && (typeof(checkpoint_tab.html()) == "undefined"))
{
mx.snippet_force_reload(root_snippet);
return false;
}
//remove all rows
tbody.find("tr:not('.mx-js_row')").each(function() {
$(this).remove();
});
var visible_cells = new Array();
$.each(data.participants, function(key, data_row) {
//fill row data and collect cells that should be visible
visible_cells = LiveScore.prototype.fillNewParticipantRow(sport, eventFK, event_row, checkpoint, checkpoint_id, data_row, visible_cells, participant_type);
});
//set visible elements
LiveScore.prototype.setVisibleElements(visible_cells, thead, tbody);
});
//update results rows
var checkpoint = "results_list";
var checkpoint_id = "results_list";
var checkpoint_container = event_row.find(".mx-collapsable-content.mx-checkpoint_" + eventFK + "_" + checkpoint_id);
var checkpoint_tab = event_row.find(".mx-button.mx-checkpoint.mx-checkpoint-" + checkpoint);
var thead = checkpoint_container.find(".mx-table.mx-" + sport + " > thead");
var tbody = checkpoint_container.find(".mx-table.mx-" + sport + " > tbody");
//remove all rows
tbody.find("tr:not('.mx-js_row')").each(function() {
$(this).remove();
});
var visible_cells = new Array();
$.each(event_data.results, function(key, data_row) {
//fill row data and collect cells that should be visible
visible_cells = LiveScore.prototype.fillNewParticipantRow(sport, eventFK, event_row, checkpoint, checkpoint_id, data_row, visible_cells, participant_type);
//flash the tabs with new rows
var highlight_duration = 3000;
mx.highlightDOM(checkpoint_tab, highlight_duration);
});
//set visible elements
LiveScore.prototype.setVisibleElements(visible_cells, thead, tbody);
//mark current scope
event_row.find(".mx-button-container > .mx-button.mx-checkpoint").each(function() {
if($(this).data("id") == event_data.current_scope_id)
{
$(this).addClass("mx-inprogress");
//switch to current checkpoint tab if there are records
var check_selector = ".mx-checkpoint_" + eventFK + "_" + $(this).data("id") + ".mx-collapsable-content tbody";
var check_body = event_row.find(check_selector);
if(!check_body.hasClass("mx-hide"))
{
$(this).click();
}
}
else
{
$(this).removeClass("mx-inprogress");
}
});
//remove inprogress class from table when new player starts
event_row.find("tr[data-pfk!='" + event_data.current_participantFK + "'].mx-ws-inprogress").each(function() {
$(this).removeClass("mx-ws-inprogress");
});
//add inprogress class from table when new player starts
event_row.find("tr[data-pfk='" + event_data.current_participantFK + "']").each(function() {
$(this).addClass("mx-ws-inprogress");
});
};
//WINTER SPORTS COMMON UPDATE FUNCTIONS
//update winter sport status
LiveScore.prototype.updateWinterSportStatus = function(event_row, event_data, root_snippet) {
var show_debug = false;
//console.log("updateWinterSportStatus Event Data", event_data.status_descfk, event_data.status_type, event_data.status_desc_name);
var status_container = event_row.find(".mx-status-container");
//console.log("updateWinterSportStatus HTML Data", status_container.attr("class"), status_container.find(".mx-status").data("status_descfk"));
if(event_data.status_type && !status_container.hasClass(prefix + event_data.status_type))
{
status_container.addClass(prefix + event_data.status_type);
}
if(event_data.status_descfk != status_container.find(".mx-status").data("status_descfk"))
{
//change status_descfk
status_container.find(".mx-status").data("status_descfk", event_data.status_descfk);
status_container.find(".mx-status").attr("data-status_descfk", event_data.status_descfk);
//console.log("change status", status_container.find(".mx-status").data("status_descfk"), event_data.status_descfk);
//search translated status name
var name_selector = "#mx-ws_status_desc_list .mx-status_name_" + event_data.status_descfk;
//console.log("status name", name_selector, event_row.find(name_selector).html());
if( (typeof(event_row.find(name_selector)) != "undefined") &&
(typeof(event_row.find(name_selector).html()) != "undefined") &&
(event_row.find(name_selector).html() != "") )
{
status_container.find(".mx-status").html(event_row.find(name_selector).html());
}
else
{
status_container.find(".mx-status").html(event_data.status_desc_name);
}
}
//reload finished event to display results
if(event_data.status_type == "finished")
{
//apply force_reload to switch to results
if(status_container.hasClass(prefix + "inprogress"))
{
status_container.removeClass(prefix + "inprogress");
if(show_debug) { console.log("force reload finished event (inprogress)"); }
mx.snippet_force_reload(root_snippet);
}
else if(status_container.hasClass(prefix + "notstarted"))
{
status_container.removeClass(prefix + "notstarted");
if(show_debug) { console.log("force reload finished event (notstarted)"); }
mx.snippet_force_reload(root_snippet);
}
return false;
}
return true;
};
//update winter sport current checkpoint
LiveScore.prototype.updateWinterSportCheckpoint = function(event_row, event_data) {
//console.log("updateWinterSportCheckpoint", event_data.current_scope, event_data.current_scope_name);
var current_scope_name = (typeof(event_data.current_scope_name) != "undefined") ? event_data.current_scope_name : "";
$("." + prefix + "checkpoint").each(function(){
$(this).removeClass(prefix + "inprogress");
});
if(typeof(event_row.find("." + prefix + "checkpoint-" + event_data.current_scope)) != "undefined")
{
event_row.find("." + prefix + "checkpoint-" + event_data.current_scope).addClass(prefix + "inprogress");
}
};
//get new participant row and fill participant info
LiveScore.prototype.getNewParticipantRow = function(participantFK, cc_row_indicator, js_row, participant_info, participant_type, event_row, data_row, eventFK) {
var root_snippet = event_row.closest(".mx-snippet-root");
//make sure that the needed information is available
if(typeof(participant_info.data("participantfk")) == "undefined")
{
mx.snippet_force_reload(root_snippet);
return "";
}
//init new row data and fill participant info
var new_row = "
" + js_row + "
";
new_row = new_row.replace(/\[cc_row_indicator\]/g, cc_row_indicator);
new_row = new_row.replace(/\[participantFK\]/g, participantFK);
new_row = new_row.replace(/\[countryFK\]/g, participant_info.data("countryfk"));
new_row = new_row.replace(/\[teamFK\]/g, participant_info.data("teamfk"));
new_row = new_row.replace(/\[participant_name\]/g, participant_info.data("participant_name"));
new_row = new_row.replace(/\[participant_name_short\]/g, participant_info.data("participant_name_short"));
if(participant_info.data("participant_start_number") !== "")
{
new_row = new_row.replace(/\[participant_start_number\]/g, "(" + participant_info.data("participant_start_number") + ")");
}
else
{
new_row = new_row.replace(/\[participant_start_number\]/g, "");
}
new_row = new_row.replace(/\[team_name\]/g, participant_info.data("team_name"));
new_row = new_row.replace(/\[team_name_short\]/g, participant_info.data("team_name_short"));
new_row = new_row.replace(/\[country_name\]/g, participant_info.data("country_name"));
if(participant_type == "team")
{
//get lineup info
var lineup_info = event_row.find(".mx-participant_info_" + participantFK + " > .mx-lineup");
//fill single current player info
if(typeof(data_row.playerFK) != "undefined")
{
new_row = new_row.replace(/\[lineup_players\]/g, "");
var player_info = lineup_info.find(".mx-participant_info_" + data_row.playerFK);
if((typeof(player_info) == "object") && (typeof(player_info.data("participantfk")) != "undefined"))
{
new_row = new_row.replace(/\[player_participantFK\]/g, player_info.data("participantfk"));
new_row = new_row.replace(/\[player_participant_name\]/g, player_info.data("participant_name"));
new_row = new_row.replace(/\[player_participant_name_short\]/g, player_info.data("participant_name_short"));
//set player lineup position
var lineup_pos = player_info.data("lineup_pos");
if(!lineup_pos)
{
lineup_pos = player_info.data("sn");
}
new_row = new_row.replace(/\[player_lineup_pos\]/g, lineup_pos);
if(lineup_pos != "")
{
new_row = new_row.replace(/\[hide_class_player_lineup_pos\]/g, "");
}
else
{
new_row = new_row.replace(/\[hide_class_player_lineup_pos\]/g, "mx-hide");
}
}
}
//get lineup player from start list container
else
{
//get start list lineup players
var selector = ".mx-checkpoint_" + eventFK + "_start_list.mx-collapsable-content tbody tr[data-pfk='" + participantFK + "'] .mx-player-name";
var players_cell = event_row.find(selector);
if(typeof(players_cell.html()) !== "undefined")
{
new_row = new_row.replace(/\[lineup_players\]/g, players_cell.html());
}
else
{
new_row = new_row.replace(/\[lineup_players\]/g, "");
}
//hide single player data
new_row = new_row.replace(/\[player_participantFK\]/g, "");
new_row = new_row.replace(/\[player_participant_name\]/g, "");
new_row = new_row.replace(/\[player_participant_name_short\]/g, "");
new_row = new_row.replace(/\[hide_class_player_lineup_pos\]/g, "mx-hide");
new_row = new_row.replace(/\[player_participantFK\]/g, "");
}
}
return new_row;
};
//fill data in new participant row
LiveScore.prototype.fillNewParticipantRow = function(sport, eventFK, event_row, checkpoint, checkpoint_id, data_row, visible_cells, participant_type) {
var checkpoint_container = event_row.find(".mx-collapsable-content.mx-checkpoint_" + eventFK + "_" + checkpoint_id);
var thead = checkpoint_container.find(".mx-table.mx-" + sport + " > thead");
var tbody = checkpoint_container.find(".mx-table.mx-" + sport + " > tbody");
var js_row = tbody.find(".mx-js_row").html();
var participantFK = data_row['participantfk'];
var participant_info = event_row.find(".mx-participant_info_" + participantFK);
//get new participant row with filled team and player info
var new_row = LiveScore.prototype.getNewParticipantRow(participantFK, checkpoint, js_row, participant_info, participant_type, event_row, data_row, eventFK);
//possible cell values that need to be filled
var cell_types = [ "participantFK","startnumber",
"team_name","team_name_short","team_number",
"participant_name","participant_name_short","participant_start_number",
"lineup_players","player_participantFK","player_lineup_pos",
"player_participant_name","player_participant_name_short",
"rank", "duration", "duration_full_time", "comment",
"missed_shots","additional_shots",
"distance","accdistance","score","runningscore",
"judge1","judge2","judge3","judge4","judge5",
"secondpoints","points","medal"];
//set row data
$.each(data_row, function(key, value) {
new_row = new_row.replace("[" + key + "]", value);
if($.inArray(key, visible_cells) < 0)
{
visible_cells.push(key);
//display also rank column when there is a comment row to keep good looking view
if((key == "comment") && ($.inArray("rank", visible_cells) < 0))
{
visible_cells.push("rank");
}
}
});
//specific case for rank that needs to be replaced twice
var rank = (typeof(data_row["rank"]) != "undefined") ? data_row["rank"] : "";
new_row = new_row.replace(/\[rank\]/g, rank);
$.each(cell_types, function(i, cell) {
new_row = new_row.replace("[" + cell + "]", "");
});
//add only participants having rank or comment (indicates that they have reached the checkpoint in question)
var comment = (typeof(data_row["comment"]) != "undefined") ? data_row["comment"] : "";
//make sure that we do not display empty brackets
new_row = new_row.replace(/\[hide_class_player_lineup_pos\]/g, "mx-hide");
if((rank !== "") || (comment !== ""))
{
tbody.append(new_row);
}
return visible_cells;
};
//set visible elements
LiveScore.prototype.setVisibleElements = function(visible_cells, thead, tbody) {
var hidden_cells = new Array("startnumber");
$.each(visible_cells, function(i, key) {
if($.inArray(key, hidden_cells) < 0)
{
thead.find("tr th[data-col='" + key + "']").removeClass("mx-hide");
tbody.find("tr:not('.mx-js_row') td[data-col='" + key + "']").each(function() {
$(this).removeClass("mx-hide");
});
}
});
var nbr_table_rows = tbody.find("tr:not('.mx-js_row')").length;
if(nbr_table_rows > 0)
{
tbody.removeClass("mx-hide");
thead.find(".mx-table-header.mx-results-header").removeClass("mx-hide");
thead.find(".mx-no_info_row").addClass("mx-hide");
}
else
{
tbody.addClass("mx-hide");
thead.find(".mx-table-header.mx-results-header").addClass("mx-hide");
thead.find(".mx-no_info_row").removeClass("mx-hide");
}
};
LiveScore.prototype.updateCurrentPlayerInfo = function(event_row, event_data) {
//console.log("updateWinterSportScopeByPlayer", event_data.current_participantFK);
var participant_type = event_data.custom_sport_data.participant_type;
var discipline_type = event_data.custom_sport_data.discipline_type;
//find live row container
var live_row_content = event_row.find(".mx-live_row_content");
//check for current scope player
if(typeof(event_data.current_participantFK) != "undefined")
{
var participantFK = event_data.current_participantFK;
//find participant info container
var participant_info = event_row.find("." + prefix + "participant_info_" + participantFK);
//show current player for team events if available
if(participant_type == "team")
{
var lineup_info = event_row.find(".mx-participant_info_" + participantFK + " > .mx-lineup");
var player_info = lineup_info.find(".mx-participant_info_" + event_data.current_playerFK);
if((typeof(player_info) == "object") && (typeof(player_info.data("participantfk")) != "undefined"))
{
participantFK = event_data.current_playerFK;
participant_info = player_info;
}
}
//fill live row
if((typeof(live_row_content.html()) != "undefined") && (typeof(participant_info.data("participantfk")) != "undefined"))
{
//START PLAYER INFO
//fill participant info
live_row_content.find(".mx-data-participant_name").html(participant_info.data("participant_name"));
live_row_content.find(".mx-data-participant_name_short").html(participant_info.data("participant_name_short"));
live_row_content.find(".mx-data-country_name").html(participant_info.data("country_name"));
live_row_content.find(".mx-data-team_name").html(participant_info.data("team_name"));
live_row_content.find(".mx-data-team_name_short").html(participant_info.data("team_name_short"));
live_row_content.find(".mx-data-icon-country").attr("title", participant_info.data("team_name"));
var icon_html = live_row_content.find(".mx-data-icon-country").html();
icon_html = '';
live_row_content.find(".mx-data-icon-country").html(icon_html);
//TODO: check from where we should get this since the start list participants are not taken from event participants
//live_row_content.find(".mx-data-start_number").html(participant_info.data("start_number"));
//TODO: find how to activate the links - maybe we should use replace() and html() like in rows
//fill player id in links
if(typeof(live_row_content.find(".mx-player-name > .mx-link").html()) != "undefined")
{
if(live_row_content.find(".mx-player-name > .mx-link").data("player") != participantFK)
{
live_row_content.find(".mx-player-name > .mx-link").data("player", participantFK);
live_row_content.find(".mx-player-name > .mx-link").attr("data-player", participantFK);
if(typeof(live_row_content.find(".mx-player-name > .mx-link").attr("href")) != "undefined")
{
var href = live_row_content.find(".mx-player-name > .mx-link").attr("href").replace("[participantFK]", participantFK);
live_row_content.find(".mx-player-name > .mx-link").attr("href", href);
}
}
}
//fill player id in links
if(typeof(live_row_content.find(".mx-team-name > .mx-link").html()) != "undefined")
{
if(live_row_content.find(".mx-team-name > .mx-link").data("team") != participantFK)
{
live_row_content.find(".mx-team-name > .mx-link").data("team", participantFK);
live_row_content.find(".mx-team-name > .mx-link").attr("data-team", participantFK);
}
//TODO: fill country id in links and flag
if(live_row_content.find(".mx-team-name > .mx-link").data("team") != participantFK)
{
live_row_content.find(".mx-team-name > .mx-link").data("team", participantFK);
live_row_content.find(".mx-team-name > .mx-link").attr("data-team", participantFK);
}
}
//set start number
if(participant_info.data("participant_start_number"))
{
live_row_content.find(".mx-data-participant_start_number").html("(" + participant_info.data("participant_start_number") + ")");
live_row_content.find(".mx-data-participant_start_number").removeClass("mx-hide");
}
else
{
live_row_content.find(".mx-data-participant_start_number").addClass("mx-hide");
}
//END PLAYER INFO
}
}
//hide for finished event
if((event_data.status_type == "finished") && (!live_row_content.hasClass(prefix + "hide")))
{
live_row_content.addClass(prefix + "hide");
}
};
LiveScore.prototype.updateCurrentPlayerDataAlpine = function(event_row, event_data) {
var result_types = new Array("duration", "comment", "points", "rank");
//find live row container
var live_row_content = event_row.find(".mx-live_row_content");
//check for current scope player
if(typeof(event_data.current_participantFK) != "undefined")
{
var participantFK = event_data.current_participantFK;
//find participant info container
var participant_info = event_row.find("." + prefix + "participant_info_" + participantFK);
//fill live row
if((typeof(live_row_content.html()) != "undefined") && (typeof(participant_info.data("participantfk")) != "undefined"))
{
//START SCOPE UPDATE
$.each(event_data.current_participant_scope_results, function(name, data) {
var checkpoint_row = live_row_content.find(".mx-live_checkpoint_" + name);
var player_results = data;
$.each(result_types, function(i, key) {
var value = "";
if(typeof(player_results[key]) != "undefined")
{
value = player_results[key];
if(key == "rank")
{
value = "[" + value + "]";
}
}
checkpoint_row.find(".mx-data-" + key).html(value);
});
});
//END SCOPE UPDATE
//display live row content
if(live_row_content.hasClass(prefix + "hide"))
{
live_row_content.removeClass(prefix + "hide");
}
}
}
//hide for finished event
if((event_data.status_type == "finished") && (!live_row_content.hasClass(prefix + "hide")))
{
live_row_content.addClass(prefix + "hide");
}
};
LiveScore.prototype.updateCurrentPlayerDataSkijump = function(event_row, event_data) {
var result_types = new Array("rank", "distance", "runningscore", "judge1", "judge2", "judge3", "judge4", "judge5");
var participant_type = event_data.custom_sport_data.participant_type;
//find live row container
var live_row_content = event_row.find(".mx-live_row_content");
//check for current scope player
if(typeof(event_data.current_participantFK) != "undefined")
{
var participantFK = event_data.current_participantFK;
//find participant info container
var participant_info = event_row.find(".mx-participant_info_" + participantFK);
//fill live row
if((typeof(live_row_content.html()) != "undefined") && (typeof(participant_info.data("participantfk")) != "undefined"))
{
//START SCOPE UPDATE
var checkpoint_row = live_row_content.find(".mx-live_checkpoint");
var player_results = [];
//individual discipline
if( (typeof(event_data.current_participant_scope_results) != "undefined") && (typeof(event_data.current_participant_scope_results["final_result"]) != "undefined") )
{
player_results = event_data.current_participant_scope_results["final_result"];
}
//team discipline
else if(typeof(event_data.current_scope_participants) != "undefined")
{
if((typeof(event_data.current_scope_participants[participantFK]) != "undefined"))
{
player_results = event_data.current_scope_participants[participantFK];
}
}
$.each(result_types, function(i, key) {
var value = "";
if(typeof(player_results[key]) != "undefined")
{
value = player_results[key];
}
checkpoint_row.find(".mx-data-" + key).html(value);
});
//END SCOPE UPDATE
//display live row content
if(live_row_content.hasClass("mx-hide"))
{
live_row_content.removeClass("mx-hide");
}
}
}
//hide for finished event
if((event_data.status_type == "finished") && (!live_row_content.hasClass("mx-hide")))
{
live_row_content.addClass("mx-hide");
}
};
//update scope by player
LiveScore.prototype.updateWinterSportScopeByPlayer = function(event_row, event_data) {
//console.log("updateWinterSportScopeByPlayer", event_data.current_participantFK);
//find live row container
var live_row_content = event_row.find(".mx-live_row_content");
//check for current scope player
if(typeof(event_data.current_participantFK) != "undefined")
{
var participantFK = event_data.current_participantFK;
//find participant info container
var participant_info = event_row.find("." + prefix + "participant_info_" + participantFK);
//fill live row
if((typeof(live_row_content.html()) != "undefined") && (typeof(participant_info.data("participantfk")) != "undefined"))
{
//START PLAYER INFO
//fill participant info
live_row_content.find(".mx-data-participant_name").html(participant_info.data("participant_name"));
live_row_content.find(".mx-data-participant_name_short").html(participant_info.data("participant_name_short"));
live_row_content.find(".mx-data-country_name").html(participant_info.data("country_name"));
live_row_content.find(".mx-data-team_name").html(participant_info.data("team_name"));
live_row_content.find(".mx-data-team_name_short").html(participant_info.data("team_name_short"));
live_row_content.find(".mx-data-icon-country").attr("title", participant_info.data("team_name"));
var icon_html = live_row_content.find(".mx-data-icon-country").html();
icon_html = '';
live_row_content.find(".mx-data-icon-country").html(icon_html);
//TODO: check from where we should get this since the start list participants are not taken from event participants
//live_row_content.find(".mx-data-start_number").html(participant_info.data("start_number"));
//TODO: find how to activate the links - maybe we should use replace() and html() like in rows
//fill player id in links
if(live_row_content.find(".mx-player-name > .mx-link").data("player") != participantFK)
{
live_row_content.find(".mx-player-name > .mx-link").data("player", participantFK);
live_row_content.find(".mx-player-name > .mx-link").attr("data-player", participantFK);
var href = live_row_content.find(".mx-player-name > .mx-link").attr("href").replace("[participantFK]", participantFK);
live_row_content.find(".mx-player-name > .mx-link").attr("href", href);
}
//fill player id in links
if(live_row_content.find(".mx-team-name > .mx-link").data("team") != participantFK)
{
live_row_content.find(".mx-team-name > .mx-link").data("team", participantFK);
live_row_content.find(".mx-team-name > .mx-link").attr("data-team", participantFK);
}
//TODO: fill country id in links and flag
if(live_row_content.find(".mx-team-name > .mx-link").data("team") != participantFK)
{
live_row_content.find(".mx-team-name > .mx-link").data("team", participantFK);
live_row_content.find(".mx-team-name > .mx-link").attr("data-team", participantFK);
}
//set start number
if(participant_info.data("participant_start_number"))
{
live_row_content.find(".mx-data-participant_start_number").html("(" + participant_info.data("participant_start_number") + ")");
live_row_content.find(".mx-data-participant_start_number").removeClass("mx-hide");
}
else
{
live_row_content.find(".mx-data-participant_start_number").addClass("mx-hide");
}
//END PLAYER INFO
//START SCOPE UPDATE
$.each(event_data.current_participant_scope_results, function(name, data) {
//console.log("current_participant_scope_results", name, data, Object.keys(data).length);
var checkpoint_row = live_row_content.find(".mx-live_checkpoint_" + name);
//TODO: do with array
//init
var duration = "";
var comment = "";
var points = "";
var rank = "";
//update checkpoint data
if(Object.keys(data).length)
{
if(data.duration) { duration = data.duration; }
if(data.comment) { comment = data.comment; }
if(data.points) { points = data.points; }
if(data.rank) { rank = "[" + data.rank + "]"; }
}
checkpoint_row.find(".mx-data-duration").html(duration);
checkpoint_row.find(".mx-data-comment").html(comment);
checkpoint_row.find(".mx-data-points").html(points);
checkpoint_row.find(".mx-data-rank").html(rank);
});
//END SCOPE UPDATE
//display live row content
if(live_row_content.hasClass(prefix + "hide"))
{
live_row_content.removeClass(prefix + "hide");
}
}
}
//hide for finished event
if((event_data.status_type == "finished") && (!live_row_content.hasClass(prefix + "hide")))
{
live_row_content.addClass(prefix + "hide");
}
};
LiveScore.prototype.applyWsLimit = function(event_row, event_data) {
if(mx.settings.ws_limit > 0)
{
var sport = this.settings.sport;
var eventFK = event_data.eventfk;
this.applyWsLimitByCheckpoint(event_row, sport, eventFK, 'results_list');
this.applyWsLimitByCheckpoint(event_row, sport, eventFK, 'start_list');
$.each(event_data.scope_results, function(checkpoint, data) {
var checkpoint_id = data["id"];
LiveScore.prototype.applyWsLimitByCheckpoint(event_row, sport, eventFK, checkpoint_id);
});
}
};
LiveScore.prototype.applyWsLimitByCheckpoint = function(event_row, sport, eventFK, checkpoint_id) {
var checkpoint_container = event_row.find(".mx-collapsable-content.mx-checkpoint_" + eventFK + "_" + checkpoint_id);
var tbody = checkpoint_container.find(".mx-table.mx-" + sport + " > tbody");
var i_row = 0;
var apply_limit = true;
if(event_row.closest(".mx-widget-gamecenter.mx-event-widget.mx-winter-sport").find(".mx-ws_show_all").hasClass("mx-hide"))
{
apply_limit = false;
}
if(apply_limit)
{
tbody.find("tr:not('.mx-js_row')").each(function() {
i_row++;
if(i_row > mx.settings.ws_limit)
{
$(this).addClass("mx-hide");
}
});
}
};
// MX LiveStats methods
var mxls;
//Main MinisiteX Class
var LiveStats = function( settings ){
//settings
this.settings = $.extend( {
// maximum number of rows and cols
max_rows: 45,
max_cols: 69,
// dom
dom: {},
// update related
sport: "",
update_interval: 5000,
update_url: "/live_data/actionzones/[eventfk]/[n]",
event_text_url: "/live_data/event_texts/[eventfk]/[languagefk]",
livestats_text_url: "/live_data/livestats_texts/[sportfk]/[languagefk]/[gender]",
ajaxSettings: {
cache: false,
dataType: "json",
ifModified: false,
isLocal: false,
type: "GET",
headers: { SITE: "MinisiteX" }
},
status: "",
// we use the data index to keep track of what cells we have processed.
// The index is a list of ID's that we check each time. If an ID is in the list, its not a new data cell but a possible update or removal.
data_storage: [],
corner_data: [],
cells_in_field: [],
//Which events are shown. Today (+ day days)
day: false,
eventFK: null,
binds: {},
finished_updates: 0,
max_finished_updates: 5,
reload_attempt: [0, 0],
stats: {}
}, settings );
this.DOM = $( this.settings.dom );
this.lang_dir = $( this.DOM ).find( "." + prefix + "zone-field-container" ).attr( "dir" );
this.type = this.determine_type( this.DOM ); //actionzone, livestats or commentary
this.timer = null;
//References to the xmlhttp object used in class
this.xmlhttp = {
event_texts: null,
livestats_texts: null
};
// Binds
this.settings.binds["INPUT:checkbox." + prefix + "zone-filter-button"] = this.settings.binds["INPUT:checkbox." + prefix + "zone-filter-button"] || {
"click": this.zone_filter,
"vclick": this.zone_filter
};
this.settings.binds["INPUT:checkbox." + prefix + "zone-filter-player-reset-button"] = this.settings.binds["INPUT:checkbox." + prefix + "zone-filter-player-reset-button"] || {
"click": this.zone_filter_player_reset,
"vclick": this.zone_filter_player_reset
};
this.settings.binds["." + prefix + "zone-filter-button"] = this.settings.binds["." + prefix + "zone-filter-button"] || {
"click": this.zone_filter2,
"vclick": this.zone_filter2
};
this.settings.binds["." + prefix + "zone-filter-team"] = this.settings.binds["." + prefix + "zone-filter-team"] || {
"click": this.zone_filter_team,
"vclick": this.zone_filter_team
};
this.settings.binds["." + prefix + "zone-filter-half"] = this.settings.binds["." + prefix + "zone-filter-half"] || {
"click": this.zone_filter_half,
"vclick": this.zone_filter_half
};
this.settings.binds["." + prefix + "zone-toggle-button"] = this.settings.binds["." + prefix + "zone-toggle-button"] || {
"click": this.zone_toggle,
"vclick": this.zone_toggle
}
};
/*
*
* Initialize the script
*
*/
LiveStats.prototype.init = function(){
this.doBinds();
this.stop();
//Set Update Inc (n)
this.n = this.DOM.data( "n" ) || 0;
var that = this;
$( "BODY" ).on( "livestats_text_update_done", function( e ){
if( !that.DOM.hasClass( prefix + "initialized-livestats-service" ) ) {
//is sport live and today
if( that.settings.day == 0 && that.sport().liveupdate ) {
that.timer = setTimeout( that.update.bind( that ), 250 );
that.DOM.addClass( prefix + "initialized-livestats-service" );
}
}
} );
$( "BODY" ).on( "event_text_update_done", function( e ){
that.update_livestats_texts();
} );
// update event_texts
this.update_event_texts();
};
//Stop LiveStatss (Clear timers and abort current xmlhttp request if any)
LiveStats.prototype.stop = function(){
try {
this.xmlhttp.abort();
} catch( e ) {
}
try {
clearTimeout( this.timer );
} catch( e ) {
}
};
//Do DOM event Binds
LiveStats.prototype.doBinds = function(){
//Loop through selectors
for( var selector in this.settings.binds ) {
if( !this.settings.binds.hasOwnProperty( selector ) ) {
continue;
}
//Loop through events
for( var eventType in this.settings.binds[selector] ) {
if( !this.settings.binds[selector].hasOwnProperty( eventType ) ) {
continue;
}
this.DOM.on( eventType, selector, { me: this }, this.settings.binds[selector][eventType] );
}
}
};
// method determines the type of livestat: ActionZone,Commentary or LiveStats
LiveStats.prototype.determine_type = function( dom ){
var return_type = false;
if( $( dom ).hasClass( prefix + "action-zone" ) ) {
return_type = "actionzone";
} else if( $( dom ).hasClass( prefix + "commentary" ) ) {
return_type = "commentary";
} else if( $( dom ).hasClass( prefix + "livestats" ) ) {
return_type = "livestats";
}
return return_type;
};
/*
*
* Action zone update methods
*
*/
// sets the url for the json update and retrieves the data from service
LiveStats.prototype.update = function(){
//Safety precaution to prevent several update processes from occuring
clearTimeout( this.timer );
//Create URL by insering [eventfk] and [n]
var url = this.settings.update_url.replace( "[eventfk]", this.settings.eventfk ).replace( "[n]", this.n );
if( !$( this.settings.dom ).is( ":visible" ) ) {
return false;
}
// if configured, send AJAX requests to a particular domain
var ajax_settings = this.settings.ajaxSettings;
var json_url = this.getJsonUrl();
if( json_url.length > 0 ) {
url = json_url + url;
delete ajax_settings.headers;
}
this.xmlhttp = $.ajax( url, ajax_settings )
.done( this.update_done.bind( this ) )
.always( this.update_always.bind( this ) )
.fail( this.update_fail.bind( this ) );
};
/*
*
* Event Texts
*
*/
// sets url and updates event_texts from service
LiveStats.prototype.update_event_texts = function( callback ){
//if languageFK is not set, fallback to english
this.settings.languagefk = this.settings.languagefk || 3;
//Create URL by inserting [eventfk] and [languagefk]
var url = this.settings.event_text_url.replace( "[eventfk]", this.settings.eventfk ).replace( "[languagefk]", this.settings.languagefk );
// if configured, send AJAX requests to a particular domain
var ajax_settings = this.settings.ajaxSettings;
var json_url = this.getJsonUrl();
if( json_url.length > 0 ) {
url = json_url + url;
delete ajax_settings.headers;
}
this.xmlhttp.event_texts = $.ajax( url, ajax_settings )
.done( this.update_event_texts_done.bind( this ) )
.always( this.update_event_texts_always.bind( this ) )
.fail( this.update_event_texts_fail.bind( this ) );
};
// event_text update succes
LiveStats.prototype.update_event_texts_done = function( data ){
this.event_texts = data;
$( "BODY" ).trigger( "event_text_update_done" );
if( typeof callback == "function" ) {
callback();
}
};
LiveStats.prototype.update_event_texts_always = function(){
return true;
};
// event_text update fail
LiveStats.prototype.update_event_texts_fail = function(){
$( "BODY" ).trigger( "event-text-update-fail" );
};
/*
*
* update Livestats texts
*
*/
// sets url and updates livestats_text from service
LiveStats.prototype.update_livestats_texts = function(){
//if languageFK is not set, fallback to english (1)
this.settings.languagefk = this.settings.languagefk || 2;
//if gender is not set, fallback to male
this.settings.gender = this.settings.gender || "male";
//Create URL by inserting [eventfk] and [languagefk]
var url = this.settings.livestats_text_url.replace( "[sportfk]", this.settings.sportfk ).replace( "[languagefk]", this.settings.languagefk ).replace( "[gender]", this.settings.gender );
// if configured, send AJAX requests to a particular domain
var ajax_settings = this.settings.ajaxSettings;
var json_url = this.getJsonUrl();
if( json_url.length > 0 ) {
url = json_url + url;
delete ajax_settings.headers;
}
this.xmlhttp.livestats_texts = $.ajax( url, ajax_settings )
.done( this.update_livestats_texts_done.bind( this ) )
.always( this.update_livestats_texts_always.bind( this ) )
.fail( this.update_livestats_texts_fail.bind( this ) );
};
// livestats_text update success
LiveStats.prototype.update_livestats_texts_done = function( data ){
this.livestats_texts = data;
$( "BODY" ).trigger( "livestats_text_update_done" );
};
LiveStats.prototype.update_livestats_texts_always = function(){
return true;
};
// livestats_text update fail
LiveStats.prototype.update_livestats_texts_fail = function(){
$( "BODY" ).trigger( "livestats_text_update_fail" );
};
//Update Success send the data on to processing
LiveStats.prototype.update_done = function( data ){
//is data and object and are there any data present
if( typeof(data) == "object" && data.t ) {
this.n = data.n;
this.status = data.s;
this.DOM.data( "status", data.s );
this.DOM.addClass( prefix + data.s );
//process the data
this.process_data( data );
}
return;
};
// Update LiveStats Complete - sets timer interval and restarts the timer
LiveStats.prototype.update_always = function( data ){
var interval = this.settings.update_interval;
//If event is not in progress increase interval to 1 minute
if( this.DOM.data( "status" ) == "finished" || this.DOM.data( "status" ) == "halftime" || this.DOM.data( "status" ) == "notstarted" ) {
interval = 60000;
}
// if status is finished only make a set number of updates before ending all updates
if( this.DOM.data( "status" ) == "finished" ) {
this.settings.finished_updates++;
}
if( this.settings.sportfk == 30 ) {
interval = this.sport().update_interval;
}
// if there are items in the current data set, set a low interval to poll quickly for more
if( typeof(data.t) == "number" && data.t > 0 ) {
interval = 50;
}
if( this.settings.finished_updates > this.settings.max_finished_updates ) {
// match finished - end updates
} else {
this.timer = setTimeout( this.update.bind( this ), interval );
}
return;
};
//Update Livescore Error
LiveStats.prototype.update_fail = function(){
return;
};
// get the json url
// could be moved to centrallized mx script
LiveStats.prototype.getJsonUrl = function(){
var json_url = "";
if( typeof(window.mx.settings.json_url) != "undefined" ) {
json_url = window.mx.settings.json_url;
} else {
if( typeof window.mx.settings.api_domain != "undefined" ) {
json_url = window.mx.settings.api_domain;
}
}
return json_url;
};
/*
*
* Methods for adding, updating and removing cells and data
*
*/
// Method extracts a name from event_texts
// if first attempt is unsuccessful a reload of the event texts will be triggered
// if the attempt still fails, provide a fallback
LiveStats.prototype.get_event_text = function get_event_text( texttype, id, that ){
// init result
var result = undefined;
if( typeof that == "undefined" ) {
that = this;
}
// resetting eventhandlers to avoid multiple calls
$( "body" ).off( "event_text_update_done" );
// are the array undefined then force a reload and try again
if( typeof that.event_texts == "undefined" && that.settings.reload_attempt[0] < 6 ) {
that.settings.reload_attempt[0] = that.settings.reload_attempt[0] + 1;
// listen for custom event, and retry getting the text
$( "body" ).on( "event_text_update_done", function(){
get_event_text( texttype, id, that );
} );
that.update_event_texts();
} else {
that.settings.reload_attempt[0] = 0;
switch( texttype ) {
case "player":
case "player1":
case "player2":
result = '' + that.event_texts.p[id] + '';
break;
case "goalkeeper":
case "coach1":
case "coach2":
result = '' + that.event_texts.p[id] + '';
break;
case "team":
result = '' + that.event_texts.p[id] + '';
break;
case "team1":
//HACK: for possession
result = '' + that.event_texts.p[that.settings.home] + '';
break;
case "team2":
//HACK: for possession
result = '' + that.event_texts.p[that.settings.away] + '';
break;
case "venue":
result = that.event_texts.v;
break;
case "tournament-template":
result = that.event_texts.tt;
break;
case "tournament-stage":
result = that.event_texts.ts;
break;
case "tournament":
result = that.event_texts.t;
break;
case "sport":
result = that.event_texts.s;
break;
case "country":
result = that.event_texts.c;
break;
}
return result;
}
};
LiveStats.prototype.get_livestats_text = function get_livestats_text( id, that ){
// init result
var result = undefined;
if( typeof that == "undefined" ) {
that = this;
}
// resetting event handlers to avoid multiple calls
$( "body" ).off( "livestats_text_update_done" );
// are the array undefined then force a reload and try again
if( typeof that.event_texts == "undefined" && that.settings.reload_attempt[0] < 6 ) {
that.settings.reload_attempt[0] = that.settings.reload_attempt[0] + 1;
// listen for custom event, and retry getting the text
$( "body" ).on( "livestats_text_update_done", function(){
get_livestats_text( id, that );
} );
that.update_livestats_texts();
} else {
that.settings.reload_attempt[0] = 0;
result = that.livestats_texts[id];
}
if( result ) {
return result;
} else {
return false;
//this.stop();
}
};
// Method processes the data recived from the service
LiveStats.prototype.process_data = function( data ){
var stat_to_zonename = this.sport().stat_to_zonename;
var that = this;
// update data storage
data.i.forEach( function( celldata ){
// update data_storage
that.update_data_storage( celldata );
} );
switch( that.type ) {
case "actionzone":
// generate cells
that.process_cells();
// update stats
that.process_stats();
break;
case "livestats":
// update stats
that.process_stats();
break;
case "commentary":
// run comments
that.process_commentary( data );
break;
}
};
// method process commentaries from livestats service
LiveStats.prototype.process_commentary = function( deltadata ){
// How many minutes back in time do we want to manipulate in the dom
var timetravel = 3;
var that = this;
var prepare_data = function(){
// method sorts and reindexes the data array
var tmp = [];
for( var i in that.settings.data_storage ) {
tmp[i] = that.settings.data_storage[i];
}
tmp = that.sort_data( tmp );
var i = 0;
var result = [];
for( var key in tmp ) {
result[i] = tmp[key];
i++;
}
return result;
};
var calculate_elapsed_span = function( elapsed, timetravel ){
// figure out the span of minutes
if( elapsed - timetravel < 0 ) {
var elapsed_start = elapsed - ((elapsed - timetravel) + timetravel);
} else {
var elapsed_start = elapsed - timetravel;
}
return elapsed_start;
};
var get_subset = function( data, elapsed ){
// method grabs a subset of data with speified elapsed
// elapsed can be a number or keyword "latest", "firsthalf", "secondhalf"
switch( elapsed ) {
case "latest":
// find the latest elapsed in data
elapsed = data[data.length - 1].elapsed;
break;
case "firsthalf":
elapsed = 45; // soccer'ish
break;
case "secondhalf":
elapsed = 90; // soccer'ish
break;
case "all":
timetravel = that.sport().max_elapsed;
elapsed = that.sport().max_elapsed;
break;
default:
elapsed = parseInt( elapsed );
}
// Calculate elapsed span, this is the span that will recieve dom updates
// starting point (current elapsed minus timetravel in minutes)
var elapsed_start = calculate_elapsed_span( elapsed, timetravel );
// the end of the elapsed span
var elapsed_end = elapsed;
// if there is an elapsed in the deltadata thats earlier than the elapsed span, then reset the elapsed_start so we get the item in question processed in the dom.
for( var i in deltadata ) {
if( deltadata[i].elapsed < elapsed_start ) {
elapsed_start = calculate_elapsed_span( elapsed, (elapsed_end - deltadata[i].elapsed) );
}
}
var result = {};
var i = 0;
// build the subset of data
for( var item in data ) {
if( data[item].elapsed >= elapsed_start && data[item].elapsed <= elapsed_end ) {
result[i] = data[item];
i++;
}
}
return result;
};
// prepare data set
var processed_data = prepare_data();
var latest_elapsed_in_data = processed_data[processed_data.length - 1].elapsed;
// are there any comments in dom container? true/false
var comments_in_dom = $( this.DOM ).find( "." + prefix + "js-commentary-table ." + prefix + "commentary-row" ).hasClass( prefix + "commentary-row" );
// if no comments in dom, use entire set. Else use only needed subset
if( !comments_in_dom ) {
var data = processed_data;
} else {
var data = get_subset( processed_data, "latest" );
}
this.update_commentary( data );
};
// method updates the commentary dom
LiveStats.prototype.update_commentary = function( data ){
for( var cell in data ) {
switch( this.get_action_dom( data[cell], "commentary-row" ) ) {
case "add":
this.insert_comment( data[cell] );
break;
case "update":
this.update_comment( data[cell] );
break;
case "remove":
this.remove_comment( data[cell] );
break;
}
}
};
// method generates a comment row
LiveStats.prototype.generate_comment_row = function( celldata ){
// we clone a copy of the row from the dom
var row = $( this.DOM ).find( "." + prefix + "js-comment-row-template" ).clone();
// cleanup
row.removeClass( prefix + "js-comment-row-template" );
// add id
row.attr( "id", prefix + "js-comment-" + this.settings.uid + "-" + celldata.id );
// set elapsed
if( !celldata.elapsed == 0 ) {
$( row ).find( "." + prefix + "js-el" ).html( celldata.elapsed );
} else {
$( row ).find( "." + prefix + "js-el" ).remove();
}
// if any elapsed plus - add that as well
if( celldata.elapsed_plus ) {
$( row ).find( "." + prefix + "js-elp" ).html( celldata.elapsed_plus );
} else {
$( row ).find( "." + prefix + "js-elp" ).remove();
}
// add icon by type
var tmp_icon = "";
switch( celldata.type ) {
case "card":
if( celldata.card_type == "y" ) {
tmp_icon = "card-yellow";
} else if( celldata.card_type == "r" ) {
tmp_icon = "card-red";
} else {
tmp_icon = celldata.type;
}
break;
default:
tmp_icon = celldata.type;
break;
}
// add icon by event_incident_typefk
var event_incident_typefk = celldata.event_incident_typefk;
switch(event_incident_typefk) {
case 1150:
case 1155:
case 1169:
case 1171:
tmp_icon = "var_green";
break;
case 1151:
case 1152:
case 1153:
case 1154:
case 1156:
case 1157:
case 1158:
case 1170:
case 1172:
case 1173:
tmp_icon = "var_red";
break;
case 1165:
case 1165:
case 1166:
case 1167:
case 1168:
tmp_icon = "var_grey";
break
}
$( row ).find( "." + prefix + "icon" ).addClass( "icons-dark-ei-type-" + tmp_icon );
// get texts
var text_line = this.prepare_comment_text( this.get_livestats_text( celldata.event_incident_typefk ), celldata );
if( text_line ) {
// add comment text if its a string
$( row ).find( "." + prefix + "js-comment-line" ).html( text_line );
return row;
}
};
// method prepares comment text line
LiveStats.prototype.prepare_comment_text = function( textline, celldata ){
if( !textline ) {
return false; // if the textline is false, then don't make any attempts
}
var keywords = this.placeholder_search( textline );
var resolved_keys = {}; // resolve keys into real texts
var error = 0;
for( var word in keywords ) {
switch( keywords[word] ) {
case "venue":
if( this.get_event_text( "venue", false, this ).length ) {
resolved_keys["[" + keywords[word] + "]"] = this.get_event_text( "venue", false, this )
} else {
error = 1;
}
break;
case "homepos":
resolved_keys["[" + keywords[word] + "]"] = celldata.homepos;
break;
case "awaypos":
resolved_keys["[" + keywords[word] + "]"] = celldata.awaypos;
break;
case "spectators":
resolved_keys["[" + keywords[word] + "]"] = celldata.spectators;
break;
case "injury_time":
resolved_keys["[" + keywords[word] + "]"] = celldata.injury_time;
break;
case "num":
resolved_keys["[" + keywords[word] + "]"] = celldata.injury_time;
break;
case "player":
if( this.get_event_text( "player", celldata[keywords[word]], this ).length ) {
resolved_keys["[" + keywords[word] + "]"] = this.get_event_text( "player", celldata[keywords[word]], this );
} else {
error = 1;
}
break;
case "player1":
resolved_keys["[" + keywords[word] + "]"] = this.get_event_text( "player1", celldata[keywords[word]], this );
break;
case "player2":
resolved_keys["[" + keywords[word] + "]"] = this.get_event_text( "player2", celldata[keywords[word]], this );
break;
case "team":
if( this.get_event_text( "team", celldata[keywords[word]], this ).length ) {
resolved_keys["[" + keywords[word] + "]"] = this.get_event_text( "team", celldata[keywords[word]], this );
} else {
error = 1;
}
break;
case "team1": //HACK: for possession
resolved_keys["[" + keywords[word] + "]"] = this.get_event_text( "team1", celldata[keywords[word]], this );
break;
case "team2": //HACK: for possession
resolved_keys["[" + keywords[word] + "]"] = this.get_event_text( "team2", celldata[keywords[word]], this );
break;
case "goalkeeper":
case "coach1":
case "coach2":
resolved_keys["[" + keywords[word] + "]"] = this.get_event_text( keywords[word], celldata[keywords[word]], this );
break;
default:
error = 1;
break;
}
}
// replace placeholders with real text
var processed_text = textline;
for( var word in resolved_keys ) {
var word_regex = word.replace('[', '');
word_regex = word_regex.replace(']', '');
//FIX: replace the word correctly when appears more than once in a commentary!
switch( word_regex ) {
case "venue":
processed_text = processed_text.replace( /\[venue\]/g, resolved_keys[word] );
break;
case "homepos":
processed_text = processed_text.replace( /\[homepos\]/g, resolved_keys[word] );
break;
case "awaypos":
processed_text = processed_text.replace( /\[awaypos\]/g, resolved_keys[word] );
break;
case "spectators":
processed_text = processed_text.replace( /\[spectators\]/g, resolved_keys[word] );
break;
case "injury_time":
processed_text = processed_text.replace( /\[injury_time\]/g, resolved_keys[word] );
break;
case "num":
processed_text = processed_text.replace( /\[num\]/g, resolved_keys[word] );
break;
case "player":
processed_text = processed_text.replace( /\[player\]/g, resolved_keys[word] );
break;
case "player1":
processed_text = processed_text.replace( /\[player1\]/g, resolved_keys[word] );
break;
case "player2":
processed_text = processed_text.replace( /\[player2\]/g, resolved_keys[word] );
break;
case "team":
processed_text = processed_text.replace( /\[team\]/g, resolved_keys[word] );
break;
case "team1":
processed_text = processed_text.replace( /\[team1\]/g, resolved_keys[word] );
break;
case "team2":
processed_text = processed_text.replace( /\[team2\]/g, resolved_keys[word] );
break;
case "goalkeeper":
processed_text = processed_text.replace( /\[goalkeeper\]/g, resolved_keys[word] );
break;
case "coach1":
processed_text = processed_text.replace( /\[coach1\]/g, resolved_keys[word] );
break;
case "coach2":
processed_text = processed_text.replace( /\[coach2\]/g, resolved_keys[word] );
break;
}
}
return processed_text;
};
// method searches for placeholders in comment textlines
LiveStats.prototype.placeholder_search = function( textline ){
// Regular expression
// Finds all words starting and ending with square brackets
// the g flag at the ends makes the search global, and regex will return all occurances in to the array.
var regexp = /\[[^\]]*\]/g;
var tmp = textline.match( regexp );
// if no results, return null
if( !tmp ) {
return tmp;
}
var result = [];
// remove square brackets from result
for( var key in tmp ) {
if( (tmp[key] != undefined) && (typeof(tmp[key]) == "string") )
{
result[key] = tmp[key].substring( 1, tmp[key].length - 1 );
}
}
return result;
};
// method inserts comment into commentary widget
LiveStats.prototype.insert_comment = function( celldata ){
// if its allready there, dont do ANY thing!
var row = $( this.DOM ).find( "#mx-js-comment-" + this.settings.uid + "-" + celldata.id );
if( !row.hasClass( prefix + "commentary-row" ) ) {
var container = $( this.DOM ).find( "." + prefix + "js-commentary-table" );
var newrow = this.generate_comment_row( celldata );
container.prepend( newrow );
}
};
// method removes comment from commentary widget
LiveStats.prototype.remove_comment = function( celldata, callback ) {
var row = $( this.DOM ).find( "#mx-js-comment-" + this.settings.uid + "-" + celldata.id );
if( row.hasClass( prefix + "commentary-row" ) ) {
row.remove();
}
if( typeof callback == "function" ) {
callback();
}
};
// method updates a comment in the commentary widget
LiveStats.prototype.update_comment = function( celldata ){
// locate the existing cell
var existing_cell = $( this.DOM ).find( "#" + prefix + "js-comment-" + this.settings.uid + "-" + celldata.id );
// does the cell really exist?
if( existing_cell.hasClass( prefix + "commentary-row" ) ) {
// remove the outdated cell
this.remove_comment( celldata );
// insert a new one
this.insert_comment( celldata );
} else {
return false;
}
};
// method sorts data
LiveStats.prototype.sort_data = function( data ){
var sorted_data = data.sort( function( a, b ){
// Mozilla docs on the SORT function
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort
// in short, the supplied compare function returns either:
// less than 0, sort a to a lower index than b, i.e. a comes first. (A, B, the rest ...)
// exactly 0, leave a and b unchanged with respect to each other, but sorted with respect to all different elements. (A, B, the rest ...)
// is greater than 0, sort b to a lower index than a. (B, A, the rest ...)
if( typeof a.elapsed != "undefined" ) {
if( a["elapsed"] != b["elapsed"] ) {
return a["elapsed"] - b["elapsed"]
} else if( a["elapsed_plus"] != b["elapsed_plus"] ) {
return a["elapsed_plus"] - b["elapsed_plus"]
} else if( a["sortorder"] != b["sortorder"] ) {
return a["sortorder"] - b["sortorder"];
} else {
return a["sortorder"] - b["sortorder"];
}
} else {
return a["sortorder"] - b["sortorder"];
}
} );
return sorted_data;
};
// method process stats from livestats service
LiveStats.prototype.process_stats = function(){
var stat_to_zonename = this.sport().stat_to_zonename;
var that = this;
// reset stat object
this.settings.stats = {
"blocked": { "home": 0, "away": 0 },
"corner": { "home": 0, "away": 0 },
"cross": { "home": 0, "away": 0 },
"foulcommit": { "home": 0, "away": 0 },
"offside": { "home": 0, "away": 0 },
"penalty": { "home": 0, "away": 0 },
"possession": { "home": 0, "away": 0 },
"shoton": { "home": 0, "away": 0 },
"shotoff": { "home": 0, "away": 0 },
"goal": { "home": 0, "away": 0 }
};
// build stat object
this.settings.data_storage.forEach( function( celldata ){
var homeaway = that.analyze_team( celldata );
for( var stat in celldata.stats ) {
var type = stat_to_zonename[stat];
that.update_stat_object( type, homeaway ); // stats table
}
if( celldata.subtype == "possession" ) {
that.update_stat_object( celldata.subtype, false, celldata ); // stats table
}
//HACK to count penalties in the case when they have coordinates (TODO: check why [stats][penalties] are not assigned in this case )
if((celldata.type == "goal") && (celldata.comment == "p") && (typeof(celldata.coordinates) != "undefined"))
{
var type = "penalty";
that.update_stat_object( type, homeaway ); // stats table
}
} );
// display stats in dom
for( var statdata in this.settings.stats ) {
for( var homeaway in this.settings.stats[statdata] ) {
var stat_container = this.DOM.find( "." + prefix + "js-livestat-" + statdata ).find( "." + prefix + "js-livestat-" + homeaway + "-part" ).find( "." + prefix + "js-livestat-value" );
var newcount = this.settings.stats[statdata][homeaway];
stat_container.data( "value", newcount );
stat_container.html( newcount );
// ball possession needs the amount added as width in percentage
if( stat_container.closest( "." + prefix + "js-livestat-" + homeaway + "-part" ).hasClass( prefix + "js-show-as-bar" ) ) {
stat_container.closest( "." + prefix + "js-livestat-" + homeaway + "-part" ).css( "width", newcount + "%" );
//fix for reported issue with many percentages appended!
var ball_possession_value = stat_container.html();
if( ball_possession_value.indexOf( "%" ) == -1 ) {
stat_container.append( "%" );
}
}
}
}
};
LiveStats.prototype.update_stat_object = function( type, homeaway, celldata ){
// if stat doesn't exist, then init with 0
if( typeof this.settings.stats[type] == "undefined" ) {
this.settings.stats[type] = { "home": 0, "away": 0 };
}
// possessions are to be used as it - no calculations
if( type == "possession" ) {
// possessions are updated
this.settings.stats[type]["home"] = celldata.homepos;
this.settings.stats[type]["away"] = celldata.awaypos;
} else {
// stats are counted
this.settings.stats[type][homeaway] = this.settings.stats[type][homeaway] + 1;
}
};
LiveStats.prototype.process_cells = function(){
var stat_to_zonename = this.sport().stat_to_zonename;
var that = this;
// process ordinary cells
this.settings.data_storage.forEach( function( celldata ){
var homeaway = that.analyze_team( celldata );
for( var stat in celldata.stats ) {
var type = stat_to_zonename[stat];
// for goals we ONLY show spot for goals and not for the corresponding shoton
// corners are skipped as they are treated by a different method
var skip_me = 0;
for( var stat in celldata.stats ) {
if( stat == "goals" && type == "shoton" || type == "corner" ) {
skip_me++;
}
}
// in order to show the stat on the field, we need coordinates present. Otherwise it wont be shown.
if( celldata.coordinates && skip_me < 1 ) {
// figure out what to do (add, update, remove or nothing)
var process_field_as = that.get_action_dom( celldata );
switch( process_field_as ) {
case "add":
that.place_cell( celldata, type ); // field
break;
case "update":
that.update_cell( celldata, type, true ); // field
break;
case "remove":
that.remove_cell( celldata ); // field
break;
default:
return;
}
}
}
} );
for( var corner in this.settings.corner_data ) {
this.generate_corner_cell( this.settings.corner_data[corner], stat_to_zonename["corners"], corner );
}
};
// method figures out what to do with the data
LiveStats.prototype.get_action = function( celldata ){
// does a cell with the same ID already exist?
if( typeof this.settings.data_storage[celldata.id] == "object" ) {
var do_i_exist = true;
} else {
var do_i_exist = false;
}
// should the cell be deleted
if( typeof celldata.del != "undefined" ) {
var delete_me = true;
}
if( do_i_exist ) {
if( delete_me ) {
var action = "remove";
} else {
var action = "update";
}
} else {
if( delete_me ) {
var action = "remove";
} else {
var action = "add"
}
}
return action;
};
// updates the data index based on action
LiveStats.prototype.update_data_storage = function( celldata ){
var process_data_as = this.get_action( celldata );
// add elapsed_plus if not present (for sorting purposes)
if( typeof celldata.elapsed_plus == "undefined" ) {
celldata.elapsed_plus = 0;
}
switch( process_data_as ) {
case "add":
case "update":
// adding or updating the new id to the array
this.settings.data_storage[celldata.id] = celldata;
// update corner_data with id's
if( celldata.type == "corner" ) {
if( typeof celldata.coordinates != "undefined" ) {
if( typeof this.settings.corner_data[celldata.coordinates[0] + celldata.coordinates[1]] == "undefined" ) {
this.settings.corner_data[celldata.coordinates[0] + celldata.coordinates[1]] = [];
}
if( this.settings.corner_data[celldata.coordinates[0] + celldata.coordinates[1]].indexOf( celldata.id ) < 0 ) {
this.settings.corner_data[celldata.coordinates[0] + celldata.coordinates[1]].push( celldata.id );
}
}
}
break;
case "remove":
// fist we get the index and then remove the id from the array with splice
this.settings.data_storage.splice( celldata.id, 1 );
// remove item from corner_data
if( typeof celldata.coordinates != "undefined" ) {
this.settings.corner_data[celldata.coordinates[0] + celldata.coordinates[1]].splice( celldata.id, 1 );
}
break;
}
};
// method figures out what to do with the data
LiveStats.prototype.get_action_dom = function( celldata, classname ){
// defaulting if not set - default is cells for action zone
if( typeof classname == "undefined" ) {
classname = "zone-cell";
}
// does a cell with the same ID already exist?
if( this.type == "commentary" ) {
var do_i_exist = $( this.DOM ).find( "#" + prefix + "js-comment-" + this.settings.uid + "-" + celldata.id ).hasClass( prefix + classname );
} else {
if( this.settings.cells_in_field.indexOf( celldata.id ) > -1 ) {
var do_i_exist = true;
}
}
// should the cell be deleted
if( typeof celldata.del != "undefined" ) {
var delete_me = true;
}
if( do_i_exist ) {
if( delete_me ) {
var action = "remove";
} else {
var action = "update";
}
} else {
if( delete_me ) {
var action = "remove";
} else {
var action = "add"
}
}
return action;
};
// items with a property named stats is the only thing counted
LiveStats.prototype.data_filter = function( celldata ){
var go_ahead = false;
if( typeof celldata.stats == "object" ) {
go_ahead = true;
}
return go_ahead;
};
// filter check or uncheck all player checkboxes
LiveStats.prototype.zone_filter_player_reset = function( e ){
var clickreciever = $( e.currentTarget );
if( clickreciever[0].checked ) {
// are we checked
clickreciever.closest( "." + prefix + "zone-lineup" ).find( "INPUT:checkbox" ).prop( "checked", true );
// show all hidden cells by removing the class that hides them
$( e.data.me.DOM ).find( "." + prefix + "hide-zone-cell" ).removeClass( prefix + "hide-zone-cell" );
} else {
// or are we not checked
clickreciever.closest( "." + prefix + "zone-lineup" ).find( "INPUT:checkbox" ).prop( "checked", false );
// hide all cells by adding the class that hides them
$( e.data.me.DOM ).find( "." + prefix + "zone-cell-item" ).addClass( prefix + "hide-zone-cell" );
}
};
// filter team home or both for zone_filter in v2
LiveStats.prototype.zone_filter_team = function( e ){
var clickreciever = $( e.currentTarget );
var currentzone = e.data.me.DOM;
var team = clickreciever.data( "filter" );
currentzone.removeClass( prefix + "zone-filter-team-home" );
currentzone.removeClass( prefix + "zone-filter-team-away" );
currentzone.removeClass( prefix + "zone-filter-team-total" );
currentzone.find( "." + prefix + "team-home-lineup INPUT" ).prop( "disabled", false );
currentzone.find( "." + prefix + "team-away-lineup INPUT" ).prop( "disabled", false );
currentzone.addClass( prefix + "zone-filter-team-" + team );
switch( team ) {
case "home":
currentzone.addClass( prefix + "zone-filter-team-" + team );
currentzone.find( "." + prefix + "team-away-lineup INPUT" ).prop( "disabled", true );
currentzone.find( "." + prefix + "team-home-lineup INPUT" ).prop( "disabled", false );
break;
case "away":
currentzone.addClass( prefix + "zone-filter-team-" + team );
currentzone.find( "." + prefix + "team-home-lineup INPUT" ).prop( "disabled", true );
currentzone.find( "." + prefix + "team-away-lineup INPUT" ).prop( "disabled", false );
break;
}
};
// filter first or second half
LiveStats.prototype.zone_filter_half = function( e ){
var clickreciever = $( e.currentTarget );
var currentzone = e.data.me.DOM;
var half = clickreciever.data( "filter" );
currentzone.removeClass( prefix + "zone-filter-firsthalf" );
currentzone.removeClass( prefix + "zone-filter-secondhalf" );
currentzone.removeClass( prefix + "zone-filter-fullmatch" );
currentzone.addClass( prefix + "zone-filter-" + half );
};
// filter the celss on the field with buttons in v2
LiveStats.prototype.zone_filter2 = function( e ){
var clickreciever = $( e.currentTarget );
var currentzone = e.data.me.DOM;
var type = clickreciever.data( "filter" );
var team = clickreciever.closest( "." + prefix + "zone-type-filter" ).data( "teamfilter" );
//decide if it's off or on
if( clickreciever.hasClass( prefix + "selected" ) ) {
// we are off
currentzone.addClass( prefix + "zone-filter-" + type );
// hack to filter goals with shoton
if( type == "shoton" ) {
currentzone.addClass( prefix + "zone-filter-goal" );
currentzone.addClass( prefix + "zone-filter-shoton" );
currentzone.addClass( prefix + "zone-filter-penalty" );
}
// change selected state
clickreciever.removeClass( prefix + "selected" );
clickreciever.addClass( prefix + "unselected" );
// hack to hide goals and penalties when shoton is selected
if( type == "shoton" ) {
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-goal" ).removeClass( prefix + "selected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-goal" ).addClass( prefix + "unselected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-penalty" ).removeClass( prefix + "selected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-penalty" ).addClass( prefix + "unselected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-shoton" ).removeClass( prefix + "selected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-shoton" ).addClass( prefix + "unselected" );
}
} else if( clickreciever.hasClass( prefix + "unselected" ) ) {
//we are on
currentzone.removeClass( prefix + "zone-filter-" + type );
// change selected state
clickreciever.removeClass( prefix + "unselected" );
clickreciever.addClass( prefix + "selected" );
// hack to filter goals with shoton
if( type == "shoton" ) {
currentzone.removeClass( prefix + "zone-filter-goal" );
currentzone.removeClass( prefix + "zone-filter-shoton" );
currentzone.removeClass( prefix + "zone-filter-penalty" );
}
// hack to show goals and penalties when shoton is selected
if( type == "shoton" ) {
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-goal" ).removeClass( prefix + "unselected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-goal" ).addClass( prefix + "selected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-penalty" ).removeClass( prefix + "unselected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-penalty" ).addClass( prefix + "selected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-shoton" ).removeClass( prefix + "unselected" );
currentzone.find( "." + prefix + "zone-filter-button." + prefix + "zone-shoton" ).addClass( prefix + "selected" );
}
}
};
// toggle buttons, toggles all stats or players on or off
// toggled or not toggled
LiveStats.prototype.zone_toggle = function( e ){
var DOM = e.data.me.DOM;
var clickreciever = $( this );
var data = clickreciever.data( "toggle" );
var toggle = function( button, data, function1, function2 ){
if( $( button ).hasClass( prefix + "toggled" ) ) {
$( button ).removeClass( prefix + "toggled" ).addClass( prefix + "nottoggled" );
//$(button).find("."+prefix+"toggle-button-text").html(data.nottoggled);
function1(); // callback
} else {
$( button ).removeClass( prefix + "nottoggled" ).addClass( prefix + "toggled" );
//$(button).find("."+prefix+"toggle-button-text").html(data.toggled);
function2(); // callback
}
};
// turns off all zone filter types
var type_filter_off = function(){
$( DOM ).find( "." + prefix + "zone-type-filter" ).find( "." + prefix + "zone-filter-button" ).each( function(){
$( this ).removeClass( prefix + "selected" ).addClass( prefix + "unselected" );
$( DOM ).addClass( prefix + "zone-filter-" + $( this ).data( "filter" ) );
} );
};
// turns on all zone filter types
var type_filter_on = function(){
$( DOM ).find( "." + prefix + "zone-type-filter" ).find( "." + prefix + "zone-filter-button" ).each( function(){
$( this ).removeClass( prefix + "unselected" ).addClass( prefix + "selected" );
$( DOM ).removeClass( prefix + "zone-filter-" + $( this ).data( "filter" ) );
} );
};
// turns off all players
var players_off = function(){
$( DOM ).find( "." + prefix + "zone-filter-player" ).each( function(){
$( DOM ).find( "." + prefix + "zone-cell-container" ).find( "." + prefix + "zone-cell-item" ).addClass( prefix + "hide-zone-cell" );
$( DOM ).find( "." + prefix + "zone-cell-container" ).find( "." + prefix + "zone-cell-item" ).closest( "." + prefix + "zone-cell" ).addClass( prefix + "element-invisible" );
$( this ).prop( "checked", false );
} );
};
// turns on all players
var players_on = function(){
$( DOM ).find( "." + prefix + "zone-filter-player" ).each( function(){
$( DOM ).find( "." + prefix + "zone-cell-container" ).find( "." + prefix + "zone-cell-item" ).removeClass( prefix + "hide-zone-cell" );
$( DOM ).find( "." + prefix + "zone-cell-container" ).find( "." + prefix + "zone-cell-item" ).closest( "." + prefix + "zone-cell" ).removeClass( prefix + "element-invisible" );
$( this ).prop( "checked", true );
} );
};
switch( data.action ) {
case "cp":
toggle( clickreciever, data, players_on, players_off );
break;
case "cs":
toggle( clickreciever, data, type_filter_on, type_filter_off );
break;
}
};
// filter the cells on the field when clicked
LiveStats.prototype.zone_filter = function( e ){
var clickreciever = $( e.currentTarget );
var currentzone = e.data.me.DOM;
var type = clickreciever.data( "filter" );
var team = false; // the team thats being filtered (home or away)
var player = false;
// pick up team
if( clickreciever.hasClass( prefix + "zone-filter-home" ) ) {
// filter home cells
team = "home";
} else if( clickreciever.hasClass( prefix + "zone-filter-away" ) ) {
// filter away cells
team = "away";
}
// pick up player
if( clickreciever.hasClass( prefix + "zone-filter-player" ) ) {
player = $( this ).data( "pfilter" );
}
if( team ) {
// are we team filtering?
// show or hide the stat
if( clickreciever[0].checked ) {
// show cells
// remove the class that invokes the hiding
currentzone.removeClass( prefix + "filter-" + type + "-" + team );
// add checks in the checkboxes
currentzone.find( "." + prefix + "team-" + team + "-lineup" ).find( "INPUT:checkbox" ).prop( "checked", true );
// enable the checkboxes again
currentzone.find( "." + prefix + "team-" + team + "-lineup" ).find( "INPUT:checkbox" ).prop( "disabled", false );
currentzone.find( "." + prefix + "team-" + team + "-lineup" ).find( "INPUT:checkbox" ).each( function(){
// cycle the checkboxes to see if there were any that was not checked when the cells were hidden
if( $( this ).hasClass( prefix + "notchecked" ) ) {
// they are still not to be checked
$( this ).prop( "checked", false );
// remove class marker
$( this ).removeClass( prefix + "notchecked" );
}
} );
} else {
// hide cells
currentzone.find( "." + prefix + "team-" + team + "-lineup" ).find( "INPUT:checkbox" ).each( function(){
// cycle checkboxes to see if there are any not checked ones
if( !$( this )[0].checked ) {
// if thats the case we then add a class marking the fact it was not checked
$( this ).addClass( prefix + "notchecked" );
}
} );
// add the class taht invokes the hiding
currentzone.addClass( prefix + "filter-" + type + "-" + team );
// remove checks in the checkboxes
currentzone.find( "." + prefix + "team-" + team + "-lineup" ).find( "INPUT:checkbox" ).prop( "checked", false );
// disable the checkboxes so you cant select them while content is hidden.
currentzone.find( "." + prefix + "team-" + team + "-lineup" ).find( "INPUT:checkbox" ).prop( "disabled", true );
}
} else if( player ) {
// or are we player filtering?
// first we check to see if there are a matching cell on the zone for the player
if( currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).hasClass( prefix + "zone-player-" + player ) ) {
// yes there is a matching cell on the zone for the player
if( currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).css( "opacity" ) != 1 ) {
// show the cell
if( currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).hasClass( prefix + "hide-zone-cell" ) ) {
currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).removeClass( prefix + "hide-zone-cell" );
currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).closest( "." + prefix + "zone-cell" ).removeClass( prefix + "element-invisible" );
} else {
currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).addClass( prefix + "show-zone-cell" );
currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).closest( "." + prefix + "zone-cell" ).addClass( prefix + "shows-zone-cell" );
}
// make sure the checkbox is checked
currentzone.find( "." + prefix + "zone-player-" + player ).prop( "checked", true );
} else {
// hide the cell
if( currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).hasClass( prefix + "show-zone-cell" ) ) {
currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).removeClass( prefix + "show-zone-cell" );
currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).closest( "." + prefix + "zone-cell" ).removeClass( prefix + "shows-zone-cell" );
} else {
currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).addClass( prefix + "hide-zone-cell" );
currentzone.find( "." + prefix + "zone-cell-item." + prefix + "zone-player-" + player ).closest( "." + prefix + "zone-cell" ).addClass( prefix + "element-invisible" );
}
// make sure the checkbox is unchecked
currentzone.find( "." + prefix + "zone-player-" + player ).prop( "checked", false );
}
} else {
// no there is no cell for the player
if( currentzone.find( "." + prefix + "zone-player-" + player ).prop( "checked" ) ) {
// if the checkbox is checked then remove the check
currentzone.find( "." + prefix + "zone-player-" + player ).prop( "checked", true );
} else {
// if the checkbox is not checked then add a check
currentzone.find( "." + prefix + "zone-player-" + player ).prop( "checked", false );
}
}
}
};
// Method places a cell on the field
LiveStats.prototype.place_cell = function( celldata, type, is_update ){
// first we generate a new cell
if( type == "corner" ) {
var new_cell = this.generate_corner_cell( celldata, type );
} else {
var new_cell = this.generate_cell( celldata, type );
}
$( new_cell ).addClass( "mx-" + this.settings.uid + celldata.id );
// figure out what half we are in (1st or 2nd)
if( celldata.elapsed <= this.sport().first_half ) {
// 1st half
var half = "first-half";
} else {
// 2nd half
var half = "second-half";
}
// there are a new cell generated then place it
if( typeof new_cell != "undefined" ) {
$( this.DOM ).find( "." + prefix + "zone-" + half + "-container" ).append( new_cell );
this.settings.cells_in_field.push( celldata.id );
// is it an update of an existing cell
if( is_update ) {
//$("#"+prefix+celldata.id).addClass(prefix+"done");
} else {
// if its not an update show animation 1
if( this.lang_dir == "rtl" ) {
$( "#" + prefix + this.settings.uid + "-" + celldata.id ).addClass( prefix + "done-rtl" );
} else {
$( "#" + prefix + this.settings.uid + "-" + celldata.id ).addClass( prefix + "done" );
}
}
}
};
// Method places a cell on the field
LiveStats.prototype.update_cell = function( celldata, type, is_update ){
// locate the existing cell
var existing_cell = $( this.DOM ).find( "#" + prefix + this.settings.uid + "-" + celldata.id );
// does the cell really exist?
if( existing_cell.hasClass( prefix + "zone-cell" ) ) {
// remove the outdated cell
this.remove_cell( celldata, true );
// insert a new one
this.place_cell( celldata, type, is_update );
} else {
return false;
}
};
// Method removes a cell on the field
LiveStats.prototype.remove_cell = function( celldata, is_update ){
// locate the existing cell
var existing_cell = $( this.DOM ).find( "#" + prefix + this.settings.uid + "-" + celldata.id );
// does the cell really exist?
if( existing_cell.hasClass( prefix + "zone-cell" ) ) {
// remove the outdated cell
existing_cell.remove();
if( is_update ) {
this.settings.cells_in_field.splice( celldata.id, 1 );
} else {
this.settings.data_storage.splice( celldata.id, 1 );
this.settings.cells_in_field.splice( celldata.id, 1 );
}
} else {
return false;
}
};
// method generates a merged cell with all attached corners
LiveStats.prototype.generate_corner_cell = function( corner_ids, type, corner_identification ){
// init
var that = this;
var popupdata = {};
var half = [];
var homeaway = [];
var i = 0;
var coords;
// first thing to do is to remove any previous instance of this cell.
$( this.DOM ).find( "#" + prefix + "js-cornerid-" + this.settings.uid + "-" + corner_identification ).remove();
corner_ids.forEach( function( cellid ){
var celldata = that.settings.data_storage[cellid];
coords = that.settings.data_storage[cellid].coordinates;
// add to popupdata
popupdata[i] = {
"el": celldata.elapsed,
"team": that.get_event_text( "player", celldata.team, that ),
"player": that.get_event_text( "player", celldata.player1, that )
};
popupdata[i].incident_name = that.DOM.find( "." + prefix + "zone-type-name-container" ).find( "." + prefix + "zone-type-name-" + type ).html().trim();
i++;
// figure out what half we are in (1st or 2nd)
if( celldata.elapsed <= that.sport().first_half ) {
// 1st half
half[0] = "first-half";
} else {
// 2nd half
half[1] = "second-half";
}
// are the cell covering both teams
switch( that.analyze_team( celldata, "cell" ) ) {
case "home":
homeaway[0] = "home";
break;
case "away":
homeaway[1] = "away";
break;
}
} );
// we clone a copy of the cell from the dom
var cell = $( "." + prefix + "zone-cell-template" ).clone();
cell.removeClass( prefix + "zone-cell-template" ).addClass( prefix + "zone-corner" );
cell.find( "." + prefix + "zone-cell-item" );
// add style positions
cell.css( this.calc_pos( coords ) );
for( var t in homeaway ) {
cell.addClass( prefix + "zone-team-" + homeaway[t] );
}
cell.data( "popup", JSON.stringify( popupdata ) );
//cell.attr("data-debug",JSON.stringify(popupdata));
cell.attr( "id", prefix + "js-cornerid-" + this.settings.uid + "-" + corner_identification );
cell.addClass( prefix + "show-corner-incidents-popup" );
for( var h in half ) {
cell.addClass( prefix + "zone-" + half[h] );
$( this.DOM ).find( "." + prefix + "zone-" + half[h] + "-container" ).append( cell ).addClass( prefix + "done" );
}
};
// Method generates and returns the cell with attributes etc.
LiveStats.prototype.generate_cell = function( celldata, type ){
// figure if team is home or away
var homeaway = this.analyze_team( celldata, "cell" );
// is it a corner?
if( type == "corner" ) {
// manipulate position of the corner if ther are other corners in th same coords.
celldata = this.position_adjustment( celldata );
}
// we are only generating a cell if the type is valid and we can identify the team for user filtering.
if( type && homeaway ) {
// we clone a copy of the cell from the dom
var cell = $( this.DOM ).find( "." + prefix + "zone-cell-template" ).clone();
// build incidents popup
var el = celldata.elapsed;
// figure out what half we are in (1st or 2nd)
if( celldata.elapsed <= this.sport().first_half ) {
// 1st half
var half = "first-half";
} else {
// 2nd half
var half = "second-half";
}
// get player names from lineup dom (they are translated and ready to use)
if( typeof celldata.player1 != "undefined" ) {
var popupdata = {};
// get a name for the incident
popupdata.incident_name = this.DOM.find( "." + prefix + "zone-type-name-container" ).find( "." + prefix + "zone-type-name-" + type ).html().trim();
// get player one name from dom
if( typeof celldata.player1 != "undefined" ) {
popupdata.line1 = this.get_event_text( "player", celldata.player1 );
}
// check also for a player2
if( typeof celldata.player2 != "undefined" ) {
popupdata.line2 = this.get_event_text( "player", celldata.player2 );
}
cell.data( "popup", popupdata ).addClass( prefix + "show-incidents-popup" );
}
// calculate position
var css_position = this.calc_pos( celldata.coordinates );
// cleanup
cell.removeClass( prefix + "zone-cell-template" );
// set data for incidents popup
if( typeof popupdata != "undefined" ) {
cell.data( "el", el );
}
// add team identifier
cell.addClass( prefix + "zone-team-" + homeaway ).addClass( prefix + "zone-" + type );
cell.find( "." + prefix + "zone-cell-item" ).addClass( prefix + "zone-player-" + celldata.player1 );
// add zone type
cell.find( "." + prefix + "zone-cell-item" ).addClass( prefix + "zone-" + type );
// add zone half
cell.addClass( prefix + "zone-" + half );
// add style positions
cell.css( css_position );
// add id
cell.attr( "id", prefix + this.settings.uid + "-" + celldata.id );
return cell;
} else {
// no cell generated
return false;
}
};
// methods determines if there are a team fk in the celldata and decides home or away
LiveStats.prototype.analyze_team = function( celldata, use_in ){
var team = undefined;
if( !use_in ) {
use_in = "stat";
}
switch( celldata.team ) {
case this.settings.home:
if( typeof celldata.stats != "undefined" && celldata.stats.owngoals && use_in == "stat" ) {
team = "away";
} else {
team = "home";
}
break;
case this.settings.away:
if( typeof celldata.stats != "undefined" && celldata.stats.owngoals && use_in == "stat" ) {
team = "home";
} else {
team = "away";
}
break;
}
return team;
};
// Calculates positions from coords to percentage
LiveStats.prototype.calc_pos = function( coords ){
var posY = coords[0]; // rows
var posX = coords[1]; // cols
// to make the positions match we need to subtract the value of one step in the grid
var posY_minus = 100 / this.settings.max_rows;
var posX_minus = 100 / this.settings.max_cols;
// calc the percentages
var posYpct = (coords[0] * 100) / this.settings.max_rows - posY_minus;
var posXpct = (posX * 100) / this.settings.max_cols - posX_minus;
//create the output
if( this.lang_dir == "rtl" ) {
return { "top": posYpct + "%", "left": posXpct + "%" };
} else {
return { "top": posYpct + "%", "right": posXpct + "%" };
}
};
// calculate the position for corners - so that they are not all in the same spot
LiveStats.prototype.position_adjustment = function( celldata ){
// compile the coords for comparison to the corner_coords
var coord = celldata.coordinates[0] + "x" + celldata.coordinates[1];
// the array position is the type 0,1,2,3
var ctype = $.inArray( coord, this.sport().corner_coords );
// how many other corners do we have in this position
var existing_corners = this.sport().corner[ctype];
// adjument to the current coordinates
var adjustment = existing_corners;
// use modulus to spread the corners on the x and y axis of the field
var modulus = existing_corners % 2;
// make sure that we are talking about a corner and make adjustments to the coordinates
if( ctype > -1 ) {
switch( ctype ) {
case 0:
if( modulus > 0 ) {
celldata.coordinates[0] = celldata.coordinates[0] + adjustment;
} else {
celldata.coordinates[1] = celldata.coordinates[1] + adjustment;
}
break;
case 1:
if( modulus > 0 ) {
celldata.coordinates[0] = celldata.coordinates[0] - adjustment;
} else {
celldata.coordinates[1] = celldata.coordinates[1] + adjustment;
}
break;
case 2:
if( modulus > 0 ) {
celldata.coordinates[0] = celldata.coordinates[0] - adjustment;
} else {
celldata.coordinates[1] = celldata.coordinates[1] - adjustment;
}
break;
case 3:
if( modulus > 0 ) {
celldata.coordinates[0] = celldata.coordinates[0] + adjustment;
} else {
celldata.coordinates[1] = celldata.coordinates[1] - adjustment;
}
break;
}
this.sport().corner[ctype] = this.sport().corner[ctype] + 1;
}
// return the celldata with modified coordinates
return celldata;
};
/*
*
* method gets sport specific settings
* - these methods could be moved to central mx for sharing with livescore
*
*/
//Get sport
LiveStats.prototype.sport = function(){
//Extend Sport with default values
return $.extend( {
//Does sport have livestats
livestats: false,
//Does sport liveupdate
liveupdate: true
}, this.sports[this.settings.sport] || {} );
};
//Sport Definitions
LiveStats.prototype.sports = {
//soccer, sportfk = 1
soccer: {
first_half: 45,
livestats: true,
liveupdate: true,
corner_coords: ["1x1", "45x1", "45x69", "1x69"],
corner: [0, 0, 0, 0],
stat_to_zonename: {
"ycards": "yellowcard",
"rcards": "redcard",
"goals": "goal",
"owngoals": "goal",
"penalties": "penalty",
"blocked": "blocked",
"shoton": "shoton",
"shotoff": "shotoff",
"offsides": "offside",
"foulscommitted": "foulcommit",
"crosses": "cross",
"corners": "corner"
},
max_elapsed: 90
// types with subtypes/comments we want to show in the action zone. Other are omitted.
},
//handball, sportfk = 20
handball: {},
//icehockey, sportfk = 5
icehockey: {},
//curling, sportfk = 10
curling: {},
//tennis, sportfk = 2
tennis: {
livestats: true,
liveupdate: true
},
//basketball, sportfk = 23
basketball: {},
//cycling, sportfk = 30
cycling: {},
//american football, sportfk = 24
football: {},
//golf, sportfk = 3
golf: {}
};
// MX MatchStats methods
var mxms;
//Main MinisiteX Class
var MatchStats = function(settings){
//settings
this.settings = $.extend({
// maximum number of rows and cols
max_rows: 45,
max_cols: 69,
// dom
dom: {},
// update related
sport: "",
update_interval: 5000,
update_url: "/live_data/event_stats/[eventfk]/[n]",
ajaxSettings: {cache: false, dataType: "json", ifModified:false, isLocal:false, type: "GET", headers:{SITE:"MinisiteX"}},
status: "",
// we use the data index to keep track of what cells we have processed.
// The index is a list of ID's that we check each time. If an ID is in the list, its not a new data cell but a possible update or removal.
data_storage: [],
//Which events are shown. Today (+ day days)
day: false,
eventFK: null,
binds: {},
finished_updates: 0,
max_finished_updates: 5,
}, settings);
this.DOM = $(this.settings.dom);
this.timer = null;
//References to the xmlhttp object used in class
this.xmlhttp = {
match_stats: null,
};
// Binds
};
/*
*
* Initialize the script
*
*/
MatchStats.prototype.init = function(){
this.doBinds();
this.stop();
//Set Update Inc (n)
this.n = this.DOM.data("n")||0;
var that = this;
//is sport live and today
if(that.settings.day===0 && that.sport().liveupdate){
that.timer = setTimeout(that.update.bind(that), 250);
that.DOM.addClass(prefix+"initialized-match-stats-service");
}
};
//Stop MatchStatss (Clear timers and abort current xmlhttp request if any)
MatchStats.prototype.stop = function(){
try{this.xmlhttp.abort();}catch(e){}
try{clearTimeout(this.timer);}catch(e){}
};
//Do DOM event Binds
MatchStats.prototype.doBinds = function(){
//Loop through selectors
for(var selector in this.settings.binds){
if(!this.settings.binds.hasOwnProperty(selector)){continue;}
//Loop through events
for(var eventType in this.settings.binds[selector]){
if(!this.settings.binds[selector].hasOwnProperty(eventType)){continue;}
this.DOM.on(eventType, selector, {me:this}, this.settings.binds[selector][eventType]);
}
};
};
/*
*
* update methods
*
*/
// sets the url for the json update and retrieves the data from service
MatchStats.prototype.update = function(){
//Safety precaution to prevent several update processes from occuring
clearTimeout(this.timer);
//Create URL by insering [eventfk] and [n]
var url = this.settings.update_url.replace("[eventfk]", this.settings.eventfk).replace("[n]", this.n);
console.log("MatchStats update url", url);
if(!$(this.settings.dom).is(":visible")){
return false;
}
// if configured, send AJAX requests to a particular domain
var ajax_settings = this.settings.ajaxSettings;
var json_url = this.getJsonUrl();
if(json_url.length > 0) {
url = json_url + url;
delete ajax_settings.headers;
}
this.xmlhttp = $.ajax(url, ajax_settings)
.done(this.update_done.bind(this))
.always(this.update_always.bind(this))
.fail(this.update_fail.bind(this));
};
//Update Success send the data on to processing
MatchStats.prototype.update_done = function(data){
//is data and object and are there any data present
if(typeof(data)==="object" && data.t){
this.n = data.n;
this.status = data.s;
this.DOM.data("status",data.s);
this.DOM.addClass(prefix+data.s);
//process the data
this.process_data(data);
}
return;
};
// Update MatchStats Complete - sets timer interval and restarts the timer
MatchStats.prototype.update_always = function(data){
var interval = this.settings.update_interval;
//If event is not inpreogress increase interval to 1 minute
if(this.DOM.data("status")==="finished" || this.DOM.data("status")==="halftime" || this.DOM.data("status")==="notstarted"){
interval = 60000;
}
// if status is finished only make a set number of updates before ending all updates
if(this.DOM.data("status")==="finished"){
this.settings.finished_updates ++;
}
if (this.settings.sportfk == 30) {
interval = this.sport().update_interval;
}
// if there are items in the current dataset, set a low interval to poll quickly for more
if(typeof(data.t) === "number" && data.t > 0){
interval = 50;
}
if(this.settings.finished_updates > this.settings.max_finished_updates){
// match finished - end updates
} else {
this.timer = setTimeout(this.update.bind(this), interval);
}
return;
};
//Update Livescore Error
MatchStats.prototype.update_fail = function(){
return;
};
// get the json url
// could be moved to centrallized mx script
MatchStats.prototype.getJsonUrl = function(){
var json_url = "";
if(typeof(window.mx.settings.json_url) != "undefined") {
json_url = window.mx.settings.json_url;
} else {
if(typeof window.mx.settings.api_domain != "undefined") {
json_url = window.mx.settings.api_domain;
}
}
return json_url;
};
// Method processes the data recived from the service
MatchStats.prototype.process_data = function(data){
for(var participant in data.i){
if(this.settings.p.indexOf(parseInt(participant)) > -1){
for(var stat in data.i[participant]){
$(this.DOM).find("."+prefix+"match-stats-"+stat+"-"+participant).html(data.i[participant][stat]);
}
}
}
};
/*
*
* method gets sport specific settings
* - these methods could be moved to central mx for sharing with livescore
*
*/
//Get sport
MatchStats.prototype.sport = function(){
//Extend Sport with default values
// check for sports presense in this.sport
if(this.sports.hasOwnProperty(this.settings.sport)){
return $.extend({
//Does sport have MatchStats
MatchStats: false,
//Does sport liveupdate
liveupdate:true,
}, this.sports[this.settings.sport]||{});
} else {
return ({
//Does sport have MatchStats
MatchStats: false,
//Does sport liveupdate
liveupdate:false
})
}
};
//Sport Definitions
MatchStats.prototype.sports = {
//soccer, sportfk = 1
soccer: {
liveupdate: true
},
//handball, sportfk = 20
handball: {
liveupdate: true
},
//icehockey, sportfk = 5
icehockey: {
liveupdate: true
},
//curling, sportfk = 10
curling: {
liveupdate: true
},
//tennis, sportfk = 2
tennis: {
liveupdate: true
},
//basketball, sportfk = 23
basketball: {
liveupdate: true
},
//cycling, sportfk = 30
cycling: {
liveupdate: false
},
//american football, sportfk = 24
football: {
liveupdate: true
},
//golf, sportfk = 3
golf: {
liveupdate: false
}
};
$(document).ready(function(){
//Check for settings in (var mxaz_settings)
//var settings = typeof(mxms_settings)==="object" ? mxms_settings : null;
//mx.initMatchStats("BODY");
//window.mxaz = mxaz = new MatchStats(settings);
//mxaz.init();
});
var gc;
// Main class constructor
var GameCenter = function(settings){
//This DOM
this.DOM = $(wrapper);
this.settings = $.extend({
binds: {}
}, settings);
// livetips popup trigger
this.settings.binds["."+prefix+"liveodds"] = this.settings.binds["."+prefix+"liveodds"] || {
"click": this.liveTipsPopup,
"vclick": this.liveTipsPopup
};
// livetips popup close
this.settings.binds["."+prefix+"close-liveodds"] = this.settings.binds["."+prefix+"close-liveodds"] || {
"click": this.liveTipsPopup,
"vclick": this.liveTipsPopup
};
// cover
this.settings.binds["."+prefix+"penalty-open-close"] = this.settings.binds["."+prefix+"penalty-open-close"] || {
"click": this.penaltyViewer,
"vclick": this.penaltyViewer
};
};
//Initialize
GameCenter.prototype.init = function(){
//check for special cases
if(mx.queryString("specialcase")){
this.specialCase(mx.queryString("specialcase"));
}
//rotating livetips in timelines of notstarted events.
//if there are no such tips, the function will not run
//gc.tipRotator();
this.doBinds();
};
GameCenter.prototype.penaltyViewer = function(e){
var target = "."+prefix+"timeline-penalty-shootout-"+$(this).data("view");
var speed = 150;
var easing = "swing";
var currentState = parseInt($(target).css("top"));
if(!$(target).hasClass(prefix+"open") && currentState > 0){
$(target).animate({top:"0px"}, speed, easing, function(){
$(target).addClass(prefix+"open");
$(target).data("css_top",currentState);
});
$(this).addClass(prefix+"open");
} else {
$(target).animate({top:$(target).data("css_top")+"px"}, speed, easing, function(){
$(target).removeClass(prefix+"open");
});
$(this).removeClass(prefix+"open");
}
};
GameCenter.prototype.liveTipsPopup = function() {
return false; // disabled for wc
/*
var popup = {};
popup.dom = $("."+prefix+$(this).data('view'));
popup.content = popup.dom.find($("."+prefix+"liveodds-container"));
popup.speed = "fast"
var display = function(popup){
$(popup.dom).fadeIn(popup.speed, function(){
// code when faded in
$(this).addClass(prefix+"showing-popup");
})
}
var hide = function(popup){
$(popup.dom).fadeOut(popup.speed, function(){
// code when faded out
$(this).removeClass(prefix+"showing-popup");
})
}
var loadContent = function(popup){
//load snippet content
mx.snippet({dom:popup.dom, always:function(){
display(popup);
}});
}
if($(popup.dom).hasClass(prefix+"showing-popup") || $(this).hasClass(prefix+"close-liveodds")){
// hide popup
hide(popup);
} else {
// show popup
loadContent(popup);
}
*/
};
//rotating livetips for the timeline
GameCenter.prototype.tipRotator = function(){
var rotationDelay = 6000;
var slideSpeed = "slow";
var timer;
// the controlling function
// checks each found gamecenter for livetips and starts rotation of tips
var run = function(){
$("."+prefix+"widget-gamecenter").each(function(){
if($(this).find("."+prefix+"timeline-tiprotator").hasClass(prefix+"timeline-tiprotator")){
var tips = $(this).find("."+prefix+"timeline-tiprotator");
var tip = findShowingTip(tips);
stepTip(tips,tip);
//if($(this).is(":visible")){
startTimer(tips, rotationDelay);
//}
}
});
};
var start = function(){
$("."+prefix+"widget-gamecenter").each(function(){
if($(this).find("."+prefix+"timeline-tiprotator").hasClass(prefix+"timeline-tiprotator")){
var tips = $(this).find("."+prefix+"timeline-tiprotator");
var tip = findShowingTip(tips);
//stepTip(tips,tip);
startTimer(tips, rotationDelay);
}
});
};
// searches for mx-viewing in the collection, and returns the following tip.
// if no tip has mx-viewing, the first tip is returned
var findShowingTip = function(tips){
if($(tips).find("."+prefix+"rotating-livetip").hasClass(prefix+"viewing")){
// reset the cycle when we get to the last tip
if($(tips).find("."+prefix+"viewing").next().hasClass(prefix+"rotating-livetip")){
return $(tips).find("."+prefix+"viewing").next();
} else {
return $(tips).find("."+prefix+"rotating-livetip").first();
}
} else {
return $(tips).find("."+prefix+"rotating-livetip").first();
}
};
var startTimer = function(tips, rotationDelay){
stopTimer();
timer = setTimeout(function(){run()}, rotationDelay);
};
// this method stops the timer
var stopTimer = function(){
clearTimeout(timer);
};
// hides showing tips marked with mx-viewing
// then shows the next.
var stepTip = function(tips,tip){
if($(tips).find("."+prefix+"rotating-livetip").hasClass(prefix+"viewing")){
$(tips).find("."+prefix+"viewing").fadeOut(slideSpeed, function(){
$(this).removeClass(prefix+"viewing");
showTip(tip);
});
} else {
showTip(tip);
}
};
// shows the tip passed to the method
var showTip = function(tip){
$(tip).fadeIn(slideSpeed, function(){
$(this).addClass(prefix+"viewing");
});
};
// go
start();
};
//Do DOM event Binds
GameCenter.prototype.doBinds = function(){
//Loop through selectors
for(var selector in this.settings.binds){
if(!this.settings.binds.hasOwnProperty(selector)){continue;}
//Loop through events
for(var eventType in this.settings.binds[selector]){
if(!this.settings.binds[selector].hasOwnProperty(eventType)){continue;}
this.DOM.on(eventType, selector, {me:this}, this.settings.binds[selector][eventType]);
}
};
};
GameCenter.prototype.useContentBackground = function(addremove, elementtocover, coveringelement) {
var useHeight = parseInt($(elementtocover).outerHeight());
if(addremove === 'add'){
if($(coveringelement).hasClass(prefix+"collapsed")){
$(coveringelement).css("height",useHeight+"px");
$(coveringelement).removeClass(prefix+"collapsed");
$(coveringelement).fadeIn(10);
}
} else {
if($(coveringelement).not(prefix+"collapsed")){
$(coveringelement).addClass(prefix+"collapsed");
$(coveringelement).fadeOut(10);
$(coveringelement).css("height","auto");
}
}
};
// Switch for special case uses of content
GameCenter.prototype.specialCase = function(caseStr){
//Special case where a gamecenter should display as minified
if(caseStr == "gamecenter_notopbar_notimeline"){
// add an extra class to gamecenter
// special css will then do the needed magic
$("."+prefix+"widget-gamecenter").addClass(prefix+"notopbar_notimeline");
}
};
//Auto Initialize Class
$(function(){
//Check for gamecenter
});
// Method reloads parent livescore widget with new date params.
MX.prototype.calendar_action = function(e){
e.stopPropagation();
e.preventDefault();
var clickReciever = $(this);
var new_date = clickReciever.data("date").split("-");
var snippet_root = $(this).closest("."+prefix+"snippet-root:not(."+prefix+"calendar-container)");
//we need to find a livescore widget to work with
if(snippet_root.length == 0){
snippet_root = $(".mx-compound-livescore").parent();
}
var snippet_params = snippet_root.data("params");
var params = snippet_params.params.split("/");
params[1] = new_date[0]+"-"+new_date[1]+"-"+new_date[2];
snippet_params.params = params.join("/");
snippet_root.data("params",snippet_params);
e.data.me.snippet({dom:snippet_root});
$(".mx-sitecover.cover-for-popup").trigger("click");
};
// method is used in date picker for live score to change monthly views
MX.prototype.calendar_manipulation = function(e){
e.stopPropagation();
var clickReciever = $(this);
var snippet_root = clickReciever.closest("."+prefix+"snippet-root");
var alt_date = clickReciever.closest("."+prefix+"calendar").data("showdate");
//e.data.me.settings.calendar_selected_day
if(typeof alt_date === "string" && alt_date.length > 1){
var myMoment = moment(alt_date, "YYYY-MM-DD");
} else {
var myMoment = moment(); // get current moment if no date is supplied
}
var snippet_params = snippet_root.data("params");
var params = snippet_params.params.split("/");
if(clickReciever.hasClass(prefix+"calendar-forward")){
var new_target_date = myMoment.add('months', 1);
var year = new_target_date.year();
var month = new_target_date.month() + 1;
var date = new_target_date.date();
params[1] = year+"-"+month+"-"+date;
} else if(clickReciever.hasClass(prefix+"calendar-backwards")){
var new_target_date = myMoment.subtract('months', 1);
var year = new_target_date.year();
var month = new_target_date.month() + 1;
var date = new_target_date.date();
params[1] = year+"-"+month+"-"+date;
}
snippet_params.params = params.join("/");
snippet_params = snippet_root.data("params",snippet_params);
e.data.me.snippet({dom:snippet_root});
};
var mxcal;
// Main class constructor
var MXcal = function(settings){
//This DOM
this.DOM = $(wrapper);
this.settings = $.extend({
binds: {},
wc2014: {
"groupmatches" : ["2014-06-12","2014-06-13","2014-06-14","2014-06-15","2014-06-16","2014-06-17","2014-06-18","2014-06-19","2014-06-20","2014-06-21","2014-06-22","2014-06-23","2014-06-24","2014-06-25","2014-06-26"],
"roundof16" : ["2014-06-28","2014-06-29","2014-06-30","2014-07-01"],
"quarterfinals" : ["2014-07-04","2014-07-05"],
"semifinals" : ["2014-07-08","2014-07-09"],
"finals" : ["2014-07-12","2014-07-13"],
"pretournament" : ["2014-06-11","2014-06-10","2014-06-09"]
},
wrapper: $("body")
}, settings);
// cover
this.settings.binds["."+prefix+"cover-for-popup"] = this.settings.binds["."+prefix+"cover-for-popup"] || {
"click": mx.cover,
"vclick": mx.cover,
//"touchstart": mx.cover
};
// calendar slides
this.settings.binds["."+prefix+"calendar-slide"] = this.settings.binds["."+prefix+"calendar-slide"] || {
"click": this.calendar_slide,
"vclick": this.calendar_slide,
//"touchstart": this.calendar_slide
};
};
//Initialize
MXcal.prototype.init = function(dom){
this.DOM = $(dom);
var root_snippet = mx.get_root_snippet(dom);
// find the link group of the snippet
if(root_snippet.size() > 0 && typeof root_snippet.data("link-group") !== "undefined") {
this.settings.link_group = root_snippet.data("link-group");
} else {
this.settings.link_group = "default";
}
this.doBinds();
this.calendar_init();
};
//Do DOM event Binds
MXcal.prototype.doBinds = function(){
//Loop through selectors
for(var selector in this.settings.binds){
if(!this.settings.binds.hasOwnProperty(selector)){continue;}
//Loop through events
for(var eventType in this.settings.binds[selector]){
if(!this.settings.binds[selector].hasOwnProperty(eventType)){continue;}
this.DOM.on(eventType, selector, {me:this}, this.settings.binds[selector][eventType]);
}
};
};
// method controls the slide up or down of the calendar when the date in header is clicked
MXcal.prototype.calendar_slide = function(e){
e.stopPropagation();
var clickReciever = $(this);
var content = clickReciever.parent().next("."+prefix+"calendar");
if(clickReciever.hasClass(prefix+"collapsed")){
clickReciever.removeClass(prefix+"collapsed");
content.slideDown("fast");
}else{
content.slideUp("fast", function(){
clickReciever.addClass(prefix+"collapsed");
}.bind(this));
}
};
/*
* Calendar Functions
* NOTE: Functions for the calendar rely on 3rd party moment.js library -> http://momentjs.com/
* A javascript date library for parsing, validating, manipulating, and formatting dates.
*
* A language can be set with moment.lang("en") for localized weekday and month names;
* Deprecation warning: moment.lang is deprecated. Use moment.locale instead
* The returned html covers the days in the span
*/
MXcal.prototype.process_startdate = function(date){
var result = {};
switch(date){
case "yesterday":
result.object = moment().subtract(1,"days"); // keyword yesterday translates to the date before today
result.string = this.set_fulldate(result.object);
break;
case "tomorrow":
result.object = moment().add(1,"days"); // keyword yesterday translates to the date before today
result.string = this.set_fulldate(result.object);
break;
default:
// create a moment based on supplied alt_date if its a string
if(typeof date === "string" && date.length > 1){
result.object = moment(date, "YYYY-MM-DD");
} else {
result.object = moment(); // get current moment if no date is supplied
}
result.string = this.set_fulldate(result.object);
}
return result;
};
// Calendar header shows the "active date"
// date_offset must be a string "yyyy-mm-dd"
MXcal.prototype.calendar_header = function(alt_date,dom){
var lang = $(dom).attr("lang");
//try quick solution for https://pariurix.com/livescore
//Deprecation warning: moment.lang is deprecated. Use moment.locale instead
if( (typeof(moment.lang) === "undefined") && ( typeof(moment.locale) === "function") )
{
moment.locale(that.setLang(lang));
}
else
{
moment.lang(that.setLang(lang));
}
var myMoment = this.process_startdate(alt_date).string;
var name_of_weekdays = this.name_of_weekdays;
var name_of_months = this.name_of_months_long;//moment.months();
var baseurl = document.location.pathname.split("/");
var link_forward = $(dom).next("."+prefix+"highres-icon").find("."+prefix+"calendar-forward");
var link_back = $(dom).prev("."+prefix+"highres-icon").find("."+prefix+"calendar-back");
var link_prefix = "showdate=";
//returns a string if found
//heystack = string
//needle = what to search for
//offset = modifier for the index to start search at
var getString = function(haystack,needle,offset){
if(haystack.indexOf(needle) != -1){
return haystack.substring(haystack.indexOf(needle), (haystack.indexOf(needle)+offset));
} else {
return false;
}
};
// string replacement
// Replaces oldS with newS in the string fullS
var replaceString = function(oldS, newS, fullS) {
for (var i = 0; i < fullS.length; i++) {
if (fullS.substring(i, i + oldS.length) == oldS) {
fullS = fullS.substring(0, i) + newS + fullS.substring(i + oldS.length, fullS.length);
}
}
return fullS;
};
var output_format = $(dom).data("format");
if(typeof output_format != "string" || output_format.length == 0){
output_format = "YYYY-M-D";
};
// show the current date
//$(dom).html(name_of_weekdays[myMoment.day()]+" "+myMoment.date()+" "+name_of_months[myMoment.month()]+" "+myMoment.year());
$(dom).html(myMoment);
};
MXcal.prototype.set_fulldate = function(moment){
var year = moment.year();
var month = moment.month() + 1;
var date = moment.date();
if(month.toString().length < 2){
month = ("0" + month).slice(-2);
}
if(date.toString().length < 2){
date = ("0" + date).slice(-2);
}
return year + "-" + month + "-" + date;
};
// Method returns an object with days and weekdays of the supplied start and enddates
// If there are no enddate, the script will return the month of the year in the stardate. IE 2014-01-09 will return the 31 days of januar 2014
// Dateformat is YYYY-MM-DD
MXcal.prototype.calendar_getData = function(unprocessed_startdate, enddate, todaydate){
var that = this;
// process keywords
var startdate = that.process_startdate(unprocessed_startdate).string;
if(this.DOM.data("type") == "days" && this.DOM.data("daysoneitherside") != "undefined"){
// if type is "days" center the current startdate between the number of days specified in data-daysoneitherside
var days_to_subtract = this.DOM.data("daysoneitherside");
var selected_day = startdate; // we copy the startdate before overwriting it with a new date
var days_start = that.set_fulldate(moment(startdate).subtract(days_to_subtract, "days"));
var days_end = that.set_fulldate(moment(startdate).add(days_to_subtract, "days"));
startdate = days_start;
var enddate = days_end;
} else {
// set start and enddate
// we need to adds days before and after the datespan. Our calendar should always start with a monday and always end with a sunday.
var startdate_array = startdate.split("-");
var year = startdate_array[0];
var month = startdate_array[1];
this.DOM.data("thismonth",month);
startdate_array[2] = "01"; // temporarily set startdate to first day of month so we can detect which day of week it is
startdate = startdate_array.join("-");
var startdate_day_of_week = moment(startdate).day();
if(startdate_day_of_week > 1){
var days_to_subtract = startdate_day_of_week-1;
}else if(startdate_day_of_week == 0){
var days_to_subtract = 6;
}
startdate = that.set_fulldate(moment(startdate).subtract(days_to_subtract, "days")); // this is the correct startdate, starting on a monday
// now set enddate
var number_of_days = this.calendar_daysInMonth(startdate); // get number of days for the current month
var enddate = year+"-"+month+"-"+number_of_days; // temporary enddate
var enddate_day_of_week = moment(enddate).day();
if(enddate_day_of_week > 0){
var days_to_add = 7-enddate_day_of_week;
}
enddate = that.set_fulldate(moment(enddate).add(days_to_add, "days")); // this is the correct enddate, ending on a sunday
}
// prepare variables
var result = new Array();
var startdate_string = that.set_fulldate(moment(startdate)).split("-").join("");
var enddate_string = that.set_fulldate(moment(enddate)).split("-").join("");
while(startdate_string <= enddate_string){
var myMoment = that.calendar_setMoment(startdate);
var fulldate = that.set_fulldate(myMoment);
var is_today = false;
if(startdate == todaydate)
{
is_today = true;
}
result.push({
"fulldate":startdate,
"daynum":myMoment.day(),
"dayname":that.name_of_weekdays[myMoment.day()],
"dayname_long":that.name_of_weekdays_long[myMoment.day()],
"month": myMoment.month(),
"monthname" : that.name_of_months[myMoment.month()],
"year" : myMoment.year(),
"date" : myMoment.date(),
"is_today" : is_today
});
// select the next day
startdate = that.set_fulldate(moment(startdate).add(1,"days"));
startdate_string = startdate.split("-").join("");
}
return result;
};
// Method returns the number of seconds since unix epoch
// Argument date must be YYYY-MM-DD
MXcal.prototype.calendar_sinceUnixEpoch = function(date){
var myMoment = this.calendar_setMoment(date);
return myMoment.unix();
};
// Method returns moment from the passed date
// Argument date must be YYYY-MM-DD
MXcal.prototype.calendar_setMoment = function(date) {
var thisdate = date.split("-");
var myMomentYear = parseInt(thisdate[0]);
var myMomentMonth = parseInt(thisdate[1]) - 1; // months need to be zero indexed and integers
var myMomentDate = parseInt(thisdate[2]); // dates need to be integers
return moment().set("year", myMomentYear).set("month", myMomentMonth).set("date", myMomentDate);
};
// Method returns the number of days for a given month/year
MXcal.prototype.calendar_daysInMonth = function(date){
var thisdate = date.split("-");
var year = parseInt(thisdate[0]);
var month = thisdate[1];
var date = parseInt(thisdate[2]); // dates need to be integers
var date = year +"-"+ month;
return moment(date, "YYYY-MM").daysInMonth();
};
MXcal.prototype.calendar_buildDayNames = function(template){
var day = 0;
var name_of_weekdays = this.name_of_weekdays;
var sunday = name_of_weekdays[0];
name_of_weekdays = name_of_weekdays.splice(1);
name_of_weekdays.push(sunday);
var html = "";
while(day <= 6){
html += template.replace("[weekday]", name_of_weekdays[day]);
day++;
}
return html;
};
// Method takes an object and builds the calendar html for each date by replacing placeholders in the template
MXcal.prototype.calendar_buildDays = function(object, showdate_obj, template, type, tournament, link_append, link_prepend){
var result = [];
var weekend = prefix+"calendar-weekend";
var today = prefix+"calendar-today";
var selected_day = prefix+"selected-day";
var not_this_month = prefix+"other-month-day";
var hide_when_small = prefix+"break-small";
var pretournum = 0;
var showdate = showdate_obj.string;
var showdate_array = showdate.split("-");
//check calendar date format in mx user settings
var calendar_date_format_short = "[date]/[month]";
if( typeof(mx.settings['calendar_date_format_short']) != "undefined" && mx.settings['calendar_date_format_short'] != "") {
calendar_date_format_short = mx.settings['calendar_date_format_short'];
}
//apply calendar date format from settings into the template
template = template.replace("[date]/[month]", calendar_date_format_short);
for(var key in object)
{
var temp = template;
var medium_count = 12;
var small_count = 7;
//quick backup in the case when the calendar is not loaded because of js errors on client site
if((typeof object[key] == "undefined") || (typeof object[key]['fulldate'] == "undefined"))
{
continue;
}
var fulldate_array = object[key]['fulldate'].split("-");
//begin replacements
temp = temp.replace("[monthname_u]", object[key]["monthname"].toUpperCase());
temp = temp.replace("[monthname]", object[key]["monthname"]);
temp = temp.replace("[month]", object[key]["month"]+1);
temp = temp.replace("[date]", object[key]["date"]);
temp = temp.replace("[weekday]", object[key]['dayname']);
temp = temp.replace("[weekday_long]", object[key]['dayname_long']);
temp = temp.replace(/\[link\]/g, link_prepend+object[key]['fulldate']+link_append);
// if the month is not the ACTUAL month we are showing all days of, set with a special class
if(showdate_array[1] != fulldate_array[1] && this.DOM.data("type") != "days"){
temp = temp.replace("[special]", not_this_month);
}
// check if the selected day is in the selectioin and add a class to highlight it
if(object[key]['year'] == showdate_array[0]
&& object[key]['month'] == (showdate_array[1]-1)
&& object[key]['date'] == showdate_array[2] )
{
if(this.DOM.data("type")=="days") {
//highlight today depending of the time zone today date
if(object[key]['is_today'])
{
temp = temp.replace("[special]", today + " " + selected_day);
}
else
{
temp = temp.replace("[special]", selected_day); //Todo: make it work so it does not salect the same date in each month
}
}
}
//highlight today depending of the time zone today date
if(object[key]['is_today'])
{
temp = temp.replace("[special]", today);
}
/** NOTE: this is the old solution using moment.js to define today date, but this does not work correctly for all time zones
// check if we hit the current date and add a class to highlight it
if(object[key]['year'] == moment().year() && object[key]['month'] == moment().month() && object[key]['date'] == moment().date()){
temp = temp.replace("[special]", today);
}
*/
//tournaments
switch(tournament){
case "wc2014" :
var wc14dates = this.settings.wc2014;
var nomatch = 0;
//check days for matchtype and add appropriate class. So days with group matches will stand out from days with quarterfinals etc.
for(var wcdates in wc14dates){
//first we loop into each type
for(var i=0; i < wc14dates[wcdates].length; i++){
// then we loop through the dates
if(object[key]['fulldate'] == wc14dates[wcdates][i]){
temp = temp.replace("[special]", prefix+"wc14-"+wcdates);
if(wcdates == "pretournament"){
pretournum = pretournum + 1;
}
} else {
nomatch = nomatch+1;
}
}
}
temp = temp.replace("[special]", prefix+"wc14-restday");
break;
default :
// check for saturdays and sundays (day 6 and 0) and add a class to highlight it
if(object[key]['daynum'] == 0 || object[key]['daynum'] == 6){
temp = temp.replace("[special]", weekend);
} else {
temp = temp.replace("[special]", "");
}
}
// type == autofit, each date will get its width set with inline css
// type == mediumwidth, the calendar dates will display in rows below eachother consisting of 11 dates each
switch(type){
case "autofit" :
var css_width = 100 / parseInt((object.length-pretournum));
temp = temp.replace("[style]", "width:"+css_width+"%;");
break;
case "mediumwidth" :
var css_width = 100 / medium_count +"%;";
var clear_both = "";
if(key != 0 && key % medium_count == 0){
clear_both = "clear:both;";
}
temp = temp.replace("[style]", "width:"+css_width+clear_both);
break;
case "smallwidth" :
var css_width = 100 / small_count +"%;";
var clear_both = "";
if(key != 0 && key % small_count == 0){
clear_both = "clear:both;";
}
temp = temp.replace("[style]", "width:"+css_width+clear_both);
break;
default :
temp = temp.replace(" [style]", "");
}
result.push(temp);
}
//console.log("ressult",result)
//add responsive classnames to first and last element of The "days" type calendar
if(result.length && (this.DOM.data("type") == "days"))
{
result[0] = $(result[0]).addClass("mx-break-small")[0].outerHTML;
result[6] = $(result[6]).addClass("mx-break-small")[0].outerHTML;
}
result = result.join(" ");
var popup_button = "";
if(this.DOM.data("type") == "days"){
var popup_button = this.get_template(".mx-show-calendar-popup");
}
return result+popup_button;
};
// Method counts the number of months in the supplied object and
// returns an object with a count of days in each month and its name
MXcal.prototype.calendar_getMonths = function(object) {
var current_month = object[0]["month"];
var current_year = object[0]["year"];
var count = 0;
var result = {};
var id = 0;
var month_names = this.name_of_months_long;//moment.months();
var save = function(count, current_month){
return {"count":count,"month_id": current_month, "month" : month_names[current_month], "year": current_year};
};
for(var key in object){
if(object[key]["month"] == current_month){
count++;
} else {
result[id] = save(count,current_month);
current_month = object[key]["month"];
current_year = object[key]["year"];
count = 1;
id++;
}
}
result[id] = save(count,current_month,current_year);
return result;
};
// Method constructs the month bars based on the passed object, temmplate and container
MXcal.prototype.calendar_buildMonth = function(object,template,container){
var result = "";
var month_count = 0;
var object_length = 0;
var sort_array = [];
for(var key in object){
sort_array[object_length] = object[key];
object_length++;
}
// sort by count
sort_array.sort(function (a, b) {
if (a.count < b.count) {
return 1;
}
if (a.count > b.count) {
return -1;
}
// a must be equal to b
return 0;
});
//var css_width = (sort_array[0]["count"] * 100)/month_count;
var temp = template.replace("[monthname]",sort_array[0]["month"]);
temp = temp.replace("[year]",sort_array[0]["year"]);
temp = temp.replace("[monthwidth]","");
result = container.replace("[HTML]",temp);
return result;
};
// Method grabs the templates used for calendar output
MXcal.prototype.get_template = function(template_class){
var temp = $(template_class,".mx-calendar-templates");
mx.update_snippet_links(temp);
if(typeof temp[0] != "undefined"){
return temp[0].outerHTML;
}
};
// Method displays the calendar for the year and month passed to it.
// If an argument is missing, we will default to current month/year
// The container will also be checked for a datespan to display
MXcal.prototype.calendar_init = function(year, month, container_class){
// traverse link groups to find possible date_link
if(typeof mx.settings.links != "undefined"
&& typeof mx.settings.links[this.settings.link_group] != "undefined"
&& typeof mx.settings.links[this.settings.link_group].date_link != "undefined")
{
var use_links = mx.settings.links[this.settings.link_group].date_link;
}
// choose the calendar type
var calendar_type = "";
if(this.DOM.data("type") == "days"){
var calendar_type = ".mx-days";
}
// if mx_user_setting has calendar_reload_page set, the calendar will work with pagelinks that reloads the entire page instead of just the widgets.
if(use_links){
var calendar_template = this.get_template(".mx-calendar-day-container.mx-as-link"+calendar_type);
} else {
var calendar_template = this.get_template(".mx-calendar-day-container"+calendar_type+":not(.mx-as-link)");
}
var calendar_daynames_template = this.get_template(".mx-calendar-day-container.mx-calendar-day-name");
var calendar_days_container = this.get_template(".mx-calendar-days");
var that = this;
// the template used for each day and month
var month_template = '
[monthname] [year]
';
var month_container = '
[HTML]
';
// add default container if none provided
if(!container_class){
container_class = prefix+"calendar";
}
var container = "."+container_class;
var calendar_header = "."+container_class+"-header";
// only build calendar if there is an appropriate container for it
$(this.settings.wrapper).find(container).each(function(){
if(!$(this).hasClass(prefix+"initiated")){
var startdate = $(this).data("startdate");
var enddate = $(this).data("enddate");
var showdate = $(this).data("showdate");
var todaydate = $(this).data("todaydate");
//var lang = $(this).attr("lang");
var type = $(this).data("type");
var show_month = $(this).data("showmonth");
var tournament = $(this).data("tournament");
var link_prepend = $(this).data("link_prepend") || "";
var link_append = $(this).data("link_append") || "";
//try quick solution for https://pariurix.com/livescore
//Deprecation warning: moment.lang is deprecated. Use moment.locale instead
if( (typeof(moment.lang) === "undefined") && ( typeof(moment.locale) === "function") )
{
moment.locale(that.setLang($(this).attr("lang")));
}
else
{
moment.lang(that.setLang($(this).attr("lang")));
}
that.name_of_weekdays = moment.weekdaysShort(); // The name of weekdays is translated into the language moment.js is set for
that.name_of_weekdays_long = moment.weekdays(); // The name of weekdays is translated into the language moment.js is set for
that.name_of_months = moment.monthsShort(); // translated months names
that.name_of_months_long = moment.months();
//Kurdish calendar translations
if( $(this).attr("lang") == "ku")
{
that.name_of_weekdays = ["یش", "دش", "سش", "چش", "پش", "هە", "شە"];
that.name_of_weekdays_long = ["یەکشەممە", "دووشەممە", "سێشەممە", "چوارشەممە", "پێجشەممە", "هەینی", "شەممە"];
that.name_of_months = ["ڕێ", "ڕەش", "خاک", "بان", "جۆزەردان", "پووش", "گەل", "خەر", "ڕەز", "گەڵا", "سەر", "بەفر"];
that.name_of_months_long = ["ڕێبەندان", "ڕەشەمێ", "خاکەلێوە", "بانەمەڕ", "جۆزەردان", "پووشپەڕ", "گەلاوێژ", "خەرمانان", "ڕەزبەر", "گەڵاڕێزان", "سەرماوەز", "بەفرانبار"];
}
var cal_data = that.calendar_getData(startdate, enddate, todaydate);
// create the html
var cal_html = "";
if(that.DOM.data("type")!="days"){
cal_html = that.calendar_buildDayNames(
calendar_daynames_template
)
}
cal_html += that.calendar_buildDays(
cal_data,
that.process_startdate(showdate),
calendar_template,
type,
tournament,
link_append,
link_prepend
);
var month_html = that.calendar_buildMonth(
that.calendar_getMonths(cal_data),
month_template,
month_container
);
// add the calendar html
if(show_month == "no"){
$(this).append(cal_html);
} else{
$(this).html(month_html);
$(this).append(calendar_days_container);
$(this).find(".mx-calendar-days").append(cal_html);
//$(this).append(cal_html);
}
mx.update_snippet_links($(cal_html));
$(this).addClass(prefix+"initiated");
}
});
$(this.settings.wrapper).find(calendar_header+"-text").each(function(){
if(!$(this).hasClass(prefix+"initiated")){
//calendar headers
var alt_date = $(this).parent().data("showdate");
that.calendar_header(alt_date,$(this).parent());
$(this).addClass(prefix+"initiated");
}
});
};
MXcal.prototype.setLang = function(lang) {
//some of our language codes differ from the ones used by Moment.js
//this switch will convert them for moment
switch(lang){
case "hy" :
lang = "hy-am";
break;
case "heb" :
lang = "he";
break;
case "no" :
lang = "nb";
break;
case "se" :
lang = "sv";
break;
case "gr" :
lang = "el";
break;
case "cz" :
lang = "cs";
break;
case "tc" :
lang = "zh-tw"; // traditional chinese
break;
case "sc" :
lang = "zh-cn"; // simple chinese
break;
case "in" :
lang = "id";
break;
case "ge" :
lang = "ka"; // georgian
break;
case "al" :
lang = "sq"; // Albanian
break;
case "mn" :
lang = "me"; // Montenegrin
break;
case "ee" :
lang = "et"; // Estonian
break;
case "en_us" :
lang = "en"; // US English
break;
case "ron" :
lang = "ro"; // Romanian
break;
}
return lang;
};
//Auto Initialize Class
$(function(){
//Check for MXcal
if($("BODY").hasClass(prefix+"site")){
mxcal = new MXcal();
mxcal.init();
}
});
// MX icon font fallback
// Checks for the icon font is actually loaded / loading
// Adds classes to the HTML element based on result.
// Original code by Filament Group https://github.com/filamentgroup/a-font-garde
// Adapted and encapsulated to run in MX
var mxicons = function(){};
mxicons.prototype.checkfonts = function( fontFamily, options ) {
var TEST_STRING = 'AxmTYklsjo190QW',
SANS_SERIF_FONTS = 'sans-serif',
SERIF_FONTS = 'serif',
win = window,
doc = win.document,
// lighter and bolder not supported
weightLookup = {
normal: '400',
bold: '700'
},
defaultOptions = {
tolerance: 2, // px
delay: 100,
glyphs: '',
success: function() {},
error: function() {},
timeout: 5000,
weight: '400', // normal
style: 'normal'
},
// See https://github.com/typekit/webfontloader/blob/master/src/core/fontruler.js#L41
style = [
'display:block',
'position:absolute',
'top:-999px',
'left:-999px',
'font-size:48px',
'width:auto',
'height:auto',
'line-height:normal',
'margin:0',
'padding:0',
'font-variant:normal',
'white-space:nowrap'
],
html = '
' + TEST_STRING + '
';
var FontFaceOnloadInstance = function() {
this.fontFamily = '';
this.appended = false;
this.serif = undefined;
this.sansSerif = undefined;
this.parent = undefined;
this.options = {};
};
FontFaceOnloadInstance.prototype.getMeasurements = function () {
return {
sansSerif: {
width: this.sansSerif.offsetWidth,
height: this.sansSerif.offsetHeight
},
serif: {
width: this.serif.offsetWidth,
height: this.serif.offsetHeight
}
};
};
FontFaceOnloadInstance.prototype.load = function () {
var startTime = new Date(),
that = this,
serif = that.serif,
sansSerif = that.sansSerif,
parent = that.parent,
appended = that.appended,
dimensions,
options = this.options,
ref = options.reference;
function getStyle( family ) {
return style
.concat( [ 'font-weight:' + options.weight, 'font-style:' + options.style ] )
.concat( "font-family:" + family )
.join( ";" );
}
var sansSerifHtml = html.replace( /\%s/, getStyle( SANS_SERIF_FONTS ) ),
serifHtml = html.replace( /\%s/, getStyle( SERIF_FONTS ) );
if( !parent ) {
parent = that.parent = doc.createElement( "div" );
}
parent.innerHTML = sansSerifHtml + serifHtml;
sansSerif = that.sansSerif = parent.firstChild;
serif = that.serif = sansSerif.nextSibling;
if( options.glyphs ) {
sansSerif.innerHTML += options.glyphs;
serif.innerHTML += options.glyphs;
}
function hasNewDimensions( dims, el, tolerance ) {
return Math.abs( dims.width - el.offsetWidth ) > tolerance ||
Math.abs( dims.height - el.offsetHeight ) > tolerance;
}
function isTimeout() {
return ( new Date() ).getTime() - startTime.getTime() > options.timeout;
}
(function checkDimensions() {
if( !ref ) {
ref = doc.body;
}
if( !appended && ref ) {
ref.appendChild( parent );
appended = that.appended = true;
dimensions = that.getMeasurements();
// Make sure we set the new font-family after we take our initial dimensions:
// handles the case where FontFaceOnload is called after the font has already
// loaded.
sansSerif.style.fontFamily = that.fontFamily + ', ' + SANS_SERIF_FONTS;
serif.style.fontFamily = that.fontFamily + ', ' + SERIF_FONTS;
}
if( appended && dimensions &&
( hasNewDimensions( dimensions.sansSerif, sansSerif, options.tolerance ) ||
hasNewDimensions( dimensions.serif, serif, options.tolerance ) ) ) {
options.success();
} else if( isTimeout() ) {
options.error();
} else {
if( !appended && "requestAnimationFrame" in window ) {
win.requestAnimationFrame( checkDimensions );
} else {
win.setTimeout( checkDimensions, options.delay );
}
}
})();
}; // end load()
FontFaceOnloadInstance.prototype.checkFontFaces = function( timeout ) {
var _t = this;
doc.fonts.forEach(function( font ) {
// replace double quotes with regex to help firefox
if( font.family.toLowerCase().replace(/['"]+/g, '') === _t.fontFamily.toLowerCase() &&
( weightLookup[ font.weight ] || font.weight ) === ''+_t.options.weight &&
font.style === _t.options.style ) {
font.load().then(function() {
_t.options.success();
win.clearTimeout( timeout );
});
}
});
};
FontFaceOnloadInstance.prototype.init = function( fontFamily, options ) {
var timeout;
for( var j in defaultOptions ) {
if( !options.hasOwnProperty( j ) ) {
options[ j ] = defaultOptions[ j ];
}
}
this.options = options;
this.fontFamily = fontFamily;
// For some reason this was failing on afontgarde + icon fonts.
if( !options.glyphs && "fonts" in doc ) {
if( options.timeout ) {
timeout = win.setTimeout(function() {
options.error();
}, options.timeout );
}
this.checkFontFaces( timeout );
} else {
this.load();
}
};
var FontFaceOnload = function( fontFamily, options ) {
var instance = new FontFaceOnloadInstance();
instance.init(fontFamily, options);
return instance;
};
FontFaceOnload(fontFamily, options);
};
mxicons.prototype.afontgarde = function(fontFamily, options){
var w = window,
doc = w.document,
me = this,
ref,
css = ['.FONT_NAME.supports-generatedcontent .icon-fallback-text .icon { display: inline-block; }',
'.FONT_NAME.supports-generatedcontent .icon-fallback-text .text { clip: rect(0 0 0 0); overflow: hidden; position: absolute; height: 1px; width: 1px; }',
'.FONT_NAME .icon-fallback-glyph .icon:before { font-size: 1em; font-size: inherit; line-height: 1; line-height: inherit; }'];
function addEvent( type, callback ) {
if( 'addEventListener' in w ) {
return w.addEventListener( type, callback, false );
} else if( 'attachEvent' in w ) {
return w.attachEvent( 'on' + type, callback );
}
}
// options can be a string of glyphs or an options object to pass into FontFaceOnload
(function( fontFamily, options ) {
var fontFamilyClassName = fontFamily.toLowerCase().replace( /\s/g, '' ),
executed = false;
function init() {
if( executed ) {
return;
}
executed = true;
if( typeof me.checkfonts === 'undefined' ) {
throw 'FontFaceOnload is a prerequisite.';
}
if( !ref ) {
ref = doc.getElementsByTagName( 'script' )[ 0 ];
}
var style = doc.createElement( 'style' ),
cssContent = css.join( '\n' ).replace( /FONT_NAME/gi, fontFamilyClassName );
style.setAttribute( 'type', 'text/css' );
if( style.styleSheet ) {
style.styleSheet.cssText = cssContent;
} else {
style.appendChild( doc.createTextNode( cssContent ) );
}
ref.parentNode.insertBefore( style, ref );
var opts = {
timeout: 100,
success: function() {
// If you’re using more than one icon font, change this classname (and in a-font-garde.css)
doc.documentElement.className += ' ' + fontFamilyClassName;
if( options && options.success ) {
options.success();
}
},
error: function(){
//console.log("error");
doc.documentElement.className += ' ' + fontFamilyClassName + "fail";
}
};
// These characters are a few of the glyphs from the font above */
if( typeof options === "string" ) {
opts.glyphs = options;
} else {
for( var j in options ) {
if( options.hasOwnProperty( j ) && j !== "success" ) {
opts[ j ] = options[ j ];
}
}
}
me.checkfonts( fontFamily, opts );
}
// MIT credit: filamentgroup/shoestring
addEvent( "DOMContentLoaded", init );
addEvent( "readystatechange", init );
addEvent( "load", init );
if( doc.readyState === "complete" ){
init();
}
})(fontFamily, options);
};
var MXicons = new mxicons();
MXicons.afontgarde("icons mx");
//
//Auto Initialize MX main Class
//
//Check for settings in (var mx_settings)
var settings = typeof(mx_settings)==="object" ? mx_settings : null;
if(typeof mx_user_settings === "object") {
$.extend(settings, mx_user_settings);
}
if(typeof settings.debug != "undefined") {
//console.log("Enetpulse settings:");
//console.log(settings);
}
window.mx = mx = new MX(settings);
mx.init();
// look for links on the page body that should be updated as per client settings in mx_user_settings
mx.update_body_links();
// Cookie policy notice control
})($enetpulse);
//functions for external use
function mx_force_load()
{
$("BODY").find(".mx-load-snippet").each(function() {
mx.snippet_force_reload($(this));
});
}
function mx_select_timezone(selectedTimeZoneOffset)
{
mx.timezoneChanged(selectedTimeZoneOffset);
}
function mx_select_event(event_fk)
{
mx.selectEvent(event_fk);
}
function mx_start_flex_containers()
{
//Check for settings in (var mxf_settings)
var settings = typeof(mxf_settings)==="object" ? mxf_settings : null;
if(typeof mx_user_breakpoints === "object") {
$.extend(settings, mx_user_breakpoints);
}
window.mxf = mxf = new MXF(settings);
mxf.startFlexContainers();
}
function mx_google_tracking_widgets(widgetCode)
{
if(widgetCode) {
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-962516-36', 'auto');
ga('send', {
'hitType': 'event',
'eventCategory': widgetCode,
'eventAction': 'widget_' + widgetCode + '_loaded',
'eventLabel': 'widgetTrackingEvent'
});
}
}