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(8, 1fr); gap: 0px; width: 100%; } .gwp-opt { box-sizing: border-box; text-align: center; border:3px solid transparent; padding:1px; margin:0px; border-radius:99px; overflow-x:hidden; position: relative; } .gwp-opt:hover { border-top:0px solid #EEEEEE; padding:1px; } .gwp-opt:hover .gwp-opt-name { padding-top:3px; } .gwp-opt-sel:hover .gwp-opt-name { padding-top: 0px; } .gwp-opt-sel { border:3px solid #FAA5BD !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:99px; } .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 = {654: "3", 655: "3", 656: "3", 646: "3", 647: "2", 637: "2", 649: "2", 1064: "1", 1078: "2", 1065: "1", 1079: "1", 1066: "1", 1161: "1", 641: "2", 1162: "1", 1067: "1", 1068: "1", 1069: "1", 1070: "1", 1071: "1", 676: "1", 1072: "1", 1073: "1", 1074: "1", 1061: "1", 1075: "1", 1062: "1", 1076: "1", 1063: "1", 1077: "1", 707: "2", 772: "2", 1084: "1", 724: "1", 1158: "1", 1159: "1", 1160: "1", 765: "1", 650: "1", 677: "1", 653: "1", 657: "1", 749: "1", 766: "1", 645: "1", 667: "1", 636: "1", 640: "1", 648: "1", 643: "1", 644: "1", 642: "1", 668: "1", 639: "1", 651: "1", 673: "1", 693: "1", 652: "1", 669: "1", 638: "1", 1088: "2", 1091: "1", 674: "1", 1092: "1", 848: "1", 672: "1", 670: "1", 671: "1", 692: "1", 681: "1", 704: "1", 683: "1", 1125: "1", 700: "1", 686: "1", 685: "1", 687: "1", 750: "1", 1090: "1", 1093: "1", 1106: "1", 859: "1", 856: "1", 855: "1", 857: "1", 854: "1", 852: "1", 1105: "2", 850: "2", 882: "", 858: "1", 1099: "1", 1103: "1", 1104: "1", 1109: "1", 1112: "1", 1113: "1", 1110: "1", 1111: "1", 1108: "1", 1114: "1", 764: "1", 767: "3", 849: "3", 851: "1", 1094: "1", 853: "1", 1095: "1", 705: "1", 706: "1", 751: "1", 1107: "1", 1123: "1", 1120: "1", 1121: "1", 1122: "1", 1037: "1", 661: "1", 662: "1", 679: "1", 663: "1", 664: "1", 665: "1", 658: "1", 666: "1", 748: "1", 680: "1", 659: "1", 660: "1", 731: "1", 845: "1", 743: "1", 732: "1", 733: "1", 682: "1", 744: "1", 736: "1", 745: "1", 847: "1", 746: "1", 842: "1", 737: "1", 747: "1", 843: "1", 738: "1", 844: "1", 739: "1", 728: "1", 740: "1", 729: "1", 734: "1", 741: "1", 730: "1", 735: "1", 742: "1", 1080: "1", 1081: "1", 1082: "1", 1083: "1", 846: "1", 1096: "1", 1097: "1", 1098: "1", 688: "1", 689: "1", 690: "1", 691: "1", 709: "1", 710: "1", 711: "2", 712: "1", 713: "1", 714: "1", 715: "1", 716: "1", 717: "1", 718: "1", 770: "1", 771: "1", 1143: "1", 1144: "1", 1145: "1", 1146: "1", 1147: "1", 1149: "1", 1148: "1", 1150: "1", 1151: "1", 1152: "1", 1153: "1", 1154: "1", 684: "1", 719: "1", 720: "1", 721: "1", 722: "1", 723: "1", 762: "1", 1134: "1", 1135: "1", 1136: "1", 1137: "1", 1138: "1", 1139: "1", 1140: "1", 1141: "1", 1142: "1", 1155: "1", 1156: "1", 1157: "1", 761: "1", 759: "1", 760: "1", 675: "1", 678: "1", 694: "1", 695: "1", 696: "1", 697: "1", 698: "1", 699: "1", 701: "1", 702: "1", 703: "1", 708: "1", 756: "1", 757: "1", 758: "1", 763: "1", 1131: "1", 1132: "1", 1133: "1", 1049: "1", 1050: "1", 1051: "1", 1052: "1", 1053: "1", 1054: "1", 1055: "1", 1056: "1", 1057: "1", 1058: "1", 1059: "1", 1060: "1", 1127: "1", 1128: "1", 1129: "1", 1130: "1", 1126: "1", 1188: "1", 1184: "1", 1185: "1", 1186: "1", 1187: "1", 1189: "1", 1190: "1", 1191: "1", 1199: "1", 1192: "1", 1193: "1", 1194: "1", 1195: "1", 1196: "1", 1197: "1", 1198: "1", 1200: "1", 1201: "1", 1202: "1", 1205: "1", 1206: "1", 1207: "1", 1210: "1", 1211: "1", 1212: "1", 1213: "1", 1214: "1", 1215: "1", 1216: "3", 1217: "1", 1218: "1", 1219: "1", 1220: "1", 1221: "1", 1222: "1", 1223: "1", 1224: "1", 1225: "1", 1226: "1", 1227: "1", 1228: "1", 1230: "1", 1231: "1", 1232: "1", 1233: "1", 1234: "1", 1235: "1", 1237: "1", 1229: "1", 1236: "1", 1240: "1", 1241: "1", 1242: "1", 1243: "1", 1244: "1", 1245: "1", 1246: "1", 1247: "1", 1248: "1", 1249: "1", 1250: "1", 1251: "1", 1252: "1", 1253: "1", 1254: "1", 1255: "1", 1256: "1", 1258: "1", 1259: "1", 1260: "1", 1265: "1", 1257: "1", 1261: "1", 1262: "1", 1263: "1", 1264: "1", 1266: "1", 1271: "1", 1272: "1", 1273: "1", 1274: "1", 1275: "1", 1276: "1", 1277: "1", 1278: "1", 1279: "1", 1280: "1", 1281: "1", 1282: "1", 1283: "1", 1284: "1", 1285: "1", 1286: "1", 1287: "1", 1288: "1", 1289: "1", 1293: "1", 1294: "1", 1295: "1", 1296: "1", 1297: "1", 1298: "1", 1299: "1", 1304: "1", 1305: "1", 1306: "1", 1307: "1", 1308: "1", 1309: "1", 1310: "1", 1311: "1", 1312: "1", 1313: "1", 1314: "1", 1315: "1", 1316: "1", 1317: "1", 1318: "1", 1319: "1", 1320: "1", 1321: "1", 1322: "1", 1323: "1", 1324: "1", 1325: "1", 1326: "1", 1327: "1", 1328: "1", 1329: "1", 1330: "1", 1331: "1", 1332: "1", 1333: "1", 1334: "1", 1335: "1", 1336: "1", 1337: "1", 1338: "1", 1339: "1", 1340: "1", 1341: "1", 1342: "1", 1343: "1", 1344: "1", 1345: "1", 1346: "1", 1347: "1", 1348: "1", 1349: "1", 1350: "1", 1351: "1", 1357: "1", 1358: "1", 1359: "1", 1360: "1", 1361: "1", 1362: "1", 1363: "1", 1364: "1", 1365: "1", 1366: "1", 1367: "1", 1368: "1", 1369: "1", 1370: "1", 1371: "1", 1372: "1", 1373: "1", 1374: "1", 1375: "1", 1376: "1", 1377: "1", 1356: "1", 1380: "1", 1381: "1", 1382: "1", 1383: "1", 1387: "1", 1388: "1", 1389: "1", 1390: "1", 1393: "1", 1394: "1", 1395: "1", 1398: "1", 1399: "1", 1400: "1", 1401: "1", 1404: "1", 1405: "1", 1406: "1", 1407: "1", 1408: "1", 1411: "1", 1412: "1", 1413: "1", 1416: "1", 1417: "1", 1418: "1", 1419: "1", 1423: "1", 1424: "1", 1425: "1", 1426: "1", 1427: "1", 1428: "1", 1429: "1", 1430: "1", 1431: "1", 1432: "1", 1433: "1", 1434: "1", 1435: "1", 1436: "1", 1437: "2", 1438: "2", 1439: "1", 1440: "1", 1441: "1", };var opt_list = [23,28,30,34,32,36,38,40,42,54,50,48,52,44,56,58,46]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '715'; var gwpurl = 'https://gwp.brweb.pl/i/715/'; var imgLimit = '100'; var moreLabel = '+'; var lessLabel = '-'; var showMLcnt = ''; 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; } if (s.className != 'control') { s = s.parentElement; smain = smain.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] + '
'; } sTitle = smTitle != '' ? smTitle : ''; 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'); div_title.id = 'gwp_div_title_'+opt_id; div_title.className = 'gwp-opt-title'; div_title.innerHTML = sTitle; 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.getElementsByClassName('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);