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:3px solid transparent; border-bottom: 0px; padding:1px 1px 5px 1px; margin:0px; border-radius:7px; overflow-x:hidden; position: relative; padding-bottom: 20px; } .gwp-opt:hover { border:0px solid #EEEEEE; padding:1px; padding-bottom: 17px; } .gwp-opt-sel { border:2px solid #777777 !important; padding:1px; padding-bottom: 17px; } .gwp-opt-sel:hover { padding:1px; padding-bottom: 17px; } .gwp-opt-name { text-align: center; width: 100%; } .gwp-opt-title { min-height: 1em; padding: 11px 0px; } .gwp-opt-prev { position:relative; } .gwp-opt-prev div { position:absolute; left:-305px; width:300px; 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; }'; document.head.appendChild(gwpstyle); } gwpNo = {9: "2", 10: "3", 11: "2", 13: "2", 14: "2", 15: "", 16: "2", 17: "", 18: "", 19: "", 20: "", 21: "2", 22: "", 23: "", 24: "", 25: "", 26: "", 27: "", 28: "", 29: "", 30: "", 31: "", 32: "", 33: "", 34: "2", 35: "2", 36: "2", 37: "2", 38: "2", 39: "2", 40: "", 41: "", 42: "2", 43: "", 44: "2", 45: "2", 46: "2", 47: "2", 48: "", 49: "", 12: "2", 50: "2", 51: "2", 52: "2", 53: "2", 54: "1", 55: "1", 56: "1", 91: "1", 90: "1", 89: "1", 88: "1", 87: "1", 86: "1", 85: "1", 84: "1", 83: "1", 82: "1", 81: "1", 80: "1", 79: "1", 78: "1", 77: "1", 75: "1", 76: "1", 74: "1", 73: "1", 72: "1", 71: "1", 70: "1", 69: "1", 68: "1", 67: "1", 66: "1", 65: "1", 64: "1", 63: "1", 62: "1", 61: "1", 60: "1", 59: "1", 58: "1", 57: "1", 92: "1", 93: "1", 94: "1", 95: "1", 96: "1", 97: "1", 98: "1", 100: "1", 101: "1", 102: "1", 103: "1", 104: "1", 105: "1", 106: "1", 107: "1", 108: "1", 109: "1", 110: "1", 111: "1", 112: "1", 113: "1", 114: "1", 115: "1", 116: "1", 117: "1", 118: "1", 122: "1", 123: "1", 124: "1", 127: "1", 128: "1", 129: "1", 130: "1", 131: "1", 132: "1", 133: "1", 134: "1", 135: "1", 136: "1", 137: "1", 138: "1", 139: "1", 140: "1", 141: "1", 142: "1", 144: "2", 145: "1", 146: "1", 147: "1", 153: "1", 154: "1", 155: "1", 156: "1", 157: "1", 158: "1", 159: "1", 160: "1", 161: "1", 162: "1", 163: "1", 99: "1", 119: "1", 120: "1", 121: "1", 125: "1", 126: "1", 143: "1", 148: "1", 149: "1", 150: "1", 151: "1", 152: "1", 169: "1", 170: "1", 171: "1", 172: "1", 173: "1", 174: "1", 175: "1", 176: "1", 177: "1", 178: "1", 179: "1", 180: "1", 181: "1", 183: "1", 182: "1", 184: "1", 185: "1", 186: "1", 187: "1", 188: "1", 164: "1", 165: "1", 166: "1", 167: "1", 168: "1", 189: "1", 190: "1", 191: "1", 192: "2", 193: "1", 195: "1", 196: "1", 197: "1", 198: "1", 194: "1", 199: "1", 200: "1", 201: "1", 202: "2", 203: "1", 204: "1", 205: "1", 206: "", 207: "1", 208: "1", 209: "1", 210: "1", 211: "1", 212: "1", 213: "1", 214: "1", 215: "1", 216: "1", 217: "1", 218: "1", 219: "1", 220: "1", 221: "1", 222: "1", 223: "1", 225: "1", 226: "2", 229: "1", 230: "1", 231: "1", 234: "1", 236: "1", 238: "1", 271: "1", 227: "1", 232: "1", 233: "1", 235: "1", 239: "1", 240: "1", 241: "1", 242: "1", 243: "1", 244: "1", 245: "1", 246: "1", 247: "1", 248: "1", 249: "1", 250: "1", 251: "1", 252: "1", 253: "1", 254: "1", 256: "1", 257: "1", 258: "1", 259: "1", 270: "1", 261: "1", 262: "1", 263: "1", 264: "1", 265: "1", 266: "1", 267: "1", 268: "1", 269: "1", 272: "1", 273: "1", 274: "1", 275: "1", 276: "1", 277: "2", 278: "1", 279: "1", 280: "1", 281: "1", 282: "2", 283: "1", 284: "1", 285: "1", 286: "1", 287: "1", 288: "1", 289: "1", 290: "1", 291: "1", 292: "1", 293: "1", 294: "1", 295: "1", 296: "1", };var opt_list = [4,5,6,7,8,10,9,11,12,13,14,15,17,18,19,20,21,22]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '359'; var gwpurl = 'https://gwp.brweb.pl/i/359/'; var imgLimit = '99999'; var moreLabel = 'Więcej '; var lessLabel = 'Mniej '; var showMLcnt = 0; var prevMopen = ''; var selectLangVal = ['','wybierz','choose','wählen','Vybrat','vali','izvēlēties','pasirinkti','választ','vyberte si','вибрати']; function oClick(e,type) { if (type == 'S') { selectClick(e); } else { radioClick(e); } setTimeout(showGWP,500); } function selectClick(e) { var id = e.id; var aId = id.split('__'); if (document.getElementById(aId[0]).value != aId[1] || document.getElementById(aId[0]).length == 1) { document.getElementById(aId[0]).value = aId[1]; if (document.getElementById('gwp_div_title_'+aId[0].replace('option_',''))) document.getElementById('gwp_div_title_'+aId[0].replace('option_','')).innerHTML = e.title; } else { document.getElementById(aId[0]).selectedIndex = '0'; if (document.getElementById('gwp_div_title_'+aId[0].replace('option_',''))) document.getElementById('gwp_div_title_'+aId[0].replace('option_','')).innerHTML = ''; id = aId[0] + '__' + document.getElementById(aId[0]).value; } document.getElementById(aId[0]).dispatchEvent(new Event('change')); 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'; } } optTmpVal[aId[0].replace('option_','')] = document.getElementById(aId[0]).value; } function radioClick(e) { var id = e.id; var aId = id.split('__'); document.getElementById(aId[0]+'_'+aId[1]).click(); if (document.getElementById('gwp_div_title_'+aId[0].replace('option_',''))) document.getElementById('gwp_div_title_'+aId[0].replace('option_','')).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 sr = document.getElementsByName('option_'+opt_id); if (sr.length == 0) { return; } var optValue = ''; if (sr[0].id == sr[0].name ) { var optType = 'S'; var s = sr[0]; var c = s.getElementsByTagName('option'); var optValue = s.value; } else { var optType = 'R'; var s = sr[0].parentElement.parentElement; var c = sr; for( var j = 0; j < c.length; j++){ if (c[j].checked == true) { optValue = c[j].innerHTML; } } } isDiff = (!optTmp[opt_id] || optTmp[opt_id] != s.innerHTML || optTmpVal[opt_id] != s.value) ? 1 : 0; var eStock = (optType == 'S') ? s.parentElement.className : sr[0].parentElement.className; if (eStock.indexOf('option_truestock ') != -1 && eStock.indexOf('loading') != -1) { isLoading++; } if (isDiff == 1 || changeStock == 1) { if (optType == 'R') { s.style.visibility = 'hidden'; s.style.width = '0px'; s.style.height = '0px'; s.style.position = 'absolute'; s.style.bottom = '0px'; } else { s.style.display = 'none'; } var sOptions = '', sPreview = '', sTitle = ''; var imgNo = 0; var optCnt = (optType == 'S') ? c.length - 1 : c.length; if (optType == 'R') { for( var j = 0; j < c.length; j++){ if (c[j].parentElement.className == 'radio-wrap none') { optCnt--; } } var rlabels = s.getElementsByTagName('label'); var rDict = new Array(); for( var rli = 0; rli < rlabels.length; rli++){ if (rlabels[1].innerHTML != '' || !rlabels[rli]) rDict[rlabels[rli].getAttribute('for')] = rlabels[rli].innerHTML; } } 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') { imgNo++; var smIsSelect = ((optType == 'S' && (s.options[s.selectedIndex].value == c[j].value || s.value == 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 = (optType == 'S') ? c[j].innerHTML : rDict[c[j].id]; oId = (optType == 'S') ? s.id : c[j].name; if (smItenSelect == ' gwp-opt-sel') { smTitle = oName; } sOptions += '
' + oName + '
'; } } if (optCnt > imgLimit) { sOptions += '
' + more_txt[opt_id] + '
'; } if (document.getElementById('gwp_div_list_'+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; } else { var div4title = s.parentElement; } div4title.prepend(div_title); if (optType == 'S') { s.parentElement.parentElement.parentElement.appendChild(div_prev); s.parentElement.parentElement.parentElement.appendChild(div_list); } else { s.parentElement.parentElement.appendChild(div_prev); s.parentElement.parentElement.appendChild(div_list); } } optTmp[opt_id] = s.innerHTML; optTmpVal[opt_id] = s.value; } }); changeStock = 0; if (isLoading > 0 || isDiff == 1) { setTimeout(showGWP,100); } } window.onload = function(){ showGWP(); }; showGWP(); setTimeout(showGWP,1000); if (!gwpstylem) { var gwpstylem = document.createElement('style'); gwpstylem.textContent = '.gwp-opt-name {text-align: left;}.gwp-opt img {width: 80px;}.gwp-opt { display: flex !important; gap: 20px; flex-direction: row; align-items: center;border: 1px solid #e3e3e3;padding: 15px 10px;transition: 200ms opacity, 200ms border-color ease;}.gwp-opt:hover {-webkit-box-shadow: 0px 16px 62px -41px rgba(66, 68, 90, 1);-moz-box-shadow: 0px 16px 62px -41px rgba(66, 68, 90, 1);box-shadow: 0px 16px 62px -41px rgba(66, 68, 90, 1);border: 1px solid #e3e3e3;padding: 15px 10px;}.sm-gwp-img-list {display: flex;flex-direction: column;gap: 10px;}'; document.head.appendChild(gwpstylem); }