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; } .gwp-opt:hover { border:0px solid #EEEEEE; padding:1px; } .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; } .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; }'; document.head.appendChild(gwpstyle); } gwpNo = {82: "2", 375: "1", 376: "1", 377: "1", 378: "1", 379: "2", 380: "2", 381: "2", 382: "2", 383: "2", 384: "2", 385: "2", 386: "2", 387: "2", 388: "2", 389: "2", 390: "2", 395: "1", 396: "1", 397: "1", 398: "1", 399: "1", 400: "1", 401: "1", 402: "1", 403: "1", 404: "1", 405: "1", 83: "2", 84: "2", 85: "2", 185: "2", 186: "2", 187: "2", 190: "2", 95: "2", 96: "2", 97: "3", 143: "2", 144: "2", 145: "3", 146: "2", 98: "2", 115: "2", 116: "2", 117: "2", 118: "2", 149: "2", 150: "2", 151: "2", 154: "2", 127: "2", 128: "2", 129: "2", 130: "2", 155: "2", 156: "2", 157: "2", 160: "2", 139: "3", 140: "2", 141: "2", 142: "2", 161: "2", 162: "2", 163: "2", 166: "2", 199: "2", 200: "2", 201: "2", 202: "2", 203: "2", 204: "2", 205: "2", 208: "2", 76: "2", 77: "2", 78: "2", 79: "2", 173: "2", 174: "2", 175: "2", 178: "2", 235: "2", 236: "2", 237: "2", 238: "2", 239: "2", 240: "2", 241: "2", 244: "2", 217: "2", 218: "2", 219: "2", 220: "2", 221: "2", 222: "2", 223: "2", 226: "2", 253: "2", 254: "2", 255: "2", 256: "2", 257: "4", 258: "2", 259: "2", 262: "2", 406: "1", 407: "1", 408: "1", 409: "1", 410: "1", 411: "1", 412: "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", 440: "1", 441: "1", 442: "1", 443: "1", 444: "1", 445: "1", 446: "1", 447: "1", 448: "1", 449: "1", 450: "1", 451: "1", 452: "1", 453: "1", 454: "1", 455: "1", 456: "1", 457: "1", 470: "1", 469: "1", 471: "1", 474: "1", 472: "1", 473: "1", 459: "2", 460: "2", 461: "2", 462: "2", 463: "2", 464: "2", 465: "2", 468: "2", 466: "1", 467: "1", 189: "1", 188: "1", 260: "1", 261: "1", 148: "2", 147: "1", 153: "1", 152: "1", 158: "1", 159: "1", 165: "1", 164: "1", 206: "1", 207: "1", 176: "1", 177: "1", 243: "1", 242: "1", 224: "1", 225: "1", 507: "1", 509: "1", 508: "1", 520: "2", 519: "1", 518: "1", 529: "1", 531: "1", 530: "1", 541: "1", 542: "1", 540: "1", 543: "1", 545: "1", 544: "1", };var opt_list = [17,53,54,55,57,19,22,24,26,28,15,32,30,34,59,60,62,63,61,68,70,72,74,75]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '450'; var url = 'https://gwp.brweb.pl/i/450/'; var imgLimit = '6'; 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','вибрати']; 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) { console.log('gwp'); 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 += '
'; } } 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);