/*! jQuery v1.7.2 jquery.com | jquery.org/license */ (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
"+""+"
",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
t
",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f .clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); /*uprava kvuli detekci banneru v glibu*/ (function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);;function getElementsByClassName(className, tag, elm) { var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)"); tag = tag || "*"; elm = elm || document; var elements = (tag == "*" && elm.all) ? elm.all : elm.getElementsByTagName(tag); var returnElements = []; var current; var length = elements.length; for (var i = 0; i < length; i++) { current = elements[i]; if (testClass.test(current.className)) { returnElements.push(current); } } return returnElements; } function getRefecence(obj, funcName) { return function(param1, param2, param3) { obj[funcName](param1, param2, param3); }; } $(document).ready(function(){ if ("1" == "1") { if (typeof cjs.BannerScrollManager != 'undefined' && typeof cjs.BannerScroll != 'undefined') { var scrollingConfig = { bannerObject: new cjs.BannerScroll($(".scrolling-banner-wrap:eq(0)"), $), startElementsOnDownHitTopOfView: [$(".scrolling-banner-top-stop:eq(0)")], stopElementsOnUpHitTopOfView: [$(".scrolling-banner-top-stop:eq(0)")], minWindowHeight: "750", fullBannerHeightVisibleOrDisable: false, leftPositionHandleElement: $(".scrolling-banner-top-stop:eq(0)") }; scrollingConfig.stopElementsOnHitByBottom = [$("#stopbottom:eq(0)")]; var sbm = new cjs.BannerScrollManager($); if ($(".scrolling-banner-wrap:eq(0)").size()) { sbm.addBanner(scrollingConfig); sbm.manage(); } } } document.lsadvert_display(); }); base64_encode = function(data) { // http://kevin.vanzonneveld.net // + original by: Tyler Akins (http://rumkin.com) // + improved by: Bayron Guevara // + improved by: Thunder.m // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Pellentesque Malesuada // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: Rafał Kukawski (http://kukawski.pl) // * example 1: base64_encode('Kevin van Zonneveld'); // * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA==' // mozilla has this native // - but breaks in 2.0.0.12! //if (typeof this.window['btoa'] == 'function') { // return btoa(data); //} var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc = "", tmp_arr = []; if (!data) { return data; } do{ // pack three octets into four hexets o1 = data.charCodeAt(i++); o2 = data.charCodeAt(i++); o3 = data.charCodeAt(i++); bits = o1 << 16 | o2 << 8 | o3; h1 = bits >> 18 & 0x3f; h2 = bits >> 12 & 0x3f; h3 = bits >> 6 & 0x3f; h4 = bits & 0x3f; // use hexets to index into b64, and append result to encoded string tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); } while (i < data.length); enc = tmp_arr.join(''); var r = data.length % 3; return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3); }; /** Utimate Ajax Object * http://www.hunlock.com/blogs/The_Ultimate_Ajax_Object */ function ajaxObject(url, callbackFunction, actionTrigger) { var that = this; this.updating = false; this.aborting = false; this.ajax_async = true; this.container = null; this.abort = function() { if (that.updating) { that.updating = false; that.aborting = true; that.AJAX.abort(); that.AJAX = null; } }; this.async = function(val) { that.ajax_async = val ? true : false; }; this.update = function(passData, postMethod) { if (that.updating) { return false; } that.AJAX = null; if (window.XMLHttpRequest) { that.AJAX = new XMLHttpRequest(); } else { that.AJAX = new ActiveXObject("Microsoft.XMLHTTP"); } if (that.AJAX == null) { return false; } else { that.AJAX.onreadystatechange = function() { try { if (that.AJAX.readyState == 4) { that.updating = false; if (!that.aborting) { if (that.AJAX.status == 200 || that.AJAX.status == 304 || that.AJAX.status == 204 || that.AJAX.status == 1223 || that.AJAX.status == 0) { that.callback(that.AJAX.status, that.AJAX.getAllResponseHeaders(), that.AJAX.responseText, actionTrigger); } } that.AJAX = null; } } catch (e) { } }; if (typeof passData == 'undefined') { passData = ''; } that.updating = new Date(); if (/post/i.test(postMethod)) { var uri = urlCall; that.AJAX.open("POST", uri, that.ajax_async); if (typeof callbackFunction != 'undefined') { that.AJAX.setRequestHeader('User-Agent', 'core' + (ie6 ? '/ie6' : '')); } that.AJAX.setRequestHeader('Accept-Language', '*'); that.AJAX.setRequestHeader('Accept', '*/*'); that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); that.AJAX.setRequestHeader("Content-Length", passData.length); that.AJAX.send(passData); } else { var uri = urlCall + (passData == '' ? '' : ('?' + passData)); that.AJAX.open("GET", uri, that.ajax_async); if (typeof callbackFunction != 'undefined') { that.AJAX.setRequestHeader('User-Agent', 'core' + (ie6 ? '/ie6' : '')); } that.AJAX.setRequestHeader('Accept-Language', '*'); that.AJAX.setRequestHeader('Accept', '*/*'); that.AJAX.send(null); } if (!that.ajax_async && that.AJAX != null) { if (that.AJAX.status == 200 || that.AJAX.status == 304 || that.AJAX.status == 204 || that.AJAX.status == 1223 || that.AJAX.status == 0) { that.callback(that.AJAX.status, that.AJAX.getAllResponseHeaders(), that.AJAX.responseText, actionTrigger); that.AJAX = null; } } return true; } }; var urlCall = url; this.callback = callbackFunction || function() { }; }; /** Set a cookie * @param string c_name cookie neme * @param string value cookie value * @param integer expiredays cookie expires after given days * @param string [origin = 'self'] document origin, can be ('self'|'parent') * @param string [path = null] set document path, default (if null) set current page */ function cookie_set(c_name, value, expiredays, origin, path, domain) { if (typeof iframe_external != 'undefined' && iframe_external) { var url = "http://www.sportstats.com/x/cookie/write"; // msie cache/gzip bug if (ie) { var pom = page_utime + ''; url += '~' + pom.substr(6, 4); } var ae_cookie = new ajaxObject(url); ae_cookie.async(false); ae_cookie.update('write=1&' + c_name + '=' + value, 'POST'); } else { if (typeof origin != 'undefined' && origin == 'parent' && parent) { var mydoc = parent.document; } else { var mydoc = document; } var exdate = new Date(); if (value === '') { expiredays = -365; } exdate.setDate(exdate.getDate() + expiredays); var cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()); if (typeof path != 'undefined' && path != null) { cookie += ';path=' + path; } if (typeof domain != 'undefined' && domain != null) { cookie += ';domain=' + domain; } mydoc.cookie = cookie; } }; /** Get a cookie * @param string c_name cookie name * @param string [origin = self] document origin, can be (self|parent) * @return string cookie value or null if cookie has not been found */ function cookie_get(c_name, origin) { if (typeof iframe_external != 'undefined' && iframe_external) { if (c_name == 'fs_tza') { return null; } var url = "http://www.sportstats.com/x/cookie/read"; // msie cache/gzip bug if (ie) { var pom = page_utime + ''; url += '~' + pom.substr(6, 4); } var ae_cookie = new ajaxObject(url, cookie_get_remote_response, c_name); ae_cookie.async(false); ae_cookie.update('read=1&' + c_name + '=1', 'POST'); if (ae_cookie.container == '-' || ae_cookie.container == '') { return null; } else { return ae_cookie.container; } } else { if (typeof origin != 'undefined' && origin == 'parent' && parent) { var mydoc = parent.document; } else { var mydoc = document; } if (mydoc.cookie.length > 0) { c_start = mydoc.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = mydoc.cookie.indexOf(";", c_start); if (c_end == -1) { c_end = mydoc.cookie.length; } return unescape(mydoc.cookie.substring(c_start, c_end)); } } return null; } }; /** Get remote cookie response */ function cookie_get_remote_response(r_status, r_headers, r_content, r_trigger) { if (r_content.length > 0) { this.container = r_content; } else { this.container = ''; } }; /** Get an attribute of an element * @param element an element to set an atribute for * @param name the attribute name */ function get_attr(element, name) { var attr = ''; if (element) { if (ie) { switch (name) { default: break; case 'class': attr = element.className; break; case 'id': attr = element.id; break; case 'rowspan': attr = element.rowSpan; break; case 'colspan': attr = element.colSpan; break; } } else { attr = element.getAttribute(name); } } if (!attr) { attr = ''; } return attr.toString(); }; /** Set an attribute of an element * @param element an element to set an atribute for * @param name the attribute name * @param content content of the attribute */ function set_attr(element, name, content) { if (ie) { switch (name) { default: break; case 'class': element.className = content; break; case 'rowspan': element.rowSpan = content; break; case 'colspan': element.colSpan = content; break; case 'id': element.id = content; break; case 'title': element.title = content; break; case 'type': element.type = content; break; case 'name': element.name = content; break; } } else { element.setAttribute(name, content); } }; /** Remove attribute on element * @param object element an object element e.g. TD, TR, ... * @param string attr attribute to be removed */ function rem_attr(element, attr) { if (ie) { set_attr(element, attr, ''); } else { element.removeAttribute(attr); } }; function text_append(text, append, unique, last) { var unique = (typeof unique == 'undefined' || unique == true) ? true : false; var last = (typeof last == 'undefined' || last == true) ? true : false; var tmp_text = text.toLowerCase(); var tmp_append = append.toLowerCase(); if (!tmp_text.match(tmp_append) && tmp_append.indexOf(' ') == 0) { tmp_append = tmp_append.substr(1); } if (text.length == 0) { return append; } else if (!unique || (unique && tmp_text.match(tmp_append) == null)) { if (last) { return text + append; } else { return append + text; } } return text; }; /** String prototype: Append text (case insensitive) * @param string append an append part * @param bool [unique = true] append only if append part is not allready included in text * @param bool [last = true] if true append last, false append before * @return string string after to be appended */ String.prototype.append = function(append, unique, last) { var unique = (typeof unique == 'undefined' || unique == true) ? true : false; var last = (typeof last == 'undefined' || last == true) ? true : false; var tmp_text = this.toLowerCase(); var tmp_append = append.toLowerCase(); if (!tmp_text.match(tmp_append) && tmp_append.indexOf(' ') == 0) { tmp_append = tmp_append.substr(1); } if (this.length == 0) { return append; } else if (!unique || (unique && tmp_text.match(tmp_append) == null)) { if (last) { return this + append; } else { return append + this; } } }; /* Remove text (case insensitive) * @param string text a text to be removed from * @param string remove a part to be removed * @return string text after to be removed */ function text_remove(text, remove) { var tmp_text = text.toLowerCase(); var tmp_remove = remove.toLowerCase(); // try to remove leading gap if (tmp_text.match(tmp_remove) == null && tmp_remove.indexOf(' ') == 0) { tmp_remove = tmp_remove.substr(1); } if (tmp_text.match(tmp_remove)) { var index_start = tmp_text.indexOf(tmp_remove); var index_stop = tmp_remove.length; tmp_remove = text.substr(index_start, index_stop); if (tmp_remove.length > 0) { text = text.replace(tmp_remove, ''); } } return text; }; /** fill begining zero if number is less then 10 * @param integer num number to be corrected */ function fill_zero(num) { if (num < 10) { return '0' + num; } else { return num; } }; /** Test if element is in array checked by its key * @param array sa source array * @param var key key to be checked * @return bool true if element is in array, false otherwise */ function test_array_key(sa, key) { if (typeof sa == 'undefined' || typeof sa[key] == 'undefined') { return false; } return true; }; /** Test if value exist in array * @param array sa source array * @param string val value to be checked * @return bool true if value is in array, false otherwise */ function test_array_val(sa, val) { for (var i in sa) { if (sa[i] == val) { return true; } } return false; }; /** Try to find value and return its key * @param array sa source array * @param string val value to be checked * @return var key if value is found, false otherwise */ function get_array_key(sa, val) { for (var i in sa) { if (sa[i] == val) { return i.to_number(); } } return false; }; /** Try to find value and return its string key * @param array sa source array * @param string val value to be checked * @return var key if value is found, false otherwise */ function get_array_string_key(sa, val) { for (var i in sa) { if (sa[i] == val) { return i; } } return false; }; /** Remove an element from array by its key * @param array sa source array * @param var key remove array key * @return array affected array */ function remove_array_key(sa, key) { var tmp_sa = new Array(); for (var i in sa) { if (i != key) { tmp_sa[i] = sa[i]; } } return tmp_sa; }; /** Window prototype: Open help window * @url string url url of window */ window.open_help = function(url) { var id = Math.floor(Math.random() * 1000); return this.open(url, id, 'hotkeys=no, resizable=no, toolbar=no, status=no, dependent=yes, scrollbars=1, width=520, height=500'); }; /** Number prototype: Convert string to number * @return number */ Number.prototype.to_number = function() { return this; }; /** String prototype: Convert string to number * @return number */ String.prototype.to_number = function() { var pom = this - 0; if (isNaN(pom)) { return this; } else { return pom; } }; /** Convert utime to dbdate * @param integer utime unix timestamp * @return string date in db format (YYYY-MM-DD) */ function utime2dbdate(utime) { var tmp = new Date(); tmp.setTime(utime * 1000); return tmp.getFullYear() + '-' + fill_zero((tmp.getMonth() + 1)) + '-' + fill_zero(tmp.getDate()); }; /** Convert utime to GMT dbdate * @param integer utime unix timestamp * @return string GMT date in db format (YYYY-MM-DD) */ function utime2gmt_dbdate(utime) { var tmp = new Date(); tmp.setTime(utime * 1000); return tmp.getUTCFullYear() + '-' + fill_zero((tmp.getUTCMonth() + 1)) + '-' + fill_zero(tmp.getUTCDate()); }; /** Convert dbdate to utime * @param string date in db format (YYYY-MM-DD) * @return integer utime */ function dbdate2utime(dbdate) { var tmp = new Date(); dbdate = dbdate.split('-'); if (dbdate.length == 3) { tmp.setFullYear(dbdate[0]); tmp.setMonth((dbdate[1] - 1)); tmp.setDate(dbdate[2]); tmp.setHours(0); tmp.setMinutes(0); tmp.setSeconds(0); tmp.setMilliseconds(0); return tmp.getTime() / 1000; } return 0; }; /** Convert utime to human time * @param integer utime unix timestamp * @param integer offset gmt offset * @param bool [time_only = true] display only time * @param bool [full_date = false] display full date DD.MM.YYYY * @param bool [no_year = false] do not display year if full date is set * * @return string formated date/time */ function utime2time(utime, offset, time_only, full_date, no_year) { var service_time = new Date(); // for service use time_only = (typeof time_only == 'undefined' || time_only) ? true : false; full_date = (typeof full_date == 'undefined' || !full_date) ? false : true; no_year = (typeof no_year == 'undefined' || !no_year) ? false : true; var time = ''; utime = utime.to_number(); offset = offset.to_number(); service_time.setTime((utime + (service_time.getTimezoneOffset() * 60) - offset) * 1000); if (!time_only) { time += fill_zero(service_time.getDate()) + '.' + fill_zero(service_time.getMonth().to_number() + 1) + '.' + (no_year ? '' : (full_date ? service_time.getFullYear() : '')) + ' '; } time += fill_zero(service_time.getHours()) + ':' + fill_zero(service_time.getMinutes()); return time; }; /** Odds format * @param float odds number * * @return return formated odds number */ function odds_format(odds) { if (odds < 10) { return odds.toPrecision(3); } else if (odds < 100) { return odds.toPrecision(4); } else { return odds.toPrecision(5); } }; /** Replace parenthesis for Hebrew version * * @param string str string to be converted * * @return string converted string */ function fix_entities(str) { return str.replace(/\(/g, "‏("); }; /** Detect client browser * @param string browser schortcat (ie|ff) * @return bool true|false true if browser match the shortcut */ function browser_detect(type) { if (type == 'ie' && navigator.userAgent.match(/MSIE/)) { return true; } else if (type == 'ie6' && navigator.userAgent.match(/MSIE 6/)) { return true; } else if (type == 'ie7' && navigator.userAgent.match(/MSIE 7/)) { return true; } else if (type == 'ff' && navigator.userAgent.match(/Gecko/)) { return true; } return false; }; /** Detect sync method */ function sync_method_detect() { if (sync_method == 'push') { var is_supported_brows = false; var supported_brows = ['MSIE 6', 'MSIE 7', 'MSIE 8', 'Gecko', 'Webkit', 'Opera/10', 'Opera Mobi']; for (var i in supported_brows) { if (navigator.userAgent.match(supported_brows[i])) { is_supported_brows = true; break; } } if (!is_supported_brows) { sync_method = 'ajax'; } } } var ie = browser_detect('ie'); var ie6 = browser_detect('ie6'); var ie7 = browser_detect('ie7'); var ff = browser_detect('ff'); var bench_result_start = null; var bench_result_stop = null; function bench_start() { var tmp_date = new Date(); bench_result_start = tmp_date.getTime(); }; function bench_stop() { var tmp_date = new Date(); bench_result_stop = tmp_date.getTime(); flog('Time: ' + (bench_result_stop - bench_result_start) + ' [ms]'); }; function replace_query_string(url, param, value) { var re = new RegExp("([?|&])" + param + "=.*?(&|$)", "i"); if (url.match(re)) { return url.replace(re, '$1' + param + "=" + value + '$2'); } else if (url.indexOf("?") == -1) { return url + '?' + param + "=" + value; } else { return url + '&' + param + "=" + value; } }; function close_lang_box() { var elm = document.getElementById('lang-box'); if (elm) { elm.style.display = 'none'; setTimeout('cookie_set( \'lang_box\', 0, 7, \'self\', \'/\' )', 100); } } function close_caption_box() { var elm = document.getElementById('caption-box'); if (elm) { elm.style.display = 'none'; // cookie_set( 'caption_box', 0, 6, 'self', '/' ); setTimeout('cookie_set( \'caption_box\', 0, 6, \'self\', \'/\' )', 100); } } /** Display/Hide element (calendar) */ function display_hide(id) { var element = document.getElementById(id); if (element) { $(element).remove(); } else { $("#ifmenu-calendar span").append(date_calendar()); } }; /** Create Push key */ function push_key(key) { return '' + key; } function getDataAjax(url, targetID, defaultID) { if ($('#' + defaultID).get(0)) { $.each($('#' + defaultID).children(), function(ind, el) { el = $(el); if (el.css('display') == 'block') { el.fadeOut('slow'); } }); if ($('#' + targetID).get(0)) { $('#' + targetID).fadeIn('slow'); } else { $.get(url).success(function(data) { $('
', { id: targetID, html: data.replace(':||:', '') }).appendTo('#' + defaultID); }).error(function(data) { flog('Getting data failed! Try action one more time, please!'); }); } } else { flog('Default target not exist!'); } return false; };function Calendar(y, m) { this.cDate = new Date(); this.uDay = 0; this.uMonth = 0; this.uYear = 0; this.url = ''; this.preUrl = null; this.footerName = null; this.footerUrl = null; this.minDate = new Date(1900, 1, 1); this.ajaxLoad = false; this.blockName = ''; this._construct = function(y, m) { if (y && m) { this.cDate.setFullYear(y, m); } }; this.setAjaxLoad = function(ajaxLoad) { this.ajaxLoad = ajaxLoad; }; this.setDateInfoData = function(data) { this.dayInfo = data; }; this.setDateHrefData = function(data) { this.dayHref = data; }; this.createCalendar = function(noAjax) { if (!noAjax && this.ajaxLoad) { var loc = (window.location + '').replace(window.location.hash, '').split('?')[0]; $.get(loc + '?blockcontent=' + this.blockName + '&m=' + (this.cDate.getMonth() + 1) + '&y=' + this.cDate.getFullYear(), function(response) { var data = jQuery.parseJSON(response); calendar.setDateInfoData(data['title']); calendar.setDateHrefData(data['href']); calendar.createCalendar(true); }); return; } var y = this.cDate.getFullYear(); var m = this.cDate.getMonth(); days = new Array('Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'); var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); //html = '
 

' + months[m] + ' ' + y + ' 

'; // var yPrev = y; // var yNext = y; // if(m - 1 < 0){ // yPrev--; // } // if(m + 1 > 11){ // yNext++; // } html = ''; html += ''; html = html + '
'; for (i = 0; i < 7; i++) { html = html + '' + days[i] + ''; } var cDate = new Date(); var cDay = cDate.getDate(); var cMonth = cDate.getMonth(); var cYear = cDate.getFullYear(); var day = 0; cDate.setFullYear(y, m, 1); var days = this._getDaysPerMonth(y, m); firstDay = cDate.getDay(); if (firstDay != 0) { cells = firstDay - 1 + days; } else { cells = 6 + days; } if (cells > 35) { cells = 42; } else { cells = 35; } if (firstDay == 0) { firstDay = 7; } // days from last month if (firstDay > 1) { var lastDays = this._getDaysPerMonth(y, m - 1); } startClass = 'odd'; html = html + ''; if (!this.uDay || !this.uMonth || !this.uYear) { this.uDay = cDay; this.uMonth = cMonth; this.uYear = cYear; } var isPast = true; var isToday = true; var isFirstCell = true; for (i = 0; i < cells; i++) { var url = this.url; if (isPast && this.preUrl) { url = this.preUrl; } html = html + ''; isFirstCell = false; if ((i + 1) % 7 == 0 && i != (cells - 1)) { if (startClass == 'odd') { startClass = 'even'; } else { startClass = 'odd'; } isFirstCell = true; html = html + ''; } } html = html + '
= 0) { if (day < days) { day = i - firstDay + 2; isToday = false; var todayClass = ''; if (day == cDay && cMonth == m && cYear == y) { isPast = false; isToday = true; todayClass += ' today'; if (day != this.uDay || m != this.uMonth || y != this.uYear) { todayClass += ' notset'; } } var dayUrl = y + '' + this._formatNumber(m + 1) + '' + this._formatNumber(day); if (this.dayInfo[dayUrl]) { html += ' title="' + this.dayInfo[dayUrl] + '"'; } if ((i - firstDay + 2) == cDay && cMonth == m && cYear == y && (this.uDay == 0 || this.uDay == cDay && this.uMonth == cMonth && this.uYear == cYear)) { html = html + ' class="c-day' + (isFirstCell ? ' first' : '') + todayClass + '">'; } else { if ((i - firstDay + 2) == cDay && cMonth == m && cYear == y && this.uDay > 0 && this.uDay != cDay) { html = html + ' class="u-day' + (isFirstCell ? ' first' : '') + todayClass + '">'; } else if (day == this.uDay && m == this.uMonth && y == this.uYear) { html = html + ' class="c-day' + (isFirstCell ? ' first' : '') + todayClass + '">'; } else { html = html + ' class="c-month' + (isFirstCell ? ' first' : '') + todayClass + '">'; } } var href = (this.dayHref[dayUrl]) ? this.dayHref[dayUrl] : (url + dayUrl + '/'); if (!this.eventsOnly || this.dayInfo[dayUrl]) { html += ''; } else { html += ''; } if (this.dayInfo[dayUrl]) { html += ''; } html += day; if (this.dayInfo[dayUrl]) { html += ''; } if (!this.eventsOnly || this.dayInfo[dayUrl]) { html += ''; } else { html += ''; } } else { html = html + ' class="o-month">'; ++day; var tmpM = m == 11 ? 1 : m + 2; var tmpY = m == 11 ? y + 1 : y; var tmpDay = day - days; var href = (this.dayHref[dayUrl]) ? this.dayHref[dayUrl] : (url + tmpY + this._formatNumber(tmpM) + this._formatNumber(tmpDay)); if (!this.eventsOnly || this.dayInfo[dayUrl]) { html += ''; } else { html += ''; } html += tmpDay; if (!this.eventsOnly || this.dayInfo[dayUrl]) { html += ''; } else { html += ''; } } } else { var tmpM = m == 0 ? 12 : m; var tmpY = m == 0 ? y - 1 : y; var tmpDay = (lastDays + (i - firstDay + 2)); html = html + ' class="o-month' + (isFirstCell ? ' first' : '') + '">'; if (!this.eventsOnly || this.dayInfo[dayUrl]) { html += ''; } else { html += ''; } html += tmpDay; if (!this.eventsOnly || this.dayInfo[dayUrl]) { html += ''; } else { html += ''; } } html = html + '
'; if (this.footerUrl && this.footerName) { html = html + ''; } this._setContent(html); ls.setTitles(document.getElementById('my-calendar')); }; this.formatYear = function(year) { var year = year - 1900; if (year > 100) { year -= 100; } if (year < 10) { year = '0' + year; } return year; }; this.formatMonth = function(month) { if (month > 11) { month -= 12; } if (month < 0) { month += 12; } month += 1; // janyary = 1 if (month < 10) { month = '0' + month; } return month; }; this._getDaysPerMonth = function(cYear, m) { daysArray = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); if (m == -1) { m = 11; } days = daysArray[m]; if (m == 1) { if ((cYear % 4) == 0) { if (((cYear % 100) == 0) && (cYear % 400) != 0) { days = 28; } else { days = 29; } } } return days; }; this._formatNumber = function(n) { if (n.toString().length == 1) { n = '0' + n; } return n; }; this.cNext = function() { var m = this.cDate.getMonth(); if (m == 11) { y = this.cDate.getFullYear() + 1; this.cDate.setFullYear(y, 0, 1); } else { this.cDate.setFullYear(this.cDate.getFullYear(), m + 1, 1); } this.createCalendar(); return false; }; this.cPrev = function() { var m = this.cDate.getMonth(); if (m == 0) { y = this.cDate.getFullYear() - 1; this.cDate.setFullYear(y, 11, 1); } else { this.cDate.setFullYear(this.cDate.getFullYear(), m - 1, 1); } if (this.minDate.getTime() > this.cDate.getTime()) { this.cDate.setFullYear(this.minDate.getFullYear(), this.minDate.getMonth(), this.cDate.getDay()); } this.createCalendar(); return false; }; this.setUserDate = function(d, m, y) { this.uDay = d; this.uMonth = m - 1; this.uYear = y; this.cDate.setFullYear(y, m - 1, d); }; this.setMinDate = function(d, m, y) { this.minDate.setFullYear(y, m - 1, d); }; this.setUrl = function(url) { this.url = url; }; this.setPreUrl = function(url) { this.preUrl = url; }; this.setFooter = function(name, url) { this.footerUrl = url; this.footerName = name; }; this._setContent = function(html) { document.getElementById('my-calendar').innerHTML = html; }; this.dayInfo = new Array(); this.dayHref = new Array(); this.setDateInfo = function(date, text, href) { this.dayInfo[date] = text; this.dayHref[date] = href; }; this.setEventsOnly = function(eventsOnly) { this.eventsOnly = eventsOnly; }; this._construct(y, m); }; ;function LsEventTable(_params) { this._uid = _params._uid; this.all = false; this._currentPage = ''; this._ajaxUrl = ''; this._ajaxParams = {}; this.loader = null; this.tournamentIds = _params.tournamentIds || []; this.reset = false; this.teamPosition = -1; this.loadingInProcess = false; this.page = 0; this._filterValues = []; this.urlParams = { 'extra':{}, //dataWrapper extra params 'd':{}, //viewWrapper extra params 'v':{} }; this.contentContainer = null; this.paginationContainer = null; this.contentChilds = {}; this.paginationChilds = {}; this.targetName = null; this.append = false; this.setPage = function(page, forceReset) { this.page = page; if (this.getPagination()) { this.getPagination().find('a').removeClass('selected'); this.getPagination().find('a.p-' + page).addClass('selected'); } this.refresh(false, this._uid + '_' + page, false, forceReset || false); }; this.getContainer = function() { if (this.contentContainer == null) { this.contentContainer = $('#LS_' + this._uid + 'Content'); this.contentContainer.css({'min-height':'50px'}); } return this.contentContainer; }; this.getPagination = function() { if (this.paginationContainer == null) { this.paginationContainer = $('.LS_' + this._uid + 'Paging'); if (!this.paginationContainer.get(0)) { this.paginationContainer = false; } } return this.paginationContainer; }; this.setDataParam = function(name, value) { if (name != undefined && value != undefined) { this.urlParams.d[name] = value; } }; this.removeDataParam = function(name) { if (name != undefined) { delete this.urlParams.d[name]; } }; this.setViewParam = function(name, value) { if (name != undefined && value != undefined) { this.urlParams.v[name] = value; } }; this.removeViewParam = function(name) { if (name != undefined) { delete this.urlParams.v[name]; } }; this.setExtraParam = function(name, value) { if (name != undefined && value != undefined) { this.urlParams.extra[name] = value; } }; this.removeExtraParam = function(name) { if (name != undefined) { delete this.urlParams.extra[name]; } }; this.getUrlParams = function(noTemporaryParams) { var temporaryParams = [8061]; var urlParams = this.clone(this.urlParams); var url = ''; for (var key in urlParams) { if (Object.keys(urlParams[key]).length > 0) { if (key == 'extra') { for (var paramName in urlParams[key]) { url += paramName + '/' + base64_encode(JSON.stringify(urlParams[key][paramName])) + '/'; } } else { if (noTemporaryParams) { for ( var i in temporaryParams) { var remKey = temporaryParams[i]; if (urlParams[key][remKey]) { delete urlParams[key][remKey]; } } } url += key + '/' + base64_encode(JSON.stringify(urlParams[key])) + '/'; } } } return url; }; this.checkReset = function() { this.reset = false; var newTeamPosition = -1; var newTournamentIds = []; for (var i in this.urlParams.d) { if (i == '55eb') { if (!$.isArray(this.urlParams.d[i])) { newTournamentIds.push(this.urlParams.d[i]); } else { newTournamentIds = this.urlParams.d[i]; } } if (i == '56db') { newTeamPosition = this.urlParams.d[i]; } } // Position if ((this.teamPosition == -1 && JSON.stringify(this.teamPosition) != JSON.stringify(newTeamPosition)) || JSON.stringify(this.teamPosition) != JSON.stringify(newTeamPosition)) { this.reset = true; } this.teamPosition = newTeamPosition; // Team if ((this.tournamentIds.length == 0 && !this.checkArrays(this.tournamentIds, newTournamentIds)) || !this.checkArrays(this.tournamentIds, newTournamentIds)) { this.reset = true; } this.tournamentIds = newTournamentIds; if (this.reset) { this.removeViewParam('dc79'); this.page = 0; } }; this.checkArrays = function(arrA, arrB) { if (arrA.length !== arrB.length) { return false; } var cA = arrA.slice().sort().join(""); var cB = arrB.slice().sort().join(""); return cA === cB; }; this.refresh = function(noCache, targetName, all, forceReset) { this.setExtraParam('tzc', ls.timezoneOffset); this.all = all || false; noCache = (typeof noCache == 'undefined' ? false : noCache); if (targetName == undefined && !this.append) { flog('Missing target name in makeAjaxRequest!'); return null; } this.setViewParam('db3e', this._uid); this.setViewParam('2d17', this.page); for (var filterName in this._filterValues) { this.setDataParam(filterName, this._filterValues[filterName]); } if (noCache) { this.setDataParam('da2a', true); } this.checkReset(); this.reset = forceReset || this.reset; if (this.append) { targetName = 'append'; } else { if (Object.keys(this.contentChilds).length > 0) { for (var childName in this.contentChilds) { if (this.all) { this.contentChilds[childName].css({'visibility':'hidden'}); } else { this.contentChilds[childName].hide(); } } } if (Object.keys(this.paginationChilds).length > 0) { for (var pchildName in this.paginationChilds) { this.paginationChilds[pchildName].hide(); } } targetName = this.hashCode(targetName + '|::|' + this._ajaxUrl + '|::|' + this.getUrlParams(true)); if (this.paginationChilds[targetName]) { this.paginationChilds[targetName].show(); } else if (Object.keys(this.paginationChilds).length == 1) { this.paginationChilds[Object.keys(this.paginationChilds)[0]].show(); } if (this.contentChilds[targetName]) { this.contentChilds[targetName].show(); this.hideLoader(); return null; } } $.get(this._ajaxUrl + this.getUrlParams(), function(AjaxResult) { this.targetName = targetName; if (this.append) { this._onSetPageAppend(AjaxResult, targetName); } else { this._onSetPage(AjaxResult, targetName); } }.bind(this)); this.loadingInProcess = true; if (!this.loader) { this.loader = $('
'); this.loader.insertBefore(this.getContainer()); } this.showLoader(); var paging = $('.LS_' + this._uid + 'Paging'); paging.children('.selected').removeClass('selected'); paging.children('.p-' + this.page).addClass('selected'); return null; }; this._fixValues = function(object) { if (typeof object != 'undesined') { if (typeof object == 'string' && object == (object * 1)) { object *= 1; } if (typeof object == 'object') { if (object instanceof Array) { $.each(object, function(key, val) { object[key] = this._fixValues(val); }.bind(this)); } if (object instanceof Object) { for (var key in object) { object[key] = this._fixValues(object[key]); } } } } return object; }; this.hashCode = function(str) { var hash = 0; if (str.length == 0) { return hash; } for (i = 0; i < str.length; i++) { char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; } return hash; }; this.showLoader = function() { if (!this.loadingInProcess) { return; } this.loader.show(); this.loader.height(this.getContainer().height()); this.loader.width(this.getContainer().width()); this.loader.css({ 'opacity': 0 }); this.loader.animate({ opacity: 1 }, 300); }; this.hideLoader = function() { if (this.loader) { this.loader.css({ 'opacity': 1 }).animate({ opacity: 0 }, 300).hide(); } this.loadingInProcess = false; }; this._onSetPage = function(data, requestId) { var response = new LsAjaxResponse(data); this.contentChilds[requestId] = $(document.createElement('div')); this.contentChilds[requestId].html('
'); if (response.getContent('table')) { var content = $(response.getContent('table')); ls.formatOdds(content); this.contentChilds[requestId].html(content); } this.getContainer().append(this.contentChilds[requestId]); if (this.targetName == requestId) { if(this.all) { for (var key in this.contentChilds) { if (key != requestId) { this.contentChilds[key].remove(); } } } this.contentChilds[requestId].show(); this.hideLoader(); } else { this.contentChilds[requestId].hide(); } if (this.getPagination()) { if (this.reset) { this.paginationChilds = {}; } if (response.getContent('paging') && this.reset) { this.paginationChilds[requestId] = $(document.createElement('div')); this.paginationChilds[requestId].html(response.getContent('paging')); } if (this.reset) { this.getPagination().html(this.paginationChilds[requestId]); } else { if (this.targetName == requestId) { if (this.paginationChilds[requestId]) { this.paginationChilds[requestId].show(); } else if (Object.keys(this.paginationChilds).length == 1) { this.paginationChilds[Object.keys(this.paginationChilds)[0]].show(); } } else { this.paginationChilds[requestId].hide(); } } } var responseParams; if (responseParams = response.getContent('params')) { this.updateDataAfterRequest(responseParams); } // reset tooltips ls.changeTimeZoneTime(this.getContainer()); ls.setTitles(this.getContainer()); }; this.updateDataAfterRequest = function(params) { if (params != undefined) { var key; if (params.data != undefined) { for (key in params.data) { this.setDataParam(key, params.data[key]); } } if (params.view != undefined) { var temporaryParams = ['c385', 8061, '8061']; for (key in params.view) { if (temporaryParams.indexOf(key) != -1 && !this.append) { continue; } this.setViewParam(key, params.view[key]); } } } }; this._onSetPageAppend = function(data, requestId) { if (this.reset) { this.getContainer().html(''); this._onSetPage(data, requestId); return; } var response = new LsAjaxResponse(data); var htmlContent; if (htmlContent = response.getContent('table')) { // no error while fetching data this.hideLoader(); if ($('#more_' + this._uid + '_' + this.page).get(0)) { $('#more_' + this._uid + '_' + this.page).remove(); } var content = $(htmlContent); ls.formatOdds(content); this.getContainer().append(content); this.getContainer().animate({ opacity: 1 }, 150); } else { // error while fetching data this.hideLoader(); this.getContainer().html('
'); this.getContainer().show(); } var responseParams; if (responseParams = response.getContent('params')) { this.updateDataAfterRequest(responseParams); } htmlContent = response.getContent('paging'); $('.LS_' + this._uid + 'Paging').html(htmlContent); // reset tooltips ls.changeTimeZoneTime(this.getContainer()); ls.setTitles(this.getContainer()); }; this.setUrl = function(url, params) { this._ajaxUrl = url; if (params) { this._ajaxParams = this._fixValues(params); } }; this.init = function(data) { if (data.appending != undefined) { this.append = data.appending; } this.updateDataAfterRequest(data); if (this._uid) { this.setViewParam('db3e', this._uid); this.setViewParam('2d17', this.page); $.each(this.getContainer().children(), function(k, el) { el = $(el); var id = this.hashCode(el.attr('id') + '|::|' + this._ajaxUrl + '|::|' + this.getUrlParams()); this.contentChilds[id] = el; }.bind(this)); ls.formatOdds('#LS_' + this._uid + 'Content'); } if (this.urlParams.d != undefined && this.urlParams.d['56db'] != undefined) { this.teamPosition = this.urlParams.d['56db']; } }; this.setFilterValue = function(name, value) { this._filterValues[name] = value; this.page = 0; this.refresh(false, this._uid + '_' + name + '_' + value.toString()); }; this.clone = function(obj) { var key, newInstance; if ((obj == null) || typeof obj !== 'object') { return obj; } newInstance = new obj.constructor(); for (key in obj) { newInstance[key] = this.clone(obj[key]); } return newInstance; }; };;function LsAjaxResponse(response){ this._response = response; this._error = null; this.getData = function(){ return this._data; }; this.getContent = function(subContent){ if(this._error){ return false; }else{ if(subContent){ return this._data['content'][subContent]; }else{ return this._data['content']; } } }; this.decode = function(){ var begStr = this._response.substring(0, 3); var endStr = this._response.substring(this._response.length-3, this._response.length); if(begStr != 'LSB' || endStr != 'LSE'){ this._error = true; ls.displayFatalError(); return; } this._error = false; this._data = $.parseJSON(this._response.substring(3, this._response.length-3)); }; this.decode(); };;function LsHandler() { this._tableArray = new Object(); this.baseUrl = '/'; this.sportMenu = {}; this.tz = null; this.oddsFormat = null; this.waitingEls = []; this.fav = new FavoriteHandler(); this.block = new BlockHandler(); this.pageCallbacks = []; this.timeZoneCorrection = 0; this.timeToday = 0; this.timeTomorrow = 0; this.timeYesterday = 0; this.timeToday = 0; this.browserTimeOffsetBegin = 0; this.timezoneOffset = 0; this.serverOffset = 0; this.serverTime = 0; this.tzId = 0; this._construct = function() { // customize calendar this.calendar = new Calendar; this.calendar._setContent = function(html) { $('#my-calendar').html(html); }; $(document).ready(function() { ls.onDomReady() }); // -- hash change this.onHashChange(function() { ls.checkHash(); }); this.checkHash = function() { var hash = window.location.hash.replace('#', ''); if (hash != '') { var hashPart = hash.split("/"); var hashTemp = ''; for (var i = 0; i < hashPart.length; i++) { if (hashTemp != '') { hashTemp += '/'; } hashTemp += hashPart[i]; ls.openTabByHash(hashTemp); } } }; this.openTabByHash = function(hash) { if (!this.TabContainerArr) { return; } var container = null; for (var i = 0; i < this.TabContainerArr.length; i++) { container = this.TabContainerArr[i]; if (container._pathArr[hash]) { var el = $('#tabSwitch_' + container._uid).find('.tabId_' + container._pathArr[hash] + ' a'); if (el.get(0)) { el.click(); } else { container.select(container._pathArr[hash]); } } } }; }; this.onDomReady = function() { $('#searchBox').focus(ls.onSearchFocusIn); $('#searchBox').blur(ls.onSearchFocusOut); this.block.onDomReady(); // -- menu filter input $('#menuFilterInput').focus(ls.onMenufilterFocusIn); $('#menuFilterInput').blur(ls.onMenufilterFocusOut); $('#menuFilterInput').keyup(ls.onMenufilterKeyUp); $('#menuHeader').mouseenter(ls.onMenuFilterMouseOver); $('#menuHeader').mouseleave(ls.onMenuFilterMouseOut); this.tt = new tooltip('tt_div'); this.setTitles(); //this.formatOdds(); }; this.onPageReady = function() { $.each(this.pageCallbacks, function(i, func) { if ($.isFunction(func)) { this.pageCallbacks[i](); } }.bind(this)); }; this.addPageReadyCallback = function(fun) { if ($.isFunction(fun)) { this.pageCallbacks.push(fun); } }; this.setTitles = function(element) { if (!element) { element = document.body; } var els = $(element).find('[title]'); els.mouseover(function(e) { var title = $(e.target).attr('title'); if (title) { // formating title = title.replace(/\[b\]/i, ''); title = title.replace(/\[\/b\]/i, ''); title = title.replace(/\[br\]/ig, '
'); title = title.replace(/\[u\]/i, ' » '); title = title.replace(/\[d\]/i, ' » '); title = title.replace(/\n/g, "
"); title = title.replace(/\\'/g, '\''); // odds formating var oddsTitles = title.match(/\[o\]([0-9\.]+)\[\/o\]/ig); if (oddsTitles && oddsTitles.length) { $.each(oddsTitles, function(index, oldOdds) { var newOdds = oldOdds.replace(/\[o\]/ig, '').replace(/\[\/o\]/ig, '') * 1; newOdds = ls.formatOdd(newOdds, true); title = title.replace(oldOdds, newOdds); }); } $(e.target).attr('title', title); } if (this.className != 'name_fixed_1' && this.className != 'name_fixed_2') { ls.tt.show(this, this, false); } }); els.mouseout(function() { ls.tt.hide(this); }); // -- render livescore try { if (typeof liveScore != 'undefined') { liveScore.render($(element)); } } catch (e) { } // -- render match highlight if (this.eventId) { $(element).find('[xteid=' + this.eventId + ']').parent('tr').addClass('highlight'); } // -- render match highlight if (this.teams) { for (var i = 0; i < this.teams.length; i++) { $(element).find('[xpid=' + this.teams[i] + ']').addClass('highlight'); } } }; this.registerTable = function(table) { this._tableArray[table._uid] = table; return table; }; this.getTable = function(tableUid) { if (this._tableArray[tableUid]) { return this._tableArray[tableUid]; } else { return false; } }; this.gt = function(tableUid) { return this.getTable(tableUid); }; this.init = function(sportId, sportLink) { this._sportId = sportId; this._sportLink = sportLink; }; // handle errors //------------------------------- this.checkResponse = function(data) { var error = false; if (data == 'error') { error = true; } if (!error) { // no error while loading return true; } this.displayFatalError(); return false; }; this.displayFatalError = function() { $.confirm({ 'title': 'Error on the site', 'message': '

