if (!gwpstyle) { var gwpstyle = document.createElement('style'); gwpstyle.textContent = ' .gwp-div { clear: both; position:relative; } .sm-gwp-img-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0px; width: 100%; } .gwp-opt { box-sizing: border-box; text-align: center; border:2px solid transparent; padding:1px; margin:0px; border-radius:7px; overflow-x:hidden; position: relative; } .gwp-opt:hover { border-top:0px solid #EEEEEE; padding:1px; } .gwp-opt:hover .gwp-opt-name { padding-top:2px; } .gwp-opt-sel:hover .gwp-opt-name { padding-top: 0px; } .gwp-opt-sel { border:2px solid #777777 !important; padding:1px; } .gwp-opt-sel:hover { padding:1px; } .gwp-opt-name { text-align: center; width: 100%; } .gwp-opt-title { min-height: 1em; padding: 11px 0px; } .gwp-opt-prev { position:relative; width: 100%; } .gwp-opt-prev div { position:absolute; left:-505px; width:500px; display:none; z-index:1000; border:1px solid #bcbcbc; background-color:#FFFFFF; box-shadow:3px 3px 6px #AAAAAA; } .gwp-opt img { cursor:pointer; border-radius:7px; } .gwp-opt-more { position:relative; cursor:pointer; border-radius:7px; border:1px solid #888888; color:#888888; padding-top:100%; } .gwp-opt-more div { font-size:14px; text-align:center; line-height:12px; position:absolute; top:50%; left:0px; width:100%; margin-top:-0.5em; } .gwp-opt-prev-title { display: block; text-align: center; } .gwp-opt-title { font-weight:bold; padding: 0px 20px; display: inline-block; } .gwp-opt-prev .icon { width:auto; height:auto; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .gwp-opt-prev .icon-close:before { content: "✕"; font-weight: bold; } '; document.head.appendChild(gwpstyle); } gwpNo = {200: "1", 201: "1", 203: "1", 204: "1", 205: "1", 206: "1", 207: "1", 208: "1", 209: "1", 210: "1", 211: "1", 212: "1", 213: "1", 277: "1", 278: "1", 280: "1", 281: "1", 282: "1", 283: "1", 284: "1", 285: "1", 286: "1", 287: "1", 288: "1", 289: "1", 290: "1", 342: "2", 343: "2", 297: "3", 298: "2", 299: "2", 300: "2", 302: "2", 303: "2", 304: "2", 305: "2", 306: "2", 279: "1", 344: "1", 345: "1", 346: "1", 347: "1", 348: "1", 349: "2", 350: "1", 351: "1", 352: "1", 353: "1", 354: "1", 355: "1", 356: "1", 357: "1", 358: "1", 359: "1", 361: "1", 362: "1", 363: "1", 364: "1", 365: "1", 366: "1", 367: "1", 368: "1", 369: "1", 370: "2", 371: "1", 372: "1", 373: "1", 374: "1", 376: "1", 375: "1", 377: "1", 378: "1", 379: "1", 380: "1", 381: "1", 382: "1", 383: "1", 384: "1", 385: "1", 386: "2", 387: "1", 388: "1", 389: "1", 390: "1", 391: "1", 392: "1", 393: "1", 394: "1", 395: "1", 396: "1", 397: "1", 398: "1", 360: "1", 405: "1", 202: "1", 538: "2", 539: "2", 540: "2", 541: "2", 542: "3", 543: "2", 544: "2", 545: "2", 546: "2", 547: "2", 548: "2", 549: "2", 550: "2", 489: "1", 490: "1", 491: "1", 492: "1", 493: "1", 494: "1", 495: "1", 496: "1", 497: "1", 498: "1", 499: "1", 500: "1", 501: "1", 502: "1", 503: "1", 504: "2", 505: "1", 506: "1", 507: "1", 508: "1", 509: "1", 510: "1", 511: "1", 512: "1", 513: "1", 514: "1", 515: "1", 516: "1", 517: "1", 518: "1", 519: "1", 520: "1", 521: "1", 522: "1", 523: "1", 524: "1", 525: "1", 526: "1", 527: "1", 528: "1", 529: "1", 530: "1", 531: "1", 532: "1", 533: "1", 534: "1", 535: "1", 536: "1", 537: "1", 614: "1", 615: "1", 616: "1", 620: "3", 621: "2", 617: "1", 618: "1", 619: "1", 562: "1", 563: "1", 564: "1", 565: "1", 566: "1", 567: "1", 568: "2", 569: "1", 570: "1", 571: "1", 572: "1", 573: "1", 574: "1", 575: "1", 576: "1", 577: "1", 578: "1", 579: "1", 580: "1", 581: "1", 582: "1", 583: "1", 584: "1", 585: "1", 586: "1", 587: "1", 588: "1", 589: "1", 590: "1", 591: "1", 592: "1", 593: "1", 594: "2", 595: "1", 596: "1", 597: "1", 598: "1", 599: "1", 600: "1", 601: "1", 602: "1", 603: "1", 604: "1", 605: "1", 606: "1", 607: "1", 608: "1", 609: "2", 610: "1", 172: "1", 173: "1", 174: "1", 175: "1", 176: "1", 177: "1", 178: "1", 179: "1", 180: "1", 181: "1", 182: "1", 183: "1", 184: "1", 185: "1", 623: "1", 625: "1", 624: "1", 415: "1", 416: "1", 417: "1", 418: "1", 419: "1", 420: "1", 421: "1", 422: "1", 423: "1", 424: "1", 425: "1", 426: "1", 427: "1", 428: "1", 429: "1", 430: "1", 431: "1", 432: "1", 433: "1", 434: "1", 435: "1", 436: "1", 437: "1", 438: "1", 439: "1", 440: "1", 441: "1", 442: "1", 443: "1", 444: "1", 445: "3", 446: "3", 447: "1", 448: "1", 449: "1", 450: "1", 451: "1", 452: "3", 453: "1", 454: "1", 455: "1", 456: "1", 457: "1", 458: "1", 459: "1", 460: "1", 462: "2", 463: "2", 464: "2", 465: "2", 466: "1", 467: "1", 468: "1", 469: "1", 461: "1", 626: "1", 627: "1", 628: "1", 629: "1", 630: "1", 631: "2", 632: "1", 633: "1", 635: "1", 636: "1", 637: "1", 638: "1", 639: "1", 640: "1", 641: "1", 643: "1", 644: "1", 645: "1", 646: "1", 647: "1", 648: "1", 649: "1", 650: "1", 651: "1", 652: "1", 653: "1", 654: "1", 655: "1", 656: "1", 657: "1", 658: "1", 659: "1", 660: "1", 661: "1", 662: "1", 663: "1", 664: "1", 665: "1", 666: "1", 667: "1", 668: "1", 669: "1", 670: "1", 671: "1", 672: "1", 673: "1", 674: "1", 675: "1", 676: "1", 677: "1", 678: "1", 679: "1", 680: "2", 681: "1", 682: "1", 683: "1", 684: "1", 685: "1", 686: "1", 687: "1", 688: "1", 689: "1", 690: "1", 691: "1", 692: "1", 729: "1", 730: "1", 731: "1", 732: "1", 733: "1", 734: "1", 735: "1", 736: "1", 737: "1", 738: "2", 739: "1", 740: "1", 807: "1", 808: "1", 809: "1", 810: "1", 793: "1", 794: "1", 795: "1", 796: "1", 782: "1", 781: "1", 780: "1", 779: "1", 765: "1", 767: "1", 766: "1", 768: "1", 820: "1", 821: "1", 822: "1", 823: "1", 824: "1", 825: "1", 826: "1", 827: "1", 919: "1", 845: "1", 846: "1", 847: "1", 848: "1", 849: "1", 850: "1", 851: "1", 852: "1", 853: "1", 854: "1", 855: "1", 856: "1", 857: "1", 858: "1", 859: "1", 860: "1", 861: "1", 862: "1", 863: "1", 864: "1", 865: "1", 866: "1", 867: "1", 868: "1", 869: "1", 870: "1", 871: "1", 872: "1", 873: "1", 874: "1", 875: "1", 876: "1", 877: "1", 878: "1", 879: "1", 880: "1", 881: "1", 882: "1", 883: "1", 884: "1", 885: "1", 886: "1", 887: "1", 888: "1", 889: "1", 890: "1", 891: "1", 892: "1", 893: "1", 894: "1", 895: "1", 896: "1", 897: "1", 898: "1", 900: "1", 901: "1", 902: "1", 903: "1", 904: "1", 905: "1", 906: "1", 907: "1", 908: "1", 909: "1", 910: "1", 911: "1", 912: "1", 913: "1", 914: "2", 915: "1", 916: "1", 917: "1", 406: "1", 407: "1", 920: "1", 921: "1", 922: "1", 923: "1", 924: "1", 935: "1", 936: "1", 937: "1", 938: "1", 939: "1", 940: "1", 941: "1", 942: "1", 943: "1", 944: "1", 945: "1", 946: "1", 947: "1", 948: "1", 961: "1", 962: "1", 963: "1", 964: "1", 965: "1", 966: "1", 967: "1", 968: "1", 970: "1", 971: "1", 972: "1", 973: "1", 974: "1", 975: "1", 976: "1", 977: "1", 978: "1", 979: "1", 980: "1", 981: "1", 982: "1", 983: "1", 984: "1", 985: "1", 986: "1", 987: "1", 988: "1", 989: "1", 990: "1", 991: "1", 992: "1", 993: "1", 994: "1", 995: "1", 996: "1", 997: "1", 998: "1", 999: "1", 1000: "1", 1001: "1", 1002: "1", 1003: "1", 1004: "1", 1005: "1", 1006: "1", 1007: "1", 1008: "1", 1009: "1", 1010: "1", 1011: "1", 1012: "1", 1013: "1", 1014: "1", 1015: "1", 1016: "1", 1017: "1", 1018: "1", 1019: "1", 1020: "1", 1021: "1", 1022: "1", 1023: "1", 1024: "1", 1025: "1", 1026: "1", 1027: "1", 1028: "1", 1029: "1", 1030: "1", 1031: "1", 1032: "1", 1033: "1", 1034: "1", 1035: "1", 1036: "2", 1037: "2", 1038: "1", 1039: "1", 1040: "1", 1041: "1", 1043: "2", 1042: "1", 1044: "1", 1045: "1", 1046: "1", 1047: "1", 1048: "1", 1049: "1", 1050: "1", 1051: "2", 1052: "1", 1053: "1", 1054: "1", 1055: "1", 1056: "1", 1057: "1", 1058: "1", 1059: "1", 1060: "1", 1061: "1", 1062: "1", 1063: "1", 1064: "1", 1065: "1", 1066: "1", 1067: "1", 1068: "1", 1069: "1", 1070: "1", 1071: "1", 1153: "1", 1155: "1", 1156: "1", 1157: "1", 1158: "1", 1159: "1", 1160: "2", 1161: "1", 1162: "1", 1163: "1", 1164: "1", 1165: "1", 1166: "1", 1167: "1", 1168: "1", 1169: "1", 551: "", 1170: "1", 1171: "1", 1172: "1", 1173: "1", 1174: "1", 1175: "1", };var opt_list = [27,35,48,41,51,58,57,60,24,50,73,74,75,90,87,84,80,92,96,97,105,107,110,117,118]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '443'; var gwpurl = 'https://gwp.brweb.pl/i/index.php?path=/i/443/'; var imgLimit = '8'; var moreLabel = '+'; var lessLabel = '-'; var showMLcnt = 1; var prevMopen = ''; var selectLangVal = ['','wybierz','choose','wählen','Vybrat','vali','izvēlēties','pasirinkti','választ','vyberte si','вибрати','-1']; function oClick(e,type) { if (type == 'S') { selectClick(e); } else { radioClick(e); } setTimeout(showGWP,500); } function setValToInput(optInput,optValue) { if (optInput) { optInput.value = optValue; } else { setTimeout(function() { setValToInput(optInput,optValue); }, 500); } } function selectClick(e) { var id = e.id; var aId = id.split('__'); var optId = aId[0].replace('option_',''); var srl = document.getElementsByName(aId[0]); var sr = null; var optInput = null; var optValue = null; for( var k = 0; k < srl.length; k++){ if (srl[k].tagName == 'H-DROPDOWN-CONTENT') { sr = srl[k]; } if (srl[k].tagName == 'INPUT') { optInput = srl[k]; } } if (sr == null) { srl[1].click(); setTimeout(function() { selectClick(e); }, 500); return false; } sr = document.getElementsByTagName('H-OPTION'); for( var k = 0; k < sr.length; k++){ if (sr[k].value == aId[1]) { sr[k].click(); optValue = aId[1]; /* if (e.parentNode.classList.contains('gwp-opt-sel')) { optValue = ''; } */ setValToInput(optInput,optValue); var aSO = aId[0].split('_'); var soptid = aSO[1]; if (document.getElementById('gwp_div_title_'+soptid)) document.getElementById('gwp_div_title_'+soptid).innerHTML = e.title; } } var c = document.getElementsByClassName('c_' + aId[0]); for( var i = 0; i < c.length; i++){ c[i].parentElement.className = c[i].parentElement.className.replace(' gwp-opt-sel'); if ( c[i].id == id ) { c[i].parentElement.className = c[i].parentElement.className + ' gwp-opt-sel'; } } } function radioClick(e) { var id = e.id; var aId = id.split('__'); document.getElementById(aId[0].replaceAll('_','-')+'-'+aId[1]).click(); var aSO = aId[0].split('_'); var soptid = aSO[1]; if (document.getElementById('gwp_div_title_'+soptid)) document.getElementById('gwp_div_title_'+soptid).innerHTML = e.title; var c = document.getElementsByClassName('c_' + aId[0]); for( var i = 0; i < c.length; i++){ c[i].parentElement.className = c[i].parentElement.className.replace(' gwp-opt-sel',''); if ( c[i].id == id ) c[i].parentElement.className = c[i].parentElement.className + ' gwp-opt-sel'; } } function gwpMore(oid) { var h = document.getElementsByClassName('gwpHidden'+oid); var type = more_txt[oid] == document.getElementById('gwp_more'+oid).innerHTML ? 'block' : 'none'; for( var i = 0; i < h.length; i++){ h[i].style.display = (h[i].className == 'gwp-opt gwpHidden'+oid+' gwp-opt-sel') ? 'block' : type; } document.getElementById('gwp_more'+oid).innerHTML = type == 'block' ? less_txt[oid] : more_txt[oid] ; } function showGWP() { var isLoading = 0; var isDiff = 0; opt_list.forEach(function(opt_id) { var pv = document.getElementsByTagName('product-variants')[0]; var radiov = ''; var srl = document.getElementsByName('option_'+opt_id); if (pv && srl.length == 0) { radiov = '_'+pv.getAttribute("product-instance-key"); srl = document.getElementsByName('option_'+opt_id+radiov); } if (srl.length == 0) { return; } var optValue = ''; var sr = null; if (srl[0].tagName == 'H-DROPDOWN') { srl[0].style.display = 'none'; var smain = srl[0].parentElement.parentElement.parentElement.parentElement; for( var k = 0; k < srl.length; k++){ if (srl[k].tagName == 'H-DROPDOWN-CONTENT') { sr = srl[k]; } if (srl[k].tagName == 'INPUT') { optValue = srl[k].value; } } if (sr == null) { srl[1].click(); setTimeout(function() { var srl = document.getElementsByName('option_'+opt_id); for( var k = 0; k < srl.length; k++){ if (srl[k].tagName == 'H-DROPDOWN-CONTENT') { sr = srl[k]; } if (srl[k].tagName == 'INPUT') { optValue = srl[k].value; } } }, 500); } var optType = 'S'; var s = sr; var c = sr.getElementsByTagName('h-option'); } else { var optType = 'R'; var s = srl[0].parentElement.parentElement.parentElement.parentElement; var smain = srl[0].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; if (sid == 497 || sid == 562 || sid == 588 || sid == 602) { s = srl[0].parentElement.parentElement.parentElement.parentElement.parentElement; smain = srl[0].parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement; } s.parentElement.style.display = 'none'; var c = srl; for( var j = 0; j < c.length; j++){ if (c[j].checked == true) { optValue = c[j].dataset.userValue; } } } isDiff = (!optTmp[opt_id] || optTmp[opt_id] != s.innerText.replace(/\s+/g, '') || (sid != 367 && optTmpVal[opt_id] != optValue)) ? 1 : 0; if (sid == 562) { isDiff = (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML.replace(/\s+/g, '') || (optTmpVal[opt_id] != optValue)) ? 1 : 0; } if (smain.getAttribute("stock-order") > 0 && smain.className.indexOf('loading') != -1) { isLoading++; } if (isDiff == 1 || changeStock == 1) { var sOptions = '', sPreview = '', sTitle = ''; var imgNo = 0; var optCnt = (optType == 'S') ? c.length : c.length; if (optType == 'R') { for( var j = 0; j < c.length; j++){ if (c[j].parentElement.getAttribute("hidden") != null) { optCnt--; } } } more_txt[opt_id] = moreLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); less_txt[opt_id] = lessLabel + (showMLcnt == 1 ? (optCnt - imgLimit + 1) : ''); var smTitle = ''; for( var j = 0; j< c.length; j++){ if (!selectLangVal.includes(c[j].value) && c[j].parentElement.className != 'radio-wrap none' && !c[j].hidden) { imgNo++; var smIsSelect = ((optType == 'S' && (optValue == c[j].value)) || (optType == 'R' && c[j].checked == true)) ? 1 : 0; smItenSelect = smIsSelect == 1 ? ' gwp-opt-sel' : ''; smItenDisplay = (imgNo < imgLimit || (imgNo == imgLimit && imgNo == optCnt)) ? 'block' : 'none'; var lastOpt = (imgNo == imgLimit - 1) ? '!important' : ''; var lastOptClass = (imgNo == imgLimit - 1) ? ' toHidden ' : ''; var lastOptId = (imgNo == imgLimit - 1) ? ' id="gwp_loi_'+oId+'" ' : ''; if (smIsSelect == 1) { smItenDisplay = 'block'; if (imgNo > imgLimit || (imgNo == imgLimit && imgNo < optCnt)) { sOptions = sOptions.replace('block!important','none'); sOptions = sOptions.replace('toHidden','gwpHidden'+opt_id); } } smItenHidden = (imgNo > imgLimit || (imgNo == imgLimit && imgNo != optCnt)) ? ' gwpHidden'+opt_id+' ' : ''; oName = c[j].dataset.userValue ; var smItemUnavailable = (c[j].hasAttribute('data-option-value-unavailable')) ? ' gwp-opt-unavailable' : ''; if (c[j].dataset.priceModifier && c[j].dataset.priceModifier != '') { oName += ' (' + c[j].dataset.priceModifier + ')'; } oId = (optType == 'S') ? s.name : c[j].name; if (smItenSelect == ' gwp-opt-sel') { smTitle = oName; } sOptions += '
'; } } if (optCnt > imgLimit) { sOptions += '
' + more_txt[opt_id] + '
'; } if (document.getElementById('gwp_div_list_'+opt_id)) { if (document.getElementById('gwp_div_title_'+opt_id)) { document.getElementById('gwp_div_title_'+opt_id).innerHTML = sTitle; } document.getElementById('gwp_div_list_'+opt_id).innerHTML = sOptions; } else { const div_title = document.createElement('div'); const div_prev = document.createElement('div'); div_prev.id = 'gwp_div_prev_'+opt_id; div_prev.className = 'gwp-opt-prev'; div_prev.innerHTML = sPreview; const div_list = document.createElement('div'); div_list.id = 'gwp_div_list_'+opt_id; div_list.className = 'sm-gwp-img-list'; div_list.innerHTML = sOptions; if (optType == 'S') { var div4title = s.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.getElementsByTagName('LABEL')[0]; } else { var div4title = s.parentElement.parentElement.parentElement.getElementsByTagName('LABEL')[0]; } div4title.appendChild(div_title); if (optType == 'S') { s.parentElement.parentElement.parentElement.parentElement.appendChild(div_prev); s.parentElement.parentElement.parentElement.parentElement.appendChild(div_list); } else { s.parentElement.parentElement.parentElement.appendChild(div_prev); s.parentElement.parentElement.parentElement.appendChild(div_list); } } optTmp[opt_id] = s.innerText.replace(/\s+/g, ''); optTmpVal[opt_id] = optValue; if (sid == 562) { optTmp[opt_id] = s.innerHTML.replace(/\s+/g, ''); } } }); changeStock = 0; if (isLoading > 0 || isDiff == 1) { setTimeout(showGWP,1000); } } window.onload = function(){ showGWP(); }; showGWP(); setTimeout(showGWP,1000);