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(7, 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 = {2322: "3", 2323: "3", 2321: "3", 2324: "2", 2325: "2", 2326: "2", 2327: "2", 2328: "2", 2329: "2", 2330: "2", 2331: "2", 2332: "2", 2333: "2", 2334: "2", 2335: "2", 2336: "2", 2337: "1", 2338: "1", 2339: "1", 2340: "1", 2341: "1", 2342: "1", 2343: "1", 2344: "1", 2345: "1", 2346: "1", 2347: "1", 2348: "1", 2349: "1", 2350: "1", 2351: "1", 2352: "1", 2353: "1", 2354: "1", 2355: "1", 2356: "1", 2357: "1", 2358: "1", 2359: "1", 2360: "1", 2361: "1", 2362: "1", 2363: "1", 2364: "1", 2365: "1", 2366: "1", 2367: "1", 2368: "1", 2369: "1", 2370: "1", 2371: "1", 2372: "1", 2373: "1", 2374: "1", 2375: "1", 2376: "1", 2377: "1", 2378: "1", 2379: "1", 2380: "1", 2381: "1", 2382: "1", 2383: "1", 2384: "1", 2385: "1", 2386: "1", 2387: "1", 2388: "1", 2389: "1", 2390: "1", 2391: "1", 2392: "1", 2393: "1", 2394: "1", 2395: "1", 2396: "1", 2397: "1", 2398: "1", 2399: "1", 2400: "1", 2401: "1", 2402: "1", 2403: "1", 2404: "1", 2405: "1", 2406: "1", 2407: "1", 2408: "1", 2409: "1", 2410: "1", 2411: "1", 2412: "1", 2413: "1", 2414: "1", 2415: "1", 2416: "1", 2417: "1", 2418: "1", 2419: "1", 2420: "1", 2421: "1", 2422: "1", 2423: "1", 2424: "1", 2425: "1", 2426: "1", 2427: "1", 2428: "1", 2429: "1", 2430: "1", 2431: "1", 2432: "1", 2433: "1", 2434: "1", 2435: "1", 2436: "1", 2437: "1", 2438: "1", 2439: "1", 2440: "1", 2441: "1", 2442: "1", 2443: "1", 2444: "1", 2445: "1", 2447: "1", 2446: "1", 2448: "1", 2449: "1", 2450: "1", 2451: "1", 2452: "1", 2453: "1", 2454: "1", 2455: "1", 2456: "1", 2457: "1", 2458: "1", 2459: "1", 2460: "1", 2461: "1", 2462: "1", 2463: "1", 2464: "1", 2465: "1", 2466: "1", 2467: "1", 2468: "1", 2469: "1", 2470: "1", 2471: "1", 2472: "1", 2473: "1", 2474: "1", 2475: "1", 2476: "2", 2477: "1", 2478: "1", 2479: "1", 2480: "1", 2481: "1", 2482: "1", 2483: "1", 2484: "1", 2485: "1", 2486: "1", 2487: "1", 2488: "1", 2489: "1", 2490: "1", 2491: "1", 2492: "1", 2493: "2", 2494: "1", 2495: "1", 2496: "1", 2497: "1", 2498: "1", 2499: "1", 2500: "1", 2501: "1", 2502: "1", 2503: "1", 2504: "1", 2505: "1", 2506: "1", 2507: "1", 2508: "1", 2509: "1", 2510: "1", 2511: "1", 2512: "1", 2513: "1", 2514: "1", 2515: "1", 2516: "1", 2517: "1", 2518: "1", 2519: "1", 2520: "1", 2521: "1", 2522: "1", 2523: "1", 2524: "1", 2525: "2", 2526: "1", 2527: "1", 2528: "1", 2529: "1", 2530: "1", 2531: "1", 2532: "1", 2533: "1", 2534: "1", 2535: "1", 2536: "1", 2537: "1", 2538: "1", 2539: "1", 2540: "1", 2541: "1", 2542: "1", 2543: "1", 2544: "1", 2545: "1", 2548: "1", 2549: "1", 2550: "1", 2551: "1", 2552: "1", 2553: "1", 2554: "1", 2555: "1", 2556: "1", 2557: "1", 2558: "1", 2559: "1", 2560: "1", 2561: "1", 2562: "1", 2563: "1", 2564: "1", 2565: "1", 2566: "1", 2567: "1", 2568: "1", 2569: "1", 2570: "1", 2571: "1", 2572: "1", 2573: "1", 2574: "1", };var opt_list = [349,350,351,352,353,354,355,356,357,358]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '589'; var gwpurl = 'https://gwp.brweb.pl/i/589/'; 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','вибрати','-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);