/** * Common JavaScript library. * * @package TenisPortal * @subpackage JavaScript * @author Livesport, s.r.o. * @copyright (c) 2007 Livesport, s.r.o.; {@link http://www.livesport.cz/} * @since 2007/09/22 */ var ajaxObject = new Array(); var cJsLib = new cJsLib(); var ie = false; var cookie = new Cookie(); var eMsg = new ExpressMessage(); var toolTip = null; var closingPermInfo = false; //addLoadEvent(searchInit); addLoadEvent(setHoverButtons); addLoadEvent(setTabIndexes); addLoadEvent(checkLastMatchSize); addLoadEvent(setToolTip); /** * Set HOVER efekt on backgrounded inputs. */ function setHoverButtons() { var obj = cJsLib.$$('input.btn'); if (! cJsLib.isNull(obj) && obj.length > 0) { for (var i = 0; i < obj.length; ++i) { obj[i].onmouseover = function() { var pElem = this.parentNode; var pCss = cJsLib.getCls(pElem); var pattBtn = new RegExp('(lGray|lOrange|lGreen)', 'g'); if (! cJsLib.empty(pCss) && pattBtn.test(pCss)) { cJsLib.addCls(this, 'hover'); } }; obj[i].onmouseout = function() { var pElem = this.parentNode; var pCss = cJsLib.getCls(pElem); var pattBtn = new RegExp('(lGray|lOrange|lGreen)', 'g'); if (! cJsLib.empty(pCss) && pattBtn.test(pCss)) { cJsLib.rmCls(this, 'hover'); } }; } } }; /** * Set tabindex attribute on selected elements. */ function setTabIndexes() { if (! cJsLib.isNull(tabIdx) && tabIdx.length > 0) { for (var i = 0; i < tabIdx.length; ++i) { cJsLib.$(tabIdx[i]).setAttribute('tabIndex', i+1); } } }; /** * Check size table with last matches on home page and resize if needed. */ function checkLastMatchSize() { var tbl = cJsLib.$(cookie.get('idx_last_game_tab') + '-data'); if (! cJsLib.isNull(tbl)) { if (tbl.offsetHeight < 219) { var lstContainer = cJsLib.$('lastMatch'); var cls = null; if (! cJsLib.isNull(lstContainer)) { cJsLib.setStyle(lstContainer, 'height:' + tbl.offsetHeight + 'px;overflow-y:hidden;'); } } if (cJsLib.isIE()) { cJsLib.setStyle(cJsLib.$('lstGame-' + cookie.get('idx_last_game_tab').replace('lstGame-', '') + '-data'), '#width:471px;_width:477px;'); } } }; function setToolTip() { toolTip = new tooltip('web-all'); }; /** * Append a new onload function. * * @param {String} func The name of function. */ function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); } } }; /** * Detect M$ IE browser. * * @return void */ function detect_browser() { if (navigator.userAgent.match(/MSIE/)) ie = true; }; detect_browser(); /** * Remove the CSS class. * * @param object * element The DOM element of target element. */ function delCls(element) { if (ie) //element.removeAttribute('className'); element.className = ''; else element.removeAttribute('class'); }; /** * Set the CSS class name. * * @param object * $element Target element object. * @param string * $clsName Name of the CSS class. * @return void */ function setCls(element, clsName) { //return (ie ? element.setAttribute('className', clsName) : element.setAttribute('class', clsName)); return (ie ? element.className = clsName : element.setAttribute('class', clsName)); }; /** * Get the CSS style. * * @param object * element Target element object. */ function getCls(element) { return (ie ? element.getAttribute('className') : element.getAttribute('class')); }; /** * Set the CSS style on parent element. * * @param object * $element DOM object of parent element. * @param string * $styleCSS The CSS style; */ function setStyle(element, styleCSS) { if (ie) element.style.cssText = styleCSS; else element.setAttribute('style', styleCSS); }; /** * Set the onclick function. * * @param object * $element DOM object of parent element. * @param string * $onAction Action for onclick event. * @return void */ function setOnClick(element, onAction) { if (ie) element.onclick = new Function("env", onAction); else element.setAttribute('onclick', onAction); }; /** * Get value of the node from XML DOM. * * @param string * $element The DOM object. * @return string */ function getNodeValue(element) { return (ie ? element.text : element.textContent); }; /** * Get object of element by ID. * * @param string * $element ID name of requested element. * @return object Returns element's object. */ function getElement(element) { return document.getElementById(element); }; /** * Get element position. * * @param {Object} obj DOM object of parent element. * @param {Object} Returns array with element position. */ function getElementPosition(obj) { var curleft = 0; var curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft; curtop = obj.offsetTop; while (obj = obj.offsetParent) { curleft += obj.offsetLeft; curtop += obj.offsetTop; } } return {curleft:curleft, curtop:curtop}; }; var nodiac = { 'á':'a', 'Á':'a', 'č':'c', 'Č':'c', 'ď':'d', 'Ď':'d', 'é':'e', 'É':'e', 'ě':'e', 'Ě':'e', 'í':'i', 'Í':'i', 'ň':'n', 'Ň':'n', 'ó':'o', 'Ó':'o', 'ř':'r', 'Ř':'r', 'š':'s', 'Š':'s', 'ť':'t', 'Ť':'t', 'ú':'u', 'Ú':'u', 'ů':'u', 'Ů':'u', 'ý':'y', 'Ý':'y', 'ž':'z', 'Ž':'z', 'ü':'ue','Ü':'ue', 'ä':'a', 'Ä':'a', 'ë':'e', 'Ë':'e', 'ö':'o', 'Ö':'o', 'ï':'i', 'Ï':'i', 'ÿ':'y', 'Ÿ':'y', 'ł':'l', 'Ł':'l', 'ĺ':'l', 'Ĺ':'l', 'ć':'c', 'Ć':'c' }; /** * Make friendly URL. * * @param string * $str Source string to convert. * @return string Returns converted string. * @copyright Jakub Vrána, http://php.vrana.cz; Jiří Švec - LiveSport, * http://www.livesport.cz/ */ function make_url(str) { str = str.toLowerCase(); var s2 = ''; for (var i = 0; i < str.length; i++) s2 += (typeof nodiac[str.charAt(i)] != 'undefined' ? nodiac[str.charAt(i)] : str.charAt(i)); return s2.replace(/[^a-z0-9_]+/g, '-').replace(/^-|-$/g, ''); }; /** * URL encode / decode. * * http://www.webtoolkit.info/ */ var url = { // public method for url encoding encode : function(string) { return escape(this._utf8_encode(string)); }, // public method for url decoding decode : function(string) { return this._utf8_decode(unescape(string)); }, // private method for UTF-8 encoding _utf8_encode : function(string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) utftext += String.fromCharCode(c); else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, // private method for UTF-8 decoding _utf8_decode : function(utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while (i < utftext.length) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } }; /** * Set the CSS class at mouseover event. * * @param object * $element Target element object. * @return void */ function m_over(element) { // last_cls = ie ? element.getAttribute('className') : // element.getAttribute('class'); setStyle(element, 'background: #f7f8dc'); }; /** * Set the CSS class in mouseout event. * * @param object * $element Target element object. * @return void */ function m_out(element) { setStyle(element, ''); }; /** * Set the CSS class in mouseover event on double row. * * @param object * $element Target element object. * @param boolean * $is_second Is second row. * @return void */ function md_over(element, is_second) { // save last CSS class // last_d_cls = ie ? element.getAttribute('className') : // element.getAttribute('class'); var one = element.getAttribute('id'); var two = one.match(/b/) ? one.slice(0,-1) : one+'b'; // setting hover setStyle(getElement(one), 'background: #f7f8dc'); setStyle(getElement(two), 'background: #f7f8dc'); }; /** * Set the CSS class in mouseout event on double row. * * @param object * $element Target element object. * @param boolean * $is_second Is second row. * @return void */ function md_out(element, is_second) { var one = element.getAttribute('id'); var two = one.match(/b/) ? one.slice(0, -1) : one+'b'; // setting hover setStyle(getElement(one), ''); setStyle(getElement(two), ''); }; function cTabMenu(prefix, id, maxId, showData, resizeOverflow, cookieName) { if (cJsLib.empty(id)) { id = new Number(1); } idx = cJsLib.$('last') == null ? false : true; resizeOverflow = ! cJsLib.isNull(resizeOverflow) && resizeOverflow ? true : false; showData = ! cJsLib.isNull(showData) && showData ? true : false; for (i = 1; i <= maxId; ++i) { cJsLib.rmCls(cJsLib.$(prefix + i)); if (showData) { cJsLib.setCls(cJsLib.$(prefix + i + '-data'), 'none'); } } cJsLib.setCls(cJsLib.$(prefix + id), 'set'); if (cJsLib.isObject(cJsLib.$(prefix + id + '-data'))) { if (showData) { cJsLib.sh(prefix + id + '-data'); } if (resizeOverflow) { var div = cJsLib.$('lastMatch'); var dataHeight = cJsLib.$(prefix + id + '-data').offsetHeight; var dHeight = dataHeight > 250 ? 250 : (dataHeight < 50 ? 20 : dataHeight); cJsLib.setStyle(div, 'height:' + dHeight.toString() + 'px;'); if (cJsLib.isIE()) { cJsLib.setStyle(cJsLib.$('lstGame-' + id + '-data'), '#width:471px;_width:477px;'); } if (dHeight == 20) { cJsLib.setCls(div, 'noScroll'); } else { cJsLib.rmCls(div); } } } // update cookie if (! cJsLib.empty(cookieName)) { cookie.add(cookieName, prefix + id, 365); } delete i,resizeOverflow,showData; }; /** * Show / hide tab menu. * * @param string * $tab ID of next tab menu. * @param boolean * $showData If need switch hidden data box enter true, * otherwise null or false. * @param string * $prefix Prefix for element ID. param boolean $show_data Show data * data block, for example paired DIV block witch some data which * depends on tab. Data block must a same ID as pared tab and * finishes '-data', e.g. lt1 for TAB and lt1-data * for the data block (optional). * @param boolean * $resize_overflow Resize overflow div (optional). * @return void */ function tmenu(prefix, id, max_id, show_data, resize_overflow) { var idx = (getElement('last') == null) ? false : true; if (typeof id == 'undefined') { id = 1; } if (typeof resize_overflow == 'undefined') { resize_overflow = false; } if (typeof show_data == 'undefined') { show_data = false; } for (var i = 1; i <= max_id; i++) { setCls(getElement(prefix+i), 'n'); if (idx) { setCls(getElement('tbl-last'+i), 'result'); } if (show_data) { setCls(getElement(prefix+i+'-data'), 'hidden'); } } setCls(getElement(prefix+id), 'a'); if (show_data) { setCls(getElement(prefix+id+'-data'), 'shown'); } if (idx && resize_overflow) { var div = getElement('last'); var dataHeight = getElement(prefix+id+'-data').offsetHeight; var dHeight = dataHeight > 250 ? 250 : (dataHeight < 50 ? 35 : dataHeight); setStyle(div, 'height:'+dHeight+'px;'); if (dHeight == 35) { setCls(div, 'no-scroll'); var tbl = getElement('tbl-last'+id); setCls(tbl, 'result no-data'); } else { delCls(div); } } }; function add_smile_to_content(what, where) { var e = cJsLib.$(where); // M$ IE fix if (document.selection) { e.value += what; vyber = document.selection.createRange(); } else if (e.selectionStart || e.selectionStart == 0) { startPos = e.selectionStart; endPos = e.selectionEnd; e.value = e.value.substring(0, startPos) + what + e.value.substring(endPos, e.value.length); } else { e.value += what; } e.focus(); } /** * Create new suggest box. * * @param string * $elementID ID of suggest box. * @return object Returns the DOM object of box. */ function _createSuggestBox(elementID) { // new suggest container var newSuggest = document.createElement('div'); newSuggest.setAttribute('id', 'mutualSuggest'); setCls(newSuggest, 'suggest'); return newSuggest; }; /** * Create suggest row. * * @param string * $rowValue Value of option in suggest. * @param string * $rowHref Link for option. * @param string * $onClickFunction Function which execute if click on element. * @return object Returns the DOM object. */ function _createSuggestRow(rowValue, rowHref, onClickFunction) { var opt = document.createElement('a'); setOnClick(opt, onClickFunction); opt.appendChild(document.createTextNode(rowValue)); opt.setAttribute('href', rowHref); return opt; }; /** * Move active row in suggest. * * @param object * $element DOM object of parent element. * @param string * $direction Direction of motion. Possible values are: * * @return void */ function moveActiveSuggestRow(element, direction) { var newPosition = lastSuggestRow; // check if suggest has some childs if (element.hasChildNodes()) { // remove hover delCls(element.childNodes[lastSuggestRow]); if (direction == 'down') { if (lastSuggestRow >= element.childNodes.length-1) newPosition = 0; else newPosition++; } else { if (lastSuggestRow <= 0) newPosition = element.childNodes.length-1; else newPosition--; } // set hover setCls(element.childNodes[newPosition], 'active'); // save last position lastSuggestRow = newPosition; } }; // AJAX {{{ var xhr; /** * Create XMLHttpRequest (XHR) object. * * @return void */ function create_xhr() { try { // Firefox, Opera 8.0+, Safari xhr = new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert(TXT_UNSUPPORTED_BROWSER); return false; } } } }; /** * Display XHR error and error code, if creation failure. * * @return void */ function show_xhr_error() { alert(TXT_XHR_ERROR); }; var lastExpress; var actGetExpress = false; /** * Get a express message and show it. * * @param {Integer} id ID of express message. */ function getExpress(id) { if (! cJsLib.empty(lastExpress) && lastExpress == id) { hideExpress(id); } else if (! actGetExpress) { // delete pointer to auto hide opened express message if (cJsLib.isActiveTimeOut()) { cJsLib.destroyTimeOut(); } actGetExpress = true; var ajaxIndex = ajaxObject.length; ajaxObject[ajaxIndex] = new XHR(); var ajax = ajaxObject[ajaxIndex]; ajax.onCompletion = function(responseXML, response) { if (typeof lastExpress != "undefined" || lastExpress != null) { contElem = cJsLib.$('emsg-' + lastExpress); cJsLib.setCls(contElem, 'hidden'); cJsLib.setCls(cJsLib.$('p-emsg-' + lastExpress), 'express'); } mContainer = cJsLib.$('emsg-' + id); mContainer.innerHTML = response; lastExpress = id; cJsLib.rmCls(mContainer).setCls(cJsLib.$('p-emsg-' + id), 'express active'); cJsLib.$('p-emsg-' + id).onmouseover = function() { cJsLib.destroyTimeOut(); }; cJsLib.$('p-emsg-' + id).onmouseout = function() { cJsLib.registerTimeOutSh('p-emsg-' + id, 5, 'hide'); }; }; ajax.setMethod('GET').setVar('id', id).setRequestFile('/res/ajax/get-express-message.php'); ajax.runAjax(); actGetExpress = false; } }; /** * Hide content of a express message. * * @param {Integer} id Id of express message. */ function hideExpress(id) { cJsLib.setCls(cJsLib.$('emsg-' + id), 'hidden'); cJsLib.setCls(cJsLib.$('p-emsg-' + lastExpress), 'express'); cJsLib.$('p-emsg-' + lastExpress).onmouseout = function() {}; lastExpress = null; }; /* Forum functions {{{ */ function hide(element, useXhr) { var e = getElement(element); var ufMin = getElement('uf-min'); var hText = ufMin.firstChild; var stat = '0'; var cl; useXhr = (typeof useXhr == 'undefined' || useXhr !== true) ? false : true; if ((cl = e.getAttribute('class')) == undefined) { cl = e.getAttribute('className'); } if (cl == 'hide' || cl == 'hidden') { delCls(e); setCls(ufMin, 'up'); hText.innerHTML = TXT_MINIMIZE; ufMin.title = TXT_CLICK_TO_MINIMIZE_FILTER; stat = '1'; } else { setCls(e, 'hide'); setCls(ufMin, 'down'); hText.innerHTML = TXT_MAXIMIZE; ufMin.title = TXT_CLICK_TO_MAXIMIZE_FILTER; } if (useXhr) { create_xhr(); xhr.open('GET', TXT_URL_DISCUSSION + 'ajax/change-filter-stat.php?stat=' + stat); xhr.send(null); } }; /** * Show reload filter button. * * @return void */ var last_search; var last_only; /** * Check value filter by user only button and if value is changed, reload * filter. * * @return void */ function check_search() { var value = getElement('search-user').value; filter_check_length(getElement('search-user'), 64); if (value.length >= 3 && value != last_search) { if (getElement('filter').value == TXT_ACTIVATE) { getElement('filter').disabled = false; } else { enable_reload(); } } else if (value.length > 0) { getElement('filter_reload').disabled = true; } else { enable_reload(); } if (last_search == undefined) { last_search = getElement('search-user').value; } }; function filter_check_length(element, len) { if (element.value.length > len) { // @debug alert('Text is too long.'); return false; } else if (element.value.length > 0) { delCls(element); } return true; } /** * Active / deaktive user filter. * * @param integer * $status New filter status. * * @return void */ function u_filter(status) { var filter_div = getElement('u-filter'); var stat; var xml; var sel; if (status == '0') { filter_div.setAttribute('class', 'uf-deact'); filter_div.setAttribute('className', 'uf-deact'); getElement('filter').value = TXT_ACTIVATE; getElement('filter-status').innerHTML = TXT_ACTIVE; stat = '0'; } else { filter_div.setAttribute('class', 'uf-act'); filter_div.setAttribute('className', 'uf-act'); getElement('filter').value = TXT_DEACTIVATE; getElement('filter-status').innerHTML = TXT_DEACTIVE; stat = '1'; } xml = ''; xml += ''+stat+''; xml += '' : ('>'+getElement('search-user').value+'')) xml += '' : ('>'+getElement('user-only').value+'')); sel = getElement('sel-highlight').options; if (sel.length > 0) { xml += ''; for (var i = 0; i < sel.length; i++) { xml += ''+sel[i].text+''; } xml += ''; } else { xml += ''; } sel = getElement('sel-ignore').options; if (sel.length > 0) { xml += ''; for (var i = 0; i < sel.length; i++) { xml += ''+sel[i].text+''; } xml += ''; } else { xml += ''; } if ($('#commentForm').length) { isArticle = true; xml += '
'; } else { isArticle = false; } xml += ''; create_xhr(); xhr.onreadystatechange = function() { if (xhr.readyState == 0 || xhr.readyState == 4) { if (xhr.status == 200) { if (isArticle) { window.location.reload(true); } else { document.location = getElement('forum').action; } } else { show_xhr_error(); } } }; xhr.open('POST', TXT_URL_DISCUSSION + 'ajax/uf-enable.php'); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;"); xhr.send(xml); }; // }}} function host(ip, parentElement) { pElem = getElement('id'+parentElement); create_xhr(); xhr.onreadystatechange = function() { if (xhr.readyState == 0 || xhr.readyState == 4) { if (xhr.status == 200) { pElem.innerHTML = xhr.responseText; pElem.title = ''; pElem.style.cursor = 'auto'; } else { show_xhr_error(); } } }; xhr.open('GET', '/res/ajax/get-hostname.php?ip='+ip, true); xhr.send(null); }; /** * Enable filter button. * * @return void */ function enable_reload() { if (getElement('filter').value == TXT_DEACTIVATE) { getElement('filter_reload').disabled = false; } else { getElement('filter_reload').disabled = false; getElement('filter_reload').style.display = ''; } }; function reload() { u_filter('1'); }; function add_wrong() { if (getElement('new_wrong').value.length > 3) { create_xhr(); var url = 'word='+getElement('new_wrong').value; xhr.onreadystatechange = function() { if (xhr.readyState == 0 || xhr.readyState == 4) { if (xhr.status == 200) { getElement('add_result').innerHTML = xhr.responseText; getElement('new_wrong').value = ''; } else { show_xhr_error(); } } }; xhr.open('POST', TXT_URL_DISCUSSION + 'ajax/add-expletive.php'); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;"); xhr.send(url); } else { getElement('add_result').innerHTML = TXT_SHORT_WORD; } }; /** * Add user to highlighted user combo box. * * @param string * $user_id ID user. * @param string * $nick Nickname. * @return void */ function add_high(user_id, nick) { var opt = document.createElement('option'); if (check_in_combo('sel-highlight', nick) == true) { alert(TXT_USER_ALREADY_EXISTS_IN_SELECTION); return false; } if (check_in_combo('sel-ignore', nick) == true) { alert(TXT_USER_CANT_ADD_TO_HIGHLIGHTED + "\n" + TXT_USER_ALREADY_IN_IGNORED); return false; } remove_empty('sel-highlight'); opt.value = user_id; opt.setAttribute('id', 'uh'+user_id); opt.appendChild(document.createTextNode(nick)); getElement('sel-highlight').appendChild(opt); reload(); } function check_in_combo(combo, value) { var sel = getElement(combo).options; for (var i = 0; i < sel.length; i++) { if (sel[i].text == value) { return true; } } return false; } /** * Remove empty value in combo box. * * @param string * $element ID of combo box. * @return void */ function remove_empty(element) { var e_name; if (element == 'sel-ignore') { e_name = 'ui0'; } else { e_name = 'uh0'; } if (getElement(e_name) != null) { sel = getElement(element); sel.removeChild(sel.options[getElement(e_name).index]); } } /** * Enable button. * * @param string * $element Button ID, which you can enable. * @return void */ function enable_clear(element) { var e = getElement('rem-'+element); var sel = getElement('sel-'+element); if (sel.options.length > 0) { e.setAttribute('disabled', ''); e.disabled = false; } } /** * Remove selected user from multi combo box. * * @param string * $element Parent element, where need remove users from list. * @return void */ function rem_sel_user(element) { var e = getElement(element); var e_rem; for (var i = e.options.length-1; i >= 0; i--) { if (e.options[i].selected == true) { e.removeChild(e.options[i]); } } if (e.id == 'sel-ignore') { e_rem = 'ignore'; } else { e_rem = 'highlight'; } if (e.options.length == 0) { var opt = document.createElement('option'); opt.value = ''; opt.setAttribute('id', 'u'+(e_rem == 'ignore' ? 'i' : 'h')+'0'); opt.appendChild(document.createTextNode('')); getElement('sel-'+e_rem).appendChild(opt); } getElement('rem-'+e_rem).disabled = true; enable_reload(); } /** * Enable / disable add user button. * * @param object * $element Object of element, which enable or disable. * @return void. */ function enable_add(element) { var te = 'add-'+(element == 'h' ? 'highlight' : 'ignore'); var e = getElement(te); if (e.value.length > 0) { getElement('b'+te).disabled = false; } else { getElement('b'+te).disabled = true; } } function checkLoginFrm() { if (cJsLib.empty(cJsLib.$('loginName').value)) { alert(TXT_BAD_USERNAME_LOGIN); return false; } if (cJsLib.empty(cJsLib.$('loginPass').value)) { alert(TXT_BAD_PASSWORD_LOGIN); return false; } return true; } // user search functions {{{ var user; var sel; function add_user(element) { var id = element.name; if (id == 'add_highlight') { user = getElement('add-highlight'); sel = getElement('sel-highlight'); if (check_in_combo('sel-ignore', user.value)) { alert(TXT_USER_CANT_ADD_TO_HIGHLIGHTED + "\n" + TXT_USER_ALREADY_IN_IGNORED); user.value = ''; return false; } } else { user = getElement('add-ignore'); sel = getElement('sel-ignore'); if (check_in_combo('sel-highlight', user.value)) { alert(TXT_USER_CANT_ADD_TO_IGNORED + "\n" + TXT_USER_ALREADY_IN_HIGHLIGHTED); user.value = ''; return false; } } if (sel.options.length >= 50) { alert(TXT_EXCEED_MAXIMUM_USERS); return false; } if (check_in_combo(sel.id, user.value)) { alert(TXT_USER_ALREADY_EXISTS_IN_SELECTION); user.value = ''; return false; } if (user.value != '') { create_xhr(); xhr.onreadystatechange = function() { if (xhr.readyState == 0 || xhr.readyState == 4) { if (xhr.status == 200) { var opt = document.createElement('option'); if (xhr.responseXML.getElementsByTagName('user')[0].hasChildNodes()) { var uid; if (xhr.responseXML.getElementsByTagName('id')[0].firstChild.textContent == undefined) { // M$ fix uid = xhr.responseXML.getElementsByTagName('id')[0].firstChild.text; value = xhr.responseXML.getElementsByTagName('nick')[0].firstChild.text; nick = xhr.responseXML.getElementsByTagName('nick')[0].firstChild.text; } else { // valid browsers uid = xhr.responseXML.getElementsByTagName('id')[0].firstChild.textContent; value = xhr.responseXML.getElementsByTagName('nick')[0].firstChild.textContent; nick = xhr.responseXML.getElementsByTagName('nick')[0].firstChild.textContent; } remove_empty(sel.id); opt.value = value opt.setAttribute('id', 'u'+(sel.id == 'sel-highlight' ? 'h' : 'i')+uid); opt.appendChild(document.createTextNode(nick)); sel.appendChild(opt); user.value = ''; if (getElement('filter').value == TXT_ACTIVATE) { getElement('filter').disabled = false; } else { enable_reload(); } } else { alert(TXT_USER_DOES_NOT_EXISTS); } } else { show_xhr_error(); } } }; xhr.open('GET', TXT_URL_DISCUSSION + 'ajax/check_user.php?user=' + user.value, true); xhr.send(null); } } // }}} /** * Reset all settings on filter and deactive it. * * @return void */ function reset_filter() { if (confirm(TXT_REALLY_DELETE_FILTER_SETTINGS)) { getElement('search-user').value = ''; getElement('user-only').value = ''; var e = getElement('sel-highlight'); for (var i = e.options.length-1; i >= 0; i--) { e.removeChild(e.options[i]); } e = getElement('sel-ignore'); for (var i = e.options.length-1; i >= 0; i--) { e.removeChild(e.options[i]); } u_filter('0'); } } /** * Add user to only user filter. * * @param string * $nick Nickname. * @return void */ function add_only(nick) { if (check_in_combo('sel-ignore', nick) == true) { alert(TXT_USER_CAN_NOT_ADD + "\n" + TXT_USER_IS_ALREADY_IGNORED); return false; } getElement('user-only').value = nick; reload(); } /** * Add user to ignored combo box. * * @param integer * user_id User ID. * @param sring * nick Nickname. * @return void */ function add_ignore(user_id, nick) { var opt = document.createElement('option'); var err = false; var mes = ''; if (check_in_combo('sel-ignore', nick) == true) { mes = TXT_USER_ALREADY_EXISTS_IN_SELECTION; err = true; } if (err === false && getElement('user-only').value == nick) { mes = TXT_USER_CANT_ADD_TO_IGNORED + "\n" + TXT_USER_IS_ALREADY_IN_FIELD_SHOW_ONLY_USERS; err = true; } if (err === true) { alert(mes); return false; } if (confirm(TXT_REALLY_IGNORE_USER)) { remove_empty('sel-ignore'); opt.value = user_id; opt.setAttribute('id', 'ui'+user_id); opt.appendChild(document.createTextNode(nick)); getElement('sel-ignore').appendChild(opt); reload(); if (getElement('filter').value == TXT_ACTIVATE) { getElement('filter').disabled = false; } } } /** * Show / hide element. * * @param object $element Element object. * @return void */ function show(element) { if (element.style.display == 'block') { element.setAttribute('style', 'display:none;'); element.style.display = 'none'; } else { element.setAttribute('style', 'display:block;'); element.style.display = 'block'; } return true; } /** * Mark all admins info as readed and remove it. * * @return void */ function closePermInfo() { if (! closingPermInfo) { closingPermInfo = true; var ajaxIndex = ajaxObject.length; // create new AJAX object ajaxObject[ajaxIndex] = new XHR(); // store created AJAX as alias var ajax = ajaxObject[ajaxIndex]; ajax.setMethod('GET') .setRequestFile(TXT_URL_DISCUSSION + 'ajax/close-perm-info.php'); // redefine function which execute after AJAX ajax.onCompletion = function(response) { var actInfo = null; if ((actInfo = cJsLib.$('active-info')) && cJsLib.isObject(actInfo)) { actInfo.parentNode.removeChild(actInfo); } } // run the AJAX ajax.runAjax(); closingPermInfo = false; } }; /** * Check value filter by user only button and if value is changed, reload * filter. * * @return void */ function check_only() { var value = getElement('user-only').value; var sel = getElement('sel-ignore').options; last_only = getElement('user-only'); filter_check_length(getElement('user-only'), 64); if (value != last_only) { for (var i = 0; i < sel.length; i++) { if (sel[i].text == value && sel[i].text != '') { alert(TXT_USER_IS_IGNORED_CANNOT_SHOW_HIS_CONTRIBUTIONS_ONLY); getElement('user-only').value = ''; return false; } } if (value != '') { create_xhr(); xhr.onreadystatechange = function() { if (xhr.readyState == 0 || xhr.readyState == 4) { if (xhr.status == 200) { var opt = document.createElement('option'); var xml = xhr.responseXML.getElementsByTagName('user')[0]; if (xml.hasChildNodes()) { if (xhr.responseXML.getElementsByTagName('nick')[0].firstChild.textContent == undefined) { // M$ fix nick = xhr.responseXML.getElementsByTagName('nick')[0].firstChild.text; id = xhr.responseXML.getElementsByTagName('id')[0].firstChild.text; next = xhr.responseXML.getElementsByTagName('next')[0].firstChild.text; } else { nick = xhr.responseXML.getElementsByTagName('nick')[0].firstChild.textContent; id = xhr.responseXML.getElementsByTagName('id')[0].firstChild.textContent; next = xhr.responseXML.getElementsByTagName('next')[0].firstChild.textContent; } if (next == '1') { if (confirm(TXT_SPECIFIED_USER_DOES_NOT_EXISTS + "\n" + TXT_NEAREST_USER_IS + nick + ".\n" . TXT_DO_YOU_CAN_FILL_THIS_USER)) { sel = getElement('sel-ignore').options; for (var i = 0; i < sel.length; i++) { if (sel[i].text == nick) { alert(TXT_USER_IS_ALREADY_IN_INGNORED_CAN_NOT_FILTER_HIS_CONTRIBUTIONS_ONLY); getElement('user-only').value = ''; return false; } } getElement('user-only').value = nick; last_only = nick; if (getElement('filter').value == TXT_DEACTIVATE) { enable_reload(); } else { getElement('filter').disabled = false; } } else { getElement('user-only').value = ''; } } else { getElement('user-only').value = nick; last_only = nick; if (getElement('filter').value == TXT_DEACTIVATE) { enable_reload(); } else { getElement('filter').disabled = false; } // enable_reload(); } } else if (getElement('user-only').value == '') { last_only = nick; if (getElement('filter').value == 'c') { enable_reload(); } else { getElement('filter').disabled = false; } // enable_reload(); } else { alert(TXT_USER_DOES_NOT_EXISTS); } } } }; xhr.open('GET', TXT_URL_DISCUSSION + 'ajax/check_user.php?user='+value); xhr.send(null); } else { enable_reload(); } } } var streamsTimeout = null; var visible = null; function showStreams(id) { document.getElementById('streams'+id).style.display = 'block'; if (streamsTimeout != null) clearTimeout(streamsTimeout); if (visible != null && visible != id) doHideStreams(visible); visible = id; } function hideStreams(id) { streamsTimeout = setTimeout('doHideStreams('+id+')', 300); } function doHideStreams(id) { getElement('streams'+id).style.display = 'none'; } function poll_vote(pollID) { var vote = 0; var r = document.forms['poll'+pollID].elements['vote']; for (var i = 0; i < r.length; i++) if(r[i].checked) vote = r[i].value; if (vote != 0) poll_submit(pollID, vote); } var pollVoting = false; function poll_submit(pollID, voteID) { if (!pollVoting) { pollVoting = true; var ajaxIndex = ajaxObject.length; // create new AJAX object ajaxObject[ajaxIndex] = new XHR(); // store created AJAX as alias var ajax = ajaxObject[ajaxIndex]; ajax.element = 'poll-' + pollID; // set requested script file ajax.method = 'GET'; ajax.requestFile = '/res/ajax/poll-vote.php'; // set up URL parameter ajax.setVar('pollID', pollID); ajax.setVar('voteID', voteID); // run the AJAX ajax.runAjax(); pollVoting = false; } } function moreButtonClick(type, back, more) { var el = document.getElementById(type + '-more'); var show = (el.style.display == 'none'); el.style.display = show ? 'block' : 'none'; document.getElementById(type + '-more-b').innerHTML = ' ' + (show ? back : more); } function playerInjuriesShow(type) { document.getElementById('injuries-' + (type == 'full' ? 'short' : 'full')).style.display = 'none'; document.getElementById('injuries-' + type).style.display = 'block'; } var fullShown = {}; function showFull(e, table_id) { $('#' + table_id).find('tr.fullonly').each(function() { // sbaleni rozbalenych turnaju v prehledu titulu u hrace $(this).find('[data-ykey]').each(function() { $('[data-row=' + $(this).attr('data-ykey') + ']').addClass('hidden'); }); $(this).toggle(); }); bt = $(e).find('.buttontext'); if (fullShown[table_id] == null) { fullShown[table_id] = bt.html(); bt.html('Back'); } else { bt.html(fullShown[table_id]); fullShown[table_id] = null; } } var tzOpen = false; var tzLoaded = false; function tz(url) { var e = document.getElementById('timezones'); if (tzOpen) { e.style.display = 'none'; tzOpen = false; } else { e.style.display = 'block'; tzOpen = true; if (!tzLoaded) { var ajaxIndex = ajaxObject.length; // create new AJAX object ajaxObject[ajaxIndex] = new XHR(); // store created AJAX as alias var ajax = ajaxObject[ajaxIndex]; ajax.element = 'timezones'; ajax.setVar('url', url); // set requested script file ajax.method = 'GET'; ajax.requestFile = '/res/ajax/timezones.php'; // run the AJAX ajax.runAjax(); tzLoaded = true; } } } function tzover(e) { e.className = 'over'; } function tzout(e) { e.className = ''; } var tzHideTimeout = null; function tzHide() { tzHideTimeout = setTimeout('tzDoHide()', 1000); } function tzStopHiding() { if (tzHideTimeout != null) clearTimeout(tzHideTimeout); } function tzDoHide() { document.getElementById('timezones').style.display = 'none'; tzOpen = false; } var to_hide = new Array(); var divShown = {}; var prevString = new Array(); var prevCountry = new Array(); var types = new Array(); var moreparams = new Array(); var mutualSelectedSex = {1: '', 2: ''}; var mutualSelectedUrl = {1: '', 2: ''}; function searchLoad(id) { clearTimeout(to_hide[id]); string = new String($('#search-text-' + id).val()); string = string.replace(/^\s+|\s+$/, ''); country = $('#search-country-' + id).length ? $('#search-country-' + id).val() : ''; if (id == 'mut1') { types[id] = mutualSelectedSex[2] != '' ? mutualSelectedSex[2] : 'p'; } if (id == 'mut2') { types[id] = mutualSelectedSex[1] != '' ? mutualSelectedSex[1] : 'p'; } if (string.length >= 2) { if (string.length - (string.lastIndexOf(' ') + 1) < 2) { string = string.substring(0, string.lastIndexOf(' ')); } if (string != prevString[id] || country != prevCountry[id]) { if (!divShown[id]) { $.each(divShown, function(key, val) { if (val) { clearTimeout(key); doSearchHide(key); } }); $('#search-results-' + id).show().html('
'); divShown[id] = true; } jQuery.ajax({ url: '/res/ajax/search.php', type: 'GET', data: 's=' + string + '&t=' + types[id] + '&c=' + country + moreparams[id], cache: false, dataType: 'json', success: function(data) { if (data.nodata) { $('#search-results-' + id).html('
No result found.
'); notOne = true; } else { var prev_type = ''; $('#search-results-' + id).html(''); for (i = 0; i < data.links.length; i++) { link = data.links[i]; if (id == 'left') { if (link.type != prev_type) { $('#search-results-' + id).append('
' + (link.type == 't' ? 'Tournaments' : 'Players') + '
'); prev_type = link.type; } } if (id == 'pt') { $('#search-results-' + id).append(' ' + link.name + ''); } else if (link.type == 't') { $('#search-results-' + id).append(' ' + link.name + ''); } else if (id == 'mut1' || id == 'mut2') { var re = new RegExp("'"); $('#search-results-' + id).append('' + link.name + ''); } else { $('#search-results-' + id).append('' + link.name + ''); } } notOne = data.links.length != 1; } if ((id == 'mut1' || id == 'mut2') && notOne) { mutualSelectedUrl[id.charAt(3)] = ''; } } }); prevString[id] = string; prevCountry[id] = country; } } else if (divShown[id]) { doSearchHide(id); } } function searchHide(id) { to_hide[id] = setTimeout('doSearchHide(\'' + id + '\')', 200); } function doSearchHide(id) { $('#search-results-' + id).hide(); divShown[id] = false; prevString[id] = ''; prevCountry[id] = ''; } function checkSearchForm(id) { if ($('#search-text-' + id).val().length < 2 && ($('#search-country-' + id).length == 0 || $('#search-country-' + id).val() == '')) { alert(TXT_SHORT_SEARCHED_TEXT); return false; } else { $('#search-submit-' + id).click(); return true; } } function searchInit() { $('[data-searchid]').each(function() { var sid = $(this).attr('data-searchid'); $(this).attr('id', 'search-text-' + sid); $(this).attr('name', 'search-text-' + sid); $(this).attr('autocomplete', 'off'); $(this).blur(function() { searchHide(sid); }); $(this).focus(function() { searchLoad(sid); }); $(this).keyup(function(e) { if ((e.keyCode || e.which) != 13) { searchLoad(sid); } }); if (sid == 'tour' || sid == 'plr') { $(this).keypress(function(e) { if ((e.keyCode || e.which) == 13) { rightSearchSubmit(sid); } }); } if (!$('#search-results-' + sid).length) { $(this).after('
'); } if ($('#search-country-' + sid).length) { $('#search-country-' + sid).blur(function() { searchHide(sid); }); $('#search-country-' + sid).focus(function() { searchLoad(sid); }); $('#search-country-' + sid).change(function() { searchLoad(sid); }); } to_hide[sid] = ''; divShown[sid] = false; prevString[sid] = ''; prevCountry[sid] = ''; types[sid] = $(this).attr('data-searchtype'); mp = $(this).attr('data-moreparams'); moreparams[sid] = typeof mp !== typeof undefined && mp !== false ? mp : ''; }); } function rightSearchSubmit(id) { string = new String($('#search-text-' + id).val()); string = string.replace(/^\s+|\s+$/, ''); if (string.length >= 2) { doSearchHide(id); var prevBut = $('#search-but-' + id).html(); $('#search-but-' + id).html(''); jQuery.ajax({ url: '/res/ajax/search.php', type: 'GET', data: 's=' + string + '&t=' + (id == 'tour' ? 't' : 'p') + '&all=1', cache: false, dataType: 'json', success: function(data) { if (data.nodata) { alert('No result found.'); } else if (data.toomuch) { alert(id == 'tour' ? 'Too many results.\nPlease specify tournament name.' : "Too many results.\nPlease specify player's name."); } else if (data.links.length == 1) { window.location = '/player/' + data.links[0].url; } else { $('#search-text-' + id).blur(); $('#search-results-box-' + id).html(''); for (i = 0; i < data.links.length; i++) { link = data.links[i]; $('#search-results-box-' + id).append('' + link.name + ' »
'); } $('#search-results-box-' + id).css('display', 'block'); } $('#search-but-' + id).html(prevBut); } }); } } function mutualClick(id, sex, name, url) { i = id.charAt(3); mutualSelectedSex[i] = sex.charAt(0); $('#search-text-' + id).val(name.replace(/ \([A-Z]+\)/, '')); mutualSelectedUrl[i] = url; if (mutualSelectedUrl[i == 1 ? 2 : 1] != '') { $('#search-but-mut').replaceWith(''); window.location = '/mutual/' + mutualSelectedUrl[1] + '/' + mutualSelectedUrl[2] + '/'; } } function mutualSubmit() { but = $('#search-but-mut').replaceWith(''); if ($('#search-text-mut1').val().length < 2 || $('#search-text-mut2').val().length < 2) { alert(TXT_SHORT_SEARCHED_TEXT); $('#search-but-mut').replaceWith(but); return false; } else { return true; } } function mutualRadioSubmit() { var p1 = $('input[name=radio_player1]:checked'); var p2 = $('input[name=radio_player2]:checked'); if (p1.length && p2.length) { window.location = '/mutual/' + p1.val() + '/' + p2.val() + '/'; } else { //@debug alert('Select players for comparison'); } } function playerTournamentSearchClick(tid, name, url) { $('#ptresults').show().html('
'); $('#search-text-pt').val(name); jQuery.ajax({ url: '/res/ajax/player-tournament-search.php', type: 'GET', data: 'tid=' + tid + '&url=' + url + '&' + $('#ptresults').attr('data-params'), cache: false, dataType: 'text', success: function(data) { $('#ptresults').html(data); } }); } function showSocialBox() { if ($('#social-abs').length == 0) { return; } if ($('body').hasClass('branding')) { $('#social-abs').remove(); return; } if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { $('#social-abs').remove(); return; } contentAdded = false; $('body').prepend('
'); (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); $('#social-abs').children('.content').append('
'); contentAdded = true; if (contentAdded) { $('#social-abs').children('.content').append('
 
