!function(e,n,i,s){"use strict";function t(n,i){this.element=n,this.$elem=e(this.element),this.options=e.extend(d,i),this.init()}var l="slimmenu",a=0,d={resizeWidth:"767",initiallyVisible:!1,collapserTitle:"Main Menu",animSpeed:"medium",easingEffect:null,indentChildren:!1,childrenIndenter:" ",expandIcon:"▼",collapseIcon:"▲"};t.prototype={init:function(){var i,s=e(n),t=this.options,l=this.$elem,a='
';l.before(a),i=l.prev(".menu-collapser"),l.on("click",".sub-toggle",function(n){n.preventDefault(),n.stopPropagation();var i=e(this).closest("li");e(this).hasClass("expanded")?(e(this).removeClass("expanded").html(t.expandIcon),i.find(">ul").slideUp(t.animSpeed,t.easingEffect)):(e(this).addClass("expanded").html(t.collapseIcon),i.find(">ul").slideDown(t.animSpeed,t.easingEffect))}),i.on("click",".collapse-button",function(e){e.preventDefault(),l.slideToggle(t.animSpeed,t.easingEffect)}),this.resizeMenu(),s.on("resize",this.resizeMenu.bind(this)),s.trigger("resize")},resizeMenu:function(){var i=this,t=e(n),l=t.width(),d=this.options,o=e(this.element),h=e("body").find(".menu-collapser");n.innerWidth!==s&&n.innerWidth>l&&(l=n.innerWidth),l!=a&&(a=l,o.find("li").each(function(){e(this).has("ul").length&&(e(this).addClass("has-submenu").has(".sub-toggle").length?e(this).children(".sub-toggle").html(d.expandIcon):e(this).addClass("has-submenu").append(''+d.expandIcon+"")),e(this).children("ul").hide().end().find(".sub-toggle").removeClass("expanded").html(d.expandIcon)}),d.resizeWidth>=l?(d.indentChildren&&o.find("ul").each(function(){var n=e(this).parents("ul").length;e(this).children("li").children("a").has("i").length||e(this).children("li").children("a").prepend(i.indent(n,d))}),o.addClass("collapsed").find("li").has("ul").off("mouseenter mouseleave"),h.show(),d.initiallyVisible||o.hide()):(o.find("li").has("ul").on("mouseenter",function(){e(this).find(">ul").stop().slideDown(d.animSpeed,d.easingEffect)}).on("mouseleave",function(){e(this).find(">ul").stop().slideUp(d.animSpeed,d.easingEffect)}),o.find("li > a > i").remove(),o.removeClass("collapsed").show(),h.hide()))},indent:function(e,n){for(var i=0,s="";e>i;i++)s+=n.childrenIndenter;return""+s+" "}},e.fn[l]=function(n){return this.each(function(){e.data(this,"plugin_"+l)||e.data(this,"plugin_"+l,new t(this,n))})}}(jQuery,window,document);;var e,t;e=this,t=function(){"use strict";function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var n=1;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,u=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){a=!0,s=e},f:function(){try{u||null==n.return||n.return()}finally{if(a)throw s}}}}(n.keys);try{for(l.s();!(c=l.n()).done;)a(c.value)}catch(e){l.e(e)}finally{l.f()}}else a()})),n.filter&&(i=n.filter(i));var s=i.slice(0,t.resultsList.maxResults);t.feedback={query:e,matches:i,results:s},f("results",t)},m="aria-expanded",b="aria-activedescendant",y="aria-selected",v=function(e,n){e.feedback.selection=t({index:n},e.feedback.results[n])},g=function(e){e.isOpen||((e.wrapper||e.input).setAttribute(m,!0),e.list.removeAttribute("hidden"),e.isOpen=!0,f("open",e))},w=function(e){e.isOpen&&((e.wrapper||e.input).setAttribute(m,!1),e.input.setAttribute(b,""),e.list.setAttribute("hidden",""),e.isOpen=!1,f("close",e))},O=function(e,t){var n=t.resultItem,r=t.list.getElementsByTagName(n.tag),o=!!n.selected&&n.selected.split(" ");if(t.isOpen&&r.length){var s,u,a=t.cursor;e>=r.length&&(e=0),e<0&&(e=r.length-1),t.cursor=e,a>-1&&(r[a].removeAttribute(y),o&&(u=r[a].classList).remove.apply(u,i(o))),r[e].setAttribute(y,!0),o&&(s=r[e].classList).add.apply(s,i(o)),t.input.setAttribute(b,r[t.cursor].id),t.list.scrollTop=r[e].offsetTop-t.list.clientHeight+r[e].clientHeight+5,t.feedback.cursor=t.cursor,v(t,e),f("navigate",t)}},A=function(e){O(e.cursor+1,e)},k=function(e){O(e.cursor-1,e)},L=function(e,t,n){(n=n>=0?n:e.cursor)<0||(e.feedback.event=t,v(e,n),f("selection",e),w(e))};function j(e,n){var r=this;return new Promise((function(i,o){var s,u;return s=n||((u=e.input)instanceof HTMLInputElement||u instanceof HTMLTextAreaElement?u.value:u.innerHTML),function(e,t,n){return t?t(e):e.length>=n}(s=e.query?e.query(s):s,e.trigger,e.threshold)?d(e,s).then((function(n){try{return e.feedback instanceof Error?i():(h(s,e),e.resultsList&&function(e){var n=e.resultsList,r=e.list,i=e.resultItem,o=e.feedback,s=o.matches,u=o.results;if(e.cursor=-1,r.innerHTML="",s.length||n.noResults){var c=new DocumentFragment;u.forEach((function(e,n){var r=a(i.tag,t({id:"".concat(i.id,"_").concat(n),role:"option",innerHTML:e.match,inside:c},i.class&&{class:i.class}));i.element&&i.element(r,e)})),r.append(c),n.element&&n.element(r,o),g(e)}else w(e)}(e),c.call(r))}catch(e){return o(e)}}),o):(w(e),c.call(r));function c(){return i()}}))}var S=function(e,t){for(var n in e)for(var r in e[n])t(n,r)},T=function(e){var n,r,i,o=e.events,s=(n=function(){return j(e)},r=e.debounce,function(){clearTimeout(i),i=setTimeout((function(){return n()}),r)}),u=e.events=t({input:t({},o&&o.input)},e.resultsList&&{list:o?t({},o.list):{}}),a={input:{input:function(){s()},keydown:function(t){!function(e,t){switch(e.keyCode){case 40:case 38:e.preventDefault(),40===e.keyCode?A(t):k(t);break;case 13:t.submit||e.preventDefault(),t.cursor>=0&&L(t,e);break;case 9:t.resultsList.tabSelect&&t.cursor>=0&&L(t,e);break;case 27:t.input.value="",w(t)}}(t,e)},blur:function(){w(e)}},list:{mousedown:function(e){e.preventDefault()},click:function(t){!function(e,t){var n=t.resultItem.tag.toUpperCase(),r=Array.from(t.list.querySelectorAll(n)),i=e.target.closest(n);i&&i.nodeName===n&&L(t,e,r.indexOf(i))}(t,e)}}};S(a,(function(t,n){(e.resultsList||"input"===n)&&(u[t][n]||(u[t][n]=a[t][n]))})),S(u,(function(t,n){e[t].addEventListener(n,u[t][n])}))};function E(e){var n=this;return new Promise((function(r,i){var o,s,u;if(o=e.placeHolder,u={role:"combobox","aria-owns":(s=e.resultsList).id,"aria-haspopup":!0,"aria-expanded":!1},a(e.input,t(t({"aria-controls":s.id,"aria-autocomplete":"both"},o&&{placeholder:o}),!e.wrapper&&t({},u))),e.wrapper&&(e.wrapper=a("div",t({around:e.input,class:e.name+"_wrapper"},u))),s&&(e.list=a(s.tag,t({dest:[s.destination,s.position],id:s.id,role:"listbox",hidden:"hidden"},s.class&&{class:s.class}))),T(e),e.data.cache)return d(e).then((function(e){try{return c.call(n)}catch(e){return i(e)}}),i);function c(){return f("init",e),r()}return c.call(n)}))}function x(e){var t=e.prototype;t.init=function(){E(this)},t.start=function(e){j(this,e)},t.unInit=function(){if(this.wrapper){var e=this.wrapper.parentNode;e.insertBefore(this.input,this.wrapper),e.removeChild(this.wrapper)}var t;S((t=this).events,(function(e,n){t[e].removeEventListener(n,t.events[e][n])}))},t.open=function(){g(this)},t.close=function(){w(this)},t.goTo=function(e){O(e,this)},t.next=function(){A(this)},t.previous=function(){k(this)},t.select=function(e){L(this,null,e)},t.search=function(e,t,n){return p(e,t,n)}}return function e(t){this.options=t,this.id=e.instances=(e.instances||0)+1,this.name="autoComplete",this.wrapper=1,this.threshold=1,this.debounce=0,this.resultsList={position:"afterend",tag:"ul",maxResults:5},this.resultItem={tag:"li"},function(e){var t=e.name,r=e.options,i=e.resultsList,o=e.resultItem;for(var s in r)if("object"===n(r[s]))for(var a in e[s]||(e[s]={}),r[s])e[s][a]=r[s][a];else e[s]=r[s];e.selector=e.selector||"#"+t,i.destination=i.destination||e.selector,i.id=i.id||t+"_list_"+e.id,o.id=o.id||t+"_result",e.input=u(e.selector)}(this),x.call(this,e),E(this)}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).autoComplete=t();
;
if (typeof Highcharts != 'undefined') {
Highcharts.theme = {
colors: ["#DDDF0D", "#7798BF", "#55BF3B", "#DF5353", "#aaeeee", "#ff0066", "#eeaaee",
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
chart: {
backgroundColor: {
linearGradient: [0, 0, 0, 400],
stops: [
[0, 'rgb(96, 96, 96)'],
[1, 'rgb(16, 16, 16)']
]
},
borderWidth: 0,
borderRadius: 0,
plotBackgroundColor: null,
plotShadow: false,
plotBorderWidth: 0
},
title: {
style: {
color: '#FFF',
font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
}
},
subtitle: {
style: {
color: '#DDD',
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
}
},
xAxis: {
gridLineWidth: 0,
lineColor: '#999',
tickColor: '#999',
labels: {
style: {
color: '#999',
fontWeight: 'bold'
}
},
title: {
style: {
color: '#AAA',
font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
}
}
},
yAxis: {
alternateGridColor: null,
minorTickInterval: null,
gridLineColor: 'rgba(255, 255, 255, .1)',
lineWidth: 0,
tickWidth: 0,
labels: {
style: {
color: '#999',
fontWeight: 'bold'
}
},
title: {
style: {
color: '#AAA',
font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
}
}
},
legend: {
itemStyle: {
color: '#CCC'
},
itemHoverStyle: {
color: '#FFF'
},
itemHiddenStyle: {
color: '#333'
}
},
labels: {
style: {
color: '#CCC'
}
},
tooltip: {
backgroundColor: {
linearGradient: [0, 0, 0, 50],
stops: [
[0, 'rgba(96, 96, 96, .8)'],
[1, 'rgba(16, 16, 16, .8)']
]
},
borderWidth: 0,
style: {
color: '#FFF'
}
},
plotOptions: {
line: {
dataLabels: {
color: '#CCC'
},
marker: {
lineColor: '#333'
}
},
spline: {
marker: {
lineColor: '#333'
}
},
scatter: {
marker: {
lineColor: '#333'
}
},
candlestick: {
lineColor: 'white'
}
},
toolbar: {
itemStyle: {
color: '#CCC'
}
},
navigation: {
buttonOptions: {
backgroundColor: {
linearGradient: [0, 0, 0, 20],
stops: [
[0.4, '#606060'],
[0.6, '#333333']
]
},
borderColor: '#000000',
symbolStroke: '#C0C0C0',
hoverSymbolStroke: '#FFFFFF'
}
},
exporting: {
buttons: {
exportButton: {
symbolFill: '#55BE3B'
},
printButton: {
symbolFill: '#7797BE'
}
}
},
// scroll charts
rangeSelector: {
buttonTheme: {
fill: {
linearGradient: [0, 0, 0, 20],
stops: [
[0.4, '#888'],
[0.6, '#555']
]
},
stroke: '#000000',
style: {
color: '#CCC',
fontWeight: 'bold'
},
states: {
hover: {
fill: {
linearGradient: [0, 0, 0, 20],
stops: [
[0.4, '#BBB'],
[0.6, '#888']
]
},
stroke: '#000000',
style: {
color: 'white'
}
},
select: {
fill: {
linearGradient: [0, 0, 0, 20],
stops: [
[0.1, '#000'],
[0.3, '#333']
]
},
stroke: '#000000',
style: {
color: 'yellow'
}
}
}
},
inputStyle: {
backgroundColor: '#333',
color: 'silver'
},
labelStyle: {
color: 'silver'
}
},
navigator: {
handles: {
backgroundColor: '#666',
borderColor: '#AAA'
},
outlineColor: '#CCC',
maskFill: 'rgba(16, 16, 16, 0.5)',
series: {
color: '#7798BF',
lineColor: '#A6C7ED'
}
},
scrollbar: {
barBackgroundColor: {
linearGradient: [0, 0, 0, 20],
stops: [
[0.4, '#888'],
[0.6, '#555']
]
},
barBorderColor: '#CCC',
buttonArrowColor: '#CCC',
buttonBackgroundColor: {
linearGradient: [0, 0, 0, 20],
stops: [
[0.4, '#888'],
[0.6, '#555']
]
},
buttonBorderColor: '#CCC',
rifleColor: '#FFF',
trackBackgroundColor: {
linearGradient: [0, 0, 0, 10],
stops: [
[0, '#000'],
[1, '#333']
]
},
trackBorderColor: '#666'
},
// special colors for some of the demo examples
legendBackgroundColor: 'rgba(48, 48, 48, 0.8)',
legendBackgroundColorSolid: 'rgb(70, 70, 70)',
dataLabelsColor: '#444',
textColor: '#E0E0E0',
maskColor: 'rgba(255,255,255,0.3)'
};
var highchartsOptions = Highcharts.setOptions(Highcharts.theme);
if (tmp = window.location.pathname.match(/^\/(uk|en|ru)(?:\/|$)/)) {
if (tmp[1] == 'ru') {
highchartsOptions = Highcharts.setOptions({lang: {
months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
shortMonths: ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек']
}});
}
} else {
highchartsOptions = Highcharts.setOptions({lang: {
months: ['Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'],
shortMonths: ['Січ', 'Лют', 'Бер', 'Кві', 'Тра', 'Чер', 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Гру']
}});
}
document.addEventListener('DOMContentLoaded', function () {
if (document.getElementById('container-chart')) {
const chart = Highcharts.stockChart('container-chart', {
chart: {
height: 400,
type: 'line',
zoomType: 'x',
scrollablePlotArea: {
minWidth: 340,
scrollPositionX: 1
}
},
rangeSelector: {
selected: 2
},
xAxis: {
type: 'datetime'
},
yAxis: {
title: {
text: document.getElementById('lang-rating').innerHTML
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
plotOptions: {
line: {
dataLabels: {
// enabled: true
},
// enableMouseTracking: false
}
},
tooltip: {
formatter: function() {
var date = new Date(this.x);
return '' + (this.series ? this.series.name + ': ' : '') + this.y + '
'+
(1900 + date.getYear()) + '-' + (1 + date.getMonth()) + '-' + date.getDate();
}
},
legend: {
enabled: false
},
series: Highcharts.__series,
responsive: {
rules: [{
condition: {
maxWidth: 500
},
chartOptions: {
chart: {
height: 300
},
subtitle: {
text: null
},
navigator: {
enabled: true
}
}
}]
}
});
}
});
}
function comparePlayer() {
// The autoComplete.js Engine instance creator
var autoCompleteEl = document.getElementById("autoComplete");
if (autoCompleteEl) {
var lang = 'uk';
if (tmp = window.location.pathname.match(/^\/(uk|en|ru)(?:\/|$)/)) {
lang = tmp[1];
}
const autoCompleteJS = new autoComplete({
wrapper: false,
data: {
src: async (query) => {
try {
// Fetch Data from external Source
const source = await fetch(`/search/${query}`);
// Data should be an array of `Objects` or `Strings`
const data = await source.json();
return data;
/*
// Loading placeholder text
autoCompleteEl.setAttribute("placeholder", "Loading...");
// Fetch External Data Source
const source = await fetch('/compare/' + autoCompleteEl.getAttribute('data-id'));
const data = await source.json();
// Post Loading placeholder text
autoCompleteEl.setAttribute("placeholder", autoCompleteJS.placeHolder);
// Returns Fetched data
return data;
*/
} catch (error) {
return error;
}
},
keys: ['fio_' + lang, 'city', 'id'],
cache: false,
filter: (list) => {
// Filter duplicates
// incase of multiple data keys usage
const filteredResults = Array.from(
new Set(list.map((value) => value.match))
).map((food) => {
return list.find((value) => value.match === food);
});
return filteredResults;
}
},
threshold: 2,
placeHolder: autoCompleteEl.getAttribute("placeholder"),
resultsList: {
/*
element: (list, data) => {
const info = document.createElement("p");
if (data.results.length > 0) {
info.innerHTML = `Displaying ${data.results.length} out of ${data.matches.length} results`;
} else {
info.innerHTML = `Found ${data.matches.length} matching results for "${data.query}"`;
}
list.prepend(info);
},
*/
noResults: true,
maxResults: 15,
tabSelect: true
},
resultItem: {
element: (item, data) => {
// console.log('data', data);
// Modify Results Item Style
item.style = "display: flex; justify-content: space-between;";
// Modify Results Item Content
item.innerHTML = `
${data.match}
${data.value.rating}
`;
},
highlight: true
},
events: {
input: {
focus: () => {
if (autoCompleteJS.input.value.length) autoCompleteJS.start();
}
}
}
});
// autoCompleteJS.input.addEventListener("init", function (event) {
// console.log(event);
// });
// autoCompleteJS.input.addEventListener("response", function (event) {
// console.log(event.detail);
// });
// autoCompleteJS.input.addEventListener("results", function (event) {
// console.log(event.detail);
// });
// autoCompleteJS.input.addEventListener("open", function (event) {
// console.log(event.detail);
// });
// autoCompleteJS.input.addEventListener("navigate", function (event) {
// console.log(event.detail);
// });
autoCompleteJS.input.addEventListener("selection", function (event) {
const feedback = event.detail;
autoCompleteJS.input.blur();
// Prepare User's Selected Value
const selection = feedback.selection.value[feedback.selection.key];
// Render selected choice to selection div
document.querySelector("#rival-id").value = feedback.selection.value.ttw_player_id;
// Replace Input value with the selected value
autoCompleteJS.input.value = selection;
// Console log autoComplete data feedback
// console.log(feedback);
document.querySelector("#rival-id").closest('form').submit();
});
// autoCompleteJS.input.addEventListener("close", function (event) {
// console.log(event.detail);
// });
// Toggle Search Engine Type/Mode
// autoCompleteJS.searchEngine = "loose";
autoCompleteJS.searchEngine = "strict";
/*
// Blur/unBlur page elements
const action = (action) => {
const title = document.querySelector("h1");
const mode = document.querySelector(".mode");
const selection = document.querySelector(".selection");
const footer = document.querySelector(".footer");
if (action === "dim") {
title.style.opacity = 1;
mode.style.opacity = 1;
selection.style.opacity = 1;
} else {
title.style.opacity = 0.3;
mode.style.opacity = 0.2;
selection.style.opacity = 0.1;
}
};
// Blur/unBlur page elements on input focus
["focus", "blur"].forEach((eventType) => {
autoCompleteJS.input.addEventListener(eventType, () => {
// Blur page elements
if (eventType === "blur") {
action("dim");
} else if (eventType === "focus") {
// unBlur page elements
action("light");
}
});
});
*/
}
}
function initTabs() {
// Show the first tab and hide the rest
$('#tabs-nav li:first-child').addClass('active');
$('.tab-content').hide();
$('.tab-content:first').show();
// Click function
$('#tabs-nav li').click(function(){
$('#tabs-nav li').removeClass('active');
$(this).addClass('active');
$('.tab-content').hide();
var activeTab = $(this).find('a').attr('href');
$(activeTab).fadeIn();
return false;
});
}
function initBtnDanger() {
// Обработчик для всех кнопок с классом btn-danger
$(".btn-danger").on("click", function (event) {
// Получаем текст кнопки
const buttonText = $(this).text().trim();
// Спрашиваем подтверждение
if (!confirm(`${buttonText}?`)) {
event.preventDefault(); // Отменяем отправку формы
}
});
}
$(function() {
//Mobile navigation
$('.nav').slimmenu({
resizeWidth: '767',
collapserTitle: jQuery('.navbar-brand')[0].outerHTML,
animSpeed: 'medium',
easingEffect: null,
indentChildren: false,
childrenIndenter: ' '
});
// recaptcha
window.addEventListener('load', () => {
const $recaptcha = document.querySelector('#g-recaptcha-response');
if ($recaptcha) {
$recaptcha.setAttribute('required', 'required');
}
})
// contactForm
var form = document.getElementById('contactForm');
if (form) {
form.addEventListener('submit', function(event) {
var submitBtn = $(this).find('[type="submit"]');
// console.log('form submitted.');
if (!grecaptcha.getResponse()) {
// show error
console.log('captcha not yet completed.');
} else {
submitBtn.prop('disabled', true);
// console.log('form really submitted.');
$.ajax({
method: "POST",
url: window.location.href,
data: $(this).serialize()
}).done(function(response) {
var result = JSON.parse(response);
if (result && result.error) {
submitBtn.prop('disabled', false);
alert(result.error);
} else {
// document.getElementById('message-success').style.display = "flex"
$('#contactForm').addClass('hidden');
$('#message-success').removeClass('hidden');
}
});
}
event.preventDefault(); //prevent form submit
});
}
// reload page if selected option
$('form select').change(function(){
$(this).parents('form').submit();
});
// autoComplete
comparePlayer();
initTabs();
initBtnDanger();
});