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(5, 1fr); gap: 0px; width: 100%; } .gwp-opt { box-sizing: border-box; text-align: center; border:1px solid transparent; padding:1px; margin:0px; border-radius:2px; overflow-x:hidden; position: relative; } .gwp-opt:hover { border-top:0px solid #EEEEEE; padding:1px; } .gwp-opt:hover .gwp-opt-name { padding-top:1px; } .gwp-opt-sel:hover .gwp-opt-name { padding-top: 0px; } .gwp-opt-sel { border:1px solid #d90091 !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:-205px; width:200px; 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:2px; } .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 = {758: "0", 762: "0", 763: "0", 767: "0", 768: "0", 772: "0", 769: "0", 770: "0", 771: "0", 759: "0", 760: "0", 761: "0", 764: "0", 765: "0", 766: "0", 793: "0", 773: "0", 774: "0", 775: "0", 776: "0", 777: "0", 778: "0", 779: "0", 780: "0", 781: "0", 782: "0", 783: "0", 784: "0", 785: "0", 786: "0", 787: "0", 788: "0", 789: "0", 790: "0", 791: "0", 792: "0", 836: "0", 837: "0", 3093: "3", 3094: "3", 3095: "1", 3096: "1", 3097: "1", 3098: "1", 3099: "1", 3100: "1", 3101: "1", 3102: "1", 3103: "1", 3104: "", 3105: "", 3106: "", 3107: "", 3144: "1", 3145: "1", 2801: "1", 2802: "1", 2803: "1", 2804: "1", 2805: "1", 2806: "1", 2807: "1", 2808: "1", 2809: "1", 3151: "1", 3152: "1", 3382: "1", 3383: "1", 3384: "1", 3385: "1", 3386: "1", 3387: "1", 3388: "1", 3147: "2", 1169: "1", 1170: "1", 1171: "1", 1172: "1", 1173: "1", 1174: "1", 1175: "1", 1176: "1", 1177: "1", 1178: "1", 1179: "1", 1180: "1", 3077: "1", 3078: "1", 3079: "1", 3080: "1", 3081: "1", 3082: "1", 3083: "1", 3085: "1", 3086: "1", 3087: "1", 3088: "1", 3089: "1", 3091: "1", 2630: "1", 2631: "1", 2632: "1", 2633: "1", 2634: "1", 2635: "1", 2636: "1", 2637: "1", 2638: "1", 2639: "1", 2640: "1", 2641: "1", 2642: "1", 2582: "1", 2583: "1", 2584: "1", 2585: "1", 2586: "1", 2587: "1", 2588: "2", 2589: "1", 2590: "2", 2591: "1", 2592: "1", 2593: "1", 2594: "1", 2910: "1", 2911: "1", 2912: "1", 2913: "1", 2914: "1", 2915: "1", 2916: "1", 2917: "1", 2918: "1", 2919: "1", 2920: "1", 2921: "1", 2922: "1", 2678: "1", 2679: "1", 2680: "1", 2681: "1", 2682: "1", 2683: "1", 2684: "1", 2685: "1", 2686: "1", 2687: "1", 2688: "1", 2689: "1", 2690: "1", 2862: "1", 2863: "1", 2864: "1", 2865: "1", 2866: "1", 2867: "1", 2868: "1", 2869: "1", 2870: "1", 2871: "1", 2872: "1", 2873: "1", 2874: "1", 2837: "1", 2838: "1", 2839: "1", 2840: "1", 2841: "1", 2842: "1", 2843: "1", 2844: "1", 2845: "1", 2846: "1", 2847: "1", 2848: "1", 2849: "1", 2812: "1", 2813: "1", 2814: "1", 2815: "1", 2816: "1", 2817: "1", 2818: "1", 2819: "1", 2820: "1", 2821: "1", 2822: "1", 2823: "1", 2824: "1", 2887: "1", 2888: "1", 2889: "1", 2890: "1", 2891: "1", 2892: "1", 2893: "1", 2894: "1", 2895: "1", 2896: "1", 2897: "1", 2898: "1", 2899: "1", 2762: "1", 2763: "1", 2764: "1", 2765: "1", 2766: "1", 2767: "1", 2768: "1", 2769: "1", 2770: "1", 2771: "1", 2772: "1", 2773: "1", 2774: "1", 2924: "1", 2925: "1", 2926: "1", 2927: "1", 2928: "1", 2929: "1", 2930: "1", 2931: "1", 2932: "1", 2933: "1", 2934: "1", 2935: "1", 2936: "1", 2940: "1", 2941: "1", 2942: "1", 2943: "1", 2944: "1", 2945: "1", 2946: "1", 2947: "1", 2948: "1", 2949: "1", 2950: "1", 2951: "1", 2952: "1", 2787: "1", 2788: "1", 2789: "1", 2790: "1", 2791: "1", 2792: "1", 2793: "1", 2794: "1", 2795: "1", 2796: "1", 2797: "1", 2798: "1", 2799: "1", 2310: "1", 2311: "1", 2312: "1", 2313: "1", 2314: "1", 2315: "1", 2316: "1", 2317: "1", 2318: "1", 2319: "1", 2320: "1", 2321: "1", 2322: "1", };var opt_list = [154,155,156,157,158,159,160,176,603,626,599,631,629,235,601,511,484,477,539,491,530,523,515,535,508,540,542,430]; var more_txt = [], less_txt = [], optTmp = [], optTmpVal = [], isStock = 0; var changeStock = 0; var sid = '92'; var gwpurl = 'https://gwp.brweb.pl/i/index.php?path=/i/92/'; var imgLimit = '5'; 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; } 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 += '
' + oName + '
'; } } 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.getElementsByTagName('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); if (!gwpstylem) { var gwpstylem = document.createElement('style'); gwpstylem.textContent = '.gwp-opt-name { font-size: 14px;}.gwp-opt-title { font-weight: bold; padding: 0px; display: inline-block;}.gwp-opt {padding: 5px;border-radius: 2px;border: 1px solid #c5cbd3;max-width: 90px;}.gwp-opt-sel {padding: 5px;max-width: 90px;}.sm-gwp-img-list { gap: 8px;}.gwp-opt-more { position: relative; cursor: pointer; border-radius: 0px; border: 0px solid #888888; color: #888888; padding-top: 100%;}'; document.head.appendChild(gwpstylem); }