1 2//VyplÅte prosÃm vÅ¡echny povinné parametry. 3//Celková cena (obruba + skla dle vybrané specifikace) 4 5const userLang = getShoptetDataLayer("language"); 6const cacheTimestamp = Math.floor(Date.now() / 1800000); 7 8if (userLang == 'cs') { 9 konfigurovat = 'Konfigurovat' 10 text_vyberte_si = 'Vyberte si' 11 priplatky = 'PÅÃplatky' 12} else if (userLang == 'sk') { 13 konfigurovat = 'KonfigurovaÅ¥' 14 text_vyberte_si = 'Vyberte si' 15 priplatky = 'PrÃplatky' 16} else if (userLang == 'en') { 17 konfigurovat = 'Customize' 18 text_vyberte_si = 'Select' 19 priplatky = 'Surcharges' 20} else if (userLang == 'de') { 21 konfigurovat = 'Anpassen' 22 text_vyberte_si = 'Wählen' 23 priplatky = 'Zuschläge' 24} else if (userLang == 'pl') { 25 konfigurovat = 'Dostosuj' 26 text_vyberte_si = 'Wybierzcie' 27 priplatky = 'DopÅaty' 28} 29 30if (!$(".surcharge-list select").length && $(".detail-parameters").length) { 31 $(".p-info-wrapper .detail-parameters").hide(); 32} 33 34if ($('body:not(".ordering-process")').length) { 35 header = $(".header-top").offset().top + $(".header-top").outerHeight() + 31 36 $(window).scroll(function () { 37 if (header <= $(window).scrollTop()) { 38 $("body").addClass("fixed-menu") 39 } 40 else { 41 $("body").removeClass("fixed-menu") 42 } 43 }) 44} 45if ($('.type-detail .surcharge-list').length) { 46 currency = dataLayer[0].shoptet.currency 47 if (currency == 'CZK') { 48 currency = 'KÄ' 49 } 50 if (currency == 'EUR') { 51 currency = 'â¬' 52 } 53 54 var unification = function (val) { 55 val = val.toLowerCase(); 56 val = val.replaceAll(' ', ''); 57 val = val.replaceAll('.', ''); 58 return val; 59 }; 60 61 jQuery.ajax({ 62 url: "/user/documents/upload/konfig/surcharge-params.json?v=" + cacheTimestamp, 63 dataType: "text", 64 success: function (data) { 65 var json = $.parseJSON(data); 66 data = []; 67 for (var i in json) { 68 item = {} 69 item["name"] = json[i].image.split('konfig/')[1].split('.jpg')[0] 70 item["image"] = json[i].image; 71 item["description"] = json[i].description; 72 data.push(item); 73 } 74 arrayOfData = JSON.stringify(data); 75 sessionStorage.variantsData = arrayOfData; 76 77 if (userLang != 'cs') { 78 var result = {}; 79 $.ajax({
80 type: "GET", 81 url: '/user/documents/translations_export.xml', 82 success: function (dataXML) { 83 $(dataXML).find('SURCHARGE_PARAMETER').each(function (key) { 84 var czechName = $(this).attr('cs'); 85 var names = $(this).find('NAME'); 86 var values = $(this).find('VALUE'); 87 88 var czechValue; 89 values.map(function () { 90 if ($(this).attr('cs') !== undefined) { 91 czechValue = $(this).attr('cs'); 92 } else { 93 var lang = unification($(this).attr('lang')); 94 var value = unification($(this).text()); 95 var name = unification(names.filter(function (key, val) { 96 return ($(val).attr('lang') === lang); 97 }).text()); 98 99 if (result[lang] === undefined) { 100 result[lang] = []; 101 } 102 if (result[lang][name] === undefined) { 103 result[lang][name] = []; 104 } 105 result[lang][name][value] = { 106 param: czechName, 107 value: czechValue, 108 } 109 } 110 }) 111 }); 112 mh_priplatky(result); 113 $(document).trigger("dataReady"); 114 }, 115 error: function () { 116 //error handler.. 117 } 118 }); 119 } else { 120 $(document).trigger("dataReady"); 121 } 122 } 123 }); 124 125 function mh_priplatky(result) { 126 lang = userLang; 127 $('.surcharge-list').each(function () { 128 select_name = $(this).find('select').attr('data-parameter-name') 129 $(this).find('option').each(function () { 130 OptitionId = $(this).val(); 131 if ($.isNumeric(OptitionId)) { 132 text = $(this).text().split('+')[0].trim(); 133 if (unification(select_name) in result[lang] && unification(text) in result[lang][unification(select_name)]) { 134 data_translate = result[lang][unification(select_name)][unification(text)]; 135 $(this).attr('data-translate-value', data_translate.value).attr('data-translate-surcharge', data_translate.param); 136 } else { 137 $(this).attr('data-translate-value', unification(text)).attr('data-translate-surcharge', unification(select_name)); 138 } 139 } 140 }) 141 }) 142 } 143 144 145 146 147 function checkVariants(name, arrayOfData) { 148 arrayOfData = sessionStorage.variantsData 149 dataArray = JSON.parse(arrayOfData) 150 151 var data = ""; 152 $.each(dataArray, function () { 153 if (this['name'] == name) { 154 data = this; 155 return false; 156 } 157 }) 158 return data; 159 160 161 } 162 163 164 165 if ($(".surcharge-list select").length) { 166 // if(sessionStorage.variantsData) { 167 // mhkonfig() 168 // $('.konfig-wrap .bottom .price').append($('.p-final-price-wrapper').html()) 169 // $('.konfig-wrap .bottom .cart').append($('.add-to-cart').html()) 170 // } else { 171 $(document).on("dataReady", function () { 172 $(".p-info-wrapper .detail-parameters").hide(); 173 mhkonfig() 174 $('.konfig-wrap .bottom .price').append($('.p-final-price-wrapper').html()) 175 $('.konfig-wrap .bottom .cart').append($('.add-to-cart').html()) 176 }) 177 // } 178 } 179 180 function mhkonfig() { 181 // $('.p-info-wrapper').append('<div class="rady-pruvodce">NevÃte si rady? PÅeÄtÄte si naÅ¡eho <span>průvodce</span></div><div class="rada"><span class="close"></span><div class="rada-inner"></div></div>') 182 $('<div class="konfigurovat"><span class="configurovat_open">' + konfigurovat + '</span></div>').insertAfter(".availability-value") 183 $('<section class="konfig-wrap"><span class="close"></span><div class="konfigurator"></div><div class="bottom not-buy"><div class="price"></div><div class="cart"></div></div></section>').insertAfter(".availability-value") 184 //$('.buy-box').clone().appendTo('.konfig-wrap') 185 186 $(".surcharge-list").each(function () { 187 $(this).attr('data-parameter-name', $(this).find('select').data('parameter-name')) 188 }) 189 $(".surcharge-list").each(function (index) { 190 index = index + 1 191 find_text_dsc = $(this).find('th .question-tooltip') 192 find_text_dsc_length = find_text_dsc.length 193 find_text_dsc_text = find_text_dsc.attr('title') 194 name = $(this).find("select").attr("data-parameter-name"); 195 povinne = $('select') 196 povinne_pocet = povinne.length 197 //console.log(povinne_pocet) 198 $('.konfigurator').attr('data-povinne', povinne_pocet) 199 if (name.includes('â')) { 200 name = name.split('â')[1] 201 202 } 203 else { 204 name = name 205 } 206 if (povinne.prop('required')) { 207 povinne = 'yes' 208 } else { 209 povinne = 'no' 210 } 211 ID = $(this).find("select").attr("data-parameter-id"); 212 nazev_priplatku = name.normalize('NFD').replace(/[^\w]/g, '').toLowerCase(); 213 priplatek_var = "<div id='box-" + ID + "' class='boxik' data-id='" + ID + "' data-povinne='" + povinne + "'>"; 214 priplatek_var += "<h2><span class='number-step'>" + index + ".</span>
214 " + name + "</h2>"; 215 priplatek_var += "<div class='config-box " + nazev_priplatku + "'>"; 216 if (find_text_dsc_length > 0) { 217 priplatek_var += "<div class='popis-textu'><p>" + find_text_dsc_text + "</p></div>"; 218 } 219 else { 220 221 } 222 // orig_name = $(this).text() 223 $(this).find("select option").each(function () { 224 225 OptitionId = $(this).val(); 226 if ($.isNumeric(OptitionId)) { 227 OptitionName = $(this).text().split('+')[0].trim(); 228 Optionnamesecond = $(this).text().split('+')[0].trim(); 229 // console.log(Optionnamesecond) 230 OptitionPrice = $(this).attr("data-surcharge-final-price"); 231 box_check = $(this).text() 232 OptitionName_second = '' 233 if (box_check.includes('#')) { 234 length_hastag = box_check.split('#').length - 1 235 if (length_hastag = 1) { 236 Optition_class = box_check.split('#')[1].split('+')[0].trim('').replace(',', '.') 237 OptitionName = box_check.split('#')[0] 238 if (box_check.includes('-')) { 239 // console.log(box_check.split('-')[1].split('#')[0]) 240 OptitionName = OptitionName.split('-')[0] 241 OptitionName_second = box_check.split('-')[1].split('#')[0] 242 } 243 else { 244 OptitionName_second = '' 245 } 246 247 } 248 249 250 } 251 else if (box_check.includes('_')) { 252 length_hastag = box_check.split('_').length - 1 253 if (length_hastag = 1) { 254 255 Optition_class = box_check.split('_')[1].split('+')[0].trim('').replace(',', '.').normalize('NFD').replace(/[^\w]/g, '').toLowerCase(); 256 OptitionName = box_check.split('_')[0] 257 } 258 } 259 260 else if (box_check.includes('(')) { 261 length_hastag = box_check.split('(').length - 1 262 if (length_hastag = 1) { 263 Optition_class = box_check.split('(')[0].trim('').replace(',', '.') 264 } 265 } 266 267 else { 268 Optition_class = OptitionName.trim('').replace(',', '.') 269 OptitionName_second = '' 270 } 271 272 273 274 275 // thisName = name_select+'-'+Elementname 276 277 278 if (userLang == 'cs') { 279 name_select = $(this).closest('.surcharge-list').attr('data-parameter-name').trim().toLocaleLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[\W_]+/g, "-").replace(new RegExp("[-]+$"), "") 280 Elementname = $(this).text().split('+')[0].trim().toLocaleLowerCase().normalize("NFD").replace('ø', 'o').replace('®', '-r-').replace(/[\u0300-\u036f]/g, "").replace(/[\W_]+/g, "-").replace(new RegExp("[-]+$"), "") 281 thisName = name_select + '-' + Elementname 282 } 283 else { 284 new_name_select = $(this).attr('data-translate-value').trim().toLocaleLowerCase().normalize("NFD").replace('ø', 'o').replace('®', '-r-').replace(/[\u0300-\u036f]/g, "").replace(/[\W_]+/g, "-").replace(new RegExp("[-]+$"), "") 285 new_Elementname = $(this).attr('data-translate-surcharge').trim().toLocaleLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[\W_]+/g, "-").replace(new RegExp("[-]+$"), "") 286 thisName = new_Elementname + '-' + new_name_select 287 } 288 289 data = checkVariants(thisName, localStorage.variantsData); 290 priplatek_var += "<div id='box-optition-" + OptitionId + "' class='check' data-select-id='" + ID + "' data-optition-id='" + OptitionId + "' data-optition-price='" + OptitionPrice + "' data-index='" + Optition_class + "'>"; 291 priplatek_var += "<div class='image' data-image-name='" + thisName + "' data-image='" + OptitionId + "'><image src=/user/documents/" + data['image'] + "></div>"; 292 priplatek_var += "<div class='boxtext'>"; 293 priplatek_var += "<span class='name'>" + OptitionName + "</span><span class='second-name'>" + OptitionName_second + "</span>"; 294 priplatek_var += "<span class='hide'>" + $(this).text() + "</span>" 295 priplatek_var += "<span class='price'>" + OptitionPrice.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ") + " " + currency + "</span>" 296 priplatek_var += "</div>"; 297 // if (zalogovany_admin) { 298 // priplatek_var += "<span class='admin-name'>Název souboru: " + OptitionId + ".png</span>"; 299 // } 300 priplatek_var += "</div>"; 301 } 302 }); 303 priplatek_var += "</div>"; 304 $(priplatek_var).appendTo(".konfigurator"); 305 $(this).hide(); 306 });
307 /* $('.konfigurator img').on("error", function() { 308 $(this).closest('.image').addClass('missing'); 309 $(this).closest('.check').addClass('missing-image'); 310 $(this).remove() 311 });*/ 312 if (parseFloat($('.konfigurator').attr('data-povinne')) > 0) { 313 $(document).on('click', '.buy-box .add-to-cart-button', function(event) { 314 // console.log("Click"); 315 pocetVybranych = parseFloat($('.konfigurator .boxik[data-selected="yes"]').length); 316 pocetPovinnych = parseFloat($('.konfigurator').attr('data-povinne')); 317 if (pocetVybranych < pocetPovinnych) { 318 event.preventDefault(); 319 $('body').addClass('open-config'); 320 } 321 }); 322 } 323 } 324 325 function prepocet() { 326 var id_priplatku = ""; 327 var validni_id = true; 328 $(".variant-list select").each(function () { 329 if ($(this).val() == "") { 330 validni_id = false; 331 } else { 332 id_priplatku = id_priplatku + $(this).attr("data-parameter-id"); 333 id_priplatku = id_priplatku + "-"; 334 id_priplatku = id_priplatku + $(this).val(); 335 id_priplatku = id_priplatku + "-"; 336 } 337 }); 338 339 if (validni_id) { 340 var total = 0; 341 $('.check.active').each(function () { 342 var value = parseFloat($(this).attr('data-optition-price').replace(/,/, '.')); 343 if (!isNaN(value)) { 344 total += value; 345 } 346 }); 347 var cenapuvodni = $('.price-final-holder:not(".noDisplay")').attr('data-price') 348 cenapuvodni = parseFloat(cenapuvodni.replace(/,/, '.')); 349 cenacelkem = cenapuvodni + total 350 // console.log('cena-za-celkem - '+cenacelkem) 351 pricewithoutvat = cenacelkem * 21 / 121 352 pricewithoutvat = cenacelkem - pricewithoutvat 353 pricewithoutvat = pricewithoutvat.toFixed(0) 354 cenacelkem = Math.round((cenacelkem + Number.EPSILON) * 100) / 100 355 cenacelkem = cenacelkem.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ") 356 } 357 358 $('.price-final-holder:not(".noDisplay") .calculated-price').html(cenacelkem + ' ' + currency) 359 $('.price-additional-holder:not(".noDisplay") .calculated-price').html(pricewithoutvat + ' ' + currency) 360 361 } 362 363 364 365 $('.konfigurator>.boxik').first().addClass('open-row') 366 367 $('html').on('click', '.boxik h2', function () { 368 $(this).closest('.boxik').toggleClass('open-row') 369 }) 370 371 372 $('html').on('click', '.configurovat_open', function () { 373 $('body').addClass('open-config') 374 }) 375 376 $('html').on('click', '.konfig-wrap .close', function () { 377 $('body').removeClass('open-config') 378 /* $('.surcharge-list select option:selected').prop("selected", false) 379 $('.surcharge-list select option').first().attr('selected', 'selected'); 380 $('.p-final-price-wrapper .price-final-holder .calculated-price').text($('.p-final-price-wrapper .price-final-holder').data('price').toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ") + ' ' + currency) */ 381 382 }) 383 $('html').on('click', '.bottom button', function () { 384 $('body').removeClass('open-config') 385 386 387 }) 388 389 390 $('body').on('click', '.boxik .check', function () { 391 var ClickSlectId = $(this).attr("data-select-id"); 392 var ClickOptitionId = $(this).attr("data-optition-id"); 393 // $(".surcharge-list .surcharge-parameter[data-parameter-id='"+ClickSlectId+"']").val(ClickOptitionId); 394 $(".surcharge-list .surcharge-parameter[data-parameter-id='" + ClickSlectId + "'] option[value='" + ClickOptitionId + "']").prop('selected', true) 395 $("#box-" + ClickSlectId + " .check").removeClass("active"); 396 $(this).addClass("active").addClass('otevreny'); 397 $(this).closest('.boxik').attr('data-selected', 'yes') 398 // $(this).closest('.boxik').removeClass('open-row').next('.boxik').addClass('open-row').addClass('otevreny') 399 /////$('.konfigurator').attr('data-selected', $('.konfigurator .boxik[data-check="1"]').length) 400 $(this).closest('.boxik').find('h2 .popisek').remove() 401 $(this).closest('.boxik').find('h2').append('<span class="popisek">' + $(this).find('.image').html() + '' + $(this).find('.boxtext').html() + '</span>') 402 prepocet(); 403 data_selected() 404 }) 405 406 407 408 function data_selected() { 409 number = parseFloat($('.konfigurator .boxik[data-selected="yes"]').length) 410 povinne = parseFloat($('.konfigurator').attr('data-povinne')) 411 if (number == povinne) { 412 $('.bottom').removeClass('not-buy') 413 } 414 else { 415 416 } 417 } 418} 419 420if ($('.ordering-process').length) { 421 $('.removeable').each(function () { 422 if ($(this).find('.main-link-surcharges').length) { 423 $(this).addClass('have-surcharge') 424 $(this).find('.main-link-surcharges').each(function () { 425 split_text = $('.main-link-surcharges').text().split(priplatky + ':')[1].replace(/,/g, '</li><li>').split('#') 426 $(this).html('<ul><li>' + split_text + '</li></ul>') 427 }) 428 $(this).find('.main-link-surcharges li').each(function () { 429 $(this).html($(this).text().split('â')[1]) 430 }) 431 } 432 }) 433} 434 435if ($('.cart-items').length) { 436 $('.cart-item').each(function () { 437 if ($(this).find('.main-link-surcharges').length) { 438 $(this).addClass('have-surcharge') 439 $(this).find('.main-link-surcharges').each(function () { 440 split_text = $('.main-link-surcharges').text().split(priplatky + ':')[1].replace(/,/g, '</li><li>').split('#') 441 $(this).html('<ul><li>' + split_text + '</li></ul>') 442 }) 443 $(this).find('.main-link-surcharges li').each(function () { 444 $(this).html($(this).text().split('â')[1]) 445 }) 446 } 447 }) 448} 449 450const showMoreTextTranslations = { 451 cs: 'Zobrazit vÃce', 452 sk: 'ZobraziÅ¥ viac', 453 pl: 'Pokaż wiÄcej', 454 de: 'Mehr anzeigen', 455 en: 'Show more', 456}; 457const showMoreTextLocalized = showMoreTextTranslations[userLang] || translations.en; 458 459function showMoreListItems($ulItems, maxItemsToShow) { 460 $ulItems.each((index, element) => { 461 const $list = $(element); 462 const $items = $list.children('li'); 463 464 if ($items.length > maxItemsToShow && $items.length != maxItemsToShow + 1) { 465 $items.slice(maxItemsToShow).hide(); 466 const $showMoreButton = $('<li class="show-more">' + showMoreTextLocalized + '</li>').appendTo($list); 467 468 $showMoreButton.on('click', () => { 469 $items.fadeIn(700); 470 $showMoreButton.remove(); 471 }); 472 } 473 }); 474} 475 476$(document).ready(function () { 477 const customMenuIDs = ['757', '781'] 478 for (const menuID of customMenuIDs) { 479 $(`.menu-item-${menuID} .menu-level-2`).addClass('custom-menu-next-level').load(`/user/documents/snippet/menu-${menuID}-${userLang}.html?v=${cacheTimestamp}`, function() { 480 showMoreListItems($(this).find('.menu-level-5'), 6); 481 });
482 } 483})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.