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(6, 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-unavailable img { filter: grayscale(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; }'; document.head.appendChild(gwpstyle); } gwpNo = {533: "1", 534: "1", 531: "", 532: "", 546: "1", 547: "1", 559: "2", 560: "3", 561: "3", 576: "2", 577: "2", 584: "2", 585: "2", 592: "1", 593: "1", 594: "1", 595: "1", 596: "1", 597: "1", 598: "1", 617: "1", 618: "1", 619: "1", 620: "1", 621: "1", 622: "1", 623: "1", 642: "1", 643: "1", 644: "1", 645: "1", 646: "1", 670: "1", 671: "1", 672: "1", 673: "1", 674: "1", 689: "1", 690: "1", 692: "1", 693: "1", 691: "1", 704: "1", 702: "1", 703: "1", 705: "1", 706: "1", 717: "1", 718: "1", 719: "1", 720: "1", 727: "1", 728: "1", 726: "1", 725: "1", 737: "1", 736: "1", 734: "1", 735: "1", 733: "1", 742: "4", 744: "1", 743: "1", 745: "1", 746: "1", 755: "1", 754: "1", 752: "1", 753: "1", 751: "1", 760: "1", 762: "1", 761: "1", 763: "1", 764: "1", 769: "1", 770: "1", 771: "1", 772: "1", 773: "1", 782: "1", 783: "1", 784: "1", 785: "1", 786: "1", 797: "1", 798: "1", 796: "1", 799: "1", 795: "1", 823: "1", 825: "1", 824: "1", 822: "1", 821: "1", 840: "1", 839: "1", 837: "1", 838: "1", 836: "1", 845: "1", 847: "1", 846: "1", 848: "1", 849: "1", 854: "1", 856: "1", 855: "1", 857: "1", 858: "1", 867: "1", 866: "1", 864: "1", 865: "1", 863: "1", 873: "1", 872: "1", 874: "1", 880: "1", 879: "1", 881: "1", 889: "1", 886: "1", 887: "1", 888: "1", 892: "1", 890: "1", 891: "1", 901: "1", 902: "1", 900: "1", 899: "1", 898: "1", 910: "1", 908: "1", 909: "1", 911: "1", 912: "1", 917: "1", 919: "1", 918: "1", 920: "1", 921: "1", 926: "1", 927: "1", 929: "1", 930: "1", 928: "1", 935: "1", 936: "1", 938: "1", 939: "1", 937: "1", 944: "1", 945: "1", 947: "1", 948: "1", 946: "1", 955: "1", 956: "1", 958: "1", 959: "1", 957: "1", 966: "1", 969: "1", 968: "1", 967: "1", 975: "1", 976: "1", 977: "1", 974: "1", 983: "1", 982: "1", 988: "1", 989: "1", 994: "1", 995: "1", 1001: "1", 1000: "1", 1007: "1", 1006: "1", 1013: "1", 1012: "1", 1020: "1", 1018: "1", 1019: "1", 1026: "1", 1025: "1", 1027: "1", 1034: "1", 1032: "1", 1033: "1", 1039: "1", 1041: "1", 1040: "1", 1046: "1", 1047: "1", 1067: "1", 1066: "1", 1074: "1", 1073: "1", 1080: "1", 1079: "1", 1091: "1", 1092: "1", 1097: "1", 1098: "1", 1103: "1", 1104: "1", 1109: "1", 1110: "1", 1116: "1", 1117: "1", 1123: "1", 1122: "1", 1128: "1", 1129: "1", 1144: "1", 1145: "1", 1146: "1", 1143: "1", 1170: "1", 1169: "1", 1175: "1", 1176: "1", 1182: "1", 1181: "1", 1193: "1", 1194: "1", 1199: "1", 1200: "1", 1206: "1", 1205: "1", 1211: "1", 1212: "1", 1218: "1", 1217: "1", 1224: "2", 1223: "2", 1230: "1", 1229: "1", 1235: "1", 1236: "1", 1241: "1", 1242: "1", 1260: "1", 1259: "1", 1266: "1", 1265: "1", 1272: "1", 1271: "1", 1278: "1", 1277: "1", 1283: "1", 1284: "1", 1285: "1", 1286: "1", 1287: "1", 1293: "1", 1292: "1", 1298: "1", 1299: "1", 1304: "1", 1306: "1", 1305: "1", 1314: "1", 1313: "1", 1312: "1", 1311: "1", 1319: "1", 1324: "1", 1323: "1", 1322: "1", 1321: "1", 1320: "1", 1336: "1", 1335: "1", 1341: "1", 1342: "1", 1348: "1", 1347: "1", 1353: "1", 1354: "1", 1365: "1", 1366: "1", 1360: "1", 1359: "1", 1372: "1", 1371: "1", 1248: "1", 1247: "1", 1253: "1", 1254: "1", 1188: "1", 1187: "1", 1330: "1", 1329: "1", 1086: "1", 1085: "1", 1377: "1", 1378: "1", 1384: "1", 1383: "1", 1389: "1", 1390: "1", 1396: "1", 1395: "1", 1402: "1", 1401: "1", 1407: "1", 1408: "1", 1414: "1", 1413: "1", 1420: "1", 1419: "1", };var opt_list = [80,83,86,89,92,95,98,101,104,107,110,114,117,120,123,126,129,132,135,138,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,240,243,246,249,252,255,258,264,267,270,273,279,282,285,288,291,294,297,300,303,312,315,318,321,324,327,330,333,336,339,345,348,351,354,360,357,363,306,309,276,342,237,366,369,372,375,378,381,384,387]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '593'; var gwpurl = 'https://gwp.brweb.pl/i/593/'; 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]; 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 == 388 || sid == 497 || sid == 562 || sid == 588) { 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); 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); if (!gwpstylem) { var gwpstylem = document.createElement('style'); gwpstylem.textContent = '/* =============================================== GLOBALNE STYLE IKON WARIANTÓW KOLORÓW dla aplikacji GWP / sm-gwp-img-list =============================================== *//* Kontener ikon ? zawsze poziomo, bez rozciągania */.sm-gwp-img-list { display: flex !important; gap: 6px !important; /* odstęp między ikonami */ justify-content: flex-start !important; align-items: center !important; margin: 6px 0 !important; padding: 0 !important;}/* Każdy element listy */.sm-gwp-img-list .gwp-opt { flex: 0 0 auto !important; /* nie rozciąga się */ margin: 0 !important; padding: 0 !important; display: block !important;}/* Ikony wariantów ? desktop (60×60 px) */.sm-gwp-img-list .gwp-opt img { width: 60px !important; height: 60px !important; border: 2px solid #ccc !important; border-radius: 4px !important; box-sizing: border-box !important; object-fit: cover !important; aspect-ratio: 1 / 1 !important; display: block !important; cursor: pointer !important; transition: border-color 0.2s ease !important;}/* Hover efekt */.sm-gwp-img-list .gwp-opt img:hover { border-color: #000 !important;}/* Mobile ? ikony 42×42 px */@media (max-width: 768px) { .sm-gwp-img-list .gwp-opt img { width: 42px !important; height: 42px !important; }}'; document.head.appendChild(gwpstylem); }