Ooops, there has been an Error


Please try to refresh the site. If the problem persists please contact us.', 'buttons': { 'Close': { 'class': 'blue' } } }); }; // menu filter functions //------------------------------- this.onMenuFilterMouseOver = function() { ls.menuFilterMouseIsOver = true; $(this).children('.menuHeaderSearch').show(); $(this).children('.menuHeaderText').hide(); }; this.onMenuFilterMouseOut = function() { ls.menuFilterMouseIsOver = false; if ($('#menuFilterInput').hasClass('inactive')) { $('#menuHeader').children('.menuHeaderSearch').hide(); $('#menuHeader').children('.menuHeaderText').show(); } }; this.onMenufilterFocusIn = function() { if ($('#menuFilterInput').hasClass('inactive')) { $('#menuFilterInput').val(''); $('#menuFilterInput').removeClass('inactive'); } }; this.onMenufilterFocusOut = function() { if ($('#menuFilterInput').val() == "") { $('#menuFilterInput').addClass('inactive'); $('#menuFilterInput').val('Type here to filter'); if (!ls.menuFilterMouseIsOver) { ls.onMenuFilterMouseOut(); } } }; this.onMenufilterKeyUp = function(e) { if (e.keyCode == 27) { $('#menuFilterInput').val(''); ls.onMenufilterFocusOut(); $('#menuFilterInput').blur(); ls.cancelFilter(); return; } ls.menuFilterReg = new RegExp("" + $(this).val() + "", "i"); $('#sportMenuContainer').children('li').each(function(index) { if ($(this).text().match(ls.menuFilterReg)) { $(this).removeClass('forceFilterHidden'); } else { $(this).addClass('forceFilterHidden'); } $(this).find('li').each(function(index) { if ($(this).text().match(ls.menuFilterReg)) { $(this).removeClass('forceFilterHidden'); } else { $(this).addClass('forceFilterHidden'); } }); }); if ($('#menuFilterInput').val() == "") { ls.cancelFilter(); } else { $('#sportMenuContainer').children('li').addClass('forceFilterExpanded'); $('#menuFilterInfo').show(); } }; this.cancelFilter = function() { $('#sportMenuContainer').children('li').removeClass('forceFilterExpanded'); $('#sportMenuContainer').find('li').removeClass('forceFilterHidden'); $('#menuFilterInfo').hide(); }; this.initUserData = function() { if (document.userData != undefined) { // time setting if (document.userData.time != undefined) { this.initTimeZone(document.userData.time.offset, document.userData.time.offsetDefault, document.userData.time.time, document.userData.time.tzId); this.addPageReadyCallback(ls.changeTimeZoneTime); var text = phpJsDate('d M H:i', ls.timezoneTime(document.userData.time.time)); $('#fakeTime').html(text); } // sport menu if (document.userData.sports != undefined && document.userData.sports.length) { $.each(document.userData.sports, function(i, sportId) { this.sportMenu[sportId] = new SsSportMenu(sportId); this.sportMenu[sportId].init(document.userData.menu); }.bind(this)); } // render favorites if (document.userData.favorites != undefined && document.userData.favorites.length > 0) { this.fav.render(document.userData.favorites); } // favorites menu status if (document.userData.favorites_status != undefined) { if (document.userData.favorites_status) { this.fav.openMenu(false); } else { this.fav.closeMenu(false); } } // odds format setting this.oddsFormat = document.userData.oddsFormat != undefined ? document.userData.oddsFormat : 1; if (oddsFormatTypes && oddsFormatTypes[this.oddsFormat]) { $('#user-header-oddsformat-expander span').text(oddsFormatTypes[this.oddsFormat]); } // formating odds $.each(this.waitingEls, function(i, el) { this.formatOdds(el); }.bind(this)); } }; this.changeOddsFormat = function(format) { // date for ajax request var date = new Date(); var url = '/ajax-set-cookie/OddsFormatID/' + format + '/?' + date.getTime(); $.get(url, {}, function() { window.location.reload(); }, ''); }; this.formatOdds = function(target) { target = target || '#content'; var targetEl; if ($.type(target) === 'string') { targetEl = $(target); } else if ($.type(target) === 'function' || $.type(target) === 'object') { targetEl = target; } if (targetEl && targetEl.get(0)) { if (this.oddsFormat === null) { this.waitingEls.push(targetEl); } else { $.each(targetEl.find('.odds'), function(index, el) { var odd = $(el).attr('xodds'); if (odd) { $(el).html($(el).html().replace(odd, this.formatOdd(odd, true))); } }.bind(this)); } } }; // togle main menu //------------------------------- this.togleMenu = function() { var date = new Date(); if ($('#mainMenuContent').is(':hidden')) { $('#mainMenuContent').show(); $('#menuHeader').removeClass('collapsed'); $.get('/ajax-set-cookie/MyBlock/LeftMenu/open/?' + date.getTime()); } else { $('#mainMenuContent').hide(); $('#menuHeader').addClass('collapsed'); var date = new Date(); $.get('/ajax-set-cookie/MyBlock/LeftMenu/close/?' + date.getTime()); } }; // togle stages menu //------------------------------- this.togleStageMenu = function() { var date = new Date(); if ($('#tournamentStages').find('ul').is(':hidden')) { $('#tournamentStages').find('ul').show(); $('#tournamentStages').removeClass('collapsed'); $.get('/ajax-set-cookie/MyBlock/StageMenu/open/?' + date.getTime()); } else { $('#tournamentStages').find('ul').hide(); $('#tournamentStages').addClass('collapsed'); $.get('/ajax-set-cookie/MyBlock/StageMenu/close/?' + date.getTime()); } }; // search functions //------------------------------- this.onSearchFocusIn = function() { $('#search').addClass('focused'); $('#dummySearchHeight').show(); }; this.onSearchFocusOut = function() { $('#search').removeClass('focused'); $('#dummySearchHeight').hide(); }; this.submitForm = function(point) { location.href = point.action + $('#searchBox').val(); }; // hash functions //------------------------------- this.changeHashUrl = function(hash) { document.location.href = '#' + hash; }; this.applyHashUrl = function() { }; this.initTimeZone = function(offset, serverOffset , serverTime , tzId){ this.timezoneOffset = offset; this.serverOffset = serverOffset; this.timeZoneCorrection = offset; this.serverTime = serverTime; this.tzId = tzId; if(!this.browserTimeOffsetBegin) { var d = new Date(); this.browserTimeOffsetBegin = d.getTime(); } }; this.timezoneTime = function(time){ return time * 1 + 3600 * this.timeZoneCorrection; }; this.revertTimezoneTime = function(time){ return time * 1 - 3600 * this.timeZoneCorrection; }; this.getTimeFromElement = function( el ){ var re = new RegExp("t([0-9]{10})-([0-9]{1})-([0-9]{1})-([0-9]{1})-([0-9]{1})"); var m = re.exec($(el).get(0).className); if(m == null) { return null; } return 1 * m[1]; }; /** * vygeneruje text pro casovy udaj * timeFormat * 1 ... today/tomorrow * 2 ... today/tomorrow + datum * 3 ... today/tomorrow nebo zkraceny nazev dne + datum * 4 ... today/tomorrow nebo plny nazev dne + datum * 5 ... today/tomorrow nebo den mesic * 6 ... today/tomorrow nebo mesic/den cas * */ this.getFormatedTimeText = function(tim, timeFormat, timeSeparator, showYear) { if(!this.timeToday) { this.timeTomorrow = phpJsDate('d M Y', this.timezoneTime(this.serverTime) + 86400); this.timeYesterday = phpJsDate('d M Y', this.timezoneTime(this.serverTime) - 86400); this.timeToday = phpJsDate('d M Y', this.timezoneTime(this.serverTime)); } tim = this.timezoneTime(tim); var isToday = (phpJsDate('d M Y', tim) == this.timeToday); var isYesterday = (!isToday && phpJsDate('d M Y', tim) == this.timeYesterday); var isTomorrow = (!isYesterday && !isYesterday && phpJsDate('d M Y', tim) == this.timeTomorrow); var formated = ''; if(timeFormat == 2 || timeFormat == 3 || timeFormat == 4 || timeFormat == 0 || timeFormat == 10){ if(isToday) { formated += 'Today' + ', ' + phpJsDate('d M ', tim); } else if(isYesterday) { formated += 'Yesterday' + ', ' + phpJsDate('d M ', tim); } else if(isTomorrow) { formated += 'Tomorrow' + ', ' + phpJsDate('d M ', tim); } else if(timeFormat == 3 || timeFormat == 10) { formated += this.daysText[phpJsDate('N', tim)] + ', ' + phpJsDate('d M ', tim); } else if(timeFormat == 4) { formated += this.daysText[phpJsDate('N', tim)] + ', ' + phpJsDate('d M ', tim); } else { formated += phpJsDate('d M Y', tim); } } if(timeFormat == 0 ){ formated = formated.replace(/ /ig,' '); return formated; } if(timeFormat == 7) { formated += phpJsDate('d M ', tim); } if(timeFormat == 5){ if(isToday) { formated += 'Today'; } else if(isYesterday) { formated += 'Yest.'; } else if(isTomorrow) { formated += 'Tomorr.'; } else { formated += phpJsDate('d M', tim); } formated = formated.replace(/ /ig,' '); if(timeSeparator){ formated += '
'; } formated += phpJsDate('H:i', tim); } if(timeFormat == 6 || timeFormat == 8 || timeFormat == 9 ){ if(isToday) { formated += 'Today'; } else if(isYesterday) { formated += 'Yest.'; } else if(isTomorrow) { formated += 'Tomorr.'; }else{ formated += phpJsDate('d/m', tim); } formated = formated.replace(' ',' '); if (timeFormat == 9){ formated += ', '; }else if(timeSeparator && timeFormat != 8){ formated += '
'; }else { formated += ', '; } formated += phpJsDate('H:i', tim); } if(timeFormat == 15){ formated = ''; if(isToday) { formated += 'Today'; } else if(isYesterday) { formated += 'Yesterday'; } else if(isTomorrow) { formated += 'Tomorrow'; }else{ formated += phpJsDate('D', tim); } formated += ', '; formated += phpJsDate('d M Y, H:i', tim); formated = formated.replace(' ',' '); } if(showYear && timeFormat != 1){ formated += phpJsDate(' Y', tim); } if(timeSeparator && (timeFormat == 1 || timeFormat == 4 || timeFormat == 7 || timeFormat == 10)){ if(formated != ''){ formated += ', '; } formated += phpJsDate('H:i', tim); } if(timeFormat == 11) { formated = phpJsDate('d/m ', tim); } if(timeFormat == 12) { formated = phpJsDate('D, d M Y', tim); } if(timeFormat == 13) { formated = phpJsDate('d/m/y', tim); } if(timeFormat == 14) { formated = phpJsDate('D d.m.Y', tim); } return formated; }; // timezone functions //------------------------------- this.daysText = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; this.setTimeZonedetected = function(timeZoneId, defaultOffset) { if (this.tz.detectType == 2) { // user settings in GMT+X format are available, we have to narrow them down to full timezone // ------------------------------- if (defaultOffset == this.tz.currentOffset) { // silently narrow the timezone setting this.setTimeZone(timeZoneId, defaultOffset, false); } else { this.setTimeZoneEstimate(this.tz.currentOffset); } } else { // forced timezone detection, user is new to the site // ------------------------------- try { if (undefined == page) { page = undefined; } } catch (e) { page = undefined; } if (defaultOffset == this.tz.currentOffset) { // silently narrow the timezone setting this.setTimeZone(timeZoneId, defaultOffset, false); } else if (page && page.timeZoneChange) { // change timezone without refresh this.setTimeZone(timeZoneId, defaultOffset, true); } else { // not able to set timezone without refresh, display message // set full timezone as estimate var h1 = document.getElementsByTagName('H1')[0]; var infoMsg = $createElement('div', h1.parentNode, 'message-info'); infoMsg.parentNode.insertBefore(infoMsg, h1.nextSibling); var offset = defaultOffset; if (offset > 0) { offset = '+' + offset; } infoMsg.innerHTML = '
  • We have noticed that you may be located in a different time zone. You may want to change the time zone here to GMT ' + offset + ' or click the time zone selector at the top right corner.
'; this.setTimeZoneEstimate(this.tz.currentOffset); } } }; this.changeTimeZoneTime = function(parent){ var els; if(!parent) { els = $('.datet'); } else { els = $(parent).find('.datet'); } var re = new RegExp("t([0-9]{10})-([0-9]{1,2})-([0-9]{1})-([0-9]{1})-([0-9]{1})"); var tit = new RegExp("tit([0-9]{10})-([0-9]{1,2})-([0-9]{1})-([0-9]{1})-([0-9]{1})"); var tim, timeFormat, m, el, timeSeparator, showYear, formated; for(var i=0 ; i 0) { // klik na select return; } if ($(event.target).parents('.timezone-container').length > 0 || $(event.target).hasClass('timezone-container')) { // klik na container return; } ls.hideTimeZone(); }; this.hideTimeZone = function() { if (!this.timeZoneParent) { return; } this.timeZoneParent.style.display = 'none'; this.timeDisplayed = false; if (this.ieHack) { this.ieHack.style.height = '0px'; } }; this.createTimeZone = function() { if (this.timeZoneCreated) { this.createTimeZoneTable(); return false; } this.timeZoneParent = $createElement('div', document.getElementById('content'), 'timezone-container'); var iframe = ''; try { if (isIe && isIe == true) { iframe = ''; } } catch (e) { iframe = ''; } this.timeZoneParent.innerHTML = iframe + 'Hide list

Please select your timezone