'); $('#social-abs').show(); } } function toggleTweetImage(e) { e = $(e); original_height = e.children().first().height(); new_height = e.height() == original_height ? 200 : original_height; e.height(new_height); e.children('.brd').height(new_height - 10); } function betRankYearChange(e, act) { if ($(e).val() == act) { $('#betRankRangeSelect').removeAttr('disabled'); } else { $('#betRankRangeSelect').attr('disabled', 'disabled').val(act); } } function betRankRightChange(i) { cTabMenu('betrank-', i, 2, true, false, ''); $('#betrankbutton').attr('href', '/ranking/betting-ranking/' + (i == 1 ? '' : '?type=worst')); } function tipclick(id) { $('#tipcomment-' + id).toggle(); } var commentsFormShown = false; function commentsShowForm() { if (!commentsFormShown) { $('#addCommentBox').remove(); $('#addCommentForm').show(); commentsFormShown = true; } } function commentsTab(parent) { commentsShowForm(); li = $('#addCommentForm').find('li'); $(li[parent == 0 ? 0 : 1]).addClass('set'); $(li[parent == 0 ? 1 : 0]).removeClass('set'); $('#parent_id').val(parent); if (parent) { $('html, body').animate({scrollTop: $('#comments').offset().top}, 0); } $('#commContent').focus(); } function load_comments(logged) { if (!logged) { $('.comments-link').show(); return; } ids = []; $('.comments-link').each(function() { ids.push($(this).attr('data-aid')); }); jQuery.ajax({ url: '/res/ajax/load-new-comments-count.php', type: 'GET', data: 'ids=' + ids.join(','), cache: false, dataType: 'json', success: function(data) { if (data.logged) { $('.comments-link').each(function() { aid = $(this).attr('data-aid'); tspan = $(this).children('.t'); ctot = tspan.html(); ctot = ctot.substring(0, ctot.indexOf(' ')); cnew = aid in data.counts ? data.counts[aid] : ctot; tspan.attr('title', 'number of comments (number of new comments)').html(ctot + ' ' + (cnew > 0 ? '' : '') + '(' + cnew + ')' + (cnew > 0 ? '' : '')); $(this).show(); }); } else { $('.comments-link').show(); } } }); } function comments_set_read(aid) { jQuery.ajax({ url: '/res/ajax/comments-set-read.php', type: 'GET', cache: false, data: 'aid=' + aid }); } function comment_show(e) { par = $(e).parent().parent(); par.children('.ignored-info').hide(); par.children('.ignored-comment').show(); } function comment_hide(e) { par = $(e).parent().parent().parent(); par.children('.ignored-info').show(); par.children('.ignored-comment').hide(); } var pastTournamentGamesOpened = null; function pastTournamentGamesClick(id) { if (pastTournamentGamesOpened != null) { $('#ptg-' + pastTournamentGamesOpened).hide(); $('#ptg-' + pastTournamentGamesOpened + '-row').find('a').toggleClass('bold'); } if (id == pastTournamentGamesOpened) { pastTournamentGamesOpened = null; } else { $('#ptg-' + id).show(); $('#ptg-' + id + '-row').find('a').toggleClass('bold'); pastTournamentGamesOpened = id; } } var tournamentListShown = 'all'; function tournamentList(type) { if (type == tournamentListShown) { return; } $('#li_' + tournamentListShown).removeClass('set'); $('#li_' + type).addClass('set'); tournamentListShown = type; if (type == 'all') { $('#tournamentList').find('tr').show(); } else { $('#tournamentList').find('tr').hide(); $('#tournamentList').find('tr[data-type=' + type + ']').show(); } if (type != 'all') { $('#tournamentList').find('.month').show(); $('#tournamentList').find('.month').each(function() { if ($(this).nextAll(':visible').first().hasClass('month')) { $(this).hide(); } }); } tournamentListScroll(type); } var tournament_list_scroll_all_id = ''; function tournamentListScroll(type) { if (type == 'all') { type = tournament_list_scroll_all_id; } if (type != '' && $('#first-actual-' + type).length) { $('html, body').animate({scrollTop: $('#first-actual-' + type).offset().top}, 300); } } $(document).on('mouseenter', '.oup, .odown', function() { $(this).children('.odds-change-div').show(); }); $(document).on('mouseleave', '.oup, .odown', function() { $(this).children('.odds-change-div').hide(); }); var draw_content_width = 0; var draw_window_width = 0; var block_scroll_handler = false; function draw_init(height, count_levels, count_players) { has_scroll_x = count_levels > 3; has_scroll_y = count_players > 32; draw_content_width = count_levels * 140 + 10; draw_window_width = has_scroll_y ? 472 : 487; $('#draw-preloader').hide(); $('#draw').css('height', height).show().scrollLeft(0).scrollTop(0); if (has_scroll_x) { but_top = Math.round(height / 2) - 20; $('#scrollbutton-left').css('top', but_top).css('left', 5); $('#scrollbutton-right').css('top', but_top).css('left', has_scroll_y ? 427: 442).show(); } $('#draw').scroll(function() { if (!block_scroll_handler) { check_scroll_buttons(); } }); } function draw_scroll(dir) { prev_scroll = $('#draw').scrollLeft(); new_scroll = Math.max(0, prev_scroll + (dir * (prev_scroll == 0 ? 151 : 140))); if (new_scroll <= 11) new_scroll = 0; block_scroll_handler = true; $('#draw').animate({ scrollLeft: new_scroll }, 150, function() { check_scroll_buttons(); block_scroll_handler = false; }); } function check_scroll_buttons() { scroll = $('#draw').scrollLeft(); $('#scrollbutton-left').toggle(scroll > 0); $('#scrollbutton-right').toggle(scroll + draw_window_width < draw_content_width); } function ranking_check_sumbit() { date = $('#rform-date').val(); name = $('#search-text-ran').val(); country = $('#search-country-ran').val(); rp = $('#rankPars'); window.location = '?date=' + date + (name != '' ? '&search-text-ran=' + encodeURIComponent(name) : '') + (country != '' ? '&country=' + country : '') + (rp.length ? rp.val() : ''); return false; } function drawclick(draw) { url = window.location.href; if (draw) { if (url.indexOf('draw=1') == -1) { window.history.pushState('drawclick', null, url + (url.indexOf('?') == -1 ? '?' : '&') + 'draw=1'); } } else { if (url.indexOf('draw=1') > -1) { if (url.indexOf('draw=1&') > -1) { newurl = url.replace('draw=1&', ''); } else { newurl = url.replace('draw=1', ''); newurl = newurl.substring(0, newurl.length - 1); } window.history.pushState('drawclick', null, newurl); } } } window.onpopstate = function(e) { if ($('#draw').length > 0) { if (window.location.href.indexOf('draw=1') > -1) { cTabMenu('tournamentTabs-', 2, 2, true, true); } else { cTabMenu('tournamentTabs-', 1, 2, true, true); } } }; function termsDisagree() { $('#termsAgree1,#termsAgree2').toggleClass('hidden'); } function showTitles(year) { $('[data-row=' + $(year).attr('data-ykey') + ']').toggleClass('hidden'); } //funkce potrebne pro externi tapetu function bgInit() { // nastaveni marginu pri existenci tapety - prestalo fungovat pri zmene kodu tapety, presunul jsem to primo do css // zakomentovano, neni uz to potreba, funkci odstranim pozdeji, pokud to bude ok /* if ($('body').hasClass('branding')) { $('#mc').css('margin-top', '200px'); } */ } var cpexSkin = function() { var skinWrapper = top.document.createElement("div"); skinWrapper.id = 'cpex-skin-wrapper'; skinWrapper.style.position = "fixed"; skinWrapper.style.left = "0"; skinWrapper.style.top = "0"; skinWrapper.style.width = "100%"; skinWrapper.style.height = "100%"; skinWrapper.style.zIndex = "0"; top.document.body.appendChild(skinWrapper); var contentElement; if (contentElement = top.document.getElementById("mc")) { contentElement.style.zIndex = 1; contentElement.style.marginTop = '200px'; contentElement.style.position = 'relative'; } $('#social-abs').remove(); return { scrollElement: top.document.body, skinWrapper: skinWrapper, contentElement: contentElement }; }; (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|mobile.+firefox|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(a){(window.browser=window.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);