1$(document).ready(function() { 2 var url = window.location.href; 3 var splitter = url.split("/"); 4 var check = splitter.pop(); 5 var check2 = splitter.pop(); 6 7 if (url.indexOf("serie") > -1) { 8 $(".sub-categories").css("display", "none"); 9 }; 10 11 if (url.indexOf("druk-plus-ebook") > -1) { 12 $("#filter_format").css("display", "none"); 13 $("#filtrCena").css("display", "none"); 14 $(".link-filter").css("display", "none"); 15 }; 16 17 if (url.indexOf("w-przedsprzedazy") > -1) { 18 $(".classPresale").addClass("mobilePresale"); 19 }; 20 21 if (url == "audiobooki") { 22 $("#pageTitle").html("Audiobooki"); 23 }; 24 25 if (url.indexOf("3471") > -1) { 26 $(".type-click-ebook").trigger("click"); 27 }; 28 29 if (url.indexOf("ebooki") > -1) { 30 $(".notOnEbooki").css("display", "none"); 31 }; 32 33 if (url.indexOf("kursy") > -1) { 34 $(".notOnVideo").css("display", "none"); 35 }; 36 37 if (url.indexOf("na-zadanie") > -1) { 38 $(".notOnDruki").css("display", "none"); 39 }; 40 41 if (url.indexOf("ksiazki") > -1) { 42 $(".notOnDruki").css("display", "none"); 43 }; 44 45 if (url.indexOf(check2) > -1) { 46 $("#" + check2) 47 .parent("li") 48 .addClass("active"); 49 }; 50 51 if (url.indexOf(check) > -1 && url.indexOf('search') == -1) { 52 var splitter2 = check.split("?"); 53 $("#" + splitter2[0]) 54 .parent("li") 55 .addClass("active"); 56 }; 57 58 $(".pricerange").keydown(function(e) { 59 // Allow: backspace, delete, tab, escape, enter and . 60 if ( 61 $.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || 62 // Allow: Ctrl+A 63 (e.keyCode == 65 && e.ctrlKey === true) || 64 // Allow: Ctrl+C 65 (e.keyCode == 67 && e.ctrlKey === true) || 66 // Allow: Ctrl+X 67 (e.keyCode == 88 && e.ctrlKey === true) || 68 // Allow: home, end, left, right 69 (e.keyCode >= 35 && e.keyCode <= 39) 70 ) { 71 return; 72 }; 73 74 if ((e.shiftKey || e.keyCode < 48 || e.keyCode > 57) && (e.keyCode < 96 || e.keyCode > 105)) { 75 e.preventDefault(); 76 }; 77 }); 78 79 $(".title.active").click(function() { 80 var parent = $(this).parent(); 81 var parId = parent.attr("id"); 82 83 if(parId == 'filter_publisher' && $(this).hasClass("active")){ 84 $("input[name='publishers_filter[]']").prop("checked", false); 85 updateCheckbox(); 86 }else if(parId == 'filter_author' && $(this).hasClass("active")){ 87 $("input[name='authors_filter[]']").prop("checked", false); 88 updateCheckbox(); 89 }else if(parId == 'filter_series' && $(this).hasClass("active")){ 90 $("input[name='series_filter[]']").prop("checked", false); 91 updateCheckbox(); 92 }else if(parId == 'filter_language' && $(this).hasClass("active")){ 93 $("input[name='languages_filter[]']").prop("checked", false); 94 updateCheckbox(); 95 }else if(parId == 'filter_category_age' && $(this).hasClass("active")){ 96 $("input[name='kategorie_wiekowe_filter[]']").prop("checked", false); 97 updateCheckbox(); 98 }else if (parId == "filtrCena" && $(this).hasClass("active")) { 99 parent.find("input").each(function(index, elem) { 100 $(this).val(""); 101 }); 102 }; 103 104 parent.find("select").change(); 105 $(this).removeClass("active"); 106 }); 107 108 $(".nowySelect").select2({ minimumResultsForSearch: 10 }); 109 110 function showFormat() { 111 var promo_filter = getQueryVariable("promocja"); 112 113 if(promo_filter){ 114 $(".promo-filter-click").trigger('click'); 115 }; 116 }; 117 setTimeout(showFormat, 500); 118 119 var url = window.location.search; 120 var filtry = url.replace("?", ""); 121 filtry = filtry.split("&"); 122 123 for (b = 0; b < filtry.length; b++) { 124 var divisionFilter = filtry[b].split("="); 125 var nameFilter = divisionFilter[0]; 126 var valueFilter = divisionFilter[1]; 127 let values = []; 128 129 if (valueFilter) { 130 if (nameFilter == "pricerange") { 131 values = valueFilter.split("-"); 132 $("#pricemin").val(values[0]); 133 $("#pricemax").val(values[1]); 134 } else if (nameFilter == "display") { 135 values = valueFilter.split("-"); 136 for (a = 0; a < values.length; a++) { 137 $("#w" + values[a]).parent().addClass("active"); 138 $("#w" + values[a]).attr("checked", "checked"); 139 }; 140 } else if (nameFilter == "format") { 141 values = valueFilter.split("-"); 142 for (a = 0; a < values.length; a++) { 143 $("#f" + values[a]) 144 .parent() 145 .addClass("active"); 146 $("#f" + values[a]).attr("checked", "checked"); 147 }; 148 } else if(nameFilter == 'promocja'){ 149 values = valueFilter.split("-"); 150 for(a=0;a<values.length;a++) { 151 $("#p"+values[a]) 152 .parent() 153 .addClass("active"); 154 $("#p"+values[a]).attr("checked", "checked"); 155 }; 156 } else { 157 let checkboxElem = $("#" + nameFilter); 158 if (checkboxElem.attr('type') == 'checkbox') { 159 checkboxElem.attr("checked", "checked"); 160 checkboxElem.parent().addClass("active"); 161 }; 162 }; 163 }; 164 }; 165 166 // TODO REFACTOR 167 $("#filter_submit").click(function() { 168 var elementy = $("#formularzFiltrowania").find(".firtly"); 169 var coZaznaczone = []; 170 var promocje = []; 171 var display = []; 172 var formaty = []; 173 var oceny = []; 174 var ceny = []; 175 var wydawca = []; 176 var author = []; 177 var jezykPub = []; 178 var categoryAge = []; 179 var series = []; 180 let lector = []; 181 let pod = [];
182 let categoryFilter = ''; 183 let bookstoreAll = false; 184 185 for (i = 0; i < elementy.length; i++) { 186 var ileAktyw = $(elementy[i]).find(".active"); 187 var ktoryFiltr = $(elementy[i]).attr("id"); 188 189 if (ktoryFiltr == "filter_publisher") { 190 ileAktyw = $(elementy[i]).find(":checked"); 191 } else if (ktoryFiltr == "filter_author") { 192 ileAktyw = $(elementy[i]).find(":checked"); 193 } else if (ktoryFiltr == "filter_language") { 194 ileAktyw = $(elementy[i]).find(":checked"); 195 } else if (ktoryFiltr == "filter_category_age") { 196 ileAktyw = $(elementy[i]).find(":checked"); 197 } else if (ktoryFiltr == "filter_series") { 198 ileAktyw = $(elementy[i]).find(":checked"); 199 } else if (ktoryFiltr == "filtrCena") { 200 ileAktyw = 0; 201 if($("#pricemin").val() != '' || $("#pricemax").val()){ 202 ceny.push($("#pricemin").val() + "-" + $("#pricemax").val()); 203 } 204 }; 205 206 for (j = 0; j < ileAktyw.length; j++) { 207 var filter_string = $(ileAktyw[j]) 208 .find("input") 209 .attr("value"); 210 211 if (ktoryFiltr == "filter_publisher") { 212 wydawca.push(ileAktyw[j].value); 213 } else if (ktoryFiltr == "filter_author") { 214 author.push(ileAktyw[j].value); 215 } else if (ktoryFiltr == "filter_category_age") { 216 categoryAge.push(ileAktyw[j].value); 217 } else if (ktoryFiltr == "filter_series") { 218 series.push(ileAktyw[j].value); 219 } else if (ktoryFiltr == "filter_language") { 220 jezykPub.push(ileAktyw[j].value); 221 }; 222 223 coZaznaczone.push(filter_string); 224 225 if (ktoryFiltr == "filter_format") { 226 if (filter_string !== undefined){ 227 formaty.push(filter_string); 228 } 229 } else if (ktoryFiltr == "filter_vote") { 230 oceny.push(filter_string); 231 } else if (ktoryFiltr == "filter_display") { 232 if (filter_string == 'all') { 233 bookstoreAll = true; 234 } else { 235 display.push(filter_string); 236 }; 237 } else if (ktoryFiltr == "filter_lector") { 238 lector.push(filter_string); 239 } else if (ktoryFiltr == "filter_pod") { 240 pod.push(filter_string); 241 } else if (ktoryFiltr == "filter_promo") { 242 promocje.push(filter_string); 243 }; 244 }; 245 }; 246 247 var url = window.location.search; 248 url = url.substring(1); 249 var fpr = "promocja"; 250 var ff = "format"; 251 var fw = "publisher"; 252 var fau = "author"; 253 var fc = "pricerange"; 254 var fj = "language"; 255 var fp = "pod"; 256 var fl = "lector"; 257 var fa = "serwisyall"; 258 var fkw = "kategoria_wiekowa"; 259 var fs = "series"; 260 var fcf = "category"; 261 var fde = "destination"; 262 var params = url.split("&"); 263 var params2 = []; 264 265 $.each(params, function(i, param) { 266 if ( 267 param.indexOf(ff) == -1 && 268 param.indexOf(fw) == -1 && 269 param.indexOf(fau) == -1 && 270 param.indexOf(fc) == -1 && 271 param.indexOf(fp) == -1 && 272 param.indexOf(fj) == -1 && 273 param.indexOf(fl) == -1 && 274 param.indexOf(fa) == -1 && 275 param.indexOf(fpr) == -1 && 276 param.indexOf(fkw) == -1 && 277 param.indexOf(fs) == -1 && 278 param.indexOf(fcf) == -1 && 279 param.indexOf(fde) == -1 280 ) { 281 params2.push(param); 282 }; 283 }); 284 285 url = "?" + params2.join("&"); 286 287 for(z = 0; z < promocje.length; z++){ 288 if(z == 0) { 289 url += "&"+'promocja='+promocje[z]; 290 } else { 291 url += "-"+promocje[z]; 292 }; 293 }; 294 295 for (z = 0; z < formaty.length; z++) { 296 if (z == 0) { 297 url += "&" + "format=" + formaty[z]; 298 } else { 299 url += "-" + formaty[z]; 300 }; 301 }; 302 303 for (z = 0; z < display.length; z++) { 304 if (z == 0) { 305 url += "&" + "display=" + display[z]; 306 } else { 307 url += "-" + display[z]; 308 }; 309 }; 310 311 for (z = 0; z < pod.length; z++) { 312 if (z == 0) { 313 url += "&" + "pod=" + pod[z]; 314 } else { 315 url += "-" + pod[z]; 316 }; 317 }; 318 319 for (z = 0; z < ceny.length; z++) { 320 url += "&" + "pricerange=" + ceny[z]; 321 }; 322 323 for (z = 0; z < wydawca.length; z++) { 324 if(z > 0){ 325 url += "," + wydawca[z]; 326 }else{ 327 url += "&" + "publisher=" + wydawca[z]; 328 } 329 }; 330 331 for (z = 0; z < author.length; z++) { 332 if(z > 0){ 333 url += "," + author[z]; 334 }else{ 335 url += "&" + "author=" + author[z]; 336 } 337 }; 338 339 for (z = 0; z < jezykPub.length; z++) { 340 if(z > 0){ 341 url += "," + jezykPub[z]; 342 }else{ 343 url += "&" + "language=" + jezykPub[z]; 344 } 345 }; 346 347 for (z = 0; z < categoryAge.length; z++) { 348 if(z > 0){ 349 url += "," + categoryAge[z]; 350 }else{ 351 url += "&" + "kategoria_wiekowa=" + categoryAge[z]; 352 } 353 }; 354 355 for (z = 0; z < series.length; z++) { 356 if(z > 0){ 357 url += "," + series[z]; 358 }else{ 359 url += "&" + "series=" + series[z]; 360 } 361 }; 362 363 let checked_list_special = document.querySelector(".checkbox-line-special-sub
363s input:checked"); 364 if(checked_list_special){ 365 url += "&" + "category=" + checked_list_special.value; 366 } 367 368 var destinations = document.querySelectorAll(".checkbox-line-destination input:checked"); 369 if(destinations.length > 0){ 370 var mainDestinationsList = []; 371 for (z = 0; z < destinations.length; z++) { 372 var mainFilterDestination = destinations[z].dataset.mainFilterDestination; 373 var subdestsFilterDestination = destinations[z].dataset.subdestsFilterDestination; 374 if(mainFilterDestination){ 375 mainDestinationsList.push(mainFilterDestination); 376 } 377 if(subdestsFilterDestination && mainDestinationsList.includes(subdestsFilterDestination)){ 378 continue; 379 } 380 if(z > 0){ 381 url += "," + destinations[z].value; 382 }else{ 383 url += "&" + "destination=" + destinations[z].value; 384 } 385 } 386 } 387 388 if (bookstoreAll) { 389 url += "&" + "serwisyall=1"; 390 }; 391 392 url = zerujStronicowanie(window.location.pathname) + url; 393 window.location.href = url; 394 }); 395 396 function zerujStronicowanie(url) { 397 page_no = url.substr(url.lastIndexOf("/") + 1); 398 new_url = url.substr(0, url.lastIndexOf("/")); 399 400 if ( 401 /^\d+$/.test(page_no) 402 && parseInt(page_no) < 1000 403 && !url.includes('2za1') 404 && !url.includes('3za2') 405 && !url.includes('drugi-50') 406 ) { 407 url = new_url; 408 }; 409 return url; 410 }; 411 412 $(".presale-newsletter").submit(function(event) { 413 let email = $("#email_presale").val(); 414 let accept_newsletter = $("#accept_newsletter_presale").is(":checked") 415 ? 1 416 : 0; 417 if (email == "") { 418 alert("Pole e-mail nie może byÄ puste!!"); 419 return false; 420 }; 421 422 if (!accept_newsletter) { 423 alert("Wyrażenie zgody jest warunkiem koniecznym wysÅania formularza!!"); 424 return false; 425 }; 426 }); 427 428 $("#tp_accept_newsletter_presale").tooltip({ 429 items: "a.tp_accept_personal_newsletter_presale", 430 content: 431 'ZgodÄ mogÄ wycofaÄ w każdej chwili, a jej wycofanie nie wpÅywa na zgodnoÅÄz prawem przetwarzania dokonanego przed jej wycofaniem. Administratorem danych osobowych jest Helion.pl Sp. z o.o.z siedzibÄ w Gliwicach (GRUPA HELION). Użytkownik ma prawo dostÄu do treÅci swoich danych, w tym uzyskania ich kopii oraz prawo sprostowania, usuniÄia, ograniczenia przetwarzania, prawo do przenoszenia danych, prawo wniesienia sprzeciwu. WiÄcej w <a href="/przewodnik/politykaprywatnosci.phtml" target="_blank" rel="nofollow">Polityce PrywatnoÅci »</a>', 432 position: { 433 my: "left+15 center", 434 at: "right center" 435 }, 436 close: function(event, ui) { 437 ui.tooltip.hover( 438 function() { 439 $(this) 440 .stop(true) 441 .fadeTo(500, 1); 442 }, 443 function() { 444 $(this).fadeOut("500", function() { 445 $(this).remove(); 446 }); 447 } 448 ); 449 } 450 }); 451 452 $("#sortowanie select").change(function() { 453 $("#sortowanie").submit(); 454 }); 455 456 //seolink = "{{ seolink }}"; 457 458 HelionInitMain("PB-NullCategory"); 459 $(".best-offers-analytics").click(function(e) { 460 e.preventDefault(); 461 ga( 462 "send", 463 "event", 464 "propozycje kategorie", 465 "troya", 466 $(this) 467 .children("img") 468 .attr("alt") 469 ); 470 window.location.href = $(this).attr("href"); 471 }); 472 473 $('.checkbox-line-special-subs input').change(function(){ updateCheckboxSpecialSubs(this); }); 474 $('.checkbox-line-destination input').on('change', function(){ 475 updateCheckboxDestination(this); 476 }); 477 478 $('.show-subdestinations').on('click', function(ev){ 479 ev.preventDefault(); 480 var destination_seolink = $(this).data("main-destination"); 481 var subdestinations = $("[data-subdests-destination='" + destination_seolink + "']"); 482 483 if($(this).hasClass('active')){ 484 $(this).removeClass('active'); 485 subdestinations.css("display", "none"); 486 }else{ 487 $(this).addClass('active'); 488 subdestinations.css("display", "block"); 489 } 490 }); 491 492 let subdestinations_lists = document.querySelectorAll(".checkbox-line-destination input");
493 subdestinations_lists.forEach(e => { 494 if(e.hasAttribute('checked')){ 495 updateCheckboxDestinationReady(e); 496 var mainFilterDestination = e.dataset.mainFilterDestination; 497 var subdestsFilterDestination = e.dataset.subdestsFilterDestination; 498 if(mainFilterDestination){ 499 if(!$("[data-main-destination='" + mainFilterDestination + "']").hasClass('active')){ 500 $("[data-main-destination='" + mainFilterDestination + "']").trigger('click'); 501 } 502 } 503 if(subdestsFilterDestination){ 504 if(!$("[data-main-destination='" + subdestsFilterDestination + "']").hasClass('active')){ 505 $("[data-main-destination='" + subdestsFilterDestination + "']").trigger('click'); 506 } 507 } 508 }; 509 }); 510 if(!$("[data-main-destination='polska']").hasClass('active')){ 511 $("[data-main-destination='polska']").trigger('click'); 512 } 513}); 514 515let clearBtn = document.querySelector('#filter_clear'); 516let promoFilter = document.querySelector('#filter_promo'); 517let formatFilter = document.querySelector('#filter_format'); 518let podFilter = document.querySelector('#filter_pod'); 519let pricemin = document.querySelector("#pricemin"); 520let pricemax = document.querySelector("#pricemax"); 521let checked = document.querySelectorAll(".checkbox-line input"); 522let checked_lists = document.querySelectorAll(".checkbox-line-filters input"); 523let subdestinations_lists = document.querySelectorAll(".checkbox-line-destination input"); 524let form = document.querySelector("#formularzFiltrowania"); 525 526const clearForm = () => { 527 if(promoFilter) { 528 promoFilter.childNodes.forEach(e => { 529 if(e.className === 'checkbox-line active') { 530 e.classList.remove('active'); 531 }; 532 }); 533 }; 534 535 if(formatFilter) { 536 formatFilter.childNodes.forEach(e => { 537 if(e.className === 'checkbox-line active') { 538 e.classList.remove('active'); 539 }; 540 }); 541 }; 542 543 if(podFilter) { 544 podFilter.childNodes.forEach(e => { 545 if(e.className === 'checkbox-line active') { 546 e.classList.remove('active'); 547 }; 548 }); 549 }; 550 551 checked.forEach(e => { 552 if(e.hasAttribute("checked")) { 553 e.removeAttribute("checked"); 554 }; 555 }); 556 557 checked_lists.forEach(e => { 558 if(e.hasAttribute("checked")) { 559 e.removeAttribute("checked"); 560 }; 561 }); 562 563 subdestinations_lists.forEach(e => { 564 if(e.checked) { 565 e.checked = false; 566 updateCheckboxDestination(e); 567 }; 568 }); 569 570 let checked_list_special = document.querySelector(".checkbox-line-special-subs input:checked"); 571 if(checked_list_special){ 572 checked_list_special.checked = false; 573 checked_list_special.parentNode.classList.remove('active'); 574 } 575 updateCheckbox(); 576 577 form.reset(); 578 pricemin.value = ""; 579 pricemax.value = ""; 580 $(".title.active").removeClass("active"); 581 form.submit(); 582}; 583 584clearBtn.addEventListener('click', clearForm); 585 586function updateCheckboxSpecialSubs(input) 587{ 588 var obj=$('.checkbox-line-special-subs input'); 589 for(var a=0;a<obj.length;a++) 590 { 591 obj[a].checked = false; 592 $(obj[a].parentNode).removeClass('active'); 593 } 594 input.checked = true; 595 input.parentNode.classList.add('active'); 596} 597 598function updateCheckboxDestination(input) 599{ 600 var mainFilterDestination = input.dataset.mainFilterDestination; 601 if(mainFilterDestination){ 602 var subdestinations = $("[data-subdests-filter-destination='" + mainFilterDestination + "']"); 603 if(subdestinations){ 604 if(input.checked){ 605 subdestinations.prop('checked', true); 606 }else{ 607 subdestinations.prop('checked', false); 608 } 609 } 610 } 611 612 var obj=$('.checkbox-line-destination input'); 613 for(var a=0;a<obj.length;a++) 614 { 615 var mainDestinationNameFilter = obj[a].dataset.subdestsFilterDestination; 616 if(obj[a].checked) { 617 $(obj[a].parentNode).addClass('active'); 618 }else{ 619 $(obj[a].parentNode).removeClass('active'); 620 $("[data-main-filter-destination='" + mainDestinationNameFilter + "']").prop('checked', false); 621 $("[data-main-filter-destination='" + mainDestinationNameFilter + "']").parent().removeClass('active'); 622 } 623 } 624} 625 626function updateCheckboxDestinationReady(input) 627{ 628 var mainFilterDestination = input.dataset.mainFilterDestination; 629 if(mainFilterDestination){ 630 var subdestinations = $("[data-subdests-filter-destination='" + mainFilterDestination + "']"); 631 if(subdestinations){ 632 if(input.checked){ 633 subdestinations.prop('checked', true); 634 }else{ 635 subdestinations.prop('checked', false); 636 } 637 } 638 } 639 640 var obj=$('.checkbox-line-destination input'); 641 for(var a=0;a<obj.length;a++) 642 { 643 if(obj[a].checked) { 644 $(obj[a].parentNode).addClass('active'); 645 } 646 } 647} 648 649const searchPublisher = { 650 startSearch(){ 651 let search_publisher_input = document.querySelector('.search-publisher'); 652 if(search_publisher_input){ 653 search_publisher_input.onkeyup = searchPublisher.search; 654 } 655 }, 656 657 search(event){ 658 const search_value = event.target.value; 659 const reg_exp = new RegExp(search_value.toLowerCase(), 'g'); 660 const publishers = document.querySelectorAll('.checkbox-line-publisher'); 661 const no_publishers_info = document.querySelector('.no-publishers-info'); 662 let i = 0; 663
664 publishers.forEach(function (value) { 665 const names = value.children[1].innerText.toLowerCase(); 666 667 value.style.display = "block"; 668 669 if(search_value.length > 2){ 670 if(!names.match(reg_exp)){ 671 value.style.display = "none"; 672 }else{ 673 i++; 674 } 675 } 676 }); 677 678 if(search_value.length > 2 && i==0){ 679 no_publishers_info.classList.add('publishers-show'); 680 }else{ 681 no_publishers_info.classList.remove('publishers-show'); 682 }; 683 }, 684} 685 686const searchSeries = { 687 startSearch(){ 688 let search_series_input = document.querySelector('.search-series'); 689 if(search_series_input){ 690 search_series_input.onkeyup = searchSeries.search; 691 } 692 }, 693 694 search(event){ 695 const search_value = event.target.value; 696 const reg_exp = new RegExp(search_value.toLowerCase(), 'g'); 697 const series = document.querySelectorAll('.checkbox-line-series'); 698 const no_series_info = document.querySelector('.no-series-info'); 699 let i = 0; 700 701 series.forEach(function (value) { 702 const names = value.children[1].innerText.toLowerCase(); 703 704 value.style.display = "block"; 705 706 if(search_value.length > 2){ 707 if(!names.match(reg_exp)){ 708 value.style.display = "none"; 709 }else{ 710 i++; 711 } 712 } 713 }); 714 715 if(search_value.length > 2 && i==0){ 716 no_series_info.classList.add('series-show'); 717 }else{ 718 no_series_info.classList.remove('series-show'); 719 }; 720 }, 721} 722 723document.addEventListener("DOMContentLoaded", function(event) { 724 searchPublisher.startSearch(); 725 searchSeries.startSearch(); 726}); 727 728 729 730 731
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.