'; if (iframe) { this.ieHack = this.timeZoneParent.getElementsByTagName('IFRAME')[0]; this.ieHack.style.height = this.timeZoneParent.offsetHeight + 'px'; } this.timeZoneContent = this.timeZoneParent.getElementsByTagName('div')[0]; this.timeZoneContent.innerHTML = ''; this.timeZoneCreated = true; $.get('/ajax-timezone/load/' + this.tz.timeStamp + '/', {}, function(jsondata) { ls.createTimeZoneOnLoad(jsondata) }, ''); $('body').click(this.hideTimeZoneOnBodyClick); return true; }; this.createTimeZoneOnLoad = function(jsondata) { jsondata = $.parseJSON(jsondata); var tzArray = jsondata['tz']; this.tzData = tzArray; this.createTimeZoneTable(); }; this.createTimeZoneTable = function() { this.timeZoneContent.className = ''; var inner = new Array; inner[0] = new Array; inner[1] = new Array; inner[2] = new Array; var i = 0; var cnt = 0; var col = 0; tzArray = this.tzData; idArray = new Array(); // sort for (var tzId in tzArray) { if (idArray.length == 0) { idArray[0] = tzId; } else { var inserted = false; for (var i = 0; i < idArray.length; i++) { if (tzArray[tzId]['offsetNow'] < tzArray[idArray[i]]['offsetNow']) { var length = idArray.length; for (var j = length - 1; j >= i; j--) { idArray[j + 1] = idArray[j]; } idArray[i] = tzId; inserted = true; break; } } if (!inserted) { idArray[idArray.length] = tzId; } } cnt++; } var i = 0; for (var j = 0; j < idArray.length; j++) { tzId = idArray[j]; var tz = tzArray[tzId]; var offsetText = ''; if (tz['offsetNow'] >= 0) { offsetText = '+ ' + tz['offsetNow']; } else { offsetText = '- ' + (tz['offsetNow'] * -1); } if (i > cnt / 3) { col++; i = 0; } if (typeof(page) != "undefined" && page && page.timeZoneChange) { var onClick = 'onclick="return ls.selectTimeZone(' + tzId + ')"'; } else { var onClick = ''; } inner[col][inner[col].length] = 'GMT ' + offsetText + '' + tz['name'] + ''; i++; } var text = ''; for (var i = 0; i < inner[0].length; i++) { for (var j = 0; j < 3; j++) { if (inner[j][i]) { text += inner[j][i]; } } } this.timeZoneContent.innerHTML = text; if (this.ieHack) { this.ieHack.style.height = this.timeZoneParent.offsetHeight + 'px'; } }; this.selectTimeZone = function(tzId) { if (page && page.timeZoneChange) { this.tzId = tzId; var tz = this.tzData[tzId]; var offset = tz['offsetNow']; this.setTimeZone(tzId, offset, true); this.hideTimeZone(); return false; } else { this.timeZoneContent.innerHTML = ''; this.timeZoneContent.className = 'loading'; if (this.ieHack) { this.ieHack.style.height = this.timeZoneParent.offsetHeight + 'px'; } // redirect by href return true; } }; this.timeZoneOnSet = function(res) { }; // homepage togle //------------------------------- this.hpTogleMoreBox = function(sportId) { $('#activeLeagues' + sportId + '').show(); $('#activeLeagues' + sportId + '_href').hide(); }; this.onHashChange = function(event) { //get hash function var getHashValue = function() { var arr = window.location.hash.split("#"); var hasValue = arr[1]; //sets default if (typeof hasValue == "undefined") { return false; } var hashLen = hasValue.indexOf("?"); if (hashLen > 0) { hasValue = hasValue.substring(0, hashLen); } return hasValue; }; //last hash var lastHash = getHashValue(); //checker (function watchHash() { var hash = getHashValue(); if (hash !== lastHash) { event(); lastHash = hash; } var t = setTimeout(watchHash, 100); })(); }; // odds this.formatOdd = function(num, returnOne, returnOneString) { if (!num) { return ''; } num = num * 1; if (num > 0.999 && num < 1.001) { if (returnOne) { return returnOneString ? returnOneString : '1.00'; } else { return ''; } } if (this.oddsFormat == 1) { return this.formatTwodigits(num); } else if (this.oddsFormat == 2) { return this.formatUk(num); } else if (this.oddsFormat == 3) { return this.formatUs(num); } else if (this.oddsFormat == 4) { return this.formatHk(num); } else if (this.oddsFormat == 5) { return this.formatMa(num); } else if (this.oddsFormat == 6) { return this.formatIn(num); } }; this.getOddDelta = function(odd, lastOdd) { if (this.oddsFormat >= 4 && this.oddsFormat <= 6) { odd = this.formatOdd(odd, true); lastOdd = this.formatOdd(lastOdd, true); } else if (this.oddsFormat == 3) { odd = this.formatOdd(odd, true); lastOdd = this.formatOdd(lastOdd, true); } return odd - lastOdd; }; this.formatOddDelta = function(delta, wrapHtml) { var ret = null; if (this.oddsFormat >= 4 && this.oddsFormat <= 6) { ret = this.formatTwodigits(delta); // pro US neprevadime do formatu } else if (this.oddsFormat == 3) { ret = this.formatNonedigit(delta); } else { ret = this.formatOdd(delta, true); } if (wrapHtml) { if (delta < 0) { ret = '' + ret + ''; } else if (delta > 0) { ret = '+' + ret + ''; } } return ret; }; this.formatUs = function(decimal) { if (decimal >= 2) { return '+' + Math.floor((decimal - 1) * 100); } else if (decimal != 1) { return -Math.round(100 / (decimal - 1)); } else { return 'N/A'; } }; this.formatUk = function(decimal) { var numerator = Math.round(decimal * 100); var denominator = 100; var gcd = this.GCD(numerator, denominator); if (gcd < -1) { gcd *= -1; } if (gcd > 1) { numerator /= gcd; denominator /= gcd; } if (numerator > denominator) { return ((Math.round(numerator) - Math.round(denominator)) + '/' + Math.round(denominator)); } else { return (Math.round(numerator) + '/' + Math.round(denominator)); } }; this.formatHk = function(decimal) { return this.formatTwodigits(decimal - 1); }; this.formatMa = function(decimal) { if (decimal <= 2) { decimal -= 1; } else { decimal = (1 / (decimal - 1)) * -1; } return this.formatTwodigits(decimal); }; this.formatIn = function(decimal) { if (decimal <= 2) { decimal = (1 / (decimal - 1)) * -1; } else { decimal -= 1; } return this.formatTwodigits(decimal); }; this.GCD = function(numerator, denominator) { var x = numerator; var y = denominator; var w; while (y != 0) { w = x % y; x = y; y = w; } return x; }; this.calculatePayout = function(values, count) { if (values.length == 0) { return false; } var sum = 0; var cnt = 0; for (var i = 0; i < values.length; i++) { sum += 1 / values[i]; cnt++; } if (count) { // add missing odds for (i = 0; i < count - values.length; i++) { sum += 1; cnt++; } } return 1 / sum; }; this.formatPayout = function(payout) { if (payout === false) { return '-'; } else { return this.formatOnedigit(payout * 100) + '%'; } }; this.formatTwodigits = function(num) { var dnum = Math.round(num * 100) / 100; var twoDPString = dnum + ""; if (twoDPString.indexOf(".") == -1) { twoDPString += ".00" } if (twoDPString.indexOf(".") == twoDPString.length - 2) { twoDPString += "0" } return twoDPString; }; this.formatOnedigit = function(num) { var dnum = Math.round(num * 10) / 10; var twoDPString = dnum + ""; if (twoDPString.indexOf(".") == -1) { twoDPString += ".0" } return twoDPString; }; this.formatNonedigit = function(num) { return Math.round(num); }; this._construct(); }; function $createElement(tagName, parent, className) { var el = document.createElement(tagName); if (parent) { parent.appendChild(el); } if (className) { el.className = className; } return el; }; $(function() { // scroll to top $('#scroll-to-top').click(function() { $('html,body').animate({scrollTop: 0}, 'slow'); } ); $(window).on('scroll touchmove resize', function() { if ($(window).scrollTop() < 100 || $(window).width() < 1120) { $('#scroll-to-top').hide(); } else { $('#scroll-to-top').show(); } } ); });;function SsSportMenu(sportId) { this.sportId = sportId; this.init = function(expandArray) { for (var i = 0; i < expandArray.length; i++) { if (expandArray[i].indexOf(this.sportId + '-') == 0) { this.expandNode(expandArray[i].replace(this.sportId + '-', ''), true); } if (expandArray[i].replace(this.sportId + '-', '') == 's-0') { this.expandSportNode(true); } } }; this.expandNode = function(nodeKey, skipCookieSet) { var node = $('#s_' + this.sportId + ' .' + nodeKey); node.children('ul').show(); node.addClass('expanded'); if (!skipCookieSet) { this.setCokie(nodeKey); } }; this.expandSportNode = function(skipCookieSet) { var sportNode = $('#mainMenuContent' + this.sportId); if (sportNode.get(0)) { sportNode.removeClass('hidden').show(); if (!skipCookieSet) { this.setCokie('s-0'); } } }; this.collapseNode = function(nodeKey, skipCookieSet) { var node = $('#s_' + this.sportId + ' .' + nodeKey); node.find('ul').hide(); node.removeClass('expanded'); if (!skipCookieSet) { this.setCokie(nodeKey); } }; this.collapseSportNode = function(skipCookieSet) { var sportNode = $('#mainMenuContent' + this.sportId); if (sportNode.get(0)) { sportNode.addClass('hidden').hide(); if (!skipCookieSet) { this.setCokie('s-0'); } } }; this.togleSportNode = function() { var sportNode = $('#mainMenuContent' + this.sportId); if (sportNode.get(0)) { if (sportNode.hasClass('hidden')) { this.expandSportNode(); } else { this.collapseSportNode(); } } return false; }; this.togleNode = function(nodeKey, skipCookieSet) { if (!skipCookieSet) { skipCookieSet = 0; } var node = $('#s_' + this.sportId + ' .' + nodeKey); var parent = $(node.closest("li")[0]); if (parent.hasClass('forceFilterExpanded')) { return true; } if (node.hasClass('expanded')) { this.collapseNode(nodeKey, skipCookieSet); } else { this.expandNode(nodeKey, skipCookieSet); } return false; }; this.setCokie = function(menuId) { var key = this.sportId + '-' + menuId; var date = new Date(); $.get('/ajax-set-cookie/MyMenu/' + key + '/?' + date.getTime()); }; };;// Generated by CoffeeScript 1.10.0 /** Better implementation of the typeof function See http://javascript.crockford.com/remedial.html @param {mixed} Mixed element to determine the typeof @return {string} Type of the element */ (function() { var base, base1, base2, dir, log, type; type = function(obj) { var classToType, i, len, myClass, name, ref; if (obj === void 0 || obj === null) { return String(obj); } classToType = new Object; ref = "Boolean Number String Function Array Date RegExp".split(" "); for (i = 0, len = ref.length; i < len; i++) { name = ref[i]; classToType["[object " + name + "]"] = name.toLowerCase(); } myClass = Object.prototype.toString.call(obj); if (myClass in classToType) { return classToType[myClass]; } return "object"; }; log = function(msg, ident) { if (ident == null) { ident = ''; } if (ident !== '') { ident = ident + ': '; } if ((typeof console !== "undefined" && console !== null ? console.log : void 0) != null) { return console.log("" + ident + msg); } }; dir = function(obj) { if ((typeof console !== "undefined" && console !== null ? console.dir : void 0) != null) { return console.dir(obj); } }; if (typeof window !== "undefined" && window !== null) { if (window.cjs == null) { window.cjs = {}; } if ((base = window.cjs).type == null) { base.type = type; } if ((base1 = window.cjs).log == null) { base1.log = log; } if ((base2 = window.cjs).dir == null) { base2.dir = dir; } } else { if (exports.type == null) { exports.type = type; } if (exports.log == null) { exports.log = log; } if (exports.dir == null) { exports.dir = dir; } } }).call(this); ;// Generated by CoffeeScript 1.10.0 /** @require Generic functions */ (function() { var BannerScroll, base; if (typeof window === "undefined" || window === null) { (typeof global !== "undefined" && global !== null ? global : window).cjs = require('../generic/generic'); } BannerScroll = (function() { BannerScroll.prototype.POSITION_FIXED = 'fixed'; BannerScroll.prototype.POSITION_ABSOLUTE = 'absolute'; BannerScroll.prototype.POSITION_STATIC = 'static'; function BannerScroll(wrapElement, jQuery) { this.wrapElement = wrapElement; this.jQuery = jQuery; this.originWrapElement = this.jQuery(this.wrapElement).clone(); this.position = null; this.originTop = this.getOffsetTop(); this.isManaged = false; this.remanageCallback = function() {}; this.remanageCallbackEmpty = true; } BannerScroll.prototype.getOriginWrapElement = function() { return this.originWrapElement; }; BannerScroll.prototype.getPosition = function() { return this.position; }; BannerScroll.prototype.resetPosition = function() { this.jQuery(this.getWrapElement()).css('top', ''); this.jQuery(this.getWrapElement()).removeClass("fixed-position"); this.jQuery(this.getWrapElement()).removeClass("absolute-position"); this.jQuery(this.getWrapElement()).addClass("static-position"); return this.position = this.POSITION_STATIC; }; BannerScroll.prototype.getWrapElement = function() { return this.wrapElement; }; BannerScroll.prototype.setToFixedPosition = function() { this.setRemanageCallback((function(context) { return function() { context.setToFixedPosition(); }; })(this)); if (!this.getIsManaged()) { return; } this.resetPosition(); this.setPosition(this.POSITION_FIXED); return this.jQuery(this.getWrapElement()).addClass("fixed-position"); }; BannerScroll.prototype.setToStaticPosition = function() { this.setRemanageCallback((function(context) { return function() { context.setToStaticPosition(); }; })(this)); if (!this.getIsManaged()) { return; } this.resetPosition(); this.setPosition(this.POSITION_STATIC); return this.jQuery(this.getWrapElement()).removeClass("fixed-position"); }; BannerScroll.prototype.setToAbsolutePosition = function(top) { top = this._calculateAbsoluteTopPosition(top); this.jQuery(this.getWrapElement()).css('left', ''); this.resetPosition(); this.jQuery(this.getWrapElement()).addClass("absolute-position"); this.setPosition(this.POSITION_ABSOLUTE); return this.jQuery(this.getWrapElement()).css("top", top + "px"); }; BannerScroll.prototype.setToAbsolutePositionAnimated = function(top, callback) { var $wrapElement, cb; top = top + 10; $wrapElement = this.jQuery(this.getWrapElement()); $wrapElement.css('left', ''); $wrapElement.removeClass("static-position"); $wrapElement.addClass("absolute-position"); this.setPosition(this.POSITION_ABSOLUTE); top = this._calculateAbsoluteTopPosition(top); cb = function() { return typeof callback === "function" ? callback() : void 0; }; $wrapElement.css("top", top + "px"); return cb(); }; BannerScroll.prototype._calculateAbsoluteTopPosition = function(top) { if (this.getWrapElement().parent().css('position') === 'relative' || this.getWrapElement().parent().css('position') === 'absolute') { top -= this.getWrapElement().parent().offset().top; } return top; }; BannerScroll.prototype.getOffsetTop = function() { return this.jQuery(this.getWrapElement()).offset().top; }; BannerScroll.prototype.getHeight = function() { var criteoTotalHeight, height; height = this.jQuery(this.getWrapElement()).outerHeight(true); criteoTotalHeight = 0; this.jQuery(this.getWrapElement()).find('div[id^="crt-"].ban_envelope:visible').each((function(_this) { return function(i, e) { return criteoTotalHeight += _this.jQuery(e).outerHeight(true); }; })(this)); return height - criteoTotalHeight; }; BannerScroll.prototype.setPosition = function(position) { this.position = position; }; BannerScroll.prototype.getIsAbsolutePosition = function() { return this.position === this.POSITION_ABSOLUTE; }; BannerScroll.prototype.getIsFixedPosition = function() { return this.position === this.POSITION_FIXED; }; BannerScroll.prototype.getIsStaticPosition = function() { return this.position === this.POSITION_STATIC; }; BannerScroll.prototype.getIsManaged = function() { return this.isManaged; }; BannerScroll.prototype.setIsManaged = function(isManaged) { this.isManaged = isManaged; }; BannerScroll.prototype.remanage = function() { this.setIsManaged(true); return this.callRemanageCallback(); }; BannerScroll.prototype.setRemanageCallback = function(remanageCallback) { this.remanageCallback = remanageCallback; return this.remanageCallbackEmpty = false; }; BannerScroll.prototype.getRemanageCallbackEmpty = function() { return this.remanageCallbackEmpty; }; BannerScroll.prototype.callRemanageCallback = function() { this.remanageCallbackEmpty = true; return this.remanageCallback(); }; return BannerScroll; })(); if (typeof window !== "undefined" && window !== null ? window.cjs : void 0) { if ((base = window.cjs).BannerScroll == null) { base.BannerScroll = BannerScroll; } } else { if (exports.BannerScroll == null) { exports.BannerScroll = BannerScroll; } } }).call(this); ;// Generated by CoffeeScript 1.10.0 /** @require Generic functions */ (function() { var BannerScrollManager, base; if (typeof window === "undefined" || window === null) { (typeof global !== "undefined" && global !== null ? global : window).cjs = require('../generic/generic'); } BannerScrollManager = (function() { function BannerScrollManager(jQuery, _isMobileDeviceGetter, _waypointGetter) { this.jQuery = jQuery; this._isMobileDeviceGetter = _isMobileDeviceGetter != null ? _isMobileDeviceGetter : (function() { return false; }); this._waypointGetter = _waypointGetter != null ? _waypointGetter : (function() { return null; }); this.banners = []; } BannerScrollManager.prototype.addBanner = function(banner) { return this.banners.push(banner); }; BannerScrollManager.prototype.getBanners = function() { return this.banners; }; BannerScrollManager.prototype.isMobileDevice = function() { return this._isMobileDeviceGetter(); }; BannerScrollManager.prototype.manage = function() { var banner, i, len, ref; ref = this.banners; for (i = 0, len = ref.length; i < len; i++) { banner = ref[i]; this.manageBanner(banner); } }; BannerScrollManager.prototype.manageBanner = function(banner) { if (banner.bannerObject.getIsManaged()) { return; } banner.bannerObject.setIsManaged(true); if (banner.stopElementsOnUpHitTopOfView != null) { this.manageStopElementsOnUpHitTopOfView(banner); } if (banner.startElementsOnDownHitTopOfView != null) { this.manageStartElementsOnDownHitTopOfView(banner); } if (!this.isMobileDevice()) { if (banner.stopElementsOnHitByBottom != null) { this.manageStopElementsOnHitByBottom(banner); } } else { this.manageMobileAnimation(banner); } if (banner.fullBannerHeightVisibleOrDisable === true && (banner.minWindowHeight === void 0 || banner.minWindowHeight < banner.bannerObject.getHeight())) { banner.minWindowHeight = banner.bannerObject.getHeight(); } if (banner.minWindowHeight != null) { this.manageMinWindowHeight(banner); } if (!this.isMobileDevice() && (banner.leftPositionHandleElement != null)) { this.manageLeftPosition(banner); } this.manageMinWindowHeightOnResize(banner); }; BannerScrollManager.prototype.manageLeftPosition = function(banner) { var m; m = function(b, context) { if (b.bannerObject.getPosition() !== cjs.BannerScroll.prototype.POSITION_ABSOLUTE) { context.jQuery(b.bannerObject.getWrapElement()).css('left', context.jQuery(banner.leftPositionHandleElement).offset().left - context.jQuery(window).scrollLeft()); } }; m(banner, this); this.jQuery(window).scroll((function(b, context) { return function() { return m(b, context); }; })(banner, this)); }; BannerScrollManager.prototype.unmanageBanner = function(banner) { return banner.bannerObject.setManaged(false); }; BannerScrollManager.prototype.manageMinWindowHeight = function(banner) { this.jQuery(window).resize((function(b, context) { return function() { return context.manageMinWindowHeightOnResize(b); }; })(banner, this)); }; BannerScrollManager.prototype.manageMinWindowHeightOnResize = function(banner) { var currentPosition, offsetTop; if (this.jQuery(window).height() < banner.minWindowHeight && banner.bannerObject.getIsManaged()) { currentPosition = banner.bannerObject.getPosition(); if (currentPosition === null) { banner.bannerObject.setIsManaged(false); return; } offsetTop = banner.bannerObject.getOffsetTop(); banner.bannerObject.setToStaticPosition(); banner.bannerObject.setRemanageCallback((function(banner, currentPosition, offsetTop) { return function() { switch (currentPosition) { case cjs.BannerScroll.prototype.POSITION_FIXED: return banner.bannerObject.setToFixedPosition(); case cjs.BannerScroll.prototype.POSITION_STATIC: return banner.bannerObject.setToStaticPosition(); case cjs.BannerScroll.prototype.POSITION_ABSOLUTE: return banner.bannerObject.setToAbsolutePosition(offsetTop); } }; })(banner, currentPosition, offsetTop)); banner.bannerObject.setIsManaged(false); } else if (this.jQuery(window).height() > banner.minWindowHeight && !banner.bannerObject.getIsManaged()) { banner.bannerObject.remanage(); } return this.jQuery(window).scroll(); }; BannerScrollManager.prototype.manageStopElementsOnUpHitTopOfView = function(banner) { var element, i, len, ref, results; ref = banner.stopElementsOnUpHitTopOfView; results = []; for (i = 0, len = ref.length; i < len; i++) { element = ref[i]; results.push(this.jQuery(element).waypoint((function(that, banner) { return function(direction) { if (direction === 'up') { that.jQuery(banner.bannerObject.getWrapElement()).stop(); return banner.bannerObject.setToStaticPosition(); } }; })(this, banner))); } return results; }; BannerScrollManager.prototype.manageStartElementsOnDownHitTopOfView = function(banner) { var element, i, len, ref, results; ref = banner.startElementsOnDownHitTopOfView; results = []; for (i = 0, len = ref.length; i < len; i++) { element = ref[i]; results.push(this.jQuery(element).waypoint((function(context, banner) { return function(direction) { var offsetTop; if (direction === 'down' && context.canMove(banner)) { if (!context.isMobileDevice()) { banner.bannerObject.setToFixedPosition(); return context.correctPosition(banner); } else if (banner.bannerObject.getIsManaged()) { offsetTop = context._getOffsetTopForAbsolutePosition(banner); return banner.bannerObject.setToAbsolutePositionAnimated(offsetTop); } } }; })(this, banner))); } return results; }; BannerScrollManager.prototype.manageStopElementsOnHitByBottom = function(banner) { var element, i, len, ref, results; ref = banner.stopElementsOnHitByBottom; results = []; for (i = 0, len = ref.length; i < len; i++) { element = ref[i]; results.push(this.jQuery(window).scroll((function(stopElementOnHitByBottom, context, banner) { return function() { if (banner.bannerObject.getIsFixedPosition()) { if (context.jQuery(stopElementOnHitByBottom).offset().top <= (banner.bannerObject.getOffsetTop() + banner.bannerObject.getHeight())) { banner.bannerObject.setToAbsolutePosition(context.jQuery(stopElementOnHitByBottom).offset().top - banner.bannerObject.getHeight()); return context.correctPosition(banner); } } else if (banner.bannerObject.getIsAbsolutePosition() && context.jQuery(stopElementOnHitByBottom).offset().top > (context.jQuery(window).scrollTop() + banner.bannerObject.getHeight())) { return banner.bannerObject.setToFixedPosition(); } }; })(element, this, banner))); } return results; }; BannerScrollManager.prototype.manageMobileAnimation = function(banner) { var offsetTop, timer; timer = 0; offsetTop = banner.bannerObject.getOffsetTop(); return this.jQuery(window).scroll((function(that, banner) { return function() { clearTimeout(timer); return timer = setTimeout(function() { if (!banner.bannerObject.getIsAbsolutePosition()) { return; } offsetTop = that._getOffsetTopForAbsolutePosition(banner); return banner.bannerObject.setToAbsolutePositionAnimated(offsetTop); }, 250); }; })(this, banner)); }; BannerScrollManager.prototype.canMove = function(banner) { var element, i, len, ref; if (banner.stopElementsOnHitByBottom) { ref = banner.stopElementsOnHitByBottom; for (i = 0, len = ref.length; i < len; i++) { element = ref[i]; if (this.jQuery(element).offset().top <= (banner.bannerObject.getOffsetTop() + banner.bannerObject.getHeight())) { return false; } } } return true; }; BannerScrollManager.prototype.correctPosition = function(banner) { var element, i, len, ref, results; if (banner.stopElementsOnHitByBottom) { ref = banner.stopElementsOnHitByBottom; results = []; for (i = 0, len = ref.length; i < len; i++) { element = ref[i]; if (this.jQuery(element).offset().top < (banner.bannerObject.getOffsetTop() + banner.bannerObject.getHeight())) { results.push(banner.bannerObject.setToAbsolutePosition(this.jQuery(element).offset().top - banner.bannerObject.getHeight())); } else { results.push(void 0); } } return results; } }; BannerScrollManager.prototype.correctPositionsOfAllBanners = function() { var banner, i, len, ref, results; ref = this.getBanners(); results = []; for (i = 0, len = ref.length; i < len; i++) { banner = ref[i]; results.push(this.correctPosition(banner)); } return results; }; BannerScrollManager.prototype._getBottomBoundaryOffsetTop = function(banner) { var element, elementOffsetTop, i, len, minOffsetTop, ref; minOffsetTop = this.jQuery('body').height(); if (banner.stopElementsOnHitByBottom) { ref = banner.stopElementsOnHitByBottom; for (i = 0, len = ref.length; i < len; i++) { element = ref[i]; elementOffsetTop = this.jQuery(element).offset().top; if (elementOffsetTop < minOffsetTop) { minOffsetTop = elementOffsetTop; } } } return minOffsetTop; }; BannerScrollManager.prototype._getOffsetTopForAbsolutePosition = function(banner) { var bottomBoundary, offsetTop; offsetTop = this.jQuery(window).scrollTop(); bottomBoundary = this._getBottomBoundaryOffsetTop(banner); if (bottomBoundary < offsetTop + banner.bannerObject.getHeight()) { offsetTop = bottomBoundary - banner.bannerObject.getHeight(); } return offsetTop; }; BannerScrollManager.prototype.refreshWaypoints = function() { var Waypoint, base; Waypoint = this._waypointGetter(); if (Waypoint != null) { return typeof Waypoint.refreshAll === "function" ? Waypoint.refreshAll() : void 0; } else { return typeof (base = this.jQuery).waypoints === "function" ? base.waypoints('refresh') : void 0; } }; return BannerScrollManager; })(); if (typeof window !== "undefined" && window !== null ? window.cjs : void 0) { if ((base = window.cjs).BannerScrollManager == null) { base.BannerScrollManager = BannerScrollManager; } } else { if (exports.BannerScrollManager == null) { exports.BannerScrollManager = BannerScrollManager; } } }).call(this); ;if (typeof $jq == 'undefined') { var $jq = jQuery; if (!$jq) { $jq = jQuer; } } function glib_show_hidden(surface_table_class, table_id, show_next_limit) { if (surface_table_class) { surface_table_class = '#' + surface_table_class + ' '; } var tbody = $jq(surface_table_class + '.' + table_id + ' tbody'); var visibleRows = tbody.data('visibleRows'); var rows = tbody.find('tr.hidden:not(.filtered-out)'); if (show_next_limit) { rows = rows.slice(0, show_next_limit); } rows.removeClass('hidden'); if (visibleRows) { tbody.data('visibleRows', visibleRows + rows.length); } fix_row_parity(tbody); toggle_show_more(tbody); }; function toggle_show_more(tbody) { var numHidden = tbody.find('tr').not(':visible,.filtered-out').length; tbody.parent().find('tr.hid').toggleClass('hidden', numHidden === 0); } function fix_row_parity(tbody) { $jq(tbody).find('tr:visible').removeClass('even').removeClass('odd'); $jq(tbody).find('tr:visible:even').addClass('odd'); $jq(tbody).find('tr:visible:odd').addClass('even'); }; ;if (typeof $jq == 'undefined') { var $jq = jQuery; if (!$jq) { $jq = jQuer; } } var iframe_external = false; function StatsDrawViewClass() { this.public = {}; this.options = { link_hide_class: 'scroll-text-inactive', height_fixes: { 'default': 1, 'mozilla': 2, 'webkit': 4, 'chrome': 4, 'safari': 4, 'msie-7': 0, 'msie-8': 0 } }; this.limits = { "min_x": 0, "min_y": 0, "max_x": undefined, "max_y": undefined, "scroll_x": undefined }; this.dimensions = { height: undefined, heightHeader: undefined, heightInternal: undefined, offsetBottom: 10, offsetTop: undefined }; this.position = { "x": undefined, "y": undefined, "xp": 0 }; this.keyCodes = { 33: 'page-up', 34: 'page-down', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down'}; this.scroll = { "horizontal": false, "vertical": false, "disabled": false }; this.item = { "height": 0, "width": 0 }; this.el = {}; // element jQuery object swap this.swap = {}; this.ready = false; this.scrollEnv = null; this.scrollContent = null; this.scrollHeader = null; this.boxes = {}; this.box_titles = {}; this.browserScrollbarWidth = null; this.searchInScrollAreaHackEnabled = true; this.detailVersion = 1; // version of detail and detail url // HELPERS { // check on browser version this.getBrowser = function() { var browser = ''; $jq.each($jq.browser, function(attr, value) { if (value == true) { browser = attr; } }); return browser + (browser == 'msie' ? '-' + parseInt($jq.browser.version) : ''); }; this.mobile = function() { return $jq.browser.mobile || /android|ipad|iphone|ipod/i.test(navigator.userAgent.toLowerCase()); }; // show/hide scroll whole links box if necessary this.update_scrollbox = function() { ((!this.scroll.disabled && !this.scroll.horizontal) || this.limits.min_x >= this.limits.max_x) ? this.scrollHeader.links.hide() : this.scrollHeader.links.show(); this.dimensions.offsetTop = this.scrollEnv.offset().top + this.dimensions.heightHeader; }; // show/hide scroll links on the top this.update_links = function() { this.position.x < this.limits.max_x ? this.show_links(this.el.lr) : this.hide_links(this.el.lr); this.position.x > this.limits.min_x ? this.show_links(this.el.ll) : this.hide_links(this.el.ll); }; this.hide_links = function(context) { context.addClass(this.options.link_hide_class); }; this.show_links = function(context) { context.removeClass(this.options.link_hide_class); }; // shorten too long names this.shorten_result_names = function() { $jq(".match").each(function(index, match) { match = $jq(match); match.find(".participant").each(function(i, part) { part = $jq(part); var name = part.find(".name"); var score = 0; score = part.find(".score"); if (score.width() == null) { score = part.parent().find(".score-final"); } name.width(part.width() - score.width() - (score.width() ? 5 : 0)); //var nameParts = []; //nameParts = name.html().split(''); //var title = nameParts ? nameParts[nameParts.length - 1] : name.html(); //name.attr({title: title}); }.bind(this)); }.bind(this)); }; // } // MOVEMENT { // Keyboard movement or move by one match this.touch = function(dir, e) { var m; var count = 1; e.preventDefault(); (typeof dir == 'number') && (dir = this.keyCodes[parseInt(dir)]); if (typeof dir == 'undefined' || !dir) { return; } var newpos; if ((this.scroll.disabled || this.scroll.horizontal) && ((dir == 'left' && this.position.x > this.limits.min_x) || (dir == 'right' && this.position.x < this.limits.max_x))) { newpos = this.position.x + count * (dir == 'left' ? -1 : 1); if (typeof newpos != 'undefined' && newpos != '') { var pos = newpos == this.limits.max_x ? this.limits.scroll_x : Math.min(0, Math.max(this.limits.scroll_x, -(this.item.width) * (newpos - this.limits.min_x))); this.set_content_displacement('horizontal', pos, 100, true); this.position.x = newpos; this.update_links(); } } else if (this.scroll.vertical && ((dir.indexOf('up') >= 0 && (m = 'up')) || (dir.indexOf('down') >= 0 && (m = 'down')))) { var d = (dir == 'down' || dir == 'page-down') ? 1 : -1; var q = dir.indexOf('page') === 0 ? this.limits.min_y : 1; // don't scroll if there is nowhere to go if ((m == 'down' && this.position.y < this.limits.max_y) || (m == 'up' && this.position.y > this.limits.min_y)) { newpos = Math.max(this.limits.min_y, Math.min(this.limits.max_y, this.position.y + (count * d * q))); this.position.y = newpos; if (newpos == this.limits.max_y) { this.el.env.tinyscrollbar_update("bottom"); return; } var limit = this.scrollContent.outerHeight() - (this.limits.min_y * this.item.height * 1.13); pos = newpos == this.limits.max_y ? limit : Math.max(0, Math.min(limit, this.item.height * (newpos - this.limits.min_y))); this.set_content_displacement('vertical', pos, 100, true); } } else if (this.scroll.vertical && dir == 'home') { this.el.env.tinyscrollbar_update("top"); this.position.y = this.limits.min_y; } else if (this.scroll.vertical && dir == 'end') { this.el.env.tinyscrollbar_update("bottom"); this.position.y = this.limits.max_y; } }; // update position when scrolling (to preserve keyboard scroll position) this.update_vertical_position = function(p) { if (this.scroll.vertical) { this.position.y = this.limits.min_y + Math.floor(-p / this.item.height); } }; // update horizontal position when scrolling (to preserve keyboard scroll position) this.update_horizontal_position = function(p) { if (this.scroll.horizontal) { this.position.x = p > this.limits.scroll_x ? this.limits.min_x + Math.floor(-p / this.item.width) : this.limits.max_x; this.update_links(); } }; // move content by to px posistion this.set_content_displacement = function(dir, p, duration) { typeof duration == 'undefined' && (duration = 0); if (dir == 'horizontal') { if (!this.scroll.disabled) { var scroll_pos = p == 0 ? 0 : Math.floor(p * (this.el.sx.width() - this.el.sx.find(".hthumb").width()) / this.limits.scroll_x); this.el.sx.find(".hthumb").animate({"left": scroll_pos}, 150); } this.scrollContent.animate({"left": Math.round(p) + 'px'}, duration, 'swing'); this.scrollHeader.content.animate({"left": Math.round(p) + 'px'}, duration, 'swing'); } dir == 'vertical' && this.el.env.tinyscrollbar_update(p); }; // move scrollbar this.set_scrollbar_displacement = function(dir, p, duration) { typeof duration == 'undefined' && (duration = 0); var cont_pos; if (dir == 'horizontal') { cont_pos = -(p == 0 ? 0 : Math.floor((p * this.limits.scroll_x) / (this.el.sx.width() - this.el.sx.find(".hthumb").width()))); this.scrollContent.animate({"left": Math.round(cont_pos) + 'px'}, duration, 'swing'); this.scrollHeader.content.animate({"left": Math.round(cont_pos) + 'px'}, duration, 'swing'); this.el.sx.find(".hthumb").animate({"left": -p}, duration); } else if (dir == 'vertical') { cont_pos = p == 0 ? 0 : Math.floor(-(p * this.limits.scroll_x) / (this.el.sx.width() - this.el.sx.find(".hthumb").width())); this.scrollContent.animate({"left": Math.round(cont_pos) + 'px'}, duration, 'swing'); this.scrollHeader.content.animate({"left": Math.round(cont_pos) + 'px'}, duration, 'swing'); this.el.sx.find(".hthumb").animate({"left": p}, duration); } }; // } // SIZE CONTROL { /* Resize draw to match window * @return void */ this.resize_viewport = function(dont_grab_size) { var dt = $jq('.detail-terminator'); var dth = parseInt(dt.css('margin-top')) + parseInt(dt.css('margin-bottom')); var wh = $jq(window).height() - $jq("body").outerHeight() + $jq("body").height() - dth; this.scrollEnv.width(this.scrollEnv.closest('#playoff-env').width()); this.update_scrollbox(); this.dimensions.heightHeader = this.scrollHeader.height(); this.dimensions.offsetTop = this.scrollEnv.offset().top; this.dimensions.offsetBottom = +$jq(".closer").outerHeight() - this.scrollEnv.outerHeight() + this.scrollEnv.height() + this.scrollHeader.height(); this.scrollEnv.height(wh - this.dimensions.offsetTop - this.dimensions.offsetBottom); this.dimensions.height = this.scrollEnv.outerHeight() - this.dimensions.heightHeader; if (!dont_grab_size) { this.dimensions.heightInternal = this.scrollContent.children().height(); } }; /* Show or hide scrollbars * @return void */ this.update_scrollbars = function() { // diff_x was reduced by 20 due to vertical scrollbars' width var denied = this.el.env.hasClass('default-scroll'); var diff_x = this.scrollContent.outerWidth() - this.scrollEnv.width() - 20; var diff_y = this.scrollContent.outerHeight() - this.scrollEnv.height(); if (this.scroll.horizontal = (!denied && diff_x > 0)) { this.scrollHeader.links.addClass('scrolls-x'); if (!((typeof tournament != 'undefined' && tournament) || (typeof tournamentPage != 'undefined' && tournamentPage) || this.detailVersion == 2)) { this.el.sx.show(); } } else { this.scrollHeader.links.removeClass('scrolls-x'); this.el.sx.hide(); this.scrollContent.css("left", 0); this.el.sx.find(".hthumb").css("left", 0); this.scrollHeader.content.css("left", 0); } if (this.scroll.vertical = (!denied && diff_y > 0)) { this.scrollHeader.links.addClass('scrolls-y'); if (!((typeof tournament != 'undefined' && tournament) || (typeof tournamentPage != 'undefined' && tournamentPage) || this.detailVersion == 2)) { this.el.sy.show(); } } else { this.scrollHeader.links.removeClass('scrolls-y'); this.el.sy.hide(); this.scrollContent.css("top", 0); } this.el.sx.width(this.el.env.width() - (this.scroll.horizontal && !this.scroll.vertical ? 0 : (this.el.sy.width() - 1))); }; // } // INIT functions { // general resize this.update_size = function(dont_grab_size) { if (this.ready && this.scrollEnv.parent().is(":visible")) { this.searchInScrollAreaHackInit(); dont_grab_size = typeof dont_grab_size == 'undefined' ? false : !!dont_grab_size; if (!this.scroll.disabled) { this.resize_viewport(dont_grab_size); this.update_scrollbars(); } else { this.dimensions.heightInternal = this.scrollContent.children().height(); } // calculate positions { var browser = this.getBrowser(); var hfix = (typeof this.options.height_fixes[browser] != 'undefined') ? this.options.height_fixes[browser] : this.options.height_fixes['default']; var fr = this.scrollContent.find(".round").first(); this.item.height = fr.find("div.relation").first().height() + fr.find("div.relation").next().height(); this.item.width = this.scrollEnv.find(".round").first().width(); this.limits.min_x = Math.round(this.scrollEnv.width() / this.item.width); this.limits.min_y = Math.round(this.scrollEnv.height() / this.item.height); this.limits.max_x = Math.ceil(this.scrollHeader.find("li").length); this.limits.max_y = Math.ceil(fr.find("div.match").length / 2); // } // reset current positions { this.position.x = Math.min(this.limits.max_x, Math.max(this.limits.min_x, Math.floor(-(parseInt(this.scrollContent.css('left')) - 5) / this.item.width) + this.limits.min_x)); this.position.y = Math.min(this.limits.max_y, Math.max(this.limits.min_y, Math.floor(parseInt(this.scrollContent.css('top')) / this.item.height) + this.limits.min_y)); // } if (!this.scroll.disabled) { // set up correct hscrollbar handle size { var tmp_w = this.el.env.children(".hcrollbar").width(); this.el.sx.find(".hthumb").width(Math.floor(Math.min(tmp_w, tmp_w / (this.scrollContent.width() / tmp_w)))); // } // save scrollbar sizes { this.dimensions.scrollbarSize = this.el.sy.children(".thumb").width(); // } } this.limits.scroll_x = this.scrollEnv.width() - this.scrollContent.width() - (isNaN(this.dimensions.scrollbarSize) ? 0 : this.dimensions.scrollbarSize) - 1; // update scroll links on top { this.update_links(); this.update_scrollbox(); if (!this.scroll.disabled) { this.resize_viewport(dont_grab_size); this.el.env.tinyscrollbar_update(); // tinyscrollbars' internal } // } this.scrollEnv.width(this.scrollEnv.parent().width()); this.searchInScrollAreaHack(); } }; this.getBrowserScrollbarWidth = function() { if (this.browserScrollbarWidth != null) { return this.browserScrollbarWidth; } var scrollTestElement = $jq("
"); $jq('body').append(scrollTestElement); var scrollbarWidth = $jq(scrollTestElement).get(0).offsetWidth - $jq(scrollTestElement).get(0).clientWidth; $jq(scrollTestElement).remove(); this.browserScrollbarWidth = scrollbarWidth; return scrollbarWidth; }; this.searchInScrollAreaHackInit = function() { if ((!$jq.browser.mozilla || !this.searchInScrollAreaHackEnabled) && !this.mobile()) { return; } $jq('#playoff-env').find('.viewport-wrap').css({'width': 'auto', 'height': 'auto'}); }; this.searchInScrollAreaHack = function() { if ((!$jq.browser.mozilla || !this.searchInScrollAreaHackEnabled) && !this.mobile()) { return; } var scrollbarWidth = this.getBrowserScrollbarWidth(); var viewport = $jq('#playoff-env').find('.viewport'); var viewportWrap = $jq('#playoff-env').find('.viewport-wrap'); $jq(viewportWrap).css({'width': $jq(viewport).outerWidth(true) + 'px', 'height': $jq(viewport).outerHeight(true) + 'px'}); $jq(viewport).css({'width': ($jq(viewport).outerWidth(true) + scrollbarWidth), 'height': ($jq(viewport).outerHeight(true) + scrollbarWidth) + 'px'}); $jq(viewportWrap).css('overflow', 'hidden'); $jq(viewport).css('overflow', 'scroll'); }; this.participantWayHighlight = function() { var matches = $jq(this.scrollEnv).find('.match'); var highlightClass = 'participant-way-highlight'; $jq(matches).hover(function() { var participantsClasses = []; if ($jq(this).is(':not(.has-events)')) { $jq(this).addClass('participant-way-highlight'); } $jq(this).find('.participant').each(function() { var participantClass = ($jq(this).attr('class').match(/\bglib\-participant\-([^\s]*)\b/)); if (participantClass != null && typeof participantClass[0] != 'undefined') { participantsClasses.push(participantClass[0]); } }); for (var i in participantsClasses) { $jq(matches).has('.participant.' + participantsClasses[i]).not(this).addClass(highlightClass); } }, function() { $jq(this).removeClass('participant-way-highlight'); $jq(matches).removeClass(highlightClass); }); }; // init hscroll (run only once) (HC Roll Bar) this.create_horizontal_scrollbar = function() { this.el.sx.thumb.unbind(".hcb").bind("mousedown", {}, function(e) { e.preventDefault(); e.stopPropagation(); // prevent IE from selecting text try { this.options.original_onselectstart = document.onselectstart; document.onselectstart = function() { return false; } } catch (e) { } typeof this.public.i == 'undefined' && (this.public.i = 0); this.public.i++; var hmax = this.el.sx.width() - this.el.sx.thumb.width(); $jq("body").bind("mousemove", { "start": e.pageX, "max": hmax, "h_quotient": hmax / this.limits.scroll_x }, function(e) { // set up limits && count position pos = Math.max(0, Math.min(e.data.max, parseInt(this.el.sx.thumb.css('left')) - (e.data.start - e.pageX))); e.data.start = e.pageX; // reset click position to last position save p = pos / e.data.h_quotient; // count content scroll this.scrollContent.css({"left": Math.round(p) + 'px'}); this.scrollHeader.content.css({"left": Math.round(p) + 'px'}); this.el.sx.thumb.css("left", pos + 'px'); this.update_horizontal_position(p); }.bind(this)); }.bind(this)); this.el.sx.find(".htrack").mousedown(function(e) { var t = this.el.sx.find('.hthumb'); var position = parseInt(t.css('left')); var width = parseInt(t.width()); var yScrollbarWidth = (this.scroll.vertical ? parseInt(this.el.sy.width()) : 0); var maxClickWidth = $jq(window).width()-yScrollbarWidth; var click=(e.pageX >= maxClickWidth ? maxClickWidth : e.pageX); this.set_scrollbar_displacement('horizontal', -click + (click >= position + width ? width : 0), 100); }.bind(this)); $jq(document).mouseup(function(e) { try { document.onselectstart = this.options.original_onselectstart; } catch (e) { } $jq("body").unbind('mousemove'); hscroll = undefined; }.bind(this)); }; this.restart = function() { this.ready = false; }; // secondary constructor, general init this.init = function(detailVersion) { if (typeof detailVersion != 'undefined') { this.detailVersion = detailVersion; } window.dw = this; // ?? this.el.env = $jq("#playoff-env"); // Don't do anything if you don't see draw if (this.el.env.length != 1) { return; } // Check all participants for long names (!$jq.browser.msie || ($jq.browser.msie && $jq.browser.version >= 7)) && this.shorten_result_names(); this.scrollEnv = this.el.env.find(".viewport"); this.scrollContent = this.el.env.find(".overview"); this.scrollHeader = $jq("#playoff-header"); this.scrollHeader.content = this.scrollHeader.find("ul").first(); this.scrollHeader.links = $jq("#playoff-links, .playoff-scroll-buttons"); if (detailVersion == 2 || (typeof tournament != 'undefined' && tournament) || (typeof tournamentPage != 'undefined' && tournamentPage)) { this.searchInScrollAreaHackEnabled = false; var columnCount = parseInt($jq('#draw_column_count').text()); var columnWidth = parseInt($jq('#detail .round').css('width')); this.scrollContent.css('width', columnWidth * columnCount); this.scrollEnv.css('height', this.scrollContent.outerHeight()); $jq('#playoff-header ul').css('width', columnWidth * columnCount); } if (this.scroll.disabled != true && !(this.scroll.disabled = this.el.env.hasClass('default-scroll'))) { this.scrollEnv.closest('#playoff-env').prepend('
'); this.scrollEnv.closest('#playoff-env').prepend('
'); this.el.sx = this.el.env.children(".hcrollbar"); this.el.sx.thumb = this.el.sx.find(".hthumb"); this.el.sy = this.el.env.children(".scrollbar"); this.el.env.tinyscrollbar(); // vertical scrollbar this.create_horizontal_scrollbar(); } this.el.lr = this.scrollHeader.links.find(".scroll-right"); this.el.ll = this.scrollHeader.links.find(".scroll-left"); $jq(window).bind('resize', {"dw": this}, function(e) { e.data.dw.update_size(); }); $jq(document).keydown(function(e) { e.keyCode in this.keyCodes && this.touch(e.keyCode, e) }.bind(this)); if (this.mobile()) { var trackV = $jq('.track'); var trackH = $jq('.htrack'); var thumbV = $jq('.scrollbar .track .thumb'); var thumbH = $jq('.hcrollbar .htrack .hthumb'); var viewport = $jq('.viewport'); var overview = $jq('.overview'); $jq('.viewport').bind('scroll', function(e) { var d = (trackV.height() - thumbV.height()) / (overview.height() - viewport.height()); var dx = (trackH.width() - thumbH.width()) / (overview.width() - viewport.width()); thumbV.css('top', Math.floor(viewport.get(0).scrollTop * d)); thumbH.css('left', Math.floor(viewport.get(0).scrollLeft * dx)); this.position.x = Math.floor((viewport.width() + viewport.get(0).scrollLeft) / this.item.width); this.update_links(); }.bind(this)); } this.update_size(); /* Fix CSS tables for madafaq IE */ if ($jq.browser.msie && $jq.browser.version <= 7) { $jq(".match.has-events ul").wrap(''); $jq(".match.has-events").each(function(i, el) { var rows = $jq(el).find(".playoff-box-result-inner li span.row"); rows.each(function(ri, row) { $jq(row).find("span").each(function(index, td) { var tds = $jq(td).hasClass('info') ? ""); var table = $jq(el).find('tr'); table.unwrap().unwrap().unwrap(); $jq(el).find('table tr td:first-child').css('border-left', 'none'); }); }); } // Set up box actions $jq(".match.has-events").unbind('.draw').bind('click.draw', {'dw': this}, this.match_cell_callback); // setup scroll links this.el.ll.unbind('click').bind('click', {'dw': this}, function(e) { e.data.dw.touch('left', e); }); this.el.lr.unbind('click').bind('click', {'dw': this}, function(e) { e.data.dw.touch('right', e); }); $jq('a.scroll-box').unbind('.draw').bind('click.draw', {'dw': this}, function(e) { e.data.dw.touch(null, e); }); this.participantWayHighlight(); this.ready = true; }; this.match_cell_callback = function(e) { var dw = e.data.dw; var box = $jq(this); var id = box.attr('id'); var matches = box.find(".matches"); typeof dw.swap.a == 'undefined' && (dw.swap.a = 1); if (matches.length) { if (box.hasClass('unpacked')) { box.removeClass('unpacked'); var bb = box.find('.matches'); var bbp = bb.prev(); bb.remove(); bb.insertAfter(bbp); typeof dw.box_titles[id] != 'undefined' && box.attr("title", dw.box_titles[id]); if (box.hasClass('shrink')) { box.removeClass('shrink'); } delete dw.boxes[id]; } else { dw.swap.a++; box.css('z-index', dw.swap.a).addClass('unpacked'); matches.css('z-index', dw.swap.a); box.parent().css('z-index', dw.swap.a); dw.boxes[id] = matches.outerHeight() + box.outerHeight() + box.position().top + box.parent().position().top + 5; dw.box_titles[id] = box.attr("title"); box.removeAttr("title"); if (dw.boxes[id] > (dw.dimensions.heightInternal)) { box.addClass('shrink'); if (dw.boxes[id] > (dw.scrollContent.height())) { if (dw.scrollEnv.height() < dw.boxes[id]) { dw.scrollEnv.height(dw.boxes[id] + 2); } dw.scrollContent.height(dw.boxes[id]); dw.update_size(true); !dw.scroll.disabled && dw.el.env.tinyscrollbar_update('bottom'); } } if (typeof detail_open == 'function') { box.find("li").click(function(e) { e.stopPropagation(); }); box.find("a.match-detail-link").click(function(e) { var classes = $jq(this).attr("class").split(" "); var mid; for (i in classes) { if (classes[i].match(/match\-[a-z]_[0-9]+_[a-zA-Z0-9]+/)) { mid = classes[i].substr(6); break; } } if (typeof mid != 'undefined' && mid) { if (dw.detailVersion == 2) { var re = / glib-partnames-([^ ]+) /; var partnames = re.exec(' ' + $jq(this).attr('class') + ' '); if (partnames && typeof partnames[1] != 'undefined') { partnames = partnames[1].split(';'); detail_open(mid, null, partnames[0], typeof partnames[1] != 'undefined' ? partnames[1] : null, $jq('#season_url').text(), false); } } else { detail_open(mid, null, null, null, null, false); } e.stopPropagation(); e.preventDefault(); return false; } }); } else { box.find("a.match-detail-link").click(function(e) { e.stopPropagation(); }); } } } }; }; var StatsDrawView = new StatsDrawViewClass(); // tinyscrollbar for jQuery, fixed for IE // used in draw (function(a) { function b(b, c) { function scrollbar_jump(a) { if (!(g.ratio >= 1)) { var offset = i.obj.offset(); var click = k ? a.pageX : a.pageY - (k ? offset['left'] : offset['top']); var size = parseInt(j.obj.css(k ? 'width' : 'height')); var pos_increment = size + o.now < click ? size : 0; o.now = (click - pos_increment); n = o.now * h.ratio; g.obj.css(l, -n); j.obj.css(l, o.now); window.dw.update_vertical_position(-n); } return false } function w(a) { if (!(g.ratio >= 1)) { o.now = Math.min(i[c.axis] - j[c.axis], Math.max(0, o.start + ((k ? a.pageX : a.pageY) - p.start))); n = o.now * h.ratio; g.obj.css(l, -n); j.obj.css(l, o.now); window.dw.update_vertical_position(-n) } return false } function v(b) { a(document).unbind(".scrollbar"); a(document).unbind("mousemove", w); a(document).unbind("mouseup", v); j.obj.unbind("mouseup", v); document.ontouchmove = j.obj[0].ontouchend = document.ontouchend = null; return false; } function u(b) { if (!(g.ratio >= 1)) { var b = b || window.event; var d = b.wheelDelta ? b.wheelDelta / 120 : -b.detail / 3; n -= d * c.wheel; n = Math.min(g[c.axis] - f[c.axis], Math.max(0, n)); j.obj.css(l, n / h.ratio); g.obj.css(l, -n); b = a.event.fix(b); window.dw.update_vertical_position(-n); b.preventDefault() } } function t(b) { p.start = k ? b.pageX : b.pageY; var c = parseInt(j.obj.css(l)); o.start = c == "auto" ? 0 : c; a(document).bind("mousemove", w); a(document).bind('mouseup.scrollbar', v); document.ontouchmove = function(b) { a(document).unbind("mousemove"); w(b.touches[0]) }; a(document).bind("mouseup", v); j.obj.bind("mouseup", v); j.obj[0].ontouchend = document.ontouchend = function(b) { a(document).unbind("mouseup"); j.obj.unbind("mouseup"); v(b.touches[0]) }; return false } this.s = function() { j.obj.bind("mousedown", t); j.obj[0].ontouchstart = function(a) { a.preventDefault(); a.stopPropagation(); j.obj.unbind("mousedown"); t(a.touches[0]); return false }; i.obj.bind("mouseup",scrollbar_jump); if (c.scroll) { if ("onmousewheel" in e[0]) { e[0].onmousewheel = u; } else { e[0].addEventListener('DOMMouseScroll', u, false); } } }; function r() { j.obj.css(l, n / h.ratio); g.obj.css(l, -n); p["start"] = j.obj.offset()[l]; var a = m.toLowerCase(); h.obj.css(a, Math.round(i[c.axis])); i.obj.css(a, Math.round(i[c.axis])); j.obj.css(a, Math.round(j[c.axis])); } this.q = function () { d.update(); this.s(); return d }; var d = this; var e = b; var f = {obj: a(".viewport", b)}; var g = {obj: a(".overview", b)}; var h = {obj: a(".scrollbar", b)}; var i = {obj: a(".track", h.obj)}; var j = {obj: a(".thumb", h.obj)}; var k = c.axis == "x", l = k ? "left" : "top", m = k ? "Width" : "Height"; var n, o = {start: 0, now: 0}, p = {}; this.update = function(a) { g[c.axis] = m == 'Height' ? $jq(g.obj[0]).outerHeight() : $jq(g.obj[0]).outerWidth(); f[c.axis] = f.obj[0]["offset" + m]; g.ratio = f[c.axis] / g[c.axis]; h.obj.toggleClass("disable", g.ratio >= 1); i[c.axis] = c.size == "auto" ? f[c.axis] : c.size; j[c.axis] = Math.min(i[c.axis], Math.max(0, c.sizethumb == "auto" ? i[c.axis] * g.ratio : c.sizethumb)); h.ratio = c.sizethumb == "auto" ? g[c.axis] / i[c.axis] : (g[c.axis] - f[c.axis]) / (i[c.axis] - j[c.axis]); n = a == "relative" && g.ratio <= 1 ? Math.min(g[c.axis] - f[c.axis], Math.max(0, n)) : 0; n = a == "bottom" && g.ratio <= 1 ? g[c.axis] - f[c.axis] : isNaN(parseInt(a)) ? n : parseInt(a); if (a == "overview-y") { n = -1 * parseInt($jq('.overview').css('top')); } r() }; return this.q() } a.tiny = a.tiny || {}; a.tiny.scrollbar = {options: {axis: "y", wheel: 40, scroll: true, size: "auto", sizethumb: "auto"}}; a.fn.tinyscrollbar = function(c) { var c = a.extend({}, a.tiny.scrollbar.options, c); this.each(function() { a(this).data("tsb", new b(a(this), c)) }); return this }; a.fn.tinyscrollbar_update = function(b) { return a(this).data("tsb").update(b) }; })($jq);;if (typeof $jq == 'undefined') { var $jq = jQuery; if (!$jq) { $jq = jQuer; } } /** SportStats javascript proxy * * This script manages fetching and loading tables by asynchronous * requests. It also manages stats menu. * * Usage: * * stats_proxy.init({ * "default_tab":'overall' * }); */ var class_stats_proxy = function() { var menu_class_prefix = 'stats-menu-', tabs = [], els = {}, proxy = this, anchor_pos, anchor_sub_pos, anchor_subsub_pos, options, current_tab, initial_tab; this.ready = false; this.fired = false; this.loading = false; this.aborting = false; this.req; this.stagesMenuInitialized = false; var stagesContent = []; this.publicOptions = null; // Options that will be used as default var default_options = { "default_tab":'overall', "before_tab_ready":function(tab_info) { }, "tab_ready":function(tab_info) { }, "tab_visible":function(tab_info) { }, "text_loading":"Loading ..", "use_links_hash":true, "init_ajax_stages_menu":false }; this.restart = function(){ tabs = []; els = {}; anchor_pos = undefined; anchor_sub_pos = undefined; anchor_subsub_pos = undefined; current_tab = undefined; initial_tab = undefined; this.ready = false; this.fired = false; this.loading = false; this.aborting = false; this.req = undefined; }; var setStageContent = function(id,content){ stagesContent[id] = content; }; var getStageContent = function(id){ if(typeof stagesContent[id] != 'undefined'){ return stagesContent[id]; } return null; }; var isStageContentAvailable = function(id){ return typeof stagesContent[id] != 'undefined'; }; this.isStagesMenuInitialized = function(){ return this.stagesMenuInitialized; }; this.getElsData = function() { return els; }; /** Prepare and startup stats_proxy * @param object opts * @return bool False on failure */ this.init = function(opts) { if (!this.ready) { this.publicOptions = options = typeof opts == 'object' ? merge_objects(default_options, opts):default_options; this.ready = find_elements(); } if (this.ready && !this.fired) { this.fired = true; get_tabs(); if (typeof initial_tab != 'undefined') { (typeof options.before_tab_ready == 'function') && options.before_tab_ready(initial_tab); (typeof options.tab_ready == 'function') && options.tab_ready(initial_tab); } this.tab(); } if(!this.isStagesMenuInitialized() && options.init_ajax_stages_menu){ this.initStagesMenu(); } return this; }; this.initStagesMenu = function(){ var menu = $jq('.ifmenu.bubble.stages-menu li a').removeAttr('onclick').unbind('click').bind("click",this,function(e){ e.preventDefault(); $jq(this).closest(".ifmenu.bubble.stages-menu").find('li').removeClass('selected'); $jq(this).closest('li').addClass('selected'); var setStage = function(context,content){ $jq('#glib-stats').children().remove(); if($jq(content).find(".ifmenu.bubble.stages-menu").size()){ $jq('#glib-stats').parent().find(".ifmenu.bubble.stages-menu").remove(); $jq('#glib-stats').before($jq(content).find(".ifmenu.bubble.stages-menu")); $jq(content).find(".ifmenu.bubble.stages-menu").remove(); } $jq('#glib-stats').append($jq(content).find("#glib-stats-menu")); context.restart(); context.init(context.options); context.initStagesMenu(); }; if(isStageContentAvailable($jq(this).attr('href'))){ setStage(e.data,getStageContent($jq(this).attr('href'))); }else{ loading(); $jq.get($jq(this).attr('href'),function(context,stageId){ return function(data){ setStageContent(stageId,data); setStage(context,data); }; }(e.data,$jq(this).attr('href'))); } }); this.stagesMenuInitialized = true; }; /** Get list of all available tabs * @return array */ var get_tabs = function() { if (tabs.length == 0) { var tab_containers = els.menu_container_main.getElementsByTagName('li'); els.menu = {}; register_tab_from_containers(tab_containers); } return tabs; }; /** Recursive function to create data structure from HTML * @param array tab_containers List of menu
  • elements * @param string parent_cname Optional name of parent tab * @return void */ var register_tab_from_containers = function(tab_containers, parent_cname, level) { var set_initial_tab; if (typeof parent_cname == 'undefined') { parent_cname = ''; } if (typeof level == 'undefined') { level = 1; } for (var i=0; i' + $el_link.html() + ''); } var boxes = els.data_container.getElementsByTagName('div'); for (var b=0; b= 0) { els.menu_spacer = item; break; } } } } return els.container && els.menu_container && els.menu_container_main && els.data_container && els.loader; }; var should_display_default_tab = function(level) { var url_data = get_url_data(); var anchor_data = getLocationHash().substr(1).split(';'); if (typeof anchor_data[0] != 'undefined' && anchor_data[0] == '') { anchor_data.shift(); } for (var i in anchor_data) { if (typeof url_data[level] != 'undefined' && anchor_data[i] == url_data[level]) { if (i < anchor_data.length - 1) { return true; } } } return false; }; /** Bind menu tab events * @return void */ var bind_tab = function(li, item) { var els = li.getElementsByTagName('a'); for (var i=0; i=0; i--) { url_data[anchor_pos+uname.length-i-1] = uname[i]; } detail_hashchangeIgnoreNext = true; if(options.use_links_hash){ setLocationHash("#" + url_data.join(";")); } setTimeout(function(f) { return function() { f(); }; }(options.tab_visible), 50); }; /** Try to remove class name * @param htmlelement obj * @param string className * @return string */ var remove_class = function(obj, className) { if(obj == null) { return false; } reg = new RegExp("\\s*"+className+"\\s*", "g"); if (typeof(obj.className) != "undefined") return obj.className = obj.className.replace(reg, ' '); else return obj.container_submenu.className = obj.container_submenu.className.replace(reg, ' '); }; /** Try to add class name * @param HTMLElement obj * @param string className * @return string */ var add_class = function(obj, className) { if(obj == null) { return false; } return obj.className = remove_class(obj, className) + ' ' + className; }; /** Does element have a class * @param HTMLElement obj * @param string className * @return bool */ var has_class = function(obj, className) { return obj.className.indexOf(className) >= 0; }; /** Show preloader * @return void */ var loading = function() { els.data_container.appendChild(els.loader); els.loader.appendChild(els.loader_helper); }; /** Hide preloader * @return void */ var prepared = function() { els.data_container.removeChild(els.loader); }; this.set_hash = function(hash) { this.hash_key = hash; }; this.dataInvalidate = function() { if (!this.ready) { return; } for(var menuItemName in els.menu) removeBoxes(els.menu[menuItemName]); els.data_container.innerHTML = ''; if (current_tab.grandparent_name) { stats_proxy.subsubtab(current_tab.grandparent_name, current_tab.parent_name, current_tab.name); } else if (current_tab.parent_name) { stats_proxy.subtab(current_tab.parent_name, current_tab.name); } else { stats_proxy.tab(current_tab.name); } }; this.dataInvalidatePart = function (partName, removeTableFromDOM) { if (removeTableFromDOM == null) { removeTableFromDOM = true; } if (typeof els.menu[partName] == "undefined") { return false; } removeBoxes(els.menu[partName], removeTableFromDOM); if (typeof current_tab != "undefined" && current_tab.name == partName) { if (current_tab.grandparent_name) { stats_proxy.subsubtab(current_tab.grandparent_name, current_tab.parent_name, current_tab.name); } else if (current_tab.parent_name) { stats_proxy.subtab(current_tab.parent_name, current_tab.name); } else { stats_proxy.tab(current_tab.name); } } return true; }; this.getBoxObj = function(partName) { if (typeof els.menu[partName] == "undefined") { return false; } return els.menu[partName]; }; var removeBoxes = function(item, removeTableFromDOM) { if (removeTableFromDOM == null) { removeTableFromDOM = true; } if (typeof item.link === 'undefined') { return false; } if (item.menu_level > 1 && item.has_submenu == true && item.box !== null) { item.box = null; item.has_submenu = false; item.menu = {}; item.menu_keys = []; delete(item.menu_default); } if(item.box && !item.has_submenu) { if (removeTableFromDOM === true) { $jq(item.box).remove(); } item.box = null; } if(item.has_submenu) { for(var menuItemName in item.menu) { removeBoxes(item.menu[menuItemName]); if (removeBoxes(item.menu[menuItemName]) === false) { item.box = null; item.has_submenu = false; item.menu = {}; item.menu_keys = []; delete(item.menu_default); break; } } } return true; }; var get_request_url = function(item, hash_key) { if (item.link === null) { var name = []; var el_link = item.container.getElementsByTagName('a')[0]; item.link = el_link.href; } if (hash_key && hash_key != '' && !/\?hash=/.test(item.link)) { item.link += '?hash=' + hash_key; } return item.link; }; /** Send ajax request to get html data from server * @param string name * @param object extra_data * @param string hash_key * @return ajax */ var request = function(item, extra_data, hash_key, display_default_tab) { loading(); (typeof extra_data == 'undefined' || extra_data === null) && (extra_data = {}); typeof this.req != 'undefined' && this.req !== null && this.req.abort(); extra_data.tab = item; if (!hash_key) { hash_key = ''; } if (typeof statsLiveChecker !== "undefined") { statsLiveChecker.stopChecking(); } display_default_tab = display_default_tab || false; var url = get_request_url(item, hash_key); return proxy.fetch_data(url, extra_data, function(status, headers, text, extra_data) { var box = get_box(extra_data.tab.name, extra_data.tab.parent_name); if(StatsLiveChecker.glibStatsHandlerClone != null && typeof StatsLiveChecker.glibStatsHandlerClone.beforeCallback === "function") { StatsLiveChecker.glibStatsHandlerClone.beforeCallback(); } box.innerHTML = text; var hashKeyElement = document.getElementById('glib-hash-' + item.name); if (hashKeyElement) { item.hashKey = hashKeyElement.innerHTML; } else { item.hashKey = null; } var submenu_data_element = extra_data.tab.parent_name ? document.getElementById("submenu-item-"+extra_data.tab.parent_name+"-"+extra_data.tab.name) : document.getElementById("submenu-item-"+extra_data.tab.name); if (submenu_data_element && submenu_data_element.innerHTML) { var submenu_data = JSON.parse(submenu_data_element.innerHTML); for(var key in submenu_data) { item[key] = submenu_data[key]; } item.container_submenu = extra_data.tab.parent_name ? document.getElementById("glib-stats-submenu-"+extra_data.tab.parent_name+"-"+extra_data.tab.name) : document.getElementById("glib-stats-submenu-"+extra_data.tab.name); for (var menu_key in submenu_data.menu) { submenu_data.menu[menu_key].box = document.getElementById(submenu_data.menu[menu_key].box_id); add_class(submenu_data.menu[menu_key].box, 'box'); delete(submenu_data.menu[menu_key].box_id); submenu_data.menu[menu_key].container = document.getElementById(submenu_data.menu[menu_key].container_id); delete(submenu_data.menu[menu_key].container_id); bind_tab(submenu_data.menu[menu_key].container, submenu_data.menu[menu_key]); } } if (typeof options.before_tab_ready == 'function') { options.before_tab_ready(extra_data.tab); } use_tab(extra_data.tab, display_default_tab); prepared(); // Zlobilo kvuli tomu subsub menu //save_anchor(extra_data.tab); if (typeof options.tab_ready == 'function') { options.tab_ready(extra_data.tab); } highlightFormParticipants(box); if(StatsLiveChecker.glibStatsHandlerClone != null) { if (typeof StatsLiveChecker.glibStatsHandlerClone.afterCallback === "function") { StatsLiveChecker.glibStatsHandlerClone.afterCallback(); } StatsLiveChecker.glibStatsHandlerClone.cloneTable = null; } }); }; var highlightFormParticipants = function(parent) { var hf = function(){ var participants = $jq(this).attr('class').match(/\bglib\-participants\-([^\-]*)\-([^\s]*)\b/); if(participants == null) { return; } typeof participants[0] != 'undefined' && delete participants[0]; if(typeof participants[1] == 'undefined' || typeof participants[1] == 'undefined') { return; } $jq("#glib-stats-data tr.glib-participant-"+participants[1]).toggleClass('highlight_hover'); $jq("#glib-stats-data tr.glib-participant-"+participants[2]).toggleClass('highlight_hover'); }; if (!parent) { parent = $jq('#glib-stats-data'); } $jq(parent).find('.form div a, .last_5 div a, a.glib-live-score').hover(hf,hf); }; /** Konstruktor StatsTableWidthChecker * * @param object settings */ StatsTableWidthChecker = function(settings){ if(this.isWorking()){ return; } this.tableElement = null; this.maxSize = null; this.minSize = null; this._isCSSTextOverflowAvaible = null; this._isCSSTextOverflowAvaible = this.isCSSTextOverflowAvaible(); this.init(settings); }; StatsTableWidthChecker.prototype.isWorking = function(){ return typeof $jq(this.tableElement).data('truncate-working') == 'undefined' ? false : $jq(this.tableElement).data('truncate-working'); }; StatsTableWidthChecker.prototype.setIsWorking = function(status){ $jq(this.tableElement).data('truncate-working',status); }; StatsTableWidthChecker.isWorking = function(tableElement){ return typeof $jq(tableElement).data('truncate-working') == 'undefined' ? false : $jq(tableElement).data('truncate-working'); }; StatsTableWidthChecker.prototype.isCSSTextOverflowAvaible = function(){ if(this._isCSSTextOverflowAvaible!== null){ return this._isCSSTextOverflowAvaible; } var d = document.createElement("span"); try{ if(typeof d.style.textOverflow == 'undefined'){ return false; }else{ d.style.textOverflow = 'ellipsis'; if(d.style.textOverflow == 'ellipsis'){ return true; }else{ return false; } } }catch(e){ return false; } }; /** Inicializace dle nastaveni * * @param object settings */ StatsTableWidthChecker.prototype.init = function(settings){ this.tableElement = settings.tableElement; this.minSize = settings.minSize; this.maxSize = settings.maxSize; }; /** * Vraci rozsah presezeni dane maxWidth */ StatsTableWidthChecker.prototype.getOverflowSize = function(){ if(this.maxSize == 0){ return 0; } var diff = $jq(this.tableElement).outerWidth() - this.maxSize; return diff >= 0 ? diff : 0; }; /** * Zkrati text v kazde bunce se jmenem participanta * */ StatsTableWidthChecker.prototype.truncateParticipant = function(){ if(this.isWorking()){ return; } this.setIsWorking(true); var overflow = this.getOverflowSize(); var participantsColumns = $jq(this.tableElement).find("tr td.participant_name"); var iconSize = 0; var orderArrowSize = 13; var teamLogo = $jq(participantsColumns).find(".team-logo"); if($jq(teamLogo).size()){ iconSize = $jq(teamLogo).outerWidth(true); } var columnSize = $jq(participantsColumns).eq(0).width(); var maxTextSize = columnSize-iconSize-overflow-orderArrowSize; if(maxTextSize < this.minSize){ maxTextSize = this.minSize; } var context = this; $jq(participantsColumns).find(".team_name_span").each(function(){ if(context.isCSSTextOverflowAvaible()){ $jq(this).css("display","inline-block"); if(maxTextSize <= 0){ $jq(this).css("width","auto"); }else{ $jq(this).css("width",maxTextSize+"px"); } return; } context.truncate(this,maxTextSize); }); this.setIsWorking(false); }; /** * Zkrati text v kazde elementu a prida '...' * @param object element - element s textem * @param object width - max sirka textu */ StatsTableWidthChecker.prototype.truncate =function (element,width){ var text = ""; if($jq(element).data('origin-text') == null){ text = $jq(element).text(); $jq(element).data('origin-text',text); }else{ text = $jq(element).data('origin-text'); $jq(element).text(text); } if($jq(element).outerWidth(true)<=width){ return; } text = text+"..."; $jq(element).text(text); while($jq(element).outerWidth(true)>width){ if(text == "..."){ return; } $jq(element).text(text.substr(0,text.length-4)+"..."); text = $jq(element).text(); } }; StatsTableWidthChecker_CheckItemWidth = function(item){ var statsTable = $jq(item.box).find("table:nth-child(1)"); var statsTableContainer = $jq(item.box).find(".stats-table-container:nth-child(1)"); if($jq(statsTable).size() == 1 && $jq(statsTableContainer).size()){ TableCheckerCallback = function(){ if(StatsTableWidthChecker.isWorking(statsTable)){ return; } var sizeChecker = new StatsTableWidthChecker({ tableElement:$jq(statsTable), maxSize:$jq(statsTableContainer).innerWidth(true), minSize:65 }); sizeChecker.truncateParticipant(); }; TableCheckerCallback(); var timeout = null; $jq(window).resize(function() { var windowWidth = $jq(window).innerWidth(); clearTimeout(timeout); timeout = setTimeout(function(width) { return function(){ if(width == $jq(window).innerWidth()){ TableCheckerCallback(); } }}(windowWidth),200); }); } }; this.fetch_data = function(url, extra_data, callback) { this.req = new class_ajax(url, callback); return this.req.fire(extra_data); }; /** Function merges two object properties as PHP array_merge * @param object set1 * @param object set2 * @return object */ var merge_objects = function(set1, set2) { for (var key in set2) { if (set2.hasOwnProperty(key)) set1[key] = set2[key] } return set1; }; /** Make all elements in array unique * @return array */ var array_unique = function(ar) { if (ar.length && typeof ar!=='string') { var sorter = {}; var out = []; for(var i=0,j=ar.length;i 0) { this.allRows = this.tbody.children(); // record number of visible rows this.tbody.data('visibleRows', this.allRows.not('.hidden').length); var obj = this; this.uls.each(function() { if (obj.initList($jq(this)) === false) { $jq(this).parent().remove(); } }); } // all lists could have been removed if (filterRow.find('ul[data-name]').length) { this.adjustFilterRowCss(filterRow); // hide opened list on any click $jq(document).on('click', {obj: this}, this.tableClicked); } }; TabFilter.prototype.tableClicked = function(e) { var obj = e.data.obj; obj.uls.removeClass('open'); }; TabFilter.prototype.initList = function(ul) { var option = null; var values = []; var nationalities = []; var valuesOrderMap = {}; var optionsFragment = null; var column = ul.attr('data-name'); var isVirtual = !!ul.attr('data-is-virtual'); var valueToRowsMap = ul.data('valueToRowsMap', {}).data('valueToRowsMap'); var obj = this; if (isVirtual) { this.allRows.each(function() { var row = $jq(this); var value = row.attr('data-virtual-' + column); var order = row.attr('data-virtual-' + column + '-choice-order'); var nationality_id = row.attr('data-nationality-id'); if (!value) { // continue, row won't be chosen by any value return true; } value = obj.processValue(column, value); if (!valueToRowsMap[value]) { valueToRowsMap[value] = $jq(); if (order) { valuesOrderMap[value] = order; } } valueToRowsMap[value].push(this); nationalities[value] = nationality_id; }); } else { var columnCell = this.tbody.find('tr:eq(0) td.' + column); // column is not present if (!columnCell.length) { return false; } var columnPosition = columnCell[0].cellIndex + 1; this.tbody.find('tr td:nth-child(' + columnPosition + ')').each(function() { var value = $jq(this).text(); if (!value) { // continue, row won't be chosen by any value return true; } value = obj.processValue(column, value); if (!valueToRowsMap[value]) { valueToRowsMap[value] = $jq(); } valueToRowsMap[value].push(this.parentNode); }); } // there are no values to filter by if ($jq.isEmptyObject(valueToRowsMap)) { return false; } // collect values for (var value in valueToRowsMap) { values.push(value); } if ($jq.isEmptyObject(valuesOrderMap)) { values.sort(this.alphaSort); } else { values.sort(function(a, b) { return valuesOrderMap[a] < valuesOrderMap[b] ? -1 : 1; }); } // set currently selected item ul.data('selectedItem', ul.children()); // append values as li's to ul // (using document fragment is faster than appending in $jq.each) optionsFragment = document.createDocumentFragment(); for (var i in values) { option = document.createElement('li'); // flags if (column == 'nationality') { var flag = document.createElement('span'); flag.setAttribute('class', 'flag fl_' + nationalities[values[i]]); option.appendChild(flag); } option.appendChild(document.createTextNode(values[i])); optionsFragment.appendChild(option); } ul[0].appendChild(optionsFragment); // bind event to do actual filtering ul.on('click', {obj: this}, this.listClicked); }; TabFilter.prototype.listClicked = function(e) { var obj = e.data.obj; var item = null; var list = $jq(this); // option was selected if (list.hasClass('open')) { item = $jq(e.target); list.data('selectedItem').removeClass('selected'); item.addClass('selected'); list.data('selectedItem', item); list.removeClass('open'); obj.filterChanged(); } // show list else { obj.uls.removeClass('open'); list.addClass('open'); } return false; }; TabFilter.prototype.filterChanged = function() { var value = null; var showAll = true; var valueToRowsMap = null; var $selectedRows = this.allRows; this.allRows.addClass('filtered-out'); this.uls.each(function() { value = $jq(this).data('selectedItem').text(); valueToRowsMap = $jq(this).data('valueToRowsMap'); if (valueToRowsMap && value in valueToRowsMap) { $selectedRows = $selectedRows.filter(valueToRowsMap[value]); showAll = false; } }); if (this.noResultsTFoot) { this.noResultsTFoot.hide(); } if (showAll) { this.allRows.removeClass('hidden filtered-out'); this.allRows.filter((function(obj) { return function(i, e) { return i >= obj.rowsVisibled; } }(this) )).addClass('hidden'); } else { $selectedRows.removeClass('hidden filtered-out'); if (!$selectedRows.length) { this.showNoResultsTFoot(); } } fix_row_parity(this.tbody); toggle_show_more(this.tbody); }; TabFilter.prototype.adjustFilterRowCss = function(filterRow) { var menu = $jq('.stats-shared-menu .ifmenu'); var spacer = $jq('.stats-shared-menu .color-spacer:visible').last(); var menuMargin = null; if (spacer.length) { menuMargin = menu.css('marginLeft'); if (parseInt(menuMargin) == 0) { menuMargin = '10px'; } filterRow.css({ backgroundColor: spacer.css('backgroundColor'), borderBottomWidth: spacer.css('borderBottomWidth'), borderBottomStyle: spacer.css('borderBottomStyle'), borderBottomColor: spacer.css('borderBottomColor'), marginTop: '-' + spacer.css('borderBottomWidth'), paddingTop: 1, paddingRight: 0, paddingBottom: parseInt(spacer.css('height'), 10) + 1, paddingLeft: menuMargin }); filterRow.find('.list-wrapper').css({ marginRight: menuMargin }); } }; TabFilter.prototype.showNoResultsTFoot = function() { // To maintain header cells padding, this complicated approach has to be taken. if (!this.noResultsTFoot) { this.noResultsTFoot = $jq('
  • '); var colspan = this.tbody.find('tr:first-child > td').length; var tr = $jq('').append( $jq('
    " : ""; $jq(td).wrap(tds); }); $jq(row).wrapInner("
    ').append( $jq('
    ').append( $jq('', { text: this.noResultsText }) ) ) ); for (var i = 1; i < colspan; i++) { tr.append('
    '); } this.noResultsTFoot.append(tr).insertAfter(this.tbody); } this.noResultsTFoot.show(); }; TabFilter.prototype.processValue = function(columnName, value) { // remove former teams if (columnName === 'team_name') { var bracketPos = value.indexOf(' ('); if (bracketPos !== -1) { return value.substring(0, bracketPos); } } return value; }; TabFilter.prototype.alphaSort = function(a, b) { // localeCompare() is slow, might cause performance problems return a.localeCompare(b); }; return TabFilter; })($jq);;if (typeof $jq == 'undefined') { var $jq = jQuery; if (!$jq) { $jq = jQuer; } } function glib_show_hidden(surface_table_class, table_id, show_next_limit) { if (surface_table_class) { surface_table_class = '#' + surface_table_class + ' '; } var tbody = $jq(surface_table_class + '.' + table_id + ' tbody'); var visibleRows = tbody.data('visibleRows'); var rows = tbody.find('tr.hidden:not(.filtered-out)'); if (show_next_limit) { rows = rows.slice(0, show_next_limit); } rows.removeClass('hidden'); if (visibleRows) { tbody.data('visibleRows', visibleRows + rows.length); } fix_row_parity(tbody); toggle_show_more(tbody); }; function toggle_show_more(tbody) { var numHidden = tbody.find('tr').not(':visible,.filtered-out').length; tbody.parent().find('tr.hid').toggleClass('hidden', numHidden === 0); } function fix_row_parity(tbody) { $jq(tbody).find('tr:visible').removeClass('even').removeClass('odd'); $jq(tbody).find('tr:visible:even').addClass('odd'); $jq(tbody).find('tr:visible:odd').addClass('even'); }; ;if (typeof $jq == 'undefined') { var $jq = jQuery; if (!$jq) { $jq = jQuer; } } var iframe_external = false; function StatsDrawViewClass() { this.public = {}; this.options = { link_hide_class: 'scroll-text-inactive', height_fixes: { 'default': 1, 'mozilla': 2, 'webkit': 4, 'chrome': 4, 'safari': 4, 'msie-7': 0, 'msie-8': 0 } }; this.limits = { "min_x": 0, "min_y": 0, "max_x": undefined, "max_y": undefined, "scroll_x": undefined }; this.dimensions = { height: undefined, heightHeader: undefined, heightInternal: undefined, offsetBottom: 10, offsetTop: undefined }; this.position = { "x": undefined, "y": undefined, "xp": 0 }; this.keyCodes = { 33: 'page-up', 34: 'page-down', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down'}; this.scroll = { "horizontal": false, "vertical": false, "disabled": false }; this.item = { "height": 0, "width": 0 }; this.el = {}; // element jQuery object swap this.swap = {}; this.ready = false; this.scrollEnv = null; this.scrollContent = null; this.scrollHeader = null; this.boxes = {}; this.box_titles = {}; this.browserScrollbarWidth = null; this.searchInScrollAreaHackEnabled = true; this.detailVersion = 1; // version of detail and detail url // HELPERS { // check on browser version this.getBrowser = function() { var browser = ''; $jq.each($jq.browser, function(attr, value) { if (value == true) { browser = attr; } }); return browser + (browser == 'msie' ? '-' + parseInt($jq.browser.version) : ''); }; this.mobile = function() { return $jq.browser.mobile || /android|ipad|iphone|ipod/i.test(navigator.userAgent.toLowerCase()); }; // show/hide scroll whole links box if necessary this.update_scrollbox = function() { ((!this.scroll.disabled && !this.scroll.horizontal) || this.limits.min_x >= this.limits.max_x) ? this.scrollHeader.links.hide() : this.scrollHeader.links.show(); this.dimensions.offsetTop = this.scrollEnv.offset().top + this.dimensions.heightHeader; }; // show/hide scroll links on the top this.update_links = function() { this.position.x < this.limits.max_x ? this.show_links(this.el.lr) : this.hide_links(this.el.lr); this.position.x > this.limits.min_x ? this.show_links(this.el.ll) : this.hide_links(this.el.ll); }; this.hide_links = function(context) { context.addClass(this.options.link_hide_class); }; this.show_links = function(context) { context.removeClass(this.options.link_hide_class); }; // shorten too long names this.shorten_result_names = function() { $jq(".match").each(function(index, match) { match = $jq(match); match.find(".participant").each(function(i, part) { part = $jq(part); var name = part.find(".name"); var score = 0; score = part.find(".score"); if (score.width() == null) { score = part.parent().find(".score-final"); } name.width(part.width() - score.width() - (score.width() ? 5 : 0)); //var nameParts = []; //nameParts = name.html().split(''); //var title = nameParts ? nameParts[nameParts.length - 1] : name.html(); //name.attr({title: title}); }.bind(this)); }.bind(this)); }; // } // MOVEMENT { // Keyboard movement or move by one match this.touch = function(dir, e) { var m; var count = 1; e.preventDefault(); (typeof dir == 'number') && (dir = this.keyCodes[parseInt(dir)]); if (typeof dir == 'undefined' || !dir) { return; } var newpos; if ((this.scroll.disabled || this.scroll.horizontal) && ((dir == 'left' && this.position.x > this.limits.min_x) || (dir == 'right' && this.position.x < this.limits.max_x))) { newpos = this.position.x + count * (dir == 'left' ? -1 : 1); if (typeof newpos != 'undefined' && newpos != '') { var pos = newpos == this.limits.max_x ? this.limits.scroll_x : Math.min(0, Math.max(this.limits.scroll_x, -(this.item.width) * (newpos - this.limits.min_x))); this.set_content_displacement('horizontal', pos, 100, true); this.position.x = newpos; this.update_links(); } } else if (this.scroll.vertical && ((dir.indexOf('up') >= 0 && (m = 'up')) || (dir.indexOf('down') >= 0 && (m = 'down')))) { var d = (dir == 'down' || dir == 'page-down') ? 1 : -1; var q = dir.indexOf('page') === 0 ? this.limits.min_y : 1; // don't scroll if there is nowhere to go if ((m == 'down' && this.position.y < this.limits.max_y) || (m == 'up' && this.position.y > this.limits.min_y)) { newpos = Math.max(this.limits.min_y, Math.min(this.limits.max_y, this.position.y + (count * d * q))); this.position.y = newpos; if (newpos == this.limits.max_y) { this.el.env.tinyscrollbar_update("bottom"); return; } var limit = this.scrollContent.outerHeight() - (this.limits.min_y * this.item.height * 1.13); pos = newpos == this.limits.max_y ? limit : Math.max(0, Math.min(limit, this.item.height * (newpos - this.limits.min_y))); this.set_content_displacement('vertical', pos, 100, true); } } else if (this.scroll.vertical && dir == 'home') { this.el.env.tinyscrollbar_update("top"); this.position.y = this.limits.min_y; } else if (this.scroll.vertical && dir == 'end') { this.el.env.tinyscrollbar_update("bottom"); this.position.y = this.limits.max_y; } }; // update position when scrolling (to preserve keyboard scroll position) this.update_vertical_position = function(p) { if (this.scroll.vertical) { this.position.y = this.limits.min_y + Math.floor(-p / this.item.height); } }; // update horizontal position when scrolling (to preserve keyboard scroll position) this.update_horizontal_position = function(p) { if (this.scroll.horizontal) { this.position.x = p > this.limits.scroll_x ? this.limits.min_x + Math.floor(-p / this.item.width) : this.limits.max_x; this.update_links(); } }; // move content by to px posistion this.set_content_displacement = function(dir, p, duration) { typeof duration == 'undefined' && (duration = 0); if (dir == 'horizontal') { if (!this.scroll.disabled) { var scroll_pos = p == 0 ? 0 : Math.floor(p * (this.el.sx.width() - this.el.sx.find(".hthumb").width()) / this.limits.scroll_x); this.el.sx.find(".hthumb").animate({"left": scroll_pos}, 150); } this.scrollContent.animate({"left": Math.round(p) + 'px'}, duration, 'swing'); this.scrollHeader.content.animate({"left": Math.round(p) + 'px'}, duration, 'swing'); } dir == 'vertical' && this.el.env.tinyscrollbar_update(p); }; // move scrollbar this.set_scrollbar_displacement = function(dir, p, duration) { typeof duration == 'undefined' && (duration = 0); var cont_pos; if (dir == 'horizontal') { cont_pos = -(p == 0 ? 0 : Math.floor((p * this.limits.scroll_x) / (this.el.sx.width() - this.el.sx.find(".hthumb").width()))); this.scrollContent.animate({"left": Math.round(cont_pos) + 'px'}, duration, 'swing'); this.scrollHeader.content.animate({"left": Math.round(cont_pos) + 'px'}, duration, 'swing'); this.el.sx.find(".hthumb").animate({"left": -p}, duration); } else if (dir == 'vertical') { cont_pos = p == 0 ? 0 : Math.floor(-(p * this.limits.scroll_x) / (this.el.sx.width() - this.el.sx.find(".hthumb").width())); this.scrollContent.animate({"left": Math.round(cont_pos) + 'px'}, duration, 'swing'); this.scrollHeader.content.animate({"left": Math.round(cont_pos) + 'px'}, duration, 'swing'); this.el.sx.find(".hthumb").animate({"left": p}, duration); } }; // } // SIZE CONTROL { /* Resize draw to match window * @return void */ this.resize_viewport = function(dont_grab_size) { var dt = $jq('.detail-terminator'); var dth = parseInt(dt.css('margin-top')) + parseInt(dt.css('margin-bottom')); var wh = $jq(window).height() - $jq("body").outerHeight() + $jq("body").height() - dth; this.scrollEnv.width(this.scrollEnv.closest('#playoff-env').width()); this.update_scrollbox(); this.dimensions.heightHeader = this.scrollHeader.height(); this.dimensions.offsetTop = this.scrollEnv.offset().top; this.dimensions.offsetBottom = +$jq(".closer").outerHeight() - this.scrollEnv.outerHeight() + this.scrollEnv.height() + this.scrollHeader.height(); this.scrollEnv.height(wh - this.dimensions.offsetTop - this.dimensions.offsetBottom); this.dimensions.height = this.scrollEnv.outerHeight() - this.dimensions.heightHeader; if (!dont_grab_size) { this.dimensions.heightInternal = this.scrollContent.children().height(); } }; /* Show or hide scrollbars * @return void */ this.update_scrollbars = function() { // diff_x was reduced by 20 due to vertical scrollbars' width var denied = this.el.env.hasClass('default-scroll'); var diff_x = this.scrollContent.outerWidth() - this.scrollEnv.width() - 20; var diff_y = this.scrollContent.outerHeight() - this.scrollEnv.height(); if (this.scroll.horizontal = (!denied && diff_x > 0)) { this.scrollHeader.links.addClass('scrolls-x'); if (!((typeof tournament != 'undefined' && tournament) || (typeof tournamentPage != 'undefined' && tournamentPage) || this.detailVersion == 2)) { this.el.sx.show(); } } else { this.scrollHeader.links.removeClass('scrolls-x'); this.el.sx.hide(); this.scrollContent.css("left", 0); this.el.sx.find(".hthumb").css("left", 0); this.scrollHeader.content.css("left", 0); } if (this.scroll.vertical = (!denied && diff_y > 0)) { this.scrollHeader.links.addClass('scrolls-y'); if (!((typeof tournament != 'undefined' && tournament) || (typeof tournamentPage != 'undefined' && tournamentPage) || this.detailVersion == 2)) { this.el.sy.show(); } } else { this.scrollHeader.links.removeClass('scrolls-y'); this.el.sy.hide(); this.scrollContent.css("top", 0); } this.el.sx.width(this.el.env.width() - (this.scroll.horizontal && !this.scroll.vertical ? 0 : (this.el.sy.width() - 1))); }; // } // INIT functions { // general resize this.update_size = function(dont_grab_size) { if (this.ready && this.scrollEnv.parent().is(":visible")) { this.searchInScrollAreaHackInit(); dont_grab_size = typeof dont_grab_size == 'undefined' ? false : !!dont_grab_size; if (!this.scroll.disabled) { this.resize_viewport(dont_grab_size); this.update_scrollbars(); } else { this.dimensions.heightInternal = this.scrollContent.children().height(); } // calculate positions { var browser = this.getBrowser(); var hfix = (typeof this.options.height_fixes[browser] != 'undefined') ? this.options.height_fixes[browser] : this.options.height_fixes['default']; var fr = this.scrollContent.find(".round").first(); this.item.height = fr.find("div.relation").first().height() + fr.find("div.relation").next().height(); this.item.width = this.scrollEnv.find(".round").first().width(); this.limits.min_x = Math.round(this.scrollEnv.width() / this.item.width); this.limits.min_y = Math.round(this.scrollEnv.height() / this.item.height); this.limits.max_x = Math.ceil(this.scrollHeader.find("li").length); this.limits.max_y = Math.ceil(fr.find("div.match").length / 2); // } // reset current positions { this.position.x = Math.min(this.limits.max_x, Math.max(this.limits.min_x, Math.floor(-(parseInt(this.scrollContent.css('left')) - 5) / this.item.width) + this.limits.min_x)); this.position.y = Math.min(this.limits.max_y, Math.max(this.limits.min_y, Math.floor(parseInt(this.scrollContent.css('top')) / this.item.height) + this.limits.min_y)); // } if (!this.scroll.disabled) { // set up correct hscrollbar handle size { var tmp_w = this.el.env.children(".hcrollbar").width(); this.el.sx.find(".hthumb").width(Math.floor(Math.min(tmp_w, tmp_w / (this.scrollContent.width() / tmp_w)))); // } // save scrollbar sizes { this.dimensions.scrollbarSize = this.el.sy.children(".thumb").width(); // } } this.limits.scroll_x = this.scrollEnv.width() - this.scrollContent.width() - (isNaN(this.dimensions.scrollbarSize) ? 0 : this.dimensions.scrollbarSize) - 1; // update scroll links on top { this.update_links(); this.update_scrollbox(); if (!this.scroll.disabled) { this.resize_viewport(dont_grab_size); this.el.env.tinyscrollbar_update(); // tinyscrollbars' internal } // } this.scrollEnv.width(this.scrollEnv.parent().width()); this.searchInScrollAreaHack(); } }; this.getBrowserScrollbarWidth = function() { if (this.browserScrollbarWidth != null) { return this.browserScrollbarWidth; } var scrollTestElement = $jq("
    "); $jq('body').append(scrollTestElement); var scrollbarWidth = $jq(scrollTestElement).get(0).offsetWidth - $jq(scrollTestElement).get(0).clientWidth; $jq(scrollTestElement).remove(); this.browserScrollbarWidth = scrollbarWidth; return scrollbarWidth; }; this.searchInScrollAreaHackInit = function() { if ((!$jq.browser.mozilla || !this.searchInScrollAreaHackEnabled) && !this.mobile()) { return; } $jq('#playoff-env').find('.viewport-wrap').css({'width': 'auto', 'height': 'auto'}); }; this.searchInScrollAreaHack = function() { if ((!$jq.browser.mozilla || !this.searchInScrollAreaHackEnabled) && !this.mobile()) { return; } var scrollbarWidth = this.getBrowserScrollbarWidth(); var viewport = $jq('#playoff-env').find('.viewport'); var viewportWrap = $jq('#playoff-env').find('.viewport-wrap'); $jq(viewportWrap).css({'width': $jq(viewport).outerWidth(true) + 'px', 'height': $jq(viewport).outerHeight(true) + 'px'}); $jq(viewport).css({'width': ($jq(viewport).outerWidth(true) + scrollbarWidth), 'height': ($jq(viewport).outerHeight(true) + scrollbarWidth) + 'px'}); $jq(viewportWrap).css('overflow', 'hidden'); $jq(viewport).css('overflow', 'scroll'); }; this.participantWayHighlight = function() { var matches = $jq(this.scrollEnv).find('.match'); var highlightClass = 'participant-way-highlight'; $jq(matches).hover(function() { var participantsClasses = []; if ($jq(this).is(':not(.has-events)')) { $jq(this).addClass('participant-way-highlight'); } $jq(this).find('.participant').each(function() { var participantClass = ($jq(this).attr('class').match(/\bglib\-participant\-([^\s]*)\b/)); if (participantClass != null && typeof participantClass[0] != 'undefined') { participantsClasses.push(participantClass[0]); } }); for (var i in participantsClasses) { $jq(matches).has('.participant.' + participantsClasses[i]).not(this).addClass(highlightClass); } }, function() { $jq(this).removeClass('participant-way-highlight'); $jq(matches).removeClass(highlightClass); }); }; // init hscroll (run only once) (HC Roll Bar) this.create_horizontal_scrollbar = function() { this.el.sx.thumb.unbind(".hcb").bind("mousedown", {}, function(e) { e.preventDefault(); e.stopPropagation(); // prevent IE from selecting text try { this.options.original_onselectstart = document.onselectstart; document.onselectstart = function() { return false; } } catch (e) { } typeof this.public.i == 'undefined' && (this.public.i = 0); this.public.i++; var hmax = this.el.sx.width() - this.el.sx.thumb.width(); $jq("body").bind("mousemove", { "start": e.pageX, "max": hmax, "h_quotient": hmax / this.limits.scroll_x }, function(e) { // set up limits && count position pos = Math.max(0, Math.min(e.data.max, parseInt(this.el.sx.thumb.css('left')) - (e.data.start - e.pageX))); e.data.start = e.pageX; // reset click position to last position save p = pos / e.data.h_quotient; // count content scroll this.scrollContent.css({"left": Math.round(p) + 'px'}); this.scrollHeader.content.css({"left": Math.round(p) + 'px'}); this.el.sx.thumb.css("left", pos + 'px'); this.update_horizontal_position(p); }.bind(this)); }.bind(this)); this.el.sx.find(".htrack").mousedown(function(e) { var t = this.el.sx.find('.hthumb'); var position = parseInt(t.css('left')); var width = parseInt(t.width()); var yScrollbarWidth = (this.scroll.vertical ? parseInt(this.el.sy.width()) : 0); var maxClickWidth = $jq(window).width()-yScrollbarWidth; var click=(e.pageX >= maxClickWidth ? maxClickWidth : e.pageX); this.set_scrollbar_displacement('horizontal', -click + (click >= position + width ? width : 0), 100); }.bind(this)); $jq(document).mouseup(function(e) { try { document.onselectstart = this.options.original_onselectstart; } catch (e) { } $jq("body").unbind('mousemove'); hscroll = undefined; }.bind(this)); }; this.restart = function() { this.ready = false; }; // secondary constructor, general init this.init = function(detailVersion) { if (typeof detailVersion != 'undefined') { this.detailVersion = detailVersion; } window.dw = this; // ?? this.el.env = $jq("#playoff-env"); // Don't do anything if you don't see draw if (this.el.env.length != 1) { return; } // Check all participants for long names (!$jq.browser.msie || ($jq.browser.msie && $jq.browser.version >= 7)) && this.shorten_result_names(); this.scrollEnv = this.el.env.find(".viewport"); this.scrollContent = this.el.env.find(".overview"); this.scrollHeader = $jq("#playoff-header"); this.scrollHeader.content = this.scrollHeader.find("ul").first(); this.scrollHeader.links = $jq("#playoff-links, .playoff-scroll-buttons"); if (detailVersion == 2 || (typeof tournament != 'undefined' && tournament) || (typeof tournamentPage != 'undefined' && tournamentPage)) { this.searchInScrollAreaHackEnabled = false; var columnCount = parseInt($jq('#draw_column_count').text()); var columnWidth = parseInt($jq('#detail .round').css('width')); this.scrollContent.css('width', columnWidth * columnCount); this.scrollEnv.css('height', this.scrollContent.outerHeight()); $jq('#playoff-header ul').css('width', columnWidth * columnCount); } if (this.scroll.disabled != true && !(this.scroll.disabled = this.el.env.hasClass('default-scroll'))) { this.scrollEnv.closest('#playoff-env').prepend('
    '); this.scrollEnv.closest('#playoff-env').prepend('
    '); this.el.sx = this.el.env.children(".hcrollbar"); this.el.sx.thumb = this.el.sx.find(".hthumb"); this.el.sy = this.el.env.children(".scrollbar"); this.el.env.tinyscrollbar(); // vertical scrollbar this.create_horizontal_scrollbar(); } this.el.lr = this.scrollHeader.links.find(".scroll-right"); this.el.ll = this.scrollHeader.links.find(".scroll-left"); $jq(window).bind('resize', {"dw": this}, function(e) { e.data.dw.update_size(); }); $jq(document).keydown(function(e) { e.keyCode in this.keyCodes && this.touch(e.keyCode, e) }.bind(this)); if (this.mobile()) { var trackV = $jq('.track'); var trackH = $jq('.htrack'); var thumbV = $jq('.scrollbar .track .thumb'); var thumbH = $jq('.hcrollbar .htrack .hthumb'); var viewport = $jq('.viewport'); var overview = $jq('.overview'); $jq('.viewport').bind('scroll', function(e) { var d = (trackV.height() - thumbV.height()) / (overview.height() - viewport.height()); var dx = (trackH.width() - thumbH.width()) / (overview.width() - viewport.width()); thumbV.css('top', Math.floor(viewport.get(0).scrollTop * d)); thumbH.css('left', Math.floor(viewport.get(0).scrollLeft * dx)); this.position.x = Math.floor((viewport.width() + viewport.get(0).scrollLeft) / this.item.width); this.update_links(); }.bind(this)); } this.update_size(); /* Fix CSS tables for madafaq IE */ if ($jq.browser.msie && $jq.browser.version <= 7) { $jq(".match.has-events ul").wrap(''); $jq(".match.has-events").each(function(i, el) { var rows = $jq(el).find(".playoff-box-result-inner li span.row"); rows.each(function(ri, row) { $jq(row).find("span").each(function(index, td) { var tds = $jq(td).hasClass('info') ? ""); var table = $jq(el).find('tr'); table.unwrap().unwrap().unwrap(); $jq(el).find('table tr td:first-child').css('border-left', 'none'); }); }); } // Set up box actions $jq(".match.has-events").unbind('.draw').bind('click.draw', {'dw': this}, this.match_cell_callback); // setup scroll links this.el.ll.unbind('click').bind('click', {'dw': this}, function(e) { e.data.dw.touch('left', e); }); this.el.lr.unbind('click').bind('click', {'dw': this}, function(e) { e.data.dw.touch('right', e); }); $jq('a.scroll-box').unbind('.draw').bind('click.draw', {'dw': this}, function(e) { e.data.dw.touch(null, e); }); this.participantWayHighlight(); this.ready = true; }; this.match_cell_callback = function(e) { var dw = e.data.dw; var box = $jq(this); var id = box.attr('id'); var matches = box.find(".matches"); typeof dw.swap.a == 'undefined' && (dw.swap.a = 1); if (matches.length) { if (box.hasClass('unpacked')) { box.removeClass('unpacked'); var bb = box.find('.matches'); var bbp = bb.prev(); bb.remove(); bb.insertAfter(bbp); typeof dw.box_titles[id] != 'undefined' && box.attr("title", dw.box_titles[id]); if (box.hasClass('shrink')) { box.removeClass('shrink'); } delete dw.boxes[id]; } else { dw.swap.a++; box.css('z-index', dw.swap.a).addClass('unpacked'); matches.css('z-index', dw.swap.a); box.parent().css('z-index', dw.swap.a); dw.boxes[id] = matches.outerHeight() + box.outerHeight() + box.position().top + box.parent().position().top + 5; dw.box_titles[id] = box.attr("title"); box.removeAttr("title"); if (dw.boxes[id] > (dw.dimensions.heightInternal)) { box.addClass('shrink'); if (dw.boxes[id] > (dw.scrollContent.height())) { if (dw.scrollEnv.height() < dw.boxes[id]) { dw.scrollEnv.height(dw.boxes[id] + 2); } dw.scrollContent.height(dw.boxes[id]); dw.update_size(true); !dw.scroll.disabled && dw.el.env.tinyscrollbar_update('bottom'); } } if (typeof detail_open == 'function') { box.find("li").click(function(e) { e.stopPropagation(); }); box.find("a.match-detail-link").click(function(e) { var classes = $jq(this).attr("class").split(" "); var mid; for (i in classes) { if (classes[i].match(/match\-[a-z]_[0-9]+_[a-zA-Z0-9]+/)) { mid = classes[i].substr(6); break; } } if (typeof mid != 'undefined' && mid) { if (dw.detailVersion == 2) { var re = / glib-partnames-([^ ]+) /; var partnames = re.exec(' ' + $jq(this).attr('class') + ' '); if (partnames && typeof partnames[1] != 'undefined') { partnames = partnames[1].split(';'); detail_open(mid, null, partnames[0], typeof partnames[1] != 'undefined' ? partnames[1] : null, $jq('#season_url').text(), false); } } else { detail_open(mid, null, null, null, null, false); } e.stopPropagation(); e.preventDefault(); return false; } }); } else { box.find("a.match-detail-link").click(function(e) { e.stopPropagation(); }); } } } }; }; var StatsDrawView = new StatsDrawViewClass(); // tinyscrollbar for jQuery, fixed for IE // used in draw (function(a) { function b(b, c) { function scrollbar_jump(a) { if (!(g.ratio >= 1)) { var offset = i.obj.offset(); var click = k ? a.pageX : a.pageY - (k ? offset['left'] : offset['top']); var size = parseInt(j.obj.css(k ? 'width' : 'height')); var pos_increment = size + o.now < click ? size : 0; o.now = (click - pos_increment); n = o.now * h.ratio; g.obj.css(l, -n); j.obj.css(l, o.now); window.dw.update_vertical_position(-n); } return false } function w(a) { if (!(g.ratio >= 1)) { o.now = Math.min(i[c.axis] - j[c.axis], Math.max(0, o.start + ((k ? a.pageX : a.pageY) - p.start))); n = o.now * h.ratio; g.obj.css(l, -n); j.obj.css(l, o.now); window.dw.update_vertical_position(-n) } return false } function v(b) { a(document).unbind(".scrollbar"); a(document).unbind("mousemove", w); a(document).unbind("mouseup", v); j.obj.unbind("mouseup", v); document.ontouchmove = j.obj[0].ontouchend = document.ontouchend = null; return false; } function u(b) { if (!(g.ratio >= 1)) { var b = b || window.event; var d = b.wheelDelta ? b.wheelDelta / 120 : -b.detail / 3; n -= d * c.wheel; n = Math.min(g[c.axis] - f[c.axis], Math.max(0, n)); j.obj.css(l, n / h.ratio); g.obj.css(l, -n); b = a.event.fix(b); window.dw.update_vertical_position(-n); b.preventDefault() } } function t(b) { p.start = k ? b.pageX : b.pageY; var c = parseInt(j.obj.css(l)); o.start = c == "auto" ? 0 : c; a(document).bind("mousemove", w); a(document).bind('mouseup.scrollbar', v); document.ontouchmove = function(b) { a(document).unbind("mousemove"); w(b.touches[0]) }; a(document).bind("mouseup", v); j.obj.bind("mouseup", v); j.obj[0].ontouchend = document.ontouchend = function(b) { a(document).unbind("mouseup"); j.obj.unbind("mouseup"); v(b.touches[0]) }; return false } this.s = function() { j.obj.bind("mousedown", t); j.obj[0].ontouchstart = function(a) { a.preventDefault(); a.stopPropagation(); j.obj.unbind("mousedown"); t(a.touches[0]); return false }; i.obj.bind("mouseup",scrollbar_jump); if (c.scroll) { if ("onmousewheel" in e[0]) { e[0].onmousewheel = u; } else { e[0].addEventListener('DOMMouseScroll', u, false); } } }; function r() { j.obj.css(l, n / h.ratio); g.obj.css(l, -n); p["start"] = j.obj.offset()[l]; var a = m.toLowerCase(); h.obj.css(a, Math.round(i[c.axis])); i.obj.css(a, Math.round(i[c.axis])); j.obj.css(a, Math.round(j[c.axis])); } this.q = function () { d.update(); this.s(); return d }; var d = this; var e = b; var f = {obj: a(".viewport", b)}; var g = {obj: a(".overview", b)}; var h = {obj: a(".scrollbar", b)}; var i = {obj: a(".track", h.obj)}; var j = {obj: a(".thumb", h.obj)}; var k = c.axis == "x", l = k ? "left" : "top", m = k ? "Width" : "Height"; var n, o = {start: 0, now: 0}, p = {}; this.update = function(a) { g[c.axis] = m == 'Height' ? $jq(g.obj[0]).outerHeight() : $jq(g.obj[0]).outerWidth(); f[c.axis] = f.obj[0]["offset" + m]; g.ratio = f[c.axis] / g[c.axis]; h.obj.toggleClass("disable", g.ratio >= 1); i[c.axis] = c.size == "auto" ? f[c.axis] : c.size; j[c.axis] = Math.min(i[c.axis], Math.max(0, c.sizethumb == "auto" ? i[c.axis] * g.ratio : c.sizethumb)); h.ratio = c.sizethumb == "auto" ? g[c.axis] / i[c.axis] : (g[c.axis] - f[c.axis]) / (i[c.axis] - j[c.axis]); n = a == "relative" && g.ratio <= 1 ? Math.min(g[c.axis] - f[c.axis], Math.max(0, n)) : 0; n = a == "bottom" && g.ratio <= 1 ? g[c.axis] - f[c.axis] : isNaN(parseInt(a)) ? n : parseInt(a); if (a == "overview-y") { n = -1 * parseInt($jq('.overview').css('top')); } r() }; return this.q() } a.tiny = a.tiny || {}; a.tiny.scrollbar = {options: {axis: "y", wheel: 40, scroll: true, size: "auto", sizethumb: "auto"}}; a.fn.tinyscrollbar = function(c) { var c = a.extend({}, a.tiny.scrollbar.options, c); this.each(function() { a(this).data("tsb", new b(a(this), c)) }); return this }; a.fn.tinyscrollbar_update = function(b) { return a(this).data("tsb").update(b) }; })($jq);;if (typeof $jq == 'undefined') { var $jq = jQuery; if (!$jq) { $jq = jQuer; } } var TabFilter = (function($jq) { var TabFilter = function(tab, selectedFilter, rowsVisibled) { this.uls = null; this.tbody = null; this.allRows = null; this.noResultsText = ''; this.noResultsTFoot = null; this.selectedFilter = []; var filterRow = $jq('.glib-stats-filter', tab.box); this.uls = filterRow.find('ul[data-name]'); this.tbody = $jq('table.stats-table tbody', tab.box); this.noResultsText = filterRow.attr('data-no-results-text'); this.rowsVisibled = this.tbody.find('tr:not(:hidden)').length; if (this.uls.length > 0) { this.allRows = this.tbody.children(); // record number of visible rows this.tbody.data('visibleRows', this.allRows.not('.hidden').length); var obj = this; this.uls.each(function() { if (obj.initList($jq(this)) === false) { $jq(this).parent().remove(); } }); } // all lists could have been removed if (filterRow.find('ul[data-name]').length) { this.adjustFilterRowCss(filterRow); // hide opened list on any click $jq(document).on('click', {obj: this}, this.tableClicked); } var filter = false; if (selectedFilter != null) { for (var i in selectedFilter) { var opt = selectedFilter[i]; if (typeof this.uls[opt.ul] !== 'undefined') { var $ul = $jq(this.uls[opt.ul]); var $li = $ul.find('li:eq(' + opt.li + ')'); this.setOption($ul, $li); filter = true; } } } if (rowsVisibled != null) { this.tbody.data('visibleRows', rowsVisibled); filter = true; } if (filter) { this.filterChanged(); } }; TabFilter.prototype.tableClicked = function(e) { var obj = e.data.obj; obj.uls.removeClass('open'); }; TabFilter.prototype.initList = function(ul) { var option = null; var values = []; var nationalities = []; var valuesOrderMap = {}; var optionsFragment = null; var column = ul.attr('data-name'); var isVirtual = !!ul.attr('data-is-virtual'); var valueToRowsMap = ul.data('valueToRowsMap', {}).data('valueToRowsMap'); var obj = this; if (isVirtual) { this.allRows.each(function() { var row = $jq(this); var value = row.attr('data-virtual-' + column); var order = row.attr('data-virtual-' + column + '-choice-order'); var nationality_id = row.attr('data-nationality-id'); if (!value) { // continue, row won't be chosen by any value return true; } value = obj.processValue(column, value); if (!valueToRowsMap[value]) { valueToRowsMap[value] = $jq(); if (order) { valuesOrderMap[value] = order; } } valueToRowsMap[value].push(this); nationalities[value] = nationality_id; }); } else { var columnCell = this.tbody.find('tr:eq(0) td.' + column); // column is not present if (!columnCell.length) { return false; } var columnPosition = columnCell[0].cellIndex + 1; this.tbody.find('tr td:nth-child(' + columnPosition + ')').each(function() { var value = $jq(this).text(); if (!value) { // continue, row won't be chosen by any value return true; } value = obj.processValue(column, value); if (!valueToRowsMap[value]) { valueToRowsMap[value] = $jq(); } valueToRowsMap[value].push(this.parentNode); }); } // there are no values to filter by if ($jq.isEmptyObject(valueToRowsMap)) { return false; } // collect values for (var value in valueToRowsMap) { values.push(value); } if ($jq.isEmptyObject(valuesOrderMap)) { values.sort(this.alphaSort); } else { values.sort(function(a, b) { return valuesOrderMap[a] < valuesOrderMap[b] ? -1 : 1; }); } // set currently selected item ul.data('selectedItem', ul.children()); // append values as li's to ul // (using document fragment is faster than appending in $jq.each) optionsFragment = document.createDocumentFragment(); for (var i in values) { option = document.createElement('li'); // flags if (column == 'nationality') { var flag = document.createElement('span'); flag.setAttribute('class', 'flag fl_' + nationalities[values[i]]); option.appendChild(flag); } option.appendChild(document.createTextNode(values[i])); optionsFragment.appendChild(option); } ul[0].appendChild(optionsFragment); // bind event to do actual filtering ul.on('click', {obj: this}, this.listClicked); }; TabFilter.prototype.listClicked = function(e) { var obj = e.data.obj; var item = null; var list = $jq(this); // option was selected if (list.hasClass('open')) { item = $jq(e.target); obj.setOption(list, item); obj.filterChanged(); } // show list else { obj.uls.removeClass('open'); list.addClass('open'); } return false; }; TabFilter.prototype.setOption = function($list, $item) { $list.data('selectedItem').removeClass('selected'); $item.addClass('selected'); $list.data('selectedItem', $item); $list.removeClass('open'); }; TabFilter.prototype.filterChanged = function() { var value = null; var showAll = true; var valueToRowsMap = null; var $selectedRows = this.allRows; this.allRows.addClass('filtered-out'); this.selectedFilter = []; this.uls.each( (function(that){ return function(ulIndex) { var $ul = $jq(this); value = $ul.data('selectedItem').text(); valueToRowsMap = $ul.data('valueToRowsMap'); if (valueToRowsMap && value in valueToRowsMap) { $selectedRows = $selectedRows.filter(valueToRowsMap[value]); that.selectedFilter.push({ul: ulIndex, li: $ul.data('selectedItem').index()}); showAll = false; } } })(this) ); if (this.noResultsTFoot) { this.noResultsTFoot.hide(); } if (showAll) { this.allRows.removeClass('hidden filtered-out'); var rowsVisibled = this.tbody.data('visibleRows'); if (rowsVisibled) { this.rowsVisibled = rowsVisibled; } this.allRows.filter((function(obj) { return function(i, e) { return i >= obj.rowsVisibled; } }(this) )).addClass('hidden'); } else { $selectedRows.removeClass('hidden filtered-out'); if (!$selectedRows.length) { this.showNoResultsTFoot(); } } fix_row_parity(this.tbody); toggle_show_more(this.tbody); }; TabFilter.prototype.adjustFilterRowCss = function(filterRow) { var menu = $jq('.stats-shared-menu .ifmenu'); var spacer = $jq('.stats-shared-menu .color-spacer:visible').last(); var menuMargin = null; if (spacer.length) { menuMargin = menu.css('marginLeft'); if (parseInt(menuMargin) == 0) { menuMargin = '10px'; } filterRow.css({ backgroundColor: spacer.css('backgroundColor'), borderBottomWidth: spacer.css('borderBottomWidth'), borderBottomStyle: spacer.css('borderBottomStyle'), borderBottomColor: spacer.css('borderBottomColor'), marginTop: '-' + spacer.css('borderBottomWidth'), paddingTop: 1, paddingRight: 0, paddingBottom: parseInt(spacer.css('height'), 10) + 1, paddingLeft: menuMargin }); filterRow.find('.list-wrapper').css({ marginRight: menuMargin }); } }; TabFilter.prototype.showNoResultsTFoot = function() { // To maintain header cells padding, this complicated approach has to be taken. if (!this.noResultsTFoot) { this.noResultsTFoot = $jq(''); var colspan = this.tbody.find('tr:first-child > td').length; var tr = $jq('').append( $jq('
    " : ""; $jq(td).wrap(tds); }); $jq(row).wrapInner("
    ').append( $jq('
    ').append( $jq('', { text: this.noResultsText }) ) ) ); for (var i = 1; i < colspan; i++) { tr.append('
    '); } this.noResultsTFoot.append(tr).insertAfter(this.tbody); } this.noResultsTFoot.show(); }; TabFilter.prototype.processValue = function(columnName, value) { // remove former teams if (columnName === 'team_name') { var bracketPos = value.indexOf(' ('); if (bracketPos !== -1) { return value.substring(0, bracketPos); } } return value; }; TabFilter.prototype.getSelectedFilter = function() { return this.selectedFilter; }; TabFilter.prototype.getRowsVisibled = function() { var rowsVisibled = this.tbody.data('visibleRows'); return rowsVisibled || this.rowsVisibled; }; TabFilter.prototype.alphaSort = function(a, b) { // localeCompare() is slow, might cause performance problems return a.localeCompare(b); }; return TabFilter; })($jq); ;/** Konstruktor StatsTableWidthChecker * * @param object settings */ var StatsTableWidthChecker = function(settings){ if(this.isWorking()){ return; } this.tableElement = null; this.maxSize = null; this.minSize = null; this._isCSSTextOverflowAvaible = null; this._isCSSTextOverflowAvaible = this.isCSSTextOverflowAvaible(); this.init(settings); }; StatsTableWidthChecker.prototype.isWorking = function(){ return typeof $jq(this.tableElement).data('truncate-working') == 'undefined' ? false : $jq(this.tableElement).data('truncate-working'); }; StatsTableWidthChecker.prototype.setIsWorking = function(status){ $jq(this.tableElement).data('truncate-working',status); }; StatsTableWidthChecker.isWorking = function(tableElement){ return typeof $jq(tableElement).data('truncate-working') == 'undefined' ? false : $jq(tableElement).data('truncate-working'); }; StatsTableWidthChecker.prototype.isCSSTextOverflowAvaible = function(){ if(this._isCSSTextOverflowAvaible!== null){ return this._isCSSTextOverflowAvaible; } var d = document.createElement("span"); try{ if(typeof d.style.textOverflow == 'undefined'){ return false; }else{ d.style.textOverflow = 'ellipsis'; if(d.style.textOverflow == 'ellipsis'){ return true; }else{ return false; } } }catch(e){ return false; } }; /** Inicializace dle nastaveni * * @param object settings */ StatsTableWidthChecker.prototype.init = function(settings){ this.tableElement = settings.tableElement; this.minSize = settings.minSize; this.maxSize = settings.maxSize; }; /** * Vraci rozsah presezeni dane maxWidth */ StatsTableWidthChecker.prototype.getOverflowSize = function(){ if(this.maxSize == 0){ return 0; } var diff = $jq(this.tableElement).outerWidth() - this.maxSize; return diff >= 0 ? diff : 0; }; /** * Zkrati text v kazde bunce se jmenem participanta * */ StatsTableWidthChecker.prototype.truncateParticipant = function(){ if(this.isWorking()){ return; } this.setIsWorking(true); var overflow = this.getOverflowSize(); var participantsColumns = $jq(this.tableElement).find("tr td.participant_name"); var iconSize = 0; var teamLogo = $jq(participantsColumns).find(".team-logo"); if($jq(teamLogo).size()){ iconSize = $jq(teamLogo).outerWidth(true); } var columnSize = $jq(participantsColumns).eq(0).width(); var maxTextSize = columnSize-iconSize-overflow; if(maxTextSize < this.minSize){ maxTextSize = this.minSize; } var context = this; $jq(participantsColumns).find(".team_name_span").each(function(){ if (context.isCSSTextOverflowAvaible()) { if (!$(this).siblings('.dw-icon').length) { $jq(this).css("display", "inline-block"); } if (maxTextSize <= 0) { $jq(this).css("width", "auto"); } else { $jq(this).css("width", maxTextSize + "px"); } return; } context.truncate(this,maxTextSize); }); this.setIsWorking(false); }; /** * Zkrati text v kazde elementu a prida '...' * @param object element - element s textem * @param object width - max sirka textu */ StatsTableWidthChecker.prototype.truncate =function (element,width){ var text = ""; if($jq(element).data('origin-text') == null){ text = $jq(element).text(); $jq(element).data('origin-text',text); }else{ text = $jq(element).data('origin-text'); $jq(element).text(text); } if($jq(element).outerWidth(true)<=width){ return; } text = text+"..."; $jq(element).text(text); while($jq(element).outerWidth(true)>width){ if(text == "..."){ return; } $jq(element).text(text.substr(0,text.length-4)+"..."); text = $jq(element).text(); } }; StatsTableWidthChecker_CheckItemWidth = function($box){ var statsTable = $jq($box).find("table:nth-child(1)"); var statsTableContainer = $jq($box).find(".stats-table-container:nth-child(1)"); if($jq(statsTable).size() == 1 && $jq(statsTableContainer).size()){ TableCheckerCallback = function(){ if(StatsTableWidthChecker.isWorking(statsTable)){ return; } var sizeChecker = new StatsTableWidthChecker({ tableElement:$jq(statsTable), maxSize:$jq(statsTableContainer).innerWidth(true), minSize:65 }); sizeChecker.truncateParticipant(); }; TableCheckerCallback(); var timeout = null; $jq(window).resize(function() { var windowWidth = $jq(window).innerWidth(); clearTimeout(timeout); timeout = setTimeout(function(width) { return function(){ if(width == $jq(window).innerWidth()){ TableCheckerCallback(); } }}(windowWidth),200); }); } }; ;// Generated by CoffeeScript 1.8.0 (function() { var AllowedTab, Events, MainTabItem, MenuHtml, Request, Signs, Stats2, TabContent, TabItem, Table, Tabs, __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, __slice = [].slice, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; AllowedTab = (function() { function AllowedTab(_config, _table, _signs) { this._config = _config; this._table = _table; this._signs = _signs; this._prepare(); } AllowedTab.prototype.isAllowed = function(tableTypeId, tableSubTypeId) { var subItem, _i, _len, _ref; if (tableSubTypeId == null) { tableSubTypeId = null; } tableTypeId = tableTypeId * 1; if (this._allowedTabs[tableTypeId]) { if (tableSubTypeId != null) { _ref = this.getSubTabItems(tableTypeId); for (_i = 0, _len = _ref.length; _i < _len; _i++) { subItem = _ref[_i]; if (subItem.id * 1 === tableSubTypeId * 1) { return true; } } return false; } else { if ((this._subTabs[tableTypeId] != null) && (this._table.isFormTable(tableTypeId) || this._table.isOverUnderTable(tableTypeId)) && this._subTabs[tableTypeId].length === 0) { return false; } } return true; } return false; }; AllowedTab.prototype.getSubTabItems = function(tableTypeId) { var ids, _ref; tableTypeId = tableTypeId * 1; if (((_ref = this._subTabs) != null ? _ref[tableTypeId] : void 0) == null) { return []; } ids = this._subTabs[tableTypeId]; if (this._table.isFormTable(tableTypeId)) { return this._getFormSubItems(ids); } else if (this._table.isOverUnderTable(tableTypeId)) { return this._getOverUnderSubItems(ids); } return []; }; AllowedTab.prototype.setAllowed = function(tableTypeId, tableSubTypeId) { if (tableSubTypeId == null) { tableSubTypeId = null; } tableTypeId = tableTypeId * 1; this._allowedTabs[tableTypeId] = 1; if (this._subTabs[tableTypeId] == null) { this._subTabs[tableTypeId] = []; } if ((tableSubTypeId != null) && __indexOf.call(this._subTabs[tableTypeId], tableSubTypeId) < 0) { return this._subTabs[tableTypeId].push(tableSubTypeId * 1); } }; AllowedTab.prototype._prepare = function() { var allowedTab, allowedTabs, tableSubTypeId, tableTypeId, _i, _len, _ref, _results; this._allowedTabs = {}; this._subTabs = {}; allowedTabs = (this._signs.TB + "").split(','); _results = []; for (_i = 0, _len = allowedTabs.length; _i < _len; _i++) { allowedTab = allowedTabs[_i]; _ref = (allowedTab + "").split(':'), tableTypeId = _ref[0], tableSubTypeId = _ref[1]; _results.push(this.setAllowed(tableTypeId, tableSubTypeId)); } return _results; }; AllowedTab.prototype._getFormSubItems = function(ids) { var id, items, _i, _len; items = []; for (_i = 0, _len = ids.length; _i < _len; _i++) { id = ids[_i]; items.push({ name: (id + 1) * 5, url: (id + 1) * 5, sortKey: id, id: id }); } return items; }; AllowedTab.prototype._getOverUnderSubItems = function(ids) { var id, items, _i, _len; if (this._config.overUnderTypes == null) { return []; } items = []; for (_i = 0, _len = ids.length; _i < _len; _i++) { id = ids[_i]; if (this._config.overUnderTypes[id] == null) { continue; } items.push({ name: this._config.overUnderTypes[id].name, url: this._config.overUnderTypes[id].name, sortKey: this._config.overUnderTypes[id].sort, defaultTabOrder: this._config.overUnderTypes[id].default_tab_order, id: id }); } return items; }; return AllowedTab; })(); Events = (function() { Events.SUPPORTED_EVENTS = { 'init': 1, 'beforeBoxDownload': 1, 'beforeBoxReplace': 1, 'afterBoxDownload': 1, 'boxShow': 1, 'boxHide': 1 }; function Events() { this._events = {}; } Events.prototype.on = function(name, cb, obj, reset) { if (obj == null) { obj = null; } if (reset == null) { reset = false; } if (!Events.SUPPORTED_EVENTS[name]) { throw new Error("Event " + name + " not supported"); } if ((this._events[name] == null) || reset) { this._events[name] = []; } return this._events[name].push({ cb: cb, obj: obj }); }; Events.prototype.fire = function() { var event, name, params, _i, _len, _ref, _results; name = arguments[0], params = 2 <= arguments.length ? __slice.call(arguments, 1) : []; if (this._events[name] == null) { return; } _ref = this._events[name]; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { event = _ref[_i]; _results.push(event.cb.apply(event.obj, params)); } return _results; }; return Events; })(); MenuHtml = (function() { function MenuHtml(_tabsMenu) { this._tabsMenu = _tabsMenu; } MenuHtml.prototype.getMenuHtml = function() { var html, submenu, _ref; if (((_ref = this._tabsMenu) != null ? _ref.hasChildren() : void 0) == null) { return ''; } html = this._getMenuHtmlPart(this._tabsMenu.getChildren()); submenu = this._getSubMenuHtmlPart(this._tabsMenu.getChildren()); html += "
    " + submenu + "
    "; return html += "
    "; }; MenuHtml.prototype._getMenuHtmlPart = function(items) { var i, item, li, liClass, title, total, ul, _i, _len; ul = '
      '; total = items.length; for (i = _i = 0, _len = items.length; _i < _len; i = ++_i) { item = items[i]; title = item.getTitle(); if (title) { title = " title=\"" + title + "\""; } liClass = ['li' + i]; if (i === 0) { liClass.push('first'); } if (total === i + 1) { liClass.push('last'); } li = "
    • \n " + (item.getName()) + "\n
    • "; ul += li; } return ul += '
    '; }; MenuHtml.prototype._getSubMenuHtmlPart = function(items) { var item, ret, _i, _len; ret = ''; for (_i = 0, _len = items.length; _i < _len; _i++) { item = items[_i]; if (!item.hasChildren()) { continue; } ret += "
    \n " + (this._getMenuHtmlPart(item.getChildren())) + "\n
    \n
    "; ret += this._getSubMenuHtmlPart(item.getChildren()); } return ret; }; return MenuHtml; })(); Request = (function() { Request.CONTEXT_TABLE_SIGNS = 'stats2_signs'; Request.CONTEXT_TABLE_CONTENT = 'stats2_content'; function Request(_config) { this._config = _config; this._activeRequests = {}; } Request.prototype.getTableSigns = function(cb, errorCb) { var callback, tournament, tournamentStage, url; tournament = this._config.tournament; tournamentStage = this._config.tournamentStage; url = this._config.getFeedUrl(this._config.urlTableSigns).replace('%TOURNAMENT%', tournament).replace('%TOURNAMENT_STAGE%', tournamentStage); callback = (function(cb, that) { return function(status, headers, content, trigger, customHeaders) { return typeof cb === "function" ? cb(that._parse(content)) : void 0; }; })(cb, this); return this._doRequest(Request.CONTEXT_TABLE_SIGNS, url, callback, errorCb); }; Request.prototype.getTableContent = function(tableTypeUrlPart, cb) { var callback, source, tournament, tournamentStage, url; tournament = this._config.tournament; tournamentStage = this._config.tournamentStage; source = this._config.source; url = this._config.getFeedUrl(this._config.urlTableContent).replace('%TOURNAMENT%', tournament).replace('%TOURNAMENT_STAGE%', tournamentStage).replace('%TABLE_TYPE%', tableTypeUrlPart).replace('%SOURCE_ID%', source); callback = (function(cb) { return function(status, headers, content, trigger, customHeaders) { return typeof cb === "function" ? cb(content) : void 0; }; })(cb); return this._doRequest(Request.CONTEXT_TABLE_CONTENT, url, callback); }; Request.prototype._doRequest = function(context, url, cb, errorCb) { var _base; if (errorCb == null) { errorCb = function() {}; } this.abortActiveRequest(context); this._activeRequests[context] = this._config.createAjaxFeedObject(url, cb, context); this._activeRequests[context].async(true); if (typeof (_base = this._activeRequests[context]).setErrorCallback === "function") { _base.setErrorCallback(errorCb); } return this._activeRequests[context].update(null, null, {}); }; Request.prototype._parse = function(str) { var data, index, item, parserConfig, row, rows, value, _i, _j, _len, _len1, _ref, _ref1; data = {}; parserConfig = this._config.getParserConfig(); if (!(str === null || str === '0' || str.length < 4)) { rows = str.split(parserConfig.JS_ROW_END); for (_i = 0, _len = rows.length; _i < _len; _i++) { row = rows[_i]; _ref = row.split(parserConfig.JS_CELL_END); for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { item = _ref[_j]; if (item !== '') { _ref1 = item.split(parserConfig.JS_INDEX), index = _ref1[0], value = _ref1[1]; if (!value) { value = null; } data[index] = value; } } } } return data; }; Request.prototype.abortActiveRequest = function(context) { if (this._activeRequests[context] == null) { return; } if (this._activeRequests[context].updating != null) { this._activeRequests[context].abort(); } return delete this._activeRequests[context]; }; Request.prototype.abortAllActiveRequests = function() { var context, _results; _results = []; for (context in this._activeRequests) { _results.push(this.abortActiveRequest(context)); } return _results; }; return Request; })(); Signs = (function() { Signs.TTL = 60000; Signs.TTL_LIVE = 5000; function Signs(_config, _request, _table) { this._config = _config; this._request = _request; this._table = _table; this._enabled = true; this._onChangeCallbacks = []; this._onChangeFinalCallbacks = []; } Signs.prototype.getSigns = function(cb) { if (this._signs != null) { return typeof cb === "function" ? cb(this._signs) : void 0; } return this._request.getTableSigns((function(cb, that) { return function(signs) { that._signs = signs; that.updateAllowedTab(); if (that.isEnabled()) { that.startUpdater(); } return typeof cb === "function" ? cb(signs) : void 0; }; })(cb, this)); }; Signs.prototype.startUpdater = function() { this._enabled = true; return this._startUpdateTimer(); }; Signs.prototype.stopUpdater = function() { this._enabled = false; return clearTimeout(this._timerId); }; Signs.prototype.isEnabled = function() { return this.enabled; }; Signs.prototype.getSignValue = function(sign) { return this._getSignValue(sign); }; Signs.prototype.onChangeCallback = function(cb, callerObj, resetPrev) { if (callerObj == null) { callerObj = this; } if (resetPrev == null) { resetPrev = false; } if (resetPrev) { this._onChangeCallbacks = []; } return this._onChangeCallbacks.push({ cb: cb, obj: callerObj }); }; Signs.prototype.onChangeFinalCallback = function(cb, callerObj, resetPrev) { if (callerObj == null) { callerObj = this; } if (resetPrev == null) { resetPrev = false; } if (resetPrev) { this._onChangeFinalCallbacks = []; } return this._onChangeFinalCallbacks.push({ cb: cb, obj: callerObj }); }; Signs.prototype.validateSign = function(sign, value) { if (this._getSignValue(sign) === value) { return true; } this._signs[sign] = value; return false; }; Signs.prototype.getAllowedTab = function() { return this._allowedTab; }; Signs.prototype.updateAllowedTab = function() { return this._allowedTab = new AllowedTab(this._config, this._table, this._signs); }; Signs.prototype._hasLiveTable = function() { var allowed; allowed = this.getAllowedTab(); if (allowed) { return allowed.isAllowed(this._table.getTabId('LIVE_OVERALL')); } return false; }; Signs.prototype._startUpdateTimer = function() { var time, updateSignsCb; if (!this._enabled) { return; } time = this._hasLiveTable() ? Signs.TTL_LIVE : Signs.TTL; clearTimeout(this._timerId); updateSignsCb = (function(that) { return function() { return that._request.getTableSigns((function(that) { return function(signs) { that._updateSigns.call(that, signs); return that._startUpdateTimer.call(that); }; })(that), (function(that) { return function() { return that._startUpdateTimer.call(that); }; })(that)); }; })(this); return this._timerId = setTimeout(updateSignsCb, time); }; Signs.prototype._getSignValue = function(sign) { var _ref; if (((_ref = this._signs) != null ? _ref[sign] : void 0) == null) { return ""; } return this._signs[sign]; }; Signs.prototype._updateSigns = function(newSigns) { var prevValue, sign, signChange, signsChange, value, whatChanged, _i, _len, _ref; if ((newSigns != null ? newSigns.TB : void 0) == null) { return; } whatChanged = {}; signsChange = []; for (sign in newSigns) { value = newSigns[sign]; prevValue = this._getSignValue(sign); if (value !== prevValue) { signsChange.push([sign, value, prevValue]); whatChanged[sign] = 1; } delete this._signs[sign]; } _ref = this._signs; for (sign in _ref) { prevValue = _ref[sign]; signsChange.push([sign, "", prevValue]); whatChanged[sign] = 1; } this._signs = newSigns; if (signsChange.length) { if (whatChanged['TB'] === 1) { this.updateAllowedTab(); } for (_i = 0, _len = signsChange.length; _i < _len; _i++) { signChange = signsChange[_i]; this._runOnChangeCallbacks(signChange[0], signChange[1], signChange[2]); } return this._runOnChangeFinalCallBacks(whatChanged); } }; Signs.prototype._runOnChangeCallbacks = function(sign, newValue, oldValue) { var cb, _i, _len, _ref, _results; _ref = this._onChangeCallbacks; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { cb = _ref[_i]; _results.push(cb.cb.call(cb.obj, sign, newValue, oldValue)); } return _results; }; Signs.prototype._runOnChangeFinalCallBacks = function(whatChanged) { var cb, _i, _len, _ref, _results; _ref = this._onChangeFinalCallbacks; _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { cb = _ref[_i]; _results.push(cb.cb.call(cb.obj, whatChanged)); } return _results; }; return Signs; })(); Stats2 = (function() { function Stats2(_config) { this._config = _config; this._enabled = true; this._checkAndPrepareConfig(); this._request = new Request(this._config); this._table = new Table(); this._events = new Events(); this._signs = new Signs(this._config, this._request, this._table); this._tabs = new Tabs(this); } Stats2.prototype.init = function() { if (this._initialized) { return; } this._initialized = true; this.updateHtml(); return this._events.fire('init'); }; Stats2.prototype.updateHtml = function() { return this._tabs.updateMenuHtmlFromHash(); }; Stats2.prototype.disable = function() { this._enabled = false; this._signs.stopUpdater(); this._request.abortAllActiveRequests(); return this._tabs._tabContent.hidePreload(); }; Stats2.prototype.enable = function(selectCurrentItem) { if (selectCurrentItem == null) { selectCurrentItem = false; } this._enabled = true; if (!this._initialized) { return; } this._signs.startUpdater(); if (selectCurrentItem) { return this._tabs.setCurrentItem(); } }; Stats2.prototype.isEnabled = function() { return this._enabled; }; Stats2.prototype.eventOn = function(name, cb, obj, reset) { if (obj == null) { obj = this; } if (reset == null) { reset = false; } return this._events.on(name, cb, obj, reset); }; Stats2.prototype._checkAndPrepareConfig = function() { var configKey, requiredConfigKeys, _i, _len, _ref; requiredConfigKeys = ['tabsConfig', 'overUnderTypes', 'tournament', 'tournamentStage', 'source', 'getFeedUrl', 'createAjaxFeedObject', 'getParserConfig', 'jQuery', 'menuWrapperElement', 'contentWrapperElement', 'statsWrapperElement', 'urlTableSigns', 'urlTableContent']; for (_i = 0, _len = requiredConfigKeys.length; _i < _len; _i++) { configKey = requiredConfigKeys[_i]; if (((_ref = this._config) != null ? _ref[configKey] : void 0) == null) { throw new Error("Config key " + configKey + " not found"); } } if (this._config.getLocationHash == null) { this._config.getLocationHash = (function() { return location.hash.replace(/^#/, ''); }); } if (this._config.setLocationHash == null) { this._config.setLocationHash = (function(hash) { return location.hash = hash; }); } if (!this._config.txtLoading) { return this._config.txtLoading = "Loading .."; } }; return Stats2; })(); if (typeof window !== "undefined" && window !== null) { window.Stats2 = Stats2; } else { exports.Stats2 = Stats2; } TabContent = (function() { function TabContent(_config, _request, _signs, _table, _events) { this._config = _config; this._request = _request; this._signs = _signs; this._table = _table; this._events = _events; this._$contentWrapperElement = this._config.jQuery(this._config.contentWrapperElement); this._createPreloaderElement(); } TabContent.prototype.updateHtml = function(tabItem, cb) { var cb1; if (this._isContentOk(tabItem)) { this._request.abortActiveRequest(Request.CONTEXT_TABLE_CONTENT); this._hidePreload(); this._signs.startUpdater(); this._showTab(tabItem); return typeof cb === "function" ? cb() : void 0; } else { cb1 = (function(that, tabItem, cb) { return function() { that._showTab(tabItem); return typeof cb === "function" ? cb() : void 0; }; })(this, tabItem, cb); return this._downloadContent(tabItem, cb1); } }; TabContent.prototype.hidePreload = function() { return this._hidePreload(); }; TabContent.prototype._showTab = function(tabItem) { var contentId; contentId = "box-table-type-" + (this._getSelectorPart(tabItem)); return this._$contentWrapperElement.find('>div[id^="box-table-type-"]').each((function(that, contentId) { return function(i, e) { var $e; $e = that._config.jQuery(e); if (e.id === contentId) { $e.show(); return that._events.fire('boxShow', tabItem, $e); } else if (e.id !== contentId && $e.is(":visible")) { $e.hide(); return that._events.fire('boxHide', tabItem, $e); } }; })(this, contentId)); }; TabContent.prototype._isContentOk = function(tabItem) { var contentId, selectorId; selectorId = this._getSelectorPart(tabItem); contentId = ("box-table-type-" + selectorId).replace(/\./g, '\\.'); return this._$contentWrapperElement.find(">div#" + contentId).length > 0 && this._getSign(tabItem) === this._getSignFromHtml(tabItem); }; TabContent.prototype._getSelectorPart = function(tabItem) { var part, tableTypeId; tableTypeId = tabItem.getTableTypeId(); part = tableTypeId + ""; if (this._table.isFormTable(tableTypeId) || this._table.isOverUnderTable(tableTypeId)) { part += '-' + tabItem.getUrlPart(); } return part; }; TabContent.prototype._getTableTypeUrlPart = function(tabItem) { var item, tableTypeId, url, urls; tableTypeId = tabItem.getTableTypeId(); urls = []; if (!(this._table.isFormTable(tableTypeId) || this._table.isOverUnderTable(tableTypeId))) { urls.push(tabItem.getUrlPart()); } item = tabItem; while (item.hasParentItem()) { item = item.getParentItem(); if (item.isRootItem()) { break; } urls.unshift(item.getUrlPart()); } url = urls.join('_'); if (urls.length === 1) { url += "_"; } return url; }; TabContent.prototype._wrapEmptyContent = function($content, tabItem) { var contentId, selectorId, signKey, tableTypeId; selectorId = this._getSelectorPart(tabItem); contentId = "box-table-type-" + selectorId; tableTypeId = tabItem.getTableTypeId(); signKey = this._table.getTabSignById(tableTypeId * 1); $content.wrapAll("
    "); return $content.parent(); }; TabContent.prototype._downloadContent = function(tabItem, cb) { var callback; this._events.fire('beforeBoxDownload', tabItem); this._signs.stopUpdater(); this._showPreload(); callback = (function(that, cb, tabItem) { return function(content) { var $content, boxClass; boxClass = 'glib-stats-box-' + tabItem.getId(); $content = that._config.jQuery('
    ').html(content).find('>div'); if ($content.hasClass('nodata-block')) { $content = that._wrapEmptyContent($content, tabItem); } $content.each((function(that) { return function(i, e) { var $el, id; id = (e.id + "").replace(/\./g, '\\.'); $el = that._$contentWrapperElement.find("#" + id); if ($el.length) { that._events.fire('beforeBoxReplace', tabItem, $el); } $el.remove(); return that._config.jQuery(e).addClass(boxClass); }; })(that)); that._$contentWrapperElement.append($content); that._hidePreload(); that._validateSign(tabItem); that._signs.startUpdater(); if (typeof cb === "function") { cb(); } return that._events.fire('afterBoxDownload', tabItem, $content); }; })(this, cb, tabItem); return this._request.getTableContent(this._getTableTypeUrlPart(tabItem), callback); }; TabContent.prototype._validateSign = function(tabItem) { var signKey, tableTypeId; tableTypeId = tabItem.getTableTypeId(); signKey = this._table.getTabSignById(tableTypeId * 1); if (!signKey) { return; } return this._signs.validateSign(signKey, this._getSignFromHtml(tabItem)); }; TabContent.prototype._getSign = function(tabItem) { var signKey, tableTypeId; tableTypeId = tabItem.getTableTypeId(); signKey = this._table.getTabSignById(tableTypeId * 1); if (!signKey) { return ''; } return this._signs.getSignValue(signKey); }; TabContent.prototype._getSignFromHtml = function(tabItem) { var $el, contentId, selectorId; selectorId = this._getSelectorPart(tabItem); contentId = ("box-table-type-" + selectorId).replace(/\./g, '\\.'); $el = this._$contentWrapperElement.find(">div#" + contentId); if (!$el.length) { return ''; } return $el.data('hash'); }; TabContent.prototype._createPreloaderElement = function() { var html; html = "
    " + this._config.txtLoading + "
    "; return this._$loaderElement = this._config.jQuery(html).appendTo(this._$contentWrapperElement); }; TabContent.prototype._showPreload = function() { return this._$loaderElement.show(); }; TabContent.prototype._hidePreload = function() { return this._$loaderElement.hide(); }; return TabContent; })(); TabItem = (function() { function TabItem(_tableTypeId, _tabFeedKey, sortKey, name, url, title, _defaultTabSort) { this._tableTypeId = _tableTypeId; this._tabFeedKey = _tabFeedKey; if (title == null) { title = ''; } this._defaultTabSort = _defaultTabSort != null ? _defaultTabSort : 0; this._data = { name: name, url: url, title: title, sortKey: sortKey }; this._children = []; this._checked = false; } TabItem.prototype.getUrl = function() { var url; url = ''; if (this.hasParentItem()) { url += this.getParentItem().getUrl(); } if (url) { url += ";"; } url += this.getUrlPart(); return url; }; TabItem.prototype.getUrlPart = function() { return this._data['url']; }; TabItem.prototype.getId = function() { var url; url = ''; if (this.hasParentItem()) { url += this.getParentItem().getId(); } if (url) { url += "-"; } return url += this._data['url']; }; TabItem.prototype.getTabFeedKey = function() { return this._tabFeedKey; }; TabItem.prototype.getIdJqSelector = function() { return this.getId().replace(/\./g, '\\.'); }; TabItem.prototype.getName = function() { return this.getValue('name'); }; TabItem.prototype.getTitle = function() { return this.getValue('title', ''); }; TabItem.prototype.getTableTypeId = function() { return this._tableTypeId; }; TabItem.prototype.getSortKey = function() { return this.getValue('sortKey', 999); }; TabItem.prototype.getValue = function(key, retValIfKeyNotFound) { if (retValIfKeyNotFound == null) { retValIfKeyNotFound = null; } if (this._data[key] != null) { return this._data[key]; } else { return retValIfKeyNotFound; } }; TabItem.prototype.getDefaultTabSort = function() { return this._defaultTabSort; }; TabItem.prototype.getParentItem = function() { return this._parentItem; }; TabItem.prototype.setParentItem = function(_parentItem) { this._parentItem = _parentItem; }; TabItem.prototype.hasParentItem = function() { return this._parentItem != null; }; TabItem.prototype.addChildren = function(children) { var child, _i, _len; for (_i = 0, _len = children.length; _i < _len; _i++) { child = children[_i]; this._children.push(child); child.setParentItem(this); } return this._children.sort(function(a, b) { var vA, vB; vA = a.getSortKey() * 1; vB = b.getSortKey() * 1; if (vA === vB) { return 0; } if (vA > vB) { return 1; } else { return -1; } }); }; TabItem.prototype.getChildren = function() { return this._children; }; TabItem.prototype.hasChildren = function() { return this._children.length > 0; }; TabItem.prototype.getContentElement = function() {}; TabItem.prototype.getContentElementId = function() {}; TabItem.prototype.setChecked = function(checked, bubble) { var checkedItem, item, _results; if (checked == null) { checked = true; } if (bubble == null) { bubble = false; } this._checked = !!checked; if (!bubble) { return; } item = this; while (item.hasParentItem()) { item = item.getParentItem(); item.setChecked(checked); } item = this; _results = []; while (item.hasChildren()) { checkedItem = item.getCheckedChild(); item = checkedItem ? checkedItem : item.getDefaultChild(); _results.push(item.setChecked(checked)); } return _results; }; TabItem.prototype.isChecked = function() { return this._checked; }; TabItem.prototype.isRootItem = function() { return false; }; TabItem.prototype.getSiblings = function() { var sibling, siblings, _i, _len, _ref; if (!this.hasParentItem()) { return []; } siblings = []; _ref = this.getParentItem().getChildren(); for (_i = 0, _len = _ref.length; _i < _len; _i++) { sibling = _ref[_i]; if (sibling !== this) { siblings.push(sibling); } } return siblings; }; TabItem.prototype.getDefaultChild = function() { var child, retChild, _i, _len, _ref; if (!this.hasChildren()) { return false; } retChild = false; _ref = this.getChildren(); for (_i = 0, _len = _ref.length; _i < _len; _i++) { child = _ref[_i]; if (retChild === false || child.getDefaultTabSort() > retChild.getDefaultTabSort()) { retChild = child; } } return retChild; }; TabItem.prototype.getCheckedChild = function() { var child, _i, _len, _ref; if (!this.hasChildren()) { return false; } _ref = this.getChildren(); for (_i = 0, _len = _ref.length; _i < _len; _i++) { child = _ref[_i]; if (child.isChecked()) { return child; } } return false; }; TabItem.prototype.getDeepestChild = function() { var checkedItem, item; if (this.hasChildren()) { checkedItem = this.getCheckedChild(); item = checkedItem ? checkedItem : this.getDefaultChild(); return item.getDeepestChild(); } return this; }; TabItem.prototype.getTopParentItem = function() { if (this.hasParentItem()) { return this.getParentItem().getTopParentItem(); } return this; }; TabItem.prototype.each = function(cb) { var child, ret, _i, _len, _ref; ret = false; if (this.hasChildren()) { _ref = this.getChildren(); for (_i = 0, _len = _ref.length; _i < _len; _i++) { child = _ref[_i]; if (ret) { break; } ret = child.each(cb); } } if (ret) { return ret; } ret = cb(this); return ret; }; return TabItem; })(); MainTabItem = (function(_super) { __extends(MainTabItem, _super); function MainTabItem() { MainTabItem.__super__.constructor.call(this, 0, [null, null], '', '', '', ''); } MainTabItem.prototype.isRootItem = function() { return true; }; MainTabItem.prototype.getDeepestChild = function() { if (!this.isChecked()) { return this; } return MainTabItem.__super__.getDeepestChild.call(this); }; return MainTabItem; })(TabItem); Table = (function() { Table.tableDefinition = { OVERALL: { id: 1, sign: 'SA' }, HOME: { id: 2, sign: 'SB' }, AWAY: { id: 3, sign: 'SC' }, ADVANCED: { id: 4, sign: 'SD' }, FORM_OVERALL: { id: 5, sign: 'SE' }, OVERUNDER_OVERALL: { id: 6, sign: 'SF' }, STREAKS: { id: 7, sign: 'SG' }, FORM_HOME: { id: 8, sign: 'SH' }, FORM_AWAY: { id: 9, sign: 'SI' }, TOP_SCORERS: { id: 10, sign: 'SJ' }, OVERUNDER_HOME: { id: 17, sign: 'SK' }, OVERUNDER_AWAY: { id: 18, sign: 'SL' }, HTFT_OVERALL: { id: 13, sign: 'SM' }, HTFT_HOME: { id: 14, sign: 'SN' }, HTFT_AWAY: { id: 15, sign: 'SO' }, LIVE_OVERALL: { id: 16, sign: 'ST' } }; function Table() { var data, key, _ref; this._tabIdToKey = {}; this._tabSignToKey = {}; _ref = Table.tableDefinition; for (key in _ref) { data = _ref[key]; this._tabIdToKey[data.id] = key; this._tabSignToKey[data.sign] = key; } } Table.prototype.getTabId = function(key) { if (Table.tableDefinition[key] == null) { return null; } return Table.tableDefinition[key].id; }; Table.prototype.getTabSign = function(key) { if (Table.tableDefinition[key] == null) { return null; } return Table.tableDefinition[key].sign; }; Table.prototype.getTabSignById = function(id) { if (this._tabIdToKey[id] == null) { return false; } return this.getTabSign(this._tabIdToKey[id]); }; Table.prototype.isFormTable = function(tableTypeId) { var _ref; return (_ref = tableTypeId * 1) === Table.tableDefinition.FORM_OVERALL.id || _ref === Table.tableDefinition.FORM_HOME.id || _ref === Table.tableDefinition.FORM_AWAY.id; }; Table.prototype.isOverUnderTable = function(tableTypeId) { var _ref; return (_ref = tableTypeId * 1) === Table.tableDefinition.OVERUNDER_OVERALL.id || _ref === Table.tableDefinition.OVERUNDER_HOME.id || _ref === Table.tableDefinition.OVERUNDER_AWAY.id; }; return Table; })(); Tabs = (function() { function Tabs(_stats) { var _ref; this._stats = _stats; _ref = this._stats, this._config = _ref._config, this._request = _ref._request, this._signs = _ref._signs, this._table = _ref._table, this._events = _ref._events; this._tabsMenu = null; this._currentUrl = ''; this._$menuWrapperElement = this._config.jQuery(this._config.menuWrapperElement); this._$statsWrapperElement = this._config.jQuery(this._config.statsWrapperElement); this._tabContent = new TabContent(this._config, this._request, this._signs, this._table, this._events); this._lastHashUrlData = {}; this._bindDomEvents(); this._signs.onChangeCallback(this._updated, this, true); this._signs.onChangeFinalCallback(this._updatedFinal, this, true); } Tabs.prototype.selectMenuItem = function(item) { var currentTab, oldTab; oldTab = this._tabsMenu.getDeepestChild(); this._tabsMenu.each(function(item) { item.setChecked(false); return false; }); item.setChecked(true, true); currentTab = this._tabsMenu.getDeepestChild(); this._onTabChangeCallback(currentTab, oldTab); return this._config.setLocationHash(this._tabsMenu.getDeepestChild().getUrl()); }; Tabs.prototype.selectMenuItemFromId = function(id) { var item, searchFunc; searchFunc = (function(id) { return function(item) { if (item.getId() === id) { return item; } }; })(id); item = this._tabsMenu.each(searchFunc); if (item === false || (this._tabsMenu && this._tabsMenu.getDeepestChild() === item.getDeepestChild())) { return false; } this.selectMenuItem(item); return true; }; Tabs.prototype.selectMenuItemFromHash = function() { var currentUrl, item, searchFunc, url; url = this._config.getLocationHash(); if (url === false) { return false; } currentUrl = this._tabsMenu.getDeepestChild().getUrl(); if (currentUrl === url || this._isUrlInLoop(url)) { return false; } searchFunc = (function(url) { return function(item) { if (item.getUrl() === url) { return item; } }; })(url); item = this._tabsMenu.each(searchFunc); if (!item) { this._tabsMenu.each(function(item) { item.setChecked(false); return false; }); item = this._tabsMenu.getDeepestChild(); } this.selectMenuItem(item); return true; }; Tabs.prototype.setCurrentItem = function() { if (!this._tabsMenu) { return; } return this.selectMenuItem(this._tabsMenu.getDeepestChild()); }; Tabs.prototype.updateMenuHtml = function(cb) { var callback; if (cb == null) { cb = function() {}; } callback = (function(that, cb) { return function(tabsMenu) { that._$menuWrapperElement.html((new MenuHtml(tabsMenu)).getMenuHtml()); return cb(); }; })(this, cb); return this._getTabsMenu(callback); }; Tabs.prototype.updateMenuHtmlFromHash = function() { var cb; cb = (function(_this) { return function() { if (!_this.selectMenuItemFromHash()) { _this.selectMenuItem(_this._tabsMenu.getDeepestChild()); return _this._updateMenuSelectedItem(); } }; })(this); return this.updateMenuHtml(cb); }; Tabs.prototype._isUrlInLoop = function(url) { var isLoop; isLoop = false; if (this._lastHashUrlData[url] != null) { clearTimeout(this._lastHashUrlData[url]); isLoop = true; } this._lastHashUrlData[url] = setTimeout((function(that, url) { return function() { return delete that._lastHashUrlData[url]; }; })(this, url), 100); return isLoop; }; Tabs.prototype._getTabsMenu = function(cb) { var callback; callback = (function(that, cb) { return function(signs) { that._tabsMenu = that._buildTabsMenu.call(that, signs); return typeof cb === "function" ? cb(that._tabsMenu) : void 0; }; })(this, cb); return this._signs.getSigns(callback); }; Tabs.prototype._buildTabsMenu = function(signs) { var actualTab, actualTabId, item, searchFunc, tabs, tabsMenu; if (this._tabsMenu) { actualTab = this._tabsMenu.getDeepestChild(); actualTabId = actualTab.getId(); } tabsMenu = new MainTabItem(); if ((signs != null ? signs.TB : void 0) != null) { tabs = this._prepareTabsItems(this._getTabsConfig()); tabsMenu.addChildren(tabs); } if (actualTabId != null) { searchFunc = (function(actualTabId) { return function(item) { if (item.getId() === actualTabId) { return item; } }; })(actualTabId); item = tabsMenu.each(searchFunc); if (item) { item.setChecked(true, true); } } return tabsMenu; }; Tabs.prototype._prepareTabsItems = function(items) { var addSubItems, allowedTab, item, ret, subTab, subTabItem, subTabItems, subTabs, tab, tabFeedKey, tableTypeId, _i, _len; allowedTab = this._signs.getAllowedTab(); ret = []; for (tableTypeId in items) { item = items[tableTypeId]; tableTypeId = tableTypeId * 1; if (!allowedTab.isAllowed(tableTypeId)) { continue; } tabFeedKey = [tableTypeId, null]; tab = new TabItem(tableTypeId, tabFeedKey, item.sortKey, item.name, item.url, item.title ? item.title : ''); addSubItems = item.has_sub_items; if (item.items != null) { subTabs = this._prepareTabsItems(item.items); if (subTabs.length > 1 || subTabs.length === 1 && subTabs[0].getTableTypeId() !== tab.getTableTypeId()) { tab.addChildren(subTabs); } else if (subTabs.length === 1 && subTabs[0].getTableTypeId() === tab.getTableTypeId() && subTabs[0].hasChildren()) { tab.addChildren(subTabs[0].getChildren()); } } if (addSubItems) { subTabs = allowedTab.getSubTabItems(tableTypeId); if (subTabs.length) { subTabItems = []; for (_i = 0, _len = subTabs.length; _i < _len; _i++) { subTabItem = subTabs[_i]; tabFeedKey = [tableTypeId, subTabItem.id]; subTab = new TabItem(tableTypeId, tabFeedKey, subTabItem.sortKey, subTabItem.name, subTabItem.url, (subTabItem.title ? subTabItem.title : ''), (subTabItem.defaultTabOrder ? subTabItem.defaultTabOrder : 0)); subTabItems.push(subTab); } tab.addChildren(subTabItems); } } ret.push(tab); } return ret; }; Tabs.prototype._bindDomEvents = function() { var hashChange; this._$statsWrapperElement.off('click').on('click', "" + this._config.menuWrapperElement + " ul li", this._config.menuWrapperElement, (function(_this) { return function(e) { var id; e.preventDefault(); id = _this._config.jQuery(e.target).closest('li').attr('id'); id = (id + "").replace(/^tabitem-/, ''); return _this.selectMenuItemFromId(id); }; })(this)); hashChange = (function(_this) { return function() { if (!_this._stats.isEnabled()) { return; } return _this.selectMenuItemFromHash(); }; })(this); return this._config.jQuery(window).off('hashchange', hashChange).on('hashchange', hashChange); }; Tabs.prototype._onTabChangeCallback = function(currentTab, prevTab) { var cb; if (currentTab.getId() === prevTab.getId()) { return; } if (prevTab.isRootItem()) { this._updateMenuSelectedItem(); this._tabContent.updateHtml(currentTab); return; } cb = (function(that) { return function() { if (that._updateMenuHtmlAfterNextTabChange === true) { that._updateMenuHtmlAfterNextTabChange = false; that._signs.updateAllowedTab(true); cb = (function(that) { return function() { return that._updateMenuSelectedItem(); }; })(that); return that.updateMenuHtml(cb); } else { return that._updateMenuSelectedItem(); } }; })(this); return this._tabContent.updateHtml(currentTab, cb); }; Tabs.prototype._updateMenuSelectedItem = function() { var cb, item, _ref; cb = (function(that) { return function(item) { var $els, itemIdJqSelector; itemIdJqSelector = item.getIdJqSelector(); if (!itemIdJqSelector) { return; } $els = that._$menuWrapperElement.find("#tabitem-" + itemIdJqSelector + ", #glib-stats-submenu-" + itemIdJqSelector); if (item.isChecked()) { $els.addClass('selected'); } else { $els.removeClass('selected'); } }; })(this); this._tabsMenu.each(cb); item = this._tabsMenu.getDeepestChild(); if ((_ref = item.getParentItem()) != null ? _ref.isRootItem() : void 0) { return this._$menuWrapperElement.find(">div.color-spacer").show(); } else { return this._$menuWrapperElement.find(">div.color-spacer").hide(); } }; Tabs.prototype._updated = function(key, value, prevValue) {}; Tabs.prototype._updatedFinal = function(what) { var cb, feedKey, tab; tab = this._tabsMenu.getDeepestChild(); feedKey = tab.getTabFeedKey(); cb = (function(tab, that) { return function() { that._updateMenuSelectedItem(); return that._tabContent.updateHtml(tab); }; })(tab, this); if ((what != null ? what.TB : void 0) === 1) { if (!this._signs.getAllowedTab().isAllowed(feedKey[0], feedKey[1])) { this._updateMenuHtmlAfterNextTabChange = true; return this._signs.getAllowedTab().setAllowed(feedKey[0], feedKey[1]); } else { return this.updateMenuHtml(cb); } } else { return cb(); } }; Tabs.prototype._getTabsConfig = function() { return this._config.jQuery.extend({}, this._config.tabsConfig, true); }; return Tabs; })(); }).call(this); ;// Generated by CoffeeScript 1.8.0 (function() { var TableSort, TableSortColumn, TableSortSorter; window.Stats2TableSort = TableSort = (function() { TableSort.SORT_OPTS_INDEX_METHOD = 0; TableSort.SORT_OPTS_INDEX_DIRECTION = 1; TableSort.SORT_OPTS_INDEX_PRIORITY = 2; function TableSort(_jQuery, _$contentWrapper, _sortOpts, _defaultOrderCb) { this._jQuery = _jQuery; this._$contentWrapper = _$contentWrapper; this._sortOpts = _sortOpts; this._defaultOrderCb = _defaultOrderCb != null ? _defaultOrderCb : function() { return 0; }; this._sortColumns = {}; this._bindArrowClick(); } TableSort.prototype.init = function($table, resetSorts) { var tableId; if (resetSorts == null) { resetSorts = false; } tableId = $table.attr('id'); return $table.find('thead').each((function(that, tableId) { return function(_, thead) { var $thead, groupId, setDefaultCol, theadIndex, _ref; $thead = that._jQuery(thead); theadIndex = $thead.index(); groupId = that._getGroupId(tableId, theadIndex); setDefaultCol = resetSorts || (((_ref = that._sortColumns) != null ? _ref[groupId] : void 0) == null); $thead.find('td, th').each((function(that, tableId, theadIndex) { return function(_, th) { return that._addSortColumn(tableId, theadIndex, th, resetSorts); }; })(that, tableId, theadIndex)); if (setDefaultCol) { that._setDefaultSortColumn(groupId); } return that._sort(groupId); }; })(this, tableId)); }; TableSort.prototype._sort = function(groupId) { var $oldRows, $rows, $tbody, $thead, activeColIndex, rows, sortColumn; sortColumn = this._getActiveSortColumn(groupId); if (sortColumn === false) { return; } $thead = this._jQuery(sortColumn.getJqTheadSelector()); $tbody = $thead.next('tbody'); activeColIndex = sortColumn.getThIndex(); $thead.find('tr.main td, tr.main th').each((function(that, activeColIndex, sortColumn) { return function(_, th) { var $a, $th; $th = that._jQuery(th); $a = $th.find('>a'); if ($th.index() === activeColIndex) { return $a.attr('class', "gTableSort-" + (sortColumn.getDirection()) + " gTableSort-on"); } else { return $a.attr('class', 'gTableSort-off'); } }; })(this, activeColIndex, sortColumn)); $oldRows = $tbody.find('>tr'); rows = (new TableSortSorter(sortColumn, $oldRows, this._defaultOrderCb)).sort(); $rows = this._jQuery(rows); $rows.find('td.col_sorted').removeClass('col_sorted'); $rows.find("td:nth-child(" + (activeColIndex + 1) + ")").addClass('col_sorted'); this._fixRowParity($rows, $tbody.data('visibleRows')); $oldRows.remove(); return $tbody.append($rows); }; TableSort.prototype._addSortColumn = function(tableId, theadIndex, thElement, reinit) { var $th, colId, direction, groupId, sortMethod, thIndex, thType, _ref, _ref1; if (reinit == null) { reinit = false; } $th = this._jQuery(thElement); thIndex = $th.index(); thType = $th.data('type'); if (((_ref = this._sortOpts) != null ? _ref[thType] : void 0) == null) { return; } groupId = this._getGroupId(tableId, theadIndex); colId = this._getColId(thType, thIndex); if (reinit) { this._sortColumns[groupId] = {}; } if (((_ref1 = this._sortColumns[groupId]) != null ? _ref1[colId] : void 0) == null) { if (this._sortColumns[groupId] == null) { this._sortColumns[groupId] = {}; } sortMethod = this._sortOpts[thType][TableSort.SORT_OPTS_INDEX_METHOD]; direction = this._sortOpts[thType][TableSort.SORT_OPTS_INDEX_DIRECTION]; this._sortColumns[groupId][colId] = new TableSortColumn(tableId, theadIndex, thType, thIndex, sortMethod, direction); } if ($th.hasClass('gTableSort-switch')) { return; } return this._wrapHeaderColumnContent($th); }; TableSort.prototype._getActiveSortColumn = function(groupId) { var sortColumn, _colId, _ref; if (this._sortColumns[groupId] == null) { return false; } _ref = this._sortColumns[groupId]; for (_colId in _ref) { sortColumn = _ref[_colId]; if (sortColumn.isActive()) { return sortColumn; } } return false; }; TableSort.prototype._setDefaultSortColumn = function(groupId) { var colId, colIdToSet, priority, priorityMax, sortColumn, type, _ref, _ref1, _ref2; if (this._sortColumns[groupId] == null) { return; } colIdToSet = null; priorityMax = -9999; _ref = this._sortColumns[groupId]; for (colId in _ref) { sortColumn = _ref[colId]; type = sortColumn.getType(); priority = ((_ref1 = this._sortOpts) != null ? (_ref2 = _ref1[type]) != null ? _ref2[TableSort.SORT_OPTS_INDEX_PRIORITY] : void 0 : void 0) != null ? this._sortOpts[type][TableSort.SORT_OPTS_INDEX_PRIORITY] : 0; if (priorityMax < priority) { colIdToSet = colId; priorityMax = priority; } } if (colIdToSet != null) { return this._setSortColumn(groupId, colIdToSet); } }; TableSort.prototype._setSortColumn = function(groupId, colId, switchDirectionIfIsActive) { var activeSortColumn, sortColumn, _colId, _ref, _results; if (switchDirectionIfIsActive == null) { switchDirectionIfIsActive = false; } if (this._sortColumns[groupId] == null) { return; } if (switchDirectionIfIsActive) { activeSortColumn = this._getActiveSortColumn(groupId); } _ref = this._sortColumns[groupId]; _results = []; for (_colId in _ref) { sortColumn = _ref[_colId]; if (_colId === colId) { sortColumn.setActive(true); if ((activeSortColumn != null) && activeSortColumn === sortColumn) { _results.push(sortColumn.switchDirection()); } else { _results.push(void 0); } } else { _results.push(sortColumn.setActive(false)); } } return _results; }; TableSort.prototype._wrapHeaderColumnContent = function($th) { return $th.wrapInner('').append('').wrapInner('').addClass('gTableSort-switch'); }; TableSort.prototype._addSortArrows = function() { return this._$tablesWrapper.each('table.stats-table'); }; TableSort.prototype._getGroupId = function(tableId, theadIndex) { return "" + tableId + "-" + theadIndex; }; TableSort.prototype._getColId = function(thType, thIndex) { return "" + thType + "-" + thIndex; }; TableSort.prototype._bindArrowClick = function() { return this._$contentWrapper.on('click', 'thead tr.main th,thead tr.main td a', (function(_this) { return function(e) { var $th, colId, groupId, tableId, thIndex, thType, theadIndex; $th = _this._jQuery(e.target).closest('th, td'); tableId = $th.closest('table').attr('id'); theadIndex = $th.closest('thead').index(); thType = $th.data('type'); if (thType == null) { return; } thIndex = $th.index(); groupId = _this._getGroupId(tableId, theadIndex); colId = _this._getColId(thType, thIndex); _this._setSortColumn(groupId, colId, true); _this._sort(groupId); e.preventDefault(); return e.stopPropagation(); }; })(this)); }; TableSort.prototype._fixRowParity = function($rows, visibleRows) { var $filteredOut, numHidden, numToShow; if (visibleRows == null) { visibleRows = 0; } $filteredOut = $rows.filter('.filtered-out'); numHidden = $rows.filter('.hidden').not($filteredOut).length; numToShow = visibleRows || $rows.length - numHidden; $rows.slice(numToShow).addClass('hidden'); return $rows.not($filteredOut).slice(0, numToShow).removeClass('hidden').each((function(_this) { return function(i, el) { return _this._jQuery(el).toggleClass('odd', i % 2 === 0).toggleClass('even', i % 2 === 1); }; })(this)); }; return TableSort; })(); TableSortColumn = (function() { function TableSortColumn(_tableId, _theadIndex, _thType, _thIndex, _sortMethod, _direction) { this._tableId = _tableId; this._theadIndex = _theadIndex; this._thType = _thType; this._thIndex = _thIndex; this._sortMethod = _sortMethod != null ? _sortMethod : 'number'; this._direction = _direction != null ? _direction : TableSortSorter.SORT_DIRECTION_ASC; this._defaultDirection = this._direction; this._isActive = false; } TableSortColumn.prototype.isActive = function() { return this._isActive; }; TableSortColumn.prototype.setActive = function(_isActive) { this._isActive = _isActive != null ? _isActive : true; }; TableSortColumn.prototype.switchDirection = function() { return this._direction = this._direction === TableSortSorter.SORT_DIRECTION_ASC ? TableSortSorter.SORT_DIRECTION_DESC : TableSortSorter.SORT_DIRECTION_ASC; }; TableSortColumn.prototype.getDirection = function() { return this._direction; }; TableSortColumn.prototype.getType = function() { return this._thType; }; TableSortColumn.prototype.getThIndex = function() { return this._thIndex; }; TableSortColumn.prototype.getJqTheadSelector = function() { return ("#" + this._tableId + " thead:nth-child(" + (this._theadIndex + 1) + ")").replace(/\./g, '\\.'); }; TableSortColumn.prototype.getSortMethod = function() { return this._sortMethod; }; TableSortColumn.prototype.getDefaultDirection = function() { return this._defaultDirection; }; return TableSortColumn; })(); TableSortSorter = (function() { TableSortSorter.SORT_DIRECTION_ASC = 'asc'; TableSortSorter.SORT_DIRECTION_DESC = 'desc'; function TableSortSorter(_sortColumn, _$rows, _defaultSortOrderCb) { this._sortColumn = _sortColumn; this._$rows = _$rows; this._defaultSortOrderCb = _defaultSortOrderCb; } TableSortSorter.SORTERS = { number: function(a, b) { if (this.getDirection() === TableSortSorter.SORT_DIRECTION_ASC) { return a - b; } else { return b - a; } }, string: function(a, b) { var num; if (a === b) { return 0; } num = a.localeCompare(b); if (this.getDirection() === TableSortSorter.SORT_DIRECTION_ASC) { return num; } else { return -num; } }, resultSum: function(a, b) { if (this.getDirection() === TableSortSorter.SORT_DIRECTION_ASC) { return a - b; } else { return b - a; } } }; TableSortSorter.MAPPERS = { number: function(row, cellIndex) { var cell, value; cell = row.childNodes[cellIndex] || { textContent: 0 }; value = (cell.textContent || cell.innerText) * 1; if (isNaN(value)) { return 0; } else { return value; } }, string: function(row, cellIndex) { var cell, value; cell = row.childNodes[cellIndex] || { textContent: '' }; value = cell.textContent || cell.innerText; return value.trim().toLowerCase(); }, resultSum: function(row, cellIndex) { var cell, value; cell = row.childNodes[cellIndex] || { textContent: '0:0' }; value = (cell.textContent || cell.innerText).split(':'); if (value.length === 2) { value = parseInt(value[0]) - parseInt(value[1]); } else { value = parseInt(value[0]); } if (isNaN(value)) { value = 0; } return value; } }; TableSortSorter.prototype.sort = function() { var cellIndex, m, map, newRows, type, _i, _len; type = this._sortColumn.getSortMethod(); cellIndex = this._sortColumn.getThIndex(); if (!((TableSortSorter.MAPPERS[type] != null) && (TableSortSorter.SORTERS[type] != null))) { return; } newRows = []; map = []; this._$rows.each((function(_this) { return function(i, e) { return map.push([i, TableSortSorter.MAPPERS[type](e, cellIndex)]); }; })(this)); map.sort((function(_this) { return function(a, b) { var ret; ret = TableSortSorter.SORTERS[type].call(_this._sortColumn, a[1], b[1]); if (!ret && (_this._defaultSortOrderCb != null)) { ret = _this._defaultSortOrderCb.call(_this._sortColumn, _this._$rows[a[0]], _this._$rows[b[0]]); } return ret; }; })(this)); for (_i = 0, _len = map.length; _i < _len; _i++) { m = map[_i]; newRows.push(this._$rows[m[0]]); } return newRows; }; return TableSortSorter; })(); }).call(this); ;/** * * */ function TabContainer(uid, pathArr, filterName, filterValues) { this._uid = uid; this._pathArr = pathArr; this.filterName = filterName; this.filterValues = filterValues; this.requestCounter = {}; this.currentRequestID = null; this.marginal = false; // zobrazuje sa na kraji, len ako 'more' bez dalsich zaloziek this._construct = function(uid) { // -- init if (!ls.TabContainerArr) { ls.TabContainerArr = new Array; $(document).ready(function() { // -- select tab from url ls.checkHash(); $("li.tabMore").live( "mouseenter", function() { $(this).addClass("hover"); }); $("li.tabMore").live("mouseleave", function() { $(this).removeClass("hover"); }); }); } this.setSize(); ls.TabContainerArr[ls.TabContainerArr.length] = this; }; this.bind = function(bindString) { this.bindString = bindString; }; this.setSize = function() { var parent = $('#tabSwitch_' + this._uid); var menuElements = parent.children('li'); var elementsWidth = 0; var parentWidth = parent.outerWidth(); var moreTabElement = parent.find('.tabMore'); var deltaSize = 2; if (this.marginal) { parentWidth = 0; } else if (parentWidth == 0) { return; } for (var i = 0; i < menuElements.length; i++) { if ($(menuElements[i]).hasClass('tabMore')) { continue; } elementsWidth += $(menuElements[i]).outerWidth(true); } elementsWidth = elementsWidth + deltaSize; if (parentWidth > elementsWidth) { moreTabElement.hide(); for (var i = 0; i < menuElements.length; i++) { if ($(menuElements[i]).hasClass('tabMore')) { continue; } $(menuElements[i]).show(); } } else { moreTabElement.find('.moreHref').html("more"); moreTabElement.removeClass('activeMore'); parentWidthAvailable = parentWidth - moreTabElement.outerWidth(true); var tempWidth = 0; var moreTabElementcontent = moreTabElement.find('ul'); moreTabElementcontent.html(''); var selectedTabIsvisible = true; for (var i = 0; i < menuElements.length; i++) { if ($(menuElements[i]).hasClass('tabMore')) { continue; } tempWidth += $(menuElements[i]).outerWidth(true); if (tempWidth < parentWidthAvailable) { $(menuElements[i]).show(); } else { var cloned = $(menuElements[i]).clone(); if (cloned.hasClass('active')) { selectedTabIsvisible = false; } if (moreTabElementcontent.html() == '') { cloned.addClass('first'); } cloned.show(); moreTabElementcontent.append(cloned); $(menuElements[i]).hide(); } } if (!selectedTabIsvisible) { moreTabElement.find('.moreHref').html(parent.children('li.active').text()); moreTabElement.addClass('activeMore'); parentWidthAvailable = parentWidth - moreTabElement.outerWidth(true); var tempWidth = 0; moreTabElementcontent.html(''); for (var i = 0; i < menuElements.length; i++) { if ($(menuElements[i]).hasClass('tabMore')) { continue; } tempWidth += $(menuElements[i]).outerWidth(true); if (tempWidth < parentWidthAvailable) { $(menuElements[i]).show(); } else { var cloned = $(menuElements[i]).clone(); if (moreTabElementcontent.html() == '') { cloned.addClass('first'); } cloned.show(); cloned.find('a').html(cloned.find('a').html().replace(/ /g, ' ')); moreTabElementcontent.append(cloned); $(menuElements[i]).hide(); } } } moreTabElement.show(); moreTabElement.addClass('hover'); moreTabElement.removeClass('hover'); } }; this.select = function(id) { var parent = $('#tabSwitch_' + this._uid); if (id == this.selectedTabId) { return; } this.selectedTabId = id; // -- deselect old var selected = parent.children('.active'); selected.removeClass('active'); var selectedId = selected.attr('class').replace('tabId_', ''); selectedId = selectedId.replace(' first', ''); selected.html(selected.children('strong').html()); $('#' + this._uid + '_' + selectedId).hide(); // -- select new // ---------- var toSelect = parent.children('.tabId_' + id); toSelect.addClass('active'); toSelect.html('' + toSelect.html() + ''); $('#' + this._uid + '_' + id).show(); if (this.bindString) { var bindElement = eval(this.bindString); var val = false; if (this.filterValues[id]) { val = this.filterValues[id]; } bindElement.setFilterValue(this.filterName, val); } this.ajaxRequest(id); for (var i = 0; i < ls.TabContainerArr.length; i++) { container = ls.TabContainerArr[i]; container.setSize(); } return false; }; this.ajaxRequest = function(id) { var element = $('#' + this._uid + '_' + id); if (element.get(0)) { if (element.html() == '' && this.requestCounter[id] == undefined) { this.requestCounter[id] = 0; element.html('
    '); var baseUrl = (window.location + "").split('#')[0]; baseUrl = baseUrl.split('?')[0]; this.requestCounter[id]++; this.currentRequestID = id; var onResponse = getRefecence(this, '_onAjaxResponse'); $.post(baseUrl + '?block=' + id, {'ret': {'id': this._uid + '_' + id}}, onResponse); } else { if (this._uid != 'betType') { $("[id^=" + this._uid + '_' + "]").addClass('tabHidden').hide(); element.removeClass('tabHidden').show(); } } } }; this._onAjaxResponse = function(data, status, params) { var spl = data.split(':|:'); data = $.parseJSON(spl[0]); var html = spl[1]; if (html.match(/system fail/g)) { if (this.requestCounter[this.currentRequestID] > 1) { this.handelError(this.currentRequestID); } else { this.ajaxRequest(this.currentRequestID); } } else { var element = $('#' + data.id); element.html(html); $("ul").delegate("li.tabMore", "mouseenter", function() { $(this).addClass("hover"); }); $("ul").delegate("li.tabMore", "mouseleave", function() { $(this).removeClass("hover"); }); if (!element) { return this; } element.find('script').each(function(script) { if (this.type != 'text/javascript') { return; } if (this.src) { //Asset.javascript(script.src); } else if (this.innerHTML.trim()) { eval.call(null, this.innerHTML); } }); } ls.changeTimeZoneTime(element); ls.setTitles(element); }; this.handleError = function(id) { var element = $('#' + id); if (element.get(0)) { element.html('
    Requesting data failed!
    Apologize for any inconvenience.
    '); } }; this._construct(uid); };; function LivescoreHandler(){ this.startTime = null; this.first = true; this.timingElements = {}; this.update = function() { if(!ls._sportId)return; var date = new Date(); var time = Math.floor(date.getTime()/10000); $.get('/feed/score/' + ls._sportId + '-' + (Math.floor(ls.tz.timeStamp/10) + (time - (this.startTime || time))) + '.dat', function(result){this.onUpdate(result, 'ajax')}.bind(this)); this.startTime = this.startTime || time; }; this.onUpdate = function(result, source) { source = source || 'ajax'; var data; if (source == 'ajax') { data = $.parseJSON(result); } else { var tmpData = $.parseJSON(result); if (tmpData.data != undefined) { data = tmpData.data; } } if(!data){ return; } this.data = data; if (source == 'ajax') { this.t = setTimeout(getRefecence(this, 'update'),10000); } this.render($('body')); }; this.render = function (parent) { var els = parent.find('[xseid]'); for(var k=0 ; k< els.length ; k++) { var el = $(els[k]); var ignoreTable = ['TeamResultsTableBlockOverview']; var skip = false; $.each(ignoreTable, function(i, cls) { if(el.parents('.' + cls).length > 0) { skip = true; } }); if (skip) { continue; } var eventId = el.attr('xseid'); if(!this.data[eventId]) { if (el.text() == 'stats') { el.removeClass(); el.addClass('result-stats'); } else { var results = el.text().replace(/ /gi, '').split('-'); if (results.length == 2) { var homeResult = results[0] * 1; var awayResult = results[1] * 1; var tdHome = el.parent().find('td.table-home'); var tdAway = el.parent().find('td.table-away'); if(homeResult > awayResult) { if (tdHome.get(0)) { tdHome.css({'font-weight': 700}); } if (tdAway.get(0)) { tdAway.css({'font-weight': 300}); } } if(homeResult < awayResult) { if (tdHome.get(0)) { tdHome.css({'font-weight': 300}); } if (tdAway.get(0)) { tdAway.css({'font-weight': 700}); } } } el.removeClass(); el.addClass('result-neutral'); } var par = el.parent(); if(par.hasClass('event-header-date')){ el.hide(); } if(this.timingElements[eventId]) { $.each(this.timingElements[eventId], function(i, e){ e.removeClass('result-live'); if (e.attr('xoldtime')) { e.html(e.attr('xoldtime')); } var par = e.parent(); if(par.hasClass('event-header-date')){ e.hide(); } }); } continue; } var row = this.data[eventId]; var resCell = $(els[k]); var text = row['score']['current'].replace(':',' - '); var aEl = resCell.find('a'); var cell = aEl.get(0) ? aEl : resCell; cell.html(text); resCell.addClass('result-live'); var resCellParent = resCell.parent().parent().parent(); resCellParent.find('[xspeid='+eventId+']').html('(' + row['score']['full'].replace(/:/g,' - ').replace(/,/g, ', ') + ')'); var timing = row['stage']['l']; var longTiming = row['stage']['l']; var max_char = row['timing'] ? 6 : 10; if(timing.length > max_char){ timing = row['stage']['s']; } if(row['timing']) { if(row['SOT']) // show only timing { timing = ' ' + row['timing'] + "' "; longTiming += ' ' + row['timing'] + "'"; }else { timing+= ' ' + row['timing'] + "' "; longTiming += ' ' + row['timing'] + "'"; } } if (row['paused']) { longTiming = row['stage']['last-status']; } if(timing) { var timingElement = resCellParent.find('[xteid='+eventId+']'); if (!timingElement.attr('xoldtime')) { var oldtime = timingElement.html(); } if(this.first) { if(!this.timingElements[eventId]){ this.timingElements[eventId] = []; } this.timingElements[eventId].push(timingElement); } timingElement.attr('xoldtime', oldtime); timingElement.html(timing); timingElement.attr('title', longTiming); timingElement.addClass('result-live'); timingElement.unbind().mouseover(function(e) { var title = $(e.target).attr('title'); if(title) { // formating title = title.replace(/\[b\]/i, ''); title = title.replace(/\[\/b\]/i, ''); title = title.replace(/\[br\]/ig, '
    '); title = title.replace(/\[u\]/i, ' » '); title = title.replace(/\[d\]/i, ' » '); title = title.replace(/\n/g, "
    "); title = title.replace(/\\'/g, '\''); $(e.target).attr('title', title); } if(this.className != 'name_fixed_1' && this.className != 'name_fixed_2'){ ls.tt.show(this,this,false); } }); timingElement.mouseout(function() { ls.tt.hide(this); }); } } this.initBlink(); if(timing){ this.first = false; } }; this.initBlink = function() { if(!this.bt)this.blinkDown(); }; this.blinkUp = function() { this.bt = setTimeout(getRefecence(this, 'blinkDown'),500); $('.result-live').addClass('blink'); }; this.blinkDown = function() { this.bt = setTimeout(getRefecence(this, 'blinkUp'),3000); $('.result-live').removeClass('blink'); }; // this.update(); };;function FavoriteHandler() { this.sortArray = {}; this.userData = []; this.manageLi = null; this.addText = 'Add %name% to My Favorites'; this.removeText = 'Remove %name% from My Favorites'; this.render = function(userData) { var favorites = $('#favMenu'); if ($('#sports-menu').get(0) && favorites.get(0)) { if (userData != undefined) { this.userData = userData; } this.initSortArray(); var contentArray = {}; favorites.html(''); var cnt = 0; if (this.userData.length > 0) { var body = $('body'); $.each(this.userData, function(i, leagueId) { if (this.sortArray[leagueId] != undefined) { contentArray[this.sortArray[leagueId].sort] = this.sortArray[leagueId].element.clone(); contentArray[this.sortArray[leagueId].sort].find('.favRemove').click(function() { this.remove(leagueId, this.sortArray[leagueId].name); }.bind(this)); this.updateCheckBoxes(leagueId, 'add'); this.updateCustomizeBlock(leagueId, this.sortArray[leagueId].name, 'add'); } }.bind(this)); if (!$.isEmptyObject(contentArray)) { $.each(contentArray, function(i, el) { favorites.append(el); cnt++; }); } } $('#favCnt').text(cnt); favorites.append(this.manageLi.clone()); } }; this.initSortArray = function() { if ($.isEmptyObject(this.sortArray)) { var i = 1; $.each($('.sport'), function(sportIndex, sportEl) { $.each($(sportEl).find('li.country'), function(countryIndex, countryEl) { $.each($(countryEl).find('li.league'), function(leagueIndex, leagueEl) { leagueEl = $(leagueEl); var matchCnt = ''; if (leagueEl.find('.matchCnt').get(0) && leagueEl.find('.matchCnt').text()) { matchCnt = ' ' + leagueEl.find('.matchCnt').text(); } //var leagueName = leagueEl.text().replace(matchCnt, ''); var leagueName = leagueEl.text().replace(matchCnt, ''); var leagueUrl = leagueEl.find('a').attr('href'); var leagueId = leagueEl.find('a').attr('rel'); var finalEl = '
  • ' + leagueName + matchCnt + '
  • '; finalEl = $(finalEl); var id = $(leagueEl).attr('id').replace('l_', ''); this.sortArray[id] = { 'sort': i, 'name': leagueName, 'element': finalEl }; i++; }.bind(this)); }.bind(this)); }.bind(this)); this.manageLi = $('#favInfo').clone(); } }; this.togle = function(idTournament, nameTournament, ref) { if (this.userData.indexOf(idTournament) > -1) { this.remove(idTournament, nameTournament); } else { this.add(idTournament, nameTournament, ref); } return false; }; this.add = function(idTournament, nameTournament, ref) { this.updateCustomizeBlock(idTournament, nameTournament, 'add'); this.updateCheckBoxes(idTournament, 'add'); globals.effects.animateAddFavorite(ref); var date = new Date(); $.get('/ajax-bookmarks-tournament/x/' + idTournament + '/add/?' + date.getTime(), getRefecence(this, 'onChange')); }; this.remove = function(idTournament, nameTournament) { this.updateCustomizeBlock(idTournament, nameTournament, 'remove'); this.updateCheckBoxes(idTournament, 'remove'); var date = new Date(); $.get('/ajax-bookmarks-tournament/x/' + idTournament + '/remove/?' + date.getTime(), getRefecence(this, 'onChange')); }; this.onChange = function(result) { var data = $.parseJSON(result); if (!data) { data = []; } this.render(data); }; this.updateCustomizeBlock = function(idTournament, nameTournament, type) { var targetEl = $('#customizeMenuHref' + idTournament); if (targetEl.get(0) && type != undefined && nameTournament != undefined) { if (type == 'add') { targetEl.removeClass('addFavorite').addClass('removeFavorite').html(this.removeText.replace('%name%', nameTournament)); } else { targetEl.removeClass('removeFavorite').addClass('addFavorite').html(this.addText.replace('%name%', nameTournament)); } } }; this.updateCheckBoxes = function(idTournament, type) { var targetEl = $('input.fav' + idTournament); if (targetEl.get(0) && type != undefined) { if (type == 'add') { targetEl.addClass('favorited'); $('.fav' + idTournament).addClass('favorited'); } else { targetEl.removeClass('favorited'); $('.fav' + idTournament).removeClass('favorited'); } targetEl.attr('checked', type == 'add'); } }; /** * togles fav menu visibility */ this.togleMenu = function() { if ($('#favMenu').is(':hidden')) { this.openMenu(); } else { this.closeMenu(); } }; this.openMenu = function(sendAjax) { var date = new Date(); $('#favMenu').show(); $('#myLeagues').find('.header').children('span').removeClass('plus'); if (sendAjax == undefined || sendAjax) { $.get('/ajax-set-cookie/MyBlock/FavMenu/open/?' + date.getTime()); } }; this.closeMenu = function(sendAjax) { var date = new Date(); $('#favMenu').hide(); $('#myLeagues').find('.header').children('span').addClass('plus'); if (sendAjax == undefined || sendAjax) { $.get('/ajax-set-cookie/MyBlock/FavMenu/close/?' + date.getTime()); } }; };/** * Class for detecting timezone * * @version 1.0 * @author LiveSport s.r.o. */ function TimezoneDetector(timeStamp, serverOffset){ this.timeStamp = timeStamp; this.serverOffset = serverOffset; /** * */ this.detect = function(altName){ var winter = new Date(2010,01,01); var summer = new Date(2010,07,01); var winterOffset = winter.getTimezoneOffset() * -60; var summerOffset = summer.getTimezoneOffset() * -60; var match; if(this.tz && this.tz[summerOffset] && this.tz[summerOffset][winterOffset]){ match = this.tz[summerOffset][winterOffset]; }else{ // not able to match timezone return false; } var matchElement = match[0]; if(match.length > 1){ for(var i=0 ; i < match.length ; i++){ if(match[i]['c']){ //countrycode matches matchElement = match[i]; break; } } } if(this.onDetect){ ls.setTimeZonedetected(matchElement['n'], matchElement['o']); } return matchElement; }; this.estimateTimeZone = function(offset){ // check if its winter or summer time var winter = new Date(2010,01,01); var summer = new Date(2010,07,01); var now = new Date(); var winterOffset = winter.getTimezoneOffset(); var summerOffset = summer.getTimezoneOffset(); var nowOffset = now.getTimezoneOffset(); var isSummerTime = null; if(summerOffset == winterOffset){ var timeZoneTryOrder = new Array(0, 1, 3, 2, 4); }else if(nowOffset == winterOffset){ var timeZoneTryOrder = new Array(3, 4, 0, 1, 2); }else if(nowOffset == summerOffset){ var timeZoneTryOrder = new Array(1, 2, 0, 3, 4); } offset = offset * 3600; var tryTimeSummer = new Array; var tryTimeWinter = new Array; tryTimeSummer[0] = offset; tryTimeWinter[0] = offset; tryTimeSummer[1] = offset; tryTimeWinter[1] = offset - 1*3600; tryTimeSummer[2] = offset; tryTimeWinter[2] = offset + 1*3600; tryTimeSummer[3] = offset + 1*3600; tryTimeWinter[3] = offset; tryTimeSummer[4] = offset - 1*3600; tryTimeWinter[4] = offset; var tryIndex; var match; for(var i=0; i < timeZoneTryOrder.length ; i++){ tryIndex = timeZoneTryOrder[i]; var match = this.tryOffset(tryTimeSummer[tryIndex], tryTimeWinter[tryIndex]); if(match){ break; } } return match[0]['n']; }; this.tryOffset = function(summerOffset, winterOffset){ if(this.tz && this.tz[summerOffset] && this.tz[summerOffset][winterOffset]){ return this.tz[summerOffset][winterOffset]; }else{ return false; } }; /** * sets detect type */ this.dt = function(detectType, currentOffset){ this.detectType = detectType; this.currentOffset = currentOffset; }; /** * * @returns boolint */ this.detectDST = function(){ var winter = new Date(2010,01,01); var summer = new Date(2010,07,01); var now = new Date(); var winterOffset = winter.getTimezoneOffset(); var summerOffset = summer.getTimezoneOffset(); var nowOffset = now.getTimezoneOffset(); this.observingDST = (summerOffset != winterOffset); this.hemisphere = (winterOffset < summerOffset) + 1; if(this.hemisphere == 1){ this.havingDST = (nowOffset == summerOffset) }else{ this.havingDST = (nowOffset == winterOffset) } }; /** * to be overwritten by implementor */ this.onDetect = function(timeZoneName){ }; };;/** * * */ function BlockHandler(uid){ this.requestCounter = {}; this.onDomReady = function() { var target = $('.boxContent'); if(target.get(0)) { target.mouseenter(function(){ $(this).find('.boxButton').show(); }); target.mouseleave(function(){ $(this).find('.boxButton').hide(); }); } }; this.togle = function(uid, blockKey) { if($('#' + uid).children('.boxContentIn:visible').length > 0){ this.collapse(uid, blockKey); }else{ this.expand(uid, blockKey); } }; this.collapse = function(uid, blockKey, skipAjax) { var target = $('#' + uid); if(target.get(0)) { target.children('.boxContentIn').hide(); var el = target.find('.collapseBox'); el.addClass('expandBox'); el.removeClass('collapseBox'); target.find('.collapseInfo').show(); target.find('h3').hide(); if(skipAjax){ }else{ var date = new Date(); $.get('/ajax-set-cookie/MyBlock/' + blockKey + '/close/?' + date.getTime()); } } }; this.expand = function(uid, blockKey, skipAjax) { var target = $('#' + uid); if(target.get(0)) { target.find('.boxContentIn').show(); var el = target.find('.expandBox'); el.addClass('collapseBox'); el.removeClass('expandBox'); target.find('.collapseInfo').hide(); target.find('h3').show(); if(skipAjax){ }else{ var date = new Date(); $.get('/ajax-set-cookie/MyBlock/' + blockKey + '/open/?' + date.getTime()); } } }; this.registerDelayed = function(uid){ $('#' + uid).html('
    '); this.getContent(uid); }; this.getContent = function(uid) { var loc = (window.location+'').split('?')[0].split('#')[0]; $.post(loc + '?blockcontent=' + uid + '', function(data, status) { var target = $('#' + uid); if(target.get(0)) { var spl = data.split(':||:'); if (typeof spl[1] == 'undefined' || spl[1].match(/system fail/g)) { if(this.requestCounter[uid] == undefined) { this.requestCounter[uid] = 0; } this.requestCounter[uid]++; if (this.requestCounter[uid] > 1) { this.handelError(uid); } else { this.getContent(uid); } } else { target.html(spl[1]); this.requestCounter[uid] = 0; // ls.formatOdds('#' + uid); ls.changeTimeZoneTime(target); ls.setTitles(target); } } }.bind(this) ).fail(function(){this.handelError(uid);}.bind(this)); }; this.handelError = function(uid) { $('#' + uid).remove(); }; }; ;// Generated by CoffeeScript 1.4.0 /* jQuery Waypoints - v2.0.2 Copyright (c) 2011-2013 Caleb Troughton Dual licensed under the MIT license and GPL license. https://github.com/imakewebthings/jquery-waypoints/blob/master/licenses.txt */ (function(){var t=[].indexOf||function(t){for(var e=0,n=this.length;e=0;s={horizontal:{},vertical:{}};f=1;a={};u="waypoints-context-id";p="resize.waypoints";y="scroll.waypoints";v=1;w="waypoints-waypoint-ids";g="waypoint";m="waypoints";o=function(){function t(t){var e=this;this.$element=t;this.element=t[0];this.didResize=false;this.didScroll=false;this.id="context"+f++;this.oldScroll={x:t.scrollLeft(),y:t.scrollTop()};this.waypoints={horizontal:{},vertical:{}};t.data(u,this.id);a[this.id]=this;t.bind(y,function(){var t;if(!(e.didScroll||c)){e.didScroll=true;t=function(){e.doScroll();return e.didScroll=false};return r.setTimeout(t,n[m].settings.scrollThrottle)}});t.bind(p,function(){var t;if(!e.didResize){e.didResize=true;t=function(){n[m]("refresh");return e.didResize=false};return r.setTimeout(t,n[m].settings.resizeThrottle)}})}t.prototype.doScroll=function(){var t,e=this;t={horizontal:{newScroll:this.$element.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.$element.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};if(c&&(!t.vertical.oldScroll||!t.vertical.newScroll)){n[m]("refresh")}n.each(t,function(t,r){var i,o,l;l=[];o=r.newScroll>r.oldScroll;i=o?r.forward:r.backward;n.each(e.waypoints[t],function(t,e){var n,i;if(r.oldScroll<(n=e.offset)&&n<=r.newScroll){return l.push(e)}else if(r.newScroll<(i=e.offset)&&i<=r.oldScroll){return l.push(e)}});l.sort(function(t,e){return t.offset-e.offset});if(!o){l.reverse()}return n.each(l,function(t,e){if(e.options.continuous||t===l.length-1){return e.trigger([i])}})});return this.oldScroll={x:t.horizontal.newScroll,y:t.vertical.newScroll}};t.prototype.refresh=function(){var t,e,r,i=this;r=n.isWindow(this.element);e=this.$element.offset();this.doScroll();t={horizontal:{contextOffset:r?0:e.left,contextScroll:r?0:this.oldScroll.x,contextDimension:this.$element.width(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:r?0:e.top,contextScroll:r?0:this.oldScroll.y,contextDimension:r?n[m]("viewportHeight"):this.$element.height(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};return n.each(t,function(t,e){return n.each(i.waypoints[t],function(t,r){var i,o,l,s,f;i=r.options.offset;l=r.offset;o=n.isWindow(r.element)?0:r.$element.offset()[e.offsetProp];if(n.isFunction(i)){i=i.apply(r.element)}else if(typeof i==="string"){i=parseFloat(i);if(r.options.offset.indexOf("%")>-1){i=Math.ceil(e.contextDimension*i/100)}}r.offset=o-e.contextOffset+e.contextScroll-i;if(r.options.onlyOnScroll&&l!=null||!r.enabled){return}if(l!==null&&l<(s=e.oldScroll)&&s<=r.offset){return r.trigger([e.backward])}else if(l!==null&&l>(f=e.oldScroll)&&f>=r.offset){return r.trigger([e.forward])}else if(l===null&&e.oldScroll>=r.offset){return r.trigger([e.forward])}})})};t.prototype.checkEmpty=function(){if(n.isEmptyObject(this.waypoints.horizontal)&&n.isEmptyObject(this.waypoints.vertical)){this.$element.unbind([p,y].join(" "));return delete a[this.id]}};return t}();l=function(){function t(t,e,r){var i,o;r=n.extend({},n.fn[g].defaults,r);if(r.offset==="bottom-in-view"){r.offset=function(){var t;t=n[m]("viewportHeight");if(!n.isWindow(e.element)){t=e.$element.height()}return t-n(this).outerHeight()}}this.$element=t;this.element=t[0];this.axis=r.horizontal?"horizontal":"vertical";this.callback=r.handler;this.context=e;this.enabled=r.enabled;this.id="waypoints"+v++;this.offset=null;this.options=r;e.waypoints[this.axis][this.id]=this;s[this.axis][this.id]=this;i=(o=t.data(w))!=null?o:[];i.push(this.id);t.data(w,i)}t.prototype.trigger=function(t){if(!this.enabled){return}if(this.callback!=null){this.callback.apply(this.element,t)}if(this.options.triggerOnce){return this.destroy()}};t.prototype.disable=function(){return this.enabled=false};t.prototype.enable=function(){this.context.refresh();return this.enabled=true};t.prototype.destroy=function(){delete s[this.axis][this.id];delete this.context.waypoints[this.axis][this.id];return this.context.checkEmpty()};t.getWaypointsByElement=function(t){var e,r;r=n(t).data(w);if(!r){return[]}e=n.extend({},s.horizontal,s.vertical);return n.map(r,function(t){return e[t]})};return t}();d={init:function(t,e){var r;if(e==null){e={}}if((r=e.handler)==null){e.handler=t}this.each(function(){var t,r,i,s;t=n(this);i=(s=e.context)!=null?s:n.fn[g].defaults.context;if(!n.isWindow(i)){i=t.closest(i)}i=n(i);r=a[i.data(u)];if(!r){r=new o(i)}return new l(t,r,e)});n[m]("refresh");return this},disable:function(){return d._invoke(this,"disable")},enable:function(){return d._invoke(this,"enable")},destroy:function(){return d._invoke(this,"destroy")},prev:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(e>0){return t.push(n[e-1])}})},next:function(t,e){return d._traverse.call(this,t,e,function(t,e,n){if(et.oldScroll.y})},left:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset<=t.oldScroll.x})},right:function(t){if(t==null){t=r}return h._filter(t,"horizontal",function(t,e){return e.offset>t.oldScroll.x})},enable:function(){return h._invoke("enable")},disable:function(){return h._invoke("disable")},destroy:function(){return h._invoke("destroy")},extendFn:function(t,e){return d[t]=e},_invoke:function(t){var e;e=n.extend({},s.vertical,s.horizontal);return n.each(e,function(e,n){n[t]();return true})},_filter:function(t,e,r){var i,o;i=a[n(t).data(u)];if(!i){return[]}o=[];n.each(i.waypoints[e],function(t,e){if(r(i,e)){return o.push(e)}});o.sort(function(t,e){return t.offset-e.offset});return n.map(o,function(t){return t.element})}};n[m]=function(){var t,n;n=arguments[0],t=2<=arguments.length?e.call(arguments,1):[];if(h[n]){return h[n].apply(null,t)}else{return h.aggregate.call(null,n)}};n[m].settings={resizeThrottle:100,scrollThrottle:30};return i.load(function(){return n[m]("refresh")})})}).call(this);;(function($) { $.confirm = function(params) { if ($('#confirmOverlay').length) { // A confirm is already shown on the page: return false; } var buttonHTML = ''; $.each(params.buttons, function(name, obj) { // Generating the markup for the buttons: buttonHTML += '' + name + ''; if (!obj.action) { obj.action = function() { }; } }); var markup = [ '
    ', '
    ', '

    ', params.title, '

    ', '

    ', params.message, '

    ', '
    ', buttonHTML, '
    ' ].join(''); $(markup).hide().appendTo('body').fadeIn(); $('#confirmOverlay').click(function(){ $.confirm.hide(); }); var buttons = $('#confirmBox .button'), i = 0; $.each(params.buttons, function(name, obj) { buttons.eq(i++).click(function() { // Calling the action attribute when a // click occurs, and hiding the confirm. obj.action(); $.confirm.hide(); return false; }); }); }; $.confirm.hide = function() { $('#confirmOverlay').fadeOut(function() { $(this).remove(); }); }; })(jQuery);;function phpJsDate(format, timestamp) { // http://kevin.vanzonneveld.net // + original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com) // + parts by: Peter-Paul Koch (http://www.quirksmode.org/js/beat.html) // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: MeEtc (http://yass.meetcweb.com) // + improved by: Brad Touesnard // + improved by: Tim Wiel // + improved by: Bryan Elliott // + improved by: Brett Zamir (http://brett-zamir.me) // + improved by: David Randall // + input by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: Brett Zamir (http://brett-zamir.me) // + improved by: Brett Zamir (http://brett-zamir.me) // + improved by: Theriault // + derived from: gettimeofday // + input by: majak // + bugfixed by: majak // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + input by: Alex // + bugfixed by: Brett Zamir (http://brett-zamir.me) // + improved by: Theriault // + improved by: Brett Zamir (http://brett-zamir.me) // + improved by: Theriault // + improved by: Thomas Beaucourt (http://www.webapp.fr) // + improved by: JT // + improved by: Theriault // + improved by: Rafał Kukawski (http://blog.kukawski.pl) // % note 1: Uses global: php_js to store the default timezone // * example 1: date('H:m:s \\m \\i\\s \\m\\o\\n\\t\\h', 1062402400); // * returns 1: '09:09:40 m is month' // * example 2: date('F j, Y, g:i a', 1062462400); // * returns 2: 'September 2, 2003, 2:26 am' // * example 3: date('Y W o', 1062462400); // * returns 3: '2003 36 2003' // * example 4: x = date('Y m d', (new Date()).getTime()/1000); // * example 4: (x+'').length == 10 // 2009 01 09 // * returns 4: true // * example 5: date('W', 1104534000); // * returns 5: '53' // * example 6: date('B t', 1104534000); // * returns 6: '999 31' // * example 7: date('W U', 1293750000.82); // 2010-12-31 // * returns 7: '52 1293750000' // * example 8: date('W', 1293836400); // 2011-01-01 // * returns 8: '52' // * example 9: date('W Y-m-d', 1293974054); // 2011-01-02 // * returns 9: '52 2011-01-02' var that = this, jsdate, f, formatChr = /\\?([a-z])/gi, formatChrCb, // Keep this here (works, but for code commented-out // below for file size reasons) //, tal= [], _pad = function (n, c) { if ((n = n + "").length < c) { return new Array((++c) - n.length).join("0") + n; } else { return n; } }, txt_words = ["Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], txt_ordin = { 1: "st", 2: "nd", 3: "rd", 21: "st", 22: "nd", 23: "rd", 31: "st" }; formatChrCb = function (t, s) { return f[t] ? f[t]() : s; }; f = { // Day d: function () { // Day of month w/leading 0; 01..31 return _pad(f.j(), 2); }, D: function () { // Shorthand day name; Mon...Sun return f.l().slice(0, 3); }, j: function () { // Day of month; 1..31 return jsdate.getDate(); }, l: function () { // Full day name; Monday...Sunday return txt_words[f.w()] + 'day'; }, N: function () { // ISO-8601 day of week; 1[Mon]..7[Sun] return f.w() || 7; }, S: function () { // Ordinal suffix for day of month; st, nd, rd, th return txt_ordin[f.j()] || 'th'; }, w: function () { // Day of week; 0[Sun]..6[Sat] return jsdate.getDay(); }, z: function () { // Day of year; 0..365 var a = new Date(f.Y(), f.n() - 1, f.j()), b = new Date(f.Y(), 0, 1); return Math.round((a - b) / 864e5) + 1; }, // Week W: function () { // ISO-8601 week number var a = new Date(f.Y(), f.n() - 1, f.j() - f.N() + 3), b = new Date(a.getFullYear(), 0, 4); return 1 + Math.round((a - b) / 864e5 / 7); }, // Month F: function () { // Full month name; January...December return txt_words[6 + f.n()]; }, m: function () { // Month w/leading 0; 01...12 return _pad(f.n(), 2); }, M: function () { // Shorthand month name; Jan...Dec return f.F().slice(0, 3); }, n: function () { // Month; 1...12 return jsdate.getMonth() + 1; }, t: function () { // Days in month; 28...31 return (new Date(f.Y(), f.n(), 0)).getDate(); }, // Year L: function () { // Is leap year?; 0 or 1 var y = f.Y(), a = y & 3, b = y % 4e2, c = y % 1e2; return 0 + (!a && (c || !b)); }, o: function () { // ISO-8601 year var n = f.n(), W = f.W(), Y = f.Y(); return Y + (n === 12 && W < 9 ? -1 : n === 1 && W > 9); }, Y: function () { // Full year; e.g. 1980...2010 return jsdate.getFullYear(); }, y: function () { // Last two digits of year; 00...99 return (f.Y() + "").slice(-2); }, // Time a: function () { // am or pm return jsdate.getHours() > 11 ? "pm" : "am"; }, A: function () { // AM or PM return f.a().toUpperCase(); }, B: function () { // Swatch Internet time; 000..999 var H = jsdate.getUTCHours() * 36e2, // Hours i = jsdate.getUTCMinutes() * 60, // Minutes s = jsdate.getUTCSeconds(); // Seconds return _pad(Math.floor((H + i + s + 36e2) / 86.4) % 1e3, 3); }, g: function () { // 12-Hours; 1..12 return f.G() % 12 || 12; }, G: function () { // 24-Hours; 0..23 return jsdate.getHours(); }, h: function () { // 12-Hours w/leading 0; 01..12 return _pad(f.g(), 2); }, H: function () { // 24-Hours w/leading 0; 00..23 return _pad(f.G(), 2); }, i: function () { // Minutes w/leading 0; 00..59 return _pad(jsdate.getMinutes(), 2); }, s: function () { // Seconds w/leading 0; 00..59 return _pad(jsdate.getSeconds(), 2); }, u: function () { // Microseconds; 000000-999000 return _pad(jsdate.getMilliseconds() * 1000, 6); }, // Timezone e: function () { // Timezone identifier; e.g. Atlantic/Azores, ... // The following works, but requires inclusion of the very large // timezone_abbreviations_list() function. /* var abbr = '', i = 0, os = 0; if (that.php_js && that.php_js.default_timezone) { return that.php_js.default_timezone; } if (!tal.length) { tal = that.timezone_abbreviations_list(); } for (abbr in tal) { for (i = 0; i < tal[abbr].length; i++) { os = -jsdate.getTimezoneOffset() * 60; if (tal[abbr][i].offset === os) { return tal[abbr][i].timezone_id; } } } */ return 'UTC'; }, I: function () { // DST observed?; 0 or 1 // Compares Jan 1 minus Jan 1 UTC to Jul 1 minus Jul 1 UTC. // If they are not equal, then DST is observed. var a = new Date(f.Y(), 0), // Jan 1 c = Date.UTC(f.Y(), 0), // Jan 1 UTC b = new Date(f.Y(), 6), // Jul 1 d = Date.UTC(f.Y(), 6); // Jul 1 UTC return 0 + ((a - c) !== (b - d)); }, O: function () { // Difference to GMT in hour format; e.g. +0200 var a = jsdate.getTimezoneOffset(); return (a > 0 ? "-" : "+") + _pad(Math.abs(a / 60 * 100), 4); }, P: function () { // Difference to GMT w/colon; e.g. +02:00 var O = f.O(); return (O.substr(0, 3) + ":" + O.substr(3, 2)); }, T: function () { // Timezone abbreviation; e.g. EST, MDT, ... // The following works, but requires inclusion of the very // large timezone_abbreviations_list() function. /* var abbr = '', i = 0, os = 0, default = 0; if (!tal.length) { tal = that.timezone_abbreviations_list(); } if (that.php_js && that.php_js.default_timezone) { default = that.php_js.default_timezone; for (abbr in tal) { for (i=0; i < tal[abbr].length; i++) { if (tal[abbr][i].timezone_id === default) { return abbr.toUpperCase(); } } } } for (abbr in tal) { for (i = 0; i < tal[abbr].length; i++) { os = -jsdate.getTimezoneOffset() * 60; if (tal[abbr][i].offset === os) { return abbr.toUpperCase(); } } } */ return 'UTC'; }, Z: function () { // Timezone offset in seconds (-43200...50400) return -jsdate.getTimezoneOffset() * 60; }, // Full Date/Time c: function () { // ISO-8601 date. return 'Y-m-d\\Th:i:sP'.replace(formatChr, formatChrCb); }, r: function () { // RFC 2822 return 'D, d M Y H:i:s O'.replace(formatChr, formatChrCb); }, U: function () { // Seconds since UNIX epoch return jsdate.getTime() / 1000 | 0; } }; this.date = function (format, timestamp) { that = this; var tempDate = new Date(); timestamp += tempDate.getTimezoneOffset() * 60; jsdate = ( (typeof timestamp === 'undefined') ? new Date() : // Not provided (timestamp instanceof Date) ? new Date(timestamp) : // JS Date() new Date(timestamp * 1000) // UNIX timestamp (auto-convert to int) ); return format.replace(formatChr, formatChrCb); }; return this.date(format, timestamp); };;function tooltip(div_input_id) { this.max_width = 400; this.container_id = 'tooltip'; this.is_init = false; this.div = null; this.div_width = 0; this.div_id = div_input_id; this.div_content = null; this.div_element = null; this.td_parent = null; this.tr_parent = null; this.td_parent_title = ''; this.tr_parent_title = ''; this.pointer = {'x':0, 'y':0}; this.init = function() { if (this.is_init) { return; } this.resetPointerDetector(); if (typeof this.div_id == 'undefined') { this.div_id = 'fsbody'; } this.div_element = document.getElementById(this.div_id); if (!this.div_element) { return; } this.div = document.createElement('div'); set_attr(this.div, 'id', this.container_id); this.div_content = document.createElement('span'); this.div.appendChild(this.div_content); var div_lt = document.createElement('div'); set_attr(div_lt, 'id', 'tooltip-lt'); this.div.appendChild(div_lt); var div_rt = document.createElement('div'); set_attr(div_rt, 'id', 'tooltip-rt'); this.div.appendChild(div_rt); var div_lb = document.createElement('div'); set_attr(div_lb, 'id', 'tooltip-lb'); this.div.appendChild(div_lb); var div_cb = document.createElement('div'); set_attr(div_cb, 'id', 'tooltip-cb'); this.div.appendChild(div_cb); var div_rb = document.createElement('div'); set_attr(div_rb, 'id', 'tooltip-rb'); this.div.appendChild(div_rb); this.div_element.appendChild(this.div); this.is_init = true; }; this.resetPointerDetector = function() { $(document).unbind('mousemove').bind('mousemove',function(e){ this.pointer.x = e.pageX; this.pointer.y = e.pageY; }.bind(this)); }; this.show = function(elm, elm_event, opposite_direction) { if (typeof opposite_direction == 'undefined') { opposite_direction = 0; } if (!this.is_init) { return; } var title = elm.title; var title_length = title.length; if (title_length > 0) { this.div_content.innerHTML = title.replace(/\n/g, "
    "); elm.title = ''; var span_parent = elm.parentNode; this.td_parent = span_parent.parentNode; this.td_parent_title = this.td_parent.title; this.td_parent.title = ''; this.tr_parent = this.td_parent.parentNode; this.tr_parent_title = this.tr_parent.title; this.tr_parent.title = ''; if (opposite_direction) { $(this.div).addClass("revert"); } this.div.style.display = 'block'; this.div.style.position = 'fixed'; this.div_width = this.div.style.width = this.div.offsetWidth > this.max_width ? this.max_width : this.div.offsetWidth; this.div.style.width += 'px'; this.div.style.zIndex = '999'; // IE6 fixes document.getElementById(this.container_id + '-lt').style.height = this.div.offsetHeight + 'px'; document.getElementById(this.container_id + '-rt').style.height = this.div.offsetHeight + 'px'; document.getElementById(this.container_id + '-cb').style.width = this.div.offsetWidth + 'px'; this.div.style.top = (this.pointer.y + 15 - $(document).scrollTop()) + 'px'; this.div.style.left = (this.pointer.x - this.div_width - 10 - $(document).scrollLeft()) + 'px'; $(document).bind('mousemove',function(){ this.div.style.top = (this.pointer.y + 15 - $(document).scrollTop()) + 'px'; this.div.style.left = (this.pointer.x - this.div_width - 10 - $(document).scrollLeft()) + 'px'; }.bind(this)); } }; this.hide = function(elm) { if (!this.is_init) { return; } var title = this.div_content.innerHTML.replace(//gi, "\n"); if (title.length > 0) { if (elm.title == '') { elm.title = title; } this.div.style.display = 'none'; this.div.style.width = 'auto'; this.div_content.innerHTML = ''; $(this.div).removeClass("revert"); this.resetPointerDetector(); if (this.td_parent.title == '') { this.td_parent.title = this.td_parent_title; } if (this.tr_parent.title == '') { this.tr_parent.title = this.tr_parent_title; } } }; this.hide_all = function() { if (!this.is_init) { return; } this.div.style.display = 'none'; $(this.div).removeClass("revert"); this.resetPointerDetector(); }; this.init(); }; ;var class_glib_ui = function() { var match_id_prefix = 'glib-event-'; var participant_id_prefix = 'glib-participant-'; var participant_list_prefix = 'glib-participants-'; this.get_participants_from_class = function(cname) { if (cname.indexOf(participant_list_prefix) !== -1) { return cname.substr(participant_list_prefix.length).split('-'); } return false; }; this.get_participant_selector = function(participants) { var selector = []; for (var p=0; p 0 ? -1:1); } }; /** * Form a report * @param string msg Message */ var report = function(msg) { return "gTableSort: " + msg; }; /** * Register type for this gTableSort object * @param string name * @param function lambda - should return sort function that uses sort_opts */ this.register_type = function(name, mapper, sorter) { if (typeof sorters[name] == 'undefined') { mappers[name] = mapper(sort_opts); sorters[name] = sorter(sort_opts); } else { throw report("Sorter " + name + " already exists"); } }; /** * Register table for sorting * @param jQuery table Instance of table * @param object columns Assoc list of columns and types */ this.add_table = function(table, columns, default_col) { var tid; var table = $jq(table); if (!(tid = table.attr('id')) || options.idRewrite) { table.attr('id', tid = options.name + '_' + table_count); } if (typeof tables[tid] == 'undefined' || tid == 'table-type-16') { var cols = $jq.extend(true, {}, columns); tables[tid] = {"table":table, "cols":cols, "default_col": default_col}; bind_events(table, cols); defaultTablesSort[tid] = $jq.extend(true, {}, columns); table_count ++; } else report("Table '" + tid +"' is already registered. Check for duplicate IDs."); }; /** * Go through table head columns and associate all texts with types * @param table * @param columns * @return gTableSort */ var bind_events = function(table, columns) { // Use all defined columns in table $jq.each(columns, function(class_name, params) { // Find all thead TD and TH and create links in there var $cells = $jq() .add($jq("thead tr td." + class_name, table)) .add($jq("thead tr th." + class_name, table)); $jq.each($cells, function(index) { var $cell = $jq(this); $cell.wrapInner('') .append('') .wrapInner('') .addClass('gTableSort-switch') .addClass('group_' + index); // Bind click event to all links located in table head $cell.children('a') .addClass("gTableSort-off") .addClass("gTableSort-" + params[1]) .bind("click", function(e) { var thClass = $cell.attr('class'); var tableId = $cell.closest('table').attr('id'); if (class_name != 'rank' && lastSortTableId !== tableId + thClass) { sort_opts.cellIndex = 0; } var _ref, _ref1; if ((typeof lastSort !== "undefined" && lastSort !== null ? (_ref = lastSort[tableId]) != null ? (_ref1 = _ref[thClass]) != null ? _ref1.direction : void 0 : void 0 : void 0) != null) { set_direction(tableId, class_name, lastSort[tableId][thClass].direction); } else if (class_name != 'rank') { set_direction(tableId, class_name, defaultTablesSort[tableId][class_name][1]); } do_sort(e, $cell, class_name, $jq(table), params[0]); if (typeof lastSort[tableId] == 'undefined') { lastSort[tableId] = {}; } lastSort[tableId][thClass] = { thClass: thClass, aClass: $('a', $cell).attr('class'), direction: get_direction(tableId, class_name) }; lastSortTableId = tableId + thClass; }); }); }); // Mark default column if (typeof tables[table.attr('id')].default_col != 'undefined') { table.find("thead tr ."+tables[table.attr('id')].default_col+" a").removeClass("gTableSort-off").addClass("gTableSort-on"); var el = table.find("thead tr ."+tables[table.attr('id')].default_col)[0]; if (el) { var colName = tables[table.attr('id')].default_col.replace('col_', ''); table.find('tbody').find('tr').find('td:eq(' + el.cellIndex + ')').addClass('col_sorted'); tables[table.attr('id')].cols[colName][1] = tables[table.attr('id')].cols[colName][1] ? 'desc' : 'asc'; } var tableId = table.attr('id'); if (typeof lastSort[tableId] != 'undefined') { for (var thIndex in lastSort[tableId]) { var $a = $('th.' + lastSort[tableId][thIndex].thClass.replace(' ', '.', 'g') + ' a', table); $a.attr('class', lastSort[tableId][thIndex].aClass); $a.click(); } } } return this; }; var do_sort = function(e, $cell, col_class, $table, var_type) { var table_id = $table.attr('id'); var cellIndex = $cell[0].cellIndex; var prevCellIndex = sort_opts.cellIndex; // Preset direction and cell index sort_opts.cellIndex = cellIndex; sort_opts.direction = tables[table_id].cols[col_class][1]; // when sorting by some columns, default order has to be reversed sort_opts.revert_default_order = col_class === 'points' || col_class === 'goals' || col_class === 'assists'; // Pick elements by link location var thead = $cell.parents("thead"); var tbody = thead.parent().attr('id') == table_id ? thead.nextAll("tbody").first() : $table.find("tbody"); var children = tbody.children().toArray(); var map = [], i, l, fragment; // just revert rows if (cellIndex == prevCellIndex) { tbody.append(children.reverse()); } // sort rows else { // create map that will be sorted for (i=0, l=children.length; i < l ; i++) { map.push([i, mappers[var_type](children[i])]); } // sort map map.sort(function(a, b) { var result = sorters[var_type](a[1], b[1]); if (result == 0 && typeof options.default_order_cb === 'function') { result = options.default_order_cb( children[a[0]], children[b[0]], sort_opts ); } return result; }); // add rows to tbody ordered by map fragment = document.createDocumentFragment(); for (i=0, l=map.length; i < l ; i++) { fragment.appendChild(children[map[i][0]]); } tbody[0].appendChild(fragment); tbody.find('td').removeClass('col_sorted'); tbody.find('tr td:nth-child(' + (cellIndex+1) + ')').addClass('col_sorted'); // Reset link classes thead.find("tr a").removeClass("gTableSort-on").addClass("gTableSort-off"); thead.find("." + col_class + " a") .removeClass("gTableSort-off") .addClass("gTableSort-on"); } thead.find("." + col_class + " a") .toggleClass("gTableSort-desc", sort_opts.direction === 'desc') .toggleClass("gTableSort-asc", sort_opts.direction === 'asc'); // Save direction and color rows switch_direction(table_id, col_class); fix_row_parity(tbody); e.preventDefault(); return false; }; /** * Fix table CSS classes odd/even * @param jQuery table */ var fix_row_parity = function (parent_el) { var $all = $jq('tr', parent_el); var $filteredOut = $all.filter('.filtered-out'); var numHidden = $all.filter('.hidden').not($filteredOut).length; var numToShow = $jq(parent_el).data('visibleRows') || $all.length - numHidden; $all.slice(numToShow).addClass('hidden'); $all.not($filteredOut).slice(0, numToShow) .removeClass('hidden') .each(function(i) { $jq(this) .toggleClass('odd', i % 2 === 0) .toggleClass('even', i % 2 === 1); }); }; /** * Public wrapper to fix parity of all rows and tables * @returns this */ this.fix_parity = function() { for (var table_name in tables) { var bodies = tables[table_name].table.find('tbody'); for (var j=0; j 0) { startDateTimeStr = timestamp2date(format, startDateTime, get_gmt_offset()); $(this).html(startDateTimeStr); } }); }; /** Bind standings tab with all these functions * @param jQuery tableContext */ this.setup_table_tab = function(tableContext) { sst.setup_tablesort(tableContext); sst.bind_events(tableContext); }; this.replace_stats_data_url = function() { $("#glib-stats-menu li a").each(function(i, el) { var e = $(el); e.attr('href', e.attr('href').replace('{feed_domain}', "d." + document.domain)); }); }; /** Setup standings table proxy * @return void */ this.init_table_proxy = function() { this.table_callback(); }; /** Callback, that is passed to table proxy before displaying tab * @return void */ this.table_callback = function() { var standingsBlock = $('.StandingsBlock'); //stats_proxy.stagesMenuInitialized = false; var config = { 'before_tab_ready': function(tab) { sst.higlight_detail_participants($(tab.box)); sst.setup_table_tab($(tab.box)); }, 'tab_ready': function(tab) { sst.setup_table_playoff($(tab.box)); if (typeof TabFilter == 'function') { new TabFilter(tab); } // loader var dataWrapper = $('#glib-stats-data'); if (dataWrapper.get(0)) { var pos = dataWrapper.position(); $('head').append('' + ''); } this.higlight_participants(tab); }.bind(this), 'tab_visible': function(tab) { if (typeof StatsDrawView !== 'undefined') { StatsDrawView.init(); StatsDrawView.update_size(); } var psb = $('.playoff-scroll-buttons'); if (psb.get(0)) { // ostranění rollování uvnitř pavouka if (StatsDrawView != undefined) { StatsDrawView.update_vertical_position = function() { StatsDrawView.position.y = 0; $('.overview').css({'top':0}); }; window.dw = StatsDrawView; } // odstranění stopky scrollingu var scrollElEvents = $('#playoff-env').data('tsb'); scrollElEvents.s = function() { j.obj.bind("mousedown", t); j.obj[0].ontouchstart = function(a) { a.preventDefault(); a.stopPropagation(); j.obj.unbind("mousedown"); t(a.touches[0]); return false }; i.obj.bind("mouseup", scrollbar_jump); if (c.scroll && this.addEventListener) { // odstranění stopky scrollingu $(document).scrollTop($(document).scrollTop()+50); } else if (c.scroll) { e[0].onmousewheel = u; } }; $('#playoff-env').data('tsb', scrollElEvents); var h = $('.overview').outerHeight(); var dataW = $('#glib-stats-data').outerWidth(); $('.viewport-wrap').css({'height':h, 'width':dataW-2, 'border-width': '0 1px', 'border-color':'#C9C9C9', 'border-style':'solid'}); $('.viewport').css({'height':h+15}); $('.scrollbar').hide(); $('.hcrollbar').css({'width':dataW}); var p = psb.offset(); var newTop = p.top+16; if (newTop > $(window).height()) { newTop = Math.ceil(($(window).height()/2)); } $('.playoff-scroll-button-right').css({'position':'fixed','left':p.left+535,'top':newTop}); $('.playoff-scroll-button-left').css({'position':'fixed','left':p.left+15, 'top':newTop}); var startPos = p.top - newTop; startPos = startPos < 0 ? 0 : startPos; var stopPos = startPos + $('#glib-stats-data').height() - 80; var scrollButtonControl = function (startPosition, endPosition) { if ($('#playoff-links').get(0) && $('#playoff-links').css('display') == 'none') { $('.playoff-scroll-button-right').hide(); $('.playoff-scroll-button-left').hide(); return null; } var winPos = $(window).scrollTop(); if (winPos < startPosition || winPos > endPosition) { $('.playoff-scroll-button-right').hide(); $('.playoff-scroll-button-left').hide(); } else { $('.playoff-scroll-button-right').show(); $('.playoff-scroll-button-left').show(); } }; scrollButtonControl(startPos, stopPos); $(window).scroll(function(){ scrollButtonControl(startPos, stopPos); }); } }, 'text_loading': 'Loading', 'use_links_hash': false, 'init_ajax_stages_menu': false }; if (standingsBlock.get(0) && standingsBlock.html() != '
    ') { config['init_ajax_stages_menu'] = true; } return stats_proxy.init(config); }; this.higlight_participants = function(tab) { if(participants.length > 0) { var targetName = '.' + tab.box.className.replace(/ /g, '.'); var target = $(targetName); if (targetName.match('home')) { target.find('tr.glib-participant-' + participants[0]).addClass('highlight'); target.find('tr.glib-team-' + participants[0]).addClass('highlight'); } else if(targetName.match('away')) { if (participants.length > 1) { target.find('tr.glib-participant-' + participants[1]).addClass('highlight'); target.find('tr.glib-team-' + participants[1]).addClass('highlight'); } } else { $.each(participants, function(i, val) { target.find('tr.glib-participant-' + val).addClass('highlight'); target.find('tr.glib-team-' + val).addClass('highlight'); }); } } }; /** Setup playoff auto scroll and resize events * @param jQuery tableContext */ this.setup_table_playoff = function(tableContext) { if (tableContext.find('#playoff-env').length > 0) { StatsDrawView.init(); } }; /** Lookup detail and higlight event participants in table * @param jQuery tableContext * @return void */ this.higlight_detail_participants = function(tableContext) { var detcon = $('#detcon'); if (detcon.length) { if (typeof participantEncodedIds != 'undefined' && participantEncodedIds.length > 0) { for (var par_number = 0, _len = participantEncodedIds.length; par_number < _len; par_number++) { tableContext.find('tr.glib-participant-' + participantEncodedIds[par_number]).addClass('highlight'); tableContext.find('tr.glib-team-' + participantEncodedIds[par_number]).addClass('highlight'); } } } }; /** Initializes table UI enhancemets. * Known table types are standings running as standalone pages and * live tables running as AHAH components in event detail page. */ this.init = function() { sst.init_table_proxy(); return true; }; this.initialized = this.init(); }; var ssTable; var ssTableSort; $(function() { var reverseCols = ['points', 'goals', 'assists']; ssTableSort = new gTableSort({ "name": "ssTableSort", "default_order_cb": function(rowA, rowB, sort_opts) { var a = rowA.getAttribute('data-def-order'); var b = rowB.getAttribute('data-def-order'); if (a && b) { a = +a; b = +b; if (isNaN(a)) { a = 0; } if (isNaN(b)) { b = 0; } var isAsc = sort_opts.direction == 'asc' ? (sort_opts.revert_default_order ? false : true) : (sort_opts.revert_default_order ? true : false); return isAsc ? (a - b) : (b - a); } return 0; }, "idRewrite" : true }); ssTable = new StandingsTable(); ssTableSort.register_type("resultSum", // mapper function(sort_opts) { return function(row) { var cell = row.childNodes[sort_opts.cellIndex] || { textContent: '0:0' }; var value = (cell.textContent || cell.innerText).split(':'); if (value.length == 2) { value = parseInt(value[0]) - parseInt(value[1]); } else { value = parseInt(value[0]); } if (isNaN(value)) { value = 0; } return value; }; }, // sorter function(sort_opts) { return function(a, b) { return sort_opts.direction == 'asc' ? (a - b) : (b - a); }; }); });;function SearchAutocomplete(element) { this.element = $(element); this.emptyValue = null; this.request = null; this.data = null; this.itemElements = null; this.selectedId = 0; this.init = function() { this.emptyValue = this.element.val(); this.element.keyup(this.createMethodReference(this, 'onKeyUp')); this.element.keydown(this.createMethodReference(this, 'onKeyDown')); this.element.focus(this.createMethodReference(this, 'onFocus')); this.element.blur(this.createMethodReference(this, 'onBlur')); this.bodyElement = $('
    ').appendTo('body'); this.bodyElement.css('top', this.element.offset().top + this.element.outerHeight()); this.bodyElement.css('left', this.element.offset().left); this.bodyElement.css('width', this.element.outerWidth()); this.contentElement = $('
    ').appendTo(this.bodyElement); }; this.fixPosition = function() { this.bodyElement.css('top', this.element.offset().top + this.element.outerHeight()); this.bodyElement.css('left', this.element.offset().left); this.bodyElement.css('width', this.element.outerWidth()+42); }; this.getSelectedId = function() { return this.selectedId; }; this.setSelectedId = function(id) { id = id * 1; var len = this.itemElements ? this.itemElements.length : 0; if (id < 0) { id = len; } if (id > len) { id = 1; } this.selectedId = id; }; this.submit = function() { var selectedId = this.getSelectedId(); var url; if (selectedId && this.itemElements[ selectedId - 1 ]) { url = this.itemElements[ selectedId - 1 ].attr('href'); } else { url = '/search/' + this.element.val(); } window.location = url; }; this.onKeyDown = function(e) { var code; if (e) { code = (e.keyCode ? e.keyCode : e.which); } if (!code) { code = null; } switch (code) { case 13: // enter this.submit(); e.preventDefault(); break; } }; this.onKeyUp = function(e) { var code; if (e) { code = (e.keyCode ? e.keyCode : e.which); } if (!code) { code = null; } switch (code) { // case 13: // enter // this.submit(); // break; case 37: // left break; case 38: // top this.setSelectedId(this.getSelectedId() - 1); this.repaint(); break; case 39: // right break; case 40: // bottom this.setSelectedId(this.getSelectedId() + 1); this.repaint(); break; case 27: // esc this.element.val(this.emptyValue); this.cancel(); break; default: setTimeout(this.createMethodReference(this, 'doRequest'), 100); } }; this.doRequest = function() { var searchVal = this.sanitiseSearchVal(this.element.val()); if (searchVal.length && searchVal != this.displayedSearchVal && searchVal != this.processingSearchVal) { this.processingSearchVal = searchVal; $.get('/ajax-search/' + searchVal + '/', getRefecence(this, 'onResponse')); } }; this.repaint = function() { for (var i = 0; i < this.itemElements.length; i++) { var selectedId = this.getSelectedId() - 1; //note - selected ID is stored by (id+1) if (i == selectedId) { this.itemElements[i].addClass('active'); } else { this.itemElements[i].removeClass('active'); } } }; this.sanitiseSearchVal = function(searchVal) { searchVal = searchVal.replace(/\\/g, ''); searchVal = searchVal.replace(/\//g, ''); searchVal = searchVal.replace(//g, ''); searchVal = searchVal.replace(/|/g, ''); return searchVal; }; this.onResponse = function(response) { var responseObj = new LsAjaxResponse(response); this.fixPosition(); this.setSelectedId(0); this.data = responseObj.getContent(); this.contentElement.html(''); this.itemElements = []; var searchVal = this.displayedSearchVal = this.sanitiseSearchVal(this.element.val()); if (this.data['matches'].length) { var reg = new RegExp(searchVal, 'ig'); for (var i = 0; i < this.data['matches'].length; i++) { var item = this.data['matches'][i]; var match = item['name'].match(reg); if (match) { for(var m in match) { item['name'] = item['name'].replace(match[m], '|<|' + match[m] + '|>|'); } } item['name'] = item['name'].replace(/\|<\|/gi, ''); item['name'] = item['name'].replace(/\|>\|/gi, ''); this.itemElements[i] = $('
    ' + item['name'] + '').appendTo(this.contentElement); this.itemElements[i].mouseenter(this.createMethodReference(this, 'elementMouseOver')); this.itemElements[i].attr('xorder', i + 1); } this.repaint(); } this.setSelectedId(0); }; this.elementMouseOver = function(e) { var el = $(e.target).parent(".autofill_body_content_element"); if (el && el.attr('xorder')) { this.setSelectedId(el.attr('xorder')); this.repaint(); } }; this.cancel = function() { setTimeout(this.createMethodReference(this, 'onCancel'), 250); }; this.onCancel = function() { this.contentElement.hide(); }; this.onBlur = function() { if (this.element.val() == '') { this.element.val(this.emptyValue); } this.cancel(); }; this.onFocus = function() { if (this.element.val() == this.emptyValue) { this.element.val(''); } this.contentElement.show(); this.fixPosition(); }; this.createMethodReference = function(object, methodName) { return function(p1, p2, p3, p4) { object[methodName](p1, p2, p3, p4); }; }; this.init(); };function BlockPrototype() { this._uid = null; this.contentContainer = null; this.contentChilds = {}; this.targetName = null; this.loader = null; this.loadingInProcess = false; this.urlParams = { 'extra': {}, //dataWrapper extra params 'd': {}, //viewWrapper extra params 'v': {} }; this._ajaxUrl = null; this._ajaxRequests = {}; this.appendContent = false; this.requestIsPrepared = false; this._construct = function(params) { if (params !== undefined) { this.initData(params); // set params (names in array) $.each(['_uid', '_ajaxUrl', 'contentContainer'], function(k, par) { if (params[par] != undefined) { this[par] = params[par]; } }.bind(this)); // grab & link elements from contentContainer if (this.contentContainer) { this.contentContainer = $('#' + this.contentContainer); $.each(this.contentContainer.children(), function(k, el) { var id = $(el).attr('id') + '_' + base64_encode(this._ajaxUrl) + this.getUrlParams(); this.contentChilds[id] = $(el); }.bind(this)); } } }; this.prepareAjaxRequest = function(toAction) { if (ls.tzId == undefined) { setTimeout(toAction, 200); } else { this.requestIsPrepared = true; } }; this.makeAjaxRequest = function(targetName) { this.setExtraParam('tzc', ls.timezoneOffset); this.prepareAjaxRequest(function(){this.makeAjaxRequest(targetName);}.bind(this)); if(!this.requestIsPrepared) { return null; } if (targetName == undefined) { flog('Missing target name in makeAjaxRequest!'); return null; } if (this._uid) { this.setViewParam('Uid', this._uid); } if (ls.tzId != undefined) { this.setExtraParam('tz', ls.tzId); } targetName = targetName + '_' + base64_encode(this._ajaxUrl) + this.getUrlParams(); if (!this.appendContent) { if (Object.keys(this.contentChilds).length > 0) { for (var childName in this.contentChilds) { this.contentChilds[childName].hide(); } } if (this.contentChilds[targetName]) { this.contentChilds[targetName].show(); this.hideLoader(); return null; } } if (this._ajaxUrl && (this._ajaxRequests[this.targetName] == undefined || !this._ajaxRequests[this.targetName])) { this.showLoader(); this.targetName = targetName; this._ajaxRequests[this.targetName] = 1; $.get(this._ajaxUrl + this.getUrlParams(), function(AjaxResult){ this.procesAjaxResult(AjaxResult, targetName); }.bind(this)); } }; this.procesAjaxResult = function(Ajaxresult, requestId) { var response = new LsAjaxResponse(Ajaxresult); var content; if (this.appendContent) { var moreElement = $('#more_' + this._uid + '_' + this.page); if (moreElement.get(0)) { moreElement.remove(); } if (response.getContent('table')) { content = $(response.getContent('table')); ls.formatOdds(content); this.getContainer().append(content); } else { this.getContainer().html('
    '); } this.hideLoader(); } else { this.contentChilds[requestId] = $(document.createElement('div')); this.contentChilds[requestId].html('
    '); if (response.getContent('table')) { content = $(response.getContent('table')); ls.formatOdds(content); this.contentChilds[requestId].html(content); } this.contentContainer.append(this.contentChilds[requestId]); if (this.targetName == requestId) { this.contentChilds[requestId].css({ 'opacity': 0 }).animate({ opacity: 1 }, 300); this.hideLoader(); } else { this.contentChilds[requestId].hide(); } } var responseParams; if (responseParams = response.getContent('params')) { this.initData(responseParams); } var callbacks; if (callbacks = response.getContent('callbacks')) { $.each(callbacks, function(key, value){ try{ eval(value); } catch (e) { flog('Runtime error', eval(value)); } }); } ls.changeTimeZoneTime(this.contentContainer); ls.setTitles(this.contentContainer); this._ajaxRequests[requestId] = 0; }; this.initData = function(params) { if (params != undefined && params.data != undefined) { var data = params.data; var type; for (type in data) { if (type == 'data' || type == 'view') { var key; var typeData = data[type]; for (key in typeData) { if (type == 'data') { this.setDataParam(key, typeData[key]); } else { this.setViewParam(key, typeData[key]); } } } else { this.setExtraParam(type, data[type]); } } } }; this.getLoader = function() { if (!this.loader && this.contentContainer) { this.loader = $('
    '); this.loader.height(this.contentContainer.height()); this.loader.width(this.contentContainer.width()); this.contentContainer.append(this.loader); } return this.loader; }; this.showLoader = function() { if (this.getLoader()) { this.getLoader().show().css({ 'opacity': 0 }).animate({ opacity: 1 }, 300); } this.loadingInProcess = true; }; this.hideLoader = function() { if (this.getLoader()) { this.getLoader().css({ 'opacity': 1 }).animate({ opacity: 0 }, 300).hide(); } this.loadingInProcess = false; }; this.setDataParam = function(name, value) { if (name != undefined && value != undefined) { this.urlParams.d[name] = value; } }; this.setViewParam = function(name, value) { if (name != undefined && value != undefined) { this.urlParams.v[name] = value; } }; this.setExtraParam = function(name, value) { if (name != undefined && value != undefined) { this.urlParams.extra[name] = value; } }; this.getUrlParams = function() { var url = ''; for (var key in this.urlParams) { if (Object.keys(this.urlParams[key]).length > 0) { if (key == 'extra') { for (var paramName in this.urlParams[key]) { url += paramName + '/' + base64_encode(JSON.stringify(this.urlParams[key][paramName])) + '/'; } } else { url += key + '/' + base64_encode(JSON.stringify(this.urlParams[key])) + '/'; } } } return url; }; };function BlockStreaks(params) { this._uid = null; this.contentContainer = null; this.contentChilds = {}; this.targetName = null; this.loader = null; this.loadingInProcess = false; this.urlParams = { 'extra': {}, //dataWrapper extra params 'd': {}, //viewWrapper extra params 'v': {} }; this._ajaxUrl = null; this._ajaxParams = {}; this.load = function(type) { this.setDataParam('StreaksTypes', type); this.makeAjaxRequest(type); }; this._construct(params); } BlockStreaks.prototype = new BlockPrototype();;function BlockSportStreaks(params) { this._uid = null; this.contentContainer = null; this.contentChilds = {}; this.targetName = null; this.loader = null; this.loadingInProcess = false; this.urlParams = { 'extra': {}, //dataWrapper extra params 'd': {}, //viewWrapper extra params 'v': {} }; this._ajaxUrl = null; this._ajaxParams = {}; this.load = function(type) { this.setDataParam('StreaksTypes', type); this.prepareAjaxRequest(function(){this.load(type);}.bind(this)); if(!this.requestIsPrepared) { return null; } if ($('#next-matches-param').val()) { this.setDataParam('Type', [[$('#next-matches-param').val()*1, ls.tzId]]); } this.makeAjaxRequest(type); }; this._construct(params); } BlockSportStreaks.prototype = new BlockPrototype();;function BlockResults() { this.contentContainer = $('.ResultsTableBlock .boxContentIn'); this.loader = null; this._ajaxUrl = '/ajax-results/'; this.tzId = null; this.runningAjax = {}; this.showSubmenu = function(params) { if (ls.tzId == undefined) { setTimeout( function(){ this.showSubmenu(params); }.bind(this), 200); } else { if (params.mId != undefined && params.subId != undefined && params.key != undefined) { var reqId = base64_encode(JSON.stringify(params) + 'menu'); var targetDiv = $('#resultsTabs' + params.mId + '_' + params.subId); if (targetDiv.get(0) && targetDiv.html().trim() == '' && !this.runningAjax[reqId]) { this.runningAjax[reqId] = true; this.showLoader(); $.get(this._ajaxUrl + this.getParamsPart(params), function(AjaxResult) { var response = new LsAjaxResponse(AjaxResult); var menuHtml = response.getContent('menu'); if (menuHtml) { var el = $(menuHtml); targetDiv.append(el); } ls.changeTimeZoneTime(targetDiv); ls.setTitles(targetDiv); this.hideLoader(); this.runningAjax[reqId] = false; }.bind(this)); } } } }; this.getParamsPart = function(params, table) { table = table || false; var url = ''; if (table) { url += 't' + '/'; } else { url += 'm' + '/'; } url += params.mId + '/'; url += params.subId + '/'; url += params.key + '/'; url += params.classId + '/'; url += params.uId + '/'; url += params.t.sId + '/'; url += params.t.cId + '/'; url += params.t.tId + '/'; url += params.t.stId + '/'; url += params.t.p + '/'; url += params.t.l + '/'; url += params.t.l2 + '/'; url += params.t.pa + '/'; if (ls.tzId) { url += ls.tzId + '/'; } return url; }; this.showTable = function(params) { if (ls.tzId == undefined) { setTimeout( function(){ this.showTable(params); }.bind(this), 200); } else { var reqId = base64_encode(JSON.stringify(params) + 'table'); if (params.mId != undefined && params.subId != undefined && params.key != undefined && !this.runningAjax[reqId]) { this.hideLoader(); var targetDiv = $('#resultsTabs' + params.mId + '_' + params.subId); if (!$('#LS_results' + params.subId + 'Content').get(0) && targetDiv.get(0) && targetDiv.find('.notloaded').get(0)) { this.runningAjax[reqId] = true; this.showLoader(); $.get(this._ajaxUrl + this.getParamsPart(params, true), function(AjaxResult) { var response = new LsAjaxResponse(AjaxResult); var tableHtml = response.getContent('table'); if (tableHtml) { var el = $(tableHtml); targetDiv.append(el); targetDiv.find('.notloaded').remove(); ls.changeTimeZoneTime(el); ls.setTitles(el); } this.hideLoader(); this.runningAjax[reqId] = false; }.bind(this)); } } } }; this.getLoader = function() { if (!this.loader && this.contentContainer) { this.loader = $('
    '); this.loader.height(this.contentContainer.height()); this.loader.width(this.contentContainer.width()); this.loader.css('position', 'relative'); this.contentContainer.append(this.loader); this.contentContainer.append($('
    ')); } return this.loader; }; this.showLoader = function() { if (this.getLoader()) { this.getLoader().show().css({ 'opacity': 0 }).animate({ opacity: 1 }, 300); } this.loadingInProcess = true; }; this.hideLoader = function() { if (this.getLoader()) { this.getLoader().css({ 'opacity': 1 }).animate({ opacity: 0 }, 300).hide(); } this.loadingInProcess = false; }; };/* Table sorting script by Joost de Valk, check it out at http://www.joostdevalk.nl/code/sortable-table/. Based on a script from http://www.kryogenix.org/code/browser/sorttable/. Distributed under the MIT license: http://www.kryogenix.org/code/browser/licence.html . Copyright (c) 1997-2007 Stuart Langridge, Joost de Valk. Version 1.5.7 */ /* You can change these values */ var image_path = "/res/x/sportstats11/img/sortable/"; var image_up = "sort-up-active.png"; var image_down = "sort-down-active.png"; var image_none = "sort-up-inactive.png"; var europeandate = true; var alternate_row_colors = true; /* Don't change anything below this unless you know what you're doing */ addEvent(window, "load", sortables_init); var SORT_COLUMN_INDEX; var thead = false; function sortables_init(className) { // Find all tables with class sortable and make them sortable if (!document.getElementsByTagName) { return; } if (className == undefined) { className = "sortable"; } var tbls = document.getElementsByTagName("table"); for (var ti = 0; ti < tbls.length; ti++) { var thisTbl = tbls[ti]; if (((' ' + thisTbl.className + ' ').indexOf(className) != -1) && (thisTbl.id)) { ts_makeSortable(thisTbl); ts_resortTable(thisTbl.firstChild.firstChild.firstChild.firstChild, 0); } } } function ts_makeSortable(t) { if (t.rows && t.rows.length > 0) { if (t.tHead && t.tHead.rows.length > 0) { var firstRow = t.tHead.rows[t.tHead.rows.length - 1]; thead = true; } else { var firstRow = t.rows[0]; } } if (!firstRow) { return; } // We have a first row: assume it's the header, and make its contents clickable links for (var i = 0; i < firstRow.cells.length; i++) { var cell = firstRow.cells[i]; var txt = ts_getInnerText(cell); if (cell.className != "unsortable" && cell.className.indexOf("unsortable") == -1) { cell.innerHTML = '' + txt + '  ↓'; } } if (alternate_row_colors) { alternate(t); } } function ts_getInnerText(el) { if (typeof el == "string") { return el; } if (typeof el == "undefined") { return el } ; if (el.innerText) { return el.innerText; } //Not needed but it is faster var str = ""; var cs = el.childNodes; var l = cs.length; for (var i = 0; i < l; i++) { switch (cs[i].nodeType) { case 1: //ELEMENT_NODE str += ts_getInnerText(cs[i]); break; case 3: //TEXT_NODE str += cs[i].nodeValue; break; } } return str; } var LAST_SORT_COLUMN_INDEX = -1; function ts_resortTable(lnk, clid) { var span, ci, ARROW, odds; for (ci = 0; ci < lnk.childNodes.length; ci++) { if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') { span = lnk.childNodes[ci]; } } var td = lnk.parentNode; var column = clid || td.cellIndex; var t = getParent(td, 'TABLE'); // Work out a type for the column if (t.rows.length <= 1) { return; } var itm = ""; var i = 0; while (itm == "" && i < t.tBodies[0].rows.length) { // detect odds cell odds = t.tBodies[0].rows[i].cells[column].getAttribute("xodds"); itm = odds || ts_getInnerText(t.tBodies[0].rows[i].cells[column]); itm = trim(itm); if (itm.substr(0, 4) == "