1(function(){ 2 'use strict'; 3 var CFG=window.RBFBP6||{}; 4 var debug=!!CFG.debug; 5 function log(){ if(debug&&window.console) console.log.apply(console,['[RBFBP6]'].concat([].slice.call(arguments))); } 6 function qs(s,c){return (c||document).querySelector(s)} 7 function qsa(s,c){return [].slice.call((c||document).querySelectorAll(s))} 8 function clamp(v,min,max){return Math.max(min,Math.min(max,v))} 9 function debounce(fn,ms){var t;return function(){clearTimeout(t);var a=arguments,ctx=this;t=setTimeout(function(){fn.apply(ctx,a)},ms)}} 10 11 function closedKey(place){return 'rbfbp6_closed_'+place+'_'+String(CFG.revision||'1')} 12 function isClosed(place,hours){ 13 try{var t=parseInt(localStorage.getItem(closedKey(place))||'0',10);return t>0 && (Date.now()-t)<hours*3600000}catch(e){return false} 14 } 15 function bindClose(){ 16 qsa('[data-rbfbp-close="1"]').forEach(function(box){ 17 var place=box.getAttribute('data-rbfbp-placement')||'main'; 18 var hours=place.indexOf('main')===0?((CFG.closeHours&&CFG.closeHours.main)||24):((CFG.closeHours&&CFG.closeHours.side)||24); 19 if(isClosed(place,hours)){box.classList.add('rbfbp6-is-hidden');return} 20 var btn=qs('.rbfbp6-close',box);if(!btn)return; 21 btn.addEventListener('click',function(ev){ev.preventDefault();ev.stopPropagation();box.classList.add('rbfbp6-is-hidden');try{localStorage.setItem(closedKey(place),String(Date.now()))}catch(e){};track(place,'close');layoutSides();}); 22 }); 23 } 24 25 function detectDevice(){var w=document.documentElement.clientWidth;return w<=782?'mobile':(w<=1024?'tablet':'desktop')} 26 function detectBrowser(){var ua=navigator.userAgent||'';if(/Edg\//.test(ua))return'edge';if(/Firefox\//.test(ua))return'firefox';if(/Chrome\//.test(ua)&&!/Edg\//.test(ua))return'chrome';if(/Safari\//.test(ua)&&!/Chrome\//.test(ua))return'safari';return'other'} 27 function activeSlide(box){var s=qs('.rbfbp6-slide.is-active',box);return s?parseInt(s.dataset.slide||'0',10):0} 28 function visitorId(){ 29 try{var k='rbfbp6_vid',v=localStorage.getItem(k);if(!v){v='v'+Math.random().toString(36).slice(2)+Date.now().toString(36);localStorage.setItem(k,v)}return v}catch(e){return''} 30 } 31 var trackQueue=[],trackTimer=null; 32 function flushTracking(sync){ 33 if(!trackQueue.length||!CFG.tracking)return;var batch=trackQueue.splice(0,20);var body='action=rbfbp6_track&events='+encodeURIComponent(JSON.stringify(batch)); 34 if(sync&&navigator.sendBeacon){try{navigator.sendBeacon(CFG.ajaxUrl,new Blob([body],{type:'application/x-www-form-urlencoded;charset=UTF-8'}));return}catch(e){}} 35 fetch(CFG.ajaxUrl,{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8'},body:body,credentials:'same-origin',keepalive:true}).catch(function(){}); 36 if(trackQueue.length)trackTimer=setTimeout(function(){flushTracking(false)},500); 37 } 38 function track(place,event,box){ 39 if(!CFG.tracking)return;if(CFG.respectDnt&&(navigator.doNotTrack==='1'||window.doNotTrack==='1'))return; 40 trackQueue.push({placement:place,event:event,slide:box?activeSlide(box):0,device:detectDevice(),browser:detectBrowser(),campaign:box?String(box.dataset.rbfbpCampaign||''):'',visitor:visitorId()}); 41 if(!CFG.trackingBatch){flushTracking(false);return}if(trackQueue.length>=8){clearTimeout(trackTimer);trackTimer=null;flushTracking(false)}else if(!trackTimer)trackTimer=setTimeout(function(){trackTimer=null;flushTracking(false)},1500); 42 } 43 function capKey(box){var c=String(box.dataset.rbfbpCampaign||'');return'rbfbp6_cap_'+(c||String(box.dataset.rbfbpPlacement||'banner'))} 44 function capEvents(box){ 45 var cap=CFG.frequencyCap||{};if(!cap.enabled)return[];try{var a=JSON.parse(localStorage.getItem(capKey(box))||'[]');if(!Array.isArray(a))a=[];var min=Date.now()-Math.max(1,parseInt(cap.hours||24,10))*3600000;return a.filter(function(t){return parseInt(t,10)>=min})}catch(e){return[]} 46 } 47 function capped(box){var cap=CFG.frequencyCap||{};return!!cap.enabled&&capEvents(box).length>=Math.max(1,parseInt(cap.views||3,10))} 48 function recordCap(box){var cap=CFG.frequencyCap||{};if(!cap.enabled)return;try{var a=capEvents(box);a.push(Date.now());localStorage.setItem(capKey(box),JSON.stringify(a.slice(-Math.max(2,parseInt(cap.views||3,10)*2))))}catch(e){}} 49 function applyFrequencyCap(){qsa('[data-rbfbp-placement]').forEach(function(box){if(capped(box))box.classList.add('rbfbp6-is-hidden')})} 50 51 function bindTracking(){ 52 qsa('[data-rbfbp-placement]').forEach(function(box){ 53 var place=box.getAttribute('data-rbfbp-placement'); 54 box.addEventListener('click',function(ev){if(ev.target.closest('a'))track(place,'click',box)}); 55 }); 56 if(!CFG.tracking)return; 57 var seen={}; 58 if('IntersectionObserver' in window){ 59 var timers=new WeakMap(); 60 var io=new IntersectionObserver(function(entries){entries.forEac
60h(function(e){var box=e.target,p=box.getAttribute('data-rbfbp-placement');if(box.classList.contains('rbfbp6-is-hidden')||capped(box))return;if(e.isIntersecting&&e.intersectionRatio>=.5){if(!seen[p]){seen[p]=1;track(p,'impression',box);recordCap(box)}if(CFG.viewability&&!timers.get(box)){timers.set(box,setTimeout(function(){track(p,'viewable',box);timers.delete(box)},1000));}}else{var t=timers.get(box);if(t){clearTimeout(t);timers.delete(box)}}})},{threshold:[0,.5,1]}); 61 qsa('[data-rbfbp-placement]').forEach(function(x){io.observe(x)}); 62 }else qsa('[data-rbfbp-placement]').forEach(function(x){if(x.classList.contains('rbfbp6-is-hidden')||capped(x))return;var p=x.getAttribute('data-rbfbp-placement');if(!seen[p]){seen[p]=1;track(p,'impression',x);recordCap(x)}}); 63 } 64 65 function firstMedia(side){ 66 if(!side)return null; 67 var slider=qs('.rbfbp6-slider',side),boxMode=slider?String(slider.dataset.boxMode||CFG.sliderBoxMode||'first'):'current'; 68 if(slider&&boxMode==='fixed')return null; 69 if(slider&&boxMode==='first'){var first=qs('.rbfbp6-slide img, .rbfbp6-slide video',slider);if(first)return first;} 70 var active=qs('.rbfbp6-slide.is-active img, .rbfbp6-slide.is-active video',side); 71 if(active)return active; 72 // StatiÄna slika / picture, video, kampanja ili fallback. 73 return qs('.rbfbp6-side-frame > .rbfbp6-link img, .rbfbp6-side-frame > picture img, .rbfbp6-side-frame > img, .rbfbp6-side-frame > video, img, video',side); 74 } 75 function naturalSize(side){ 76 var m=firstMedia(side);if(!m)return null; 77 if(m.tagName==='IMG' && m.naturalWidth&&m.naturalHeight)return {w:m.naturalWidth,h:m.naturalHeight,src:m.currentSrc||m.src||''}; 78 if(m.tagName==='VIDEO' && m.videoWidth&&m.videoHeight)return {w:m.videoWidth,h:m.videoHeight,src:m.currentSrc||m.src||''}; 79 return null; 80 } 81 function breakpointScale(vw){ 82 var smart=CFG.smart||{};if(!smart.breakpointsEnabled)return 1; 83 var pct=smart.bpSmallScale||72; 84 if(vw>=parseInt(smart.bpWideMin||1920,10))pct=smart.bpWideScale||100; 85 else if(vw>=parseInt(smart.bpDesktopMin||1440,10))pct=smart.bpDesktopScale||92; 86 else if(vw>=parseInt(smart.bpCompactMin||1180,10))pct=smart.bpCompactScale||82; 87 return clamp(parseInt(pct,10)||100,30,140)/100; 88 } 89 90 function desired(side,top,availW){ 91 var smart=CFG.smart||{},nat=naturalSize(side),fallbackW=Math.max(1,parseInt(side.dataset.width||'300',10)),fallbackH=Math.max(1,parseInt(side.dataset.height||'600',10)); 92 var mode=(side.dataset.sizeMode||'auto').toLowerCase(),useNatural=mode==='auto'&&smart.autoDetectDimensions!==false&&nat&&nat.w&&nat.h; 93 var ratio=useNatural?(nat.w/nat.h):(fallbackW/fallbackH);if(!isFinite(ratio)||ratio<=0)ratio=.5; 94 var scale=breakpointScale(document.documentElement.clientWidth||window.innerWidth||1440); 95 var preferred=(useNatural?nat.w:fallbackW)*scale,maxSmart=Math.max(40,parseInt(smart.maxWidth||420,10)*scale);preferred=Math.min(preferred,maxSmart); 96 var maxByWidth=Math.max(1,availW),viewportH=document.documentElement.clientHeight||window.innerHeight||800; 97 var maxByVh=Math.max(60,viewportH*((smart.maxHeightVh||78)/100)); 98 var maxByBottom=Math.max(60,viewportH-top-(smart.edgeMargin||16)); 99 var maxH=Math.min(maxByVh,maxByBottom),maxByHeight=maxH*ratio; 100 var w=preferred;if(smart.autoResize)w=Math.min(w,maxByWidth,maxByHeight);w=Math.max(1,w);var h=w/ratio; 101 return {w:w,h:h,ratio:ratio,nat:nat,mode:mode,prefW:fallbackW,prefH:fallbackH,scale:scale}; 102 } 103 104 function detectHeaderBottom(){ 105 if(!(CFG.smart&&CFG.smart.autoHeader))return 0; 106 var sels=['#wpadminbar','header.site-header','.site-header','.sticky-header','.elementor-sticky--active','header[style*="position: fixed"]','header[style*="position:fixed"]']; 107 var max=0; 108 sels.forEach(function(sel){qsa(sel).forEach(function(el){var cs=getComputedStyle(el),r=el.getBoundingClientRect();if(r.height<=0||r.bottom<=0)return;if(el.id==='wpadminbar'||cs.position==='fixed'||cs.position==='sticky'||el.classList.contains('elementor-sticky--active'))max=Math.max(max,r.bottom)})}); 109 return max; 110 } 111 112 function detectContentBounds(vw){ 113 var smart=CFG.smart||{},custom=(smart.selector||'').trim(),target=Math.min(parseInt(smart.contentWidth||1180,10),Math.max(320,vw-32)); 114 function valid(el){if(!el||el===document.body||el===document.documentElement||el.closest&&el.closest('#rbfbp6-side-layer'))return null;var r=el.getBoundingClientRect();
114if(r.width<320||r.height<120||r.right<0||r.left>vw)return null;var left=Math.max(0,r.left),right=Math.min(vw,r.right),width=right-left;if(width<320)return null;return{el:el,left:left,right:right,width:width,cx:(left+right)/2}} 115 if(custom){try{var cc=qsa(custom).map(valid).filter(Boolean);cc.sort(function(a,b){return b.width-a.width});if(cc.length){var cb=cc[0];return{left:Math.round(cb.left),right:Math.round(cb.right),width:Math.round(cb.width),detected:true,source:'custom'}}}catch(e){log('invalid custom selector',custom)}} 116 var defs=[ 117 ['.td-container,.td-main-content-wrap',420],['.jeg_main,.jeg_main_content',420],['.site-content,.content-wrapper,.main-content',380],['.container',340],['.elementor-location-single',300],['#content',260],['main,#main,.site-main',220],['.content-area',180],['article',90],['#page,.site',-500] 118 ],candidates=[],seen=new Set(); 119 defs.forEach(function(def){var nodes=[];try{nodes=qsa(def[0])}catch(e){return}nodes.forEach(function(el){if(seen.has(el))return;seen.add(el);var c=valid(el);if(!c)return;var centerPenalty=Math.abs(c.cx-vw/2),widthPenalty=Math.abs(c.width-target)*.65,viewportPenalty=c.width>vw*.94?900:0;c.score=1400+def[1]-widthPenalty-centerPenalty*1.25-viewportPenalty;candidates.push(c)})}); 120 candidates.sort(function(a,b){return b.score-a.score}); 121 if(candidates.length){var b=candidates[0];return{left:Math.round(b.left),right:Math.round(b.right),width:Math.round(b.width),detected:true,source:'auto'}} 122 var configured=Math.min(target,Math.max(320,vw-2*((smart.minWidth||90)+(smart.minGap||18)+(smart.edgeMargin||16)))); 123 return{left:Math.round((vw-configured)/2),right:Math.round((vw+configured)/2),width:Math.round(configured),detected:false,source:'fallback'}; 124 } 125 126 function verticalBase(side){ 127 var smart=CFG.smart||{},manual=Math.max(parseInt(smart.topOffset||20,10),parseInt(side&&side.dataset.top||'0',10)); 128 if(!smart.verticalEnabled||smart.verticalMode==='manual'||(smart.lockPagePosition&&smart.verticalMode==='auto'))return manual; 129 var hb=detectHeaderBottom(),auto=Math.max(parseInt(smart.topOffset||20,10),hb+(hb?parseInt(smart.headerGap||12,10):0)); 130 return Math.max(manual,auto); 131 } 132 133 function collisionNodes(side){ 134 var smart=CFG.smart||{},raw=String(smart.collisionSelectors||''),nodes=[],seen=new Set(); 135 raw.split(',').map(function(x){return x.trim()}).filter(Boolean).forEach(function(sel){ 136 try{qsa(sel).forEach(function(el){if(!el||seen.has(el)||el===side||(el.closest&&el.closest('#rbfbp6-side-layer')))return;seen.add(el);var cs=getComputedStyle(el),r=el.getBoundingClientRect();if(r.width<2||r.height<2||cs.display==='none'||cs.visibility==='hidden')return;if(el.id!=='wpadminbar'&&cs.position!=='fixed'&&cs.position!=='sticky')return;nodes.push(el)})}catch(e){} 137 }); 138 return nodes; 139 } 140 141 function resolveCollisionTop(side,x,top,size){ 142 var smart=CFG.smart||{};if(smart.lockPagePosition)return top;if(!smart.verticalEnabled||(smart.verticalMode!=='auto'&&smart.verticalMode!=='center')||!smart.collisionEnabled||!side)return top; 143 var gap=parseInt(smart.collisionGap||12,10),attempts=clamp(parseInt(smart.collisionAttempts||4,10),1,10),vh=document.documentElement.clientHeight||window.innerHeight||800,edge=smart.edgeMargin||16,minTop=parseInt(smart.topOffset||20,10),nodes=collisionNodes(side); 144 var cur=top; 145 for(var a=0;a<attempts;a++){var changed=false;for(var i=0;i<nodes.length;i++){var r=nodes[i].getBoundingClientRect(),right=x+size.w,bottom=cur+size.h,hitX=right>r.left&&x<r.right,hitY=bottom>r.top&&cur<r.bottom;if(!hitX||!hitY)continue;var below=r.bottom+gap,above=r.top-gap-size.h;if(below+size.h<=vh-edge)cur=below;else if(above>=minTop)cur=above;else cur=Math.max(minTop,Math.min(cur,vh-edge-size.h));changed=true;}if(!changed)break;} 146 return Math.max(minTop,Math.min(cur,Math.max(minTop,vh-edge-size.h))); 147 } 148 149 function placeSmart(side,x,top,size){ 150 var fixedTop=resolveCollisionTop(side,x,top,size);setBox(side,x,fixedTop,size); 151 } 152 153 function deviceAllowsSides(){ 154 var w=document.documentElement.clientWidth,d=CFG.devices||{}; 155 if(w<=782)return !!d.sideMobile; 156 if(w<=1024)return !!d.sideTablet; 157 return !!d.sideDesktop; 158 } 159 160 function setBox(side,x,top,size){ 161 side.style.setProperty('left',Math.round(x)+'px','important'); 162 side.style.setProperty('right','auto','important'); 163 side.style.setProperty('top',Math.round(top)+'px','important'); 164 side.style.setProperty('bottom','auto','important'); 165 side.style.setProperty('width',Math.max(1,Math.round(size.w))+'px','important'); 166 side.style.setProperty('height',Math.max(1,Math.round(size.h))+'px','important'); 167 side.style.setProperty('transform','none','important'); 168 side.classList.remove('rbfbp6-is-hidden');var layer=side.closest&&side.closest('#rbfbp6-side-layer');if(layer)layer.classList.add('rbfbp6-layout-ready'); 169 } 170 function hide(side){if(side)side.classList.add('rbfbp6-is-hidden')} 171 172 function layoutSides(){ 173 var layer=qs('#rbfbp6-side-layer');if(!layer)return; 174 var left=qs('.rbfbp6-side-left',layer),right=qs('.rbfbp6-side-right',layer),smart=CFG.smart||{}; 175 if(!deviceAllowsSides()){hide(left);hide(right);layer.classList.add('rbfbp6-layout-ready');return} 176 if(!smart.enabled){ 177 var equalSliderFrames=!!CFG.sliderEqualSideFrames&&left&&right&&left.dataset.hasSlider==='1'&&right.dataset.hasSlider==='1'; 178 var eqW=equalSliderFrames?Math.min(parseInt(left.dataset.width||300,10),parseInt(right.dataset.width||300,10)):0; 179 var eqH=equalSliderFrames?Math.min(parseInt(left.dataset.height||600,
17910),parseInt(right.dataset.height||600,10)):0; 180 var eqTop=equalSliderFrames?Math.max(parseInt(left.dataset.top||smart.topOffset||20,10),parseInt(right.dataset.top||smart.topOffset||20,10)):0; 181 [left,right].forEach(function(side){if(!side)return;var top=equalSliderFrames?eqTop:parseInt(side.dataset.top||smart.topOffset||20,10);side.classList.remove('rbfbp6-is-hidden');side.style.top=top+'px';side.style.width=((equalSliderFrames?eqW:parseInt(side.dataset.width||300,10)))+'px';side.style.height=((equalSliderFrames?eqH:parseInt(side.dataset.height||600,10)))+'px'});layer.classList.add('rbfbp6-layout-ready');return; 182 } 183 var vw=document.documentElement.clientWidth, edge=smart.edgeMargin||16,gap=smart.minGap||18; 184 var bounds=detectContentBounds(vw),mode=String(smart.horizontalMode||'content'),cLeft=bounds.left,cRight=bounds.right; 185 if(mode==='viewport'||mode==='manual'||(mode==='content'&&smart.lockPagePosition)){var cw=Math.min(vw-2*(edge+gap),Math.max(320,parseInt(smart.contentWidth||1180,10)));cLeft=(vw-cw)/2;cRight=(vw+cw)/2;} 186 else if(smart.strictSymmetry){var cw2=Math.min(vw-2*(edge+gap),Math.max(320,bounds.width||parseInt(smart.contentWidth||1180,10)));cLeft=(vw-cw2)/2;cRight=(vw+cw2)/2;} 187 var leftAvail=Math.max(0,cLeft-gap-edge),rightAvail=Math.max(0,vw-cRight-gap-edge); 188 var lTop=left?verticalBase(left):parseInt(smart.topOffset||20,10),rTop=right?verticalBase(right):parseInt(smart.topOffset||20,10),baseTop=Math.max(lTop,rTop); 189 var lSize=left?desired(left,lTop,leftAvail):null; 190 var rSize=right?desired(right,rTop,rightAvail):null; 191 if(smart.verticalEnabled&&smart.verticalMode==='center'){var vh=document.documentElement.clientHeight||window.innerHeight||800,hb=smart.lockPagePosition?0:detectHeaderBottom(),minTop=Math.max(parseInt(smart.topOffset||20,10),hb+(hb?parseInt(smart.headerGap||12,10):0));if(lSize)lTop=clamp((vh-lSize.h)/2,minTop,Math.max(minTop,vh-edge-lSize.h));if(rSize)rTop=clamp((vh-rSize.h)/2,minTop,Math.max(minTop,vh-edge-rSize.h));baseTop=Math.max(lTop,rTop);} 192 193 var pairedSliders=!!CFG.sliderEqualSideFrames&&left&&right&&left.dataset.hasSlider==='1'&&right.dataset.hasSlider==='1'; 194 if(left&&right&&lSize&&rSize&&(smart.matchEqual||smart.forceEqualBox||pairedSliders)){ 195 var dimEqual=!!(lSize.nat&&rSize.nat&&lSize.nat.w===rSize.nat.w&&lSize.nat.h===rSize.nat.h); 196 var manualEqual=lSize.mode==='manual'&&rSize.mode==='manual'&&lSize.prefW===rSize.prefW&&lSize.prefH===rSize.prefH; 197 var ratioEqual=Math.abs(lSize.ratio-rSize.ratio)<.001; 198 var commonAvail=Math.max(1,Math.min(leftAvail,rightAvail)),commonW=Math.min(lSize.w,rSize.w,commonAvail,smart.maxWidth||420),maxH=Math.max(60,document.documentElement.clientHeight-baseTop-edge); 199 if(smart.forceEqualBox||pairedSliders){var commonH=Math.min(maxH,Math.max(60,Math.min(lSize.h,rSize.h)));lSize.w=rSize.w=commonW;lSize.h=rSize.h=commonH;} 200 else if(dimEqual||manualEqual||ratioEqual){var ratio=lSize.ratio,commonH2=commonW/ratio;if(commonH2>maxH){commonH2=maxH;commonW=commonH2*ratio}lSize.w=rSize.w=commonW;lSize.h=rSize.h=commonH2;} 201 } 202 203 var minW=smart.minWidth||90; 204 var lFits=left&&lSize&&leftAvail>=Math.min(minW,lSize.w)&&lSize.w>1; 205 var rFits=right&&rSize&&rightAvail>=Math.min(minW,rSize.w)&&rSize.w>1; 206 if((left&&!lFits)||(right&&!rFits)){ 207 if(smart.narrowBehavior==='bottom'&&!lFits&&!rFits){ 208 var one=left||right;hide(left===one?right:left);if(one){var w=Math.min(smart.maxWidth||420,vw-2*edge),s=desired(one,baseTop,w);one.style.setProperty('left','50%','important');one.style.setProperty('right','auto','important');one.style.setProperty('top','auto','important');one.style.setProperty('bottom',edge+'px','important');one.style.setProperty('width',Math.round(Math.min(w,s.w))+'px','important');one.style.setProperty('height',Math.round(s.h)+'px','important');one.style.setProperty('transform','translateX(-50%)','important');one.classList.remove('rbfbp6-is-hidden')}layer.classList.add('rbfbp6-layout-ready');return; 209 } 210 if(smart.narrowBehavior==='single'&&!lFits&&!rFits){ 211 var keep=left||right,drop=keep===left?right:left;hide(drop); 212 if(keep){var avail=keep===left?leftAvail:rightAvail,kt=verticalBase(keep),s2=desired(keep,kt,Math.max(1,avail));if(smart.verticalEnabled&&smart.verticalMode==='center'){var vh2=document.documentElement.clientHeight||window.innerHeight||800,hb2=detectHeaderBottom(),minTop2=Math.max(parseInt(smart.topOffset||20,10),hb2+(hb2?parseInt(smart.headerGap||12,10):0));kt=clamp((vh2-s2.h)/2,minTop2,Math.max(minTop2,vh2-edge-s2.h));}
212var x2=(keep===left?edge+(leftAvail-s2.w)/2:cRight+gap+(rightAvail-s2.w)/2)+parseInt(keep.dataset.xOffset||0,10);placeSmart(keep,x2,kt,s2)}layer.classList.add('rbfbp6-layout-ready');return; 213 } 214 } 215 216 var lx=null,rx=null; 217 if(left&&lFits){lx=edge+(leftAvail-lSize.w)/2+parseInt(left.dataset.xOffset||smart.leftXOffset||0,10);lx=clamp(lx,edge,Math.max(edge,cLeft-gap-lSize.w))} 218 if(right&&rFits){rx=cRight+gap+(rightAvail-rSize.w)/2+parseInt(right.dataset.xOffset||smart.rightXOffset||0,10);rx=clamp(rx,cRight+gap,Math.max(cRight+gap,vw-edge-rSize.w))} 219 if(pairedSliders&&left&&right&&lFits&&rFits){ 220 var lt=resolveCollisionTop(left,lx,lTop,lSize),rt=resolveCollisionTop(right,rx,rTop,rSize),pairedTop=Math.max(lt,rt); 221 setBox(left,lx,pairedTop,lSize);setBox(right,rx,pairedTop,rSize); 222 }else{ 223 if(left&&lFits)placeSmart(left,lx,lTop,lSize);else hide(left); 224 if(right&&rFits)placeSmart(right,rx,rTop,rSize);else hide(right); 225 } 226 layer.classList.add('rbfbp6-layout-ready');log('layout',{vw:vw,bounds:bounds,leftAvail:leftAvail,rightAvail:rightAvail,left:lSize,right:rSize}); 227 } 228 229 function initSliders(){ 230 if(CFG.safeMode)return; 231 var controllers=[]; 232 qsa('.rbfbp6-slider').forEach(function(slider){ 233 var slides=qsa('.rbfbp6-slide',slider);if(slides.length<2)return; 234 var boxMode=String(slider.dataset.boxMode||CFG.sliderBoxMode||'first'); 235 if(boxMode==='first'||boxMode==='fixed')slider.classList.add('rbfbp6-slider-uniform'); 236 slides.forEach(function(sl){var link=qs(':scope > .rbfbp6-link',sl);if(link)link.classList.add('rbfbp6-slide-link-full')}); 237 var dots=qsa('.rbfbp6-slider-dots button',slider),index=Math.max(0,slides.findIndex(function(s){return s.classList.contains('is-active')})),timer=null; 238 var interval=Math.max(2,parseInt(slider.dataset.interval||'6',10))*1000; 239 var transition=Math.max(100,parseInt(slider.dataset.transition||'550',10)); 240 var easingKey=String(slider.dataset.easing||'ease-in-out'); 241 var easingMap={ 242 'linear':'linear','ease':'ease','ease-in':'ease-in','ease-out':'ease-out','ease-in-out':'ease-in-out', 243 'cinematic':'cubic-bezier(.22,1,.36,1)','snappy':'cubic-bezier(.2,.8,.2,1)','soft-spring':'cubic-bezier(.34,1.35,.64,1)', 244 'overshoot':'cubic-bezier(.34,1.56,.64,1)','fast-out':'cubic-bezier(.4,0,1,1)','smooth-strong':'cubic-bezier(.65,0,.35,1)' 245 }; 246 var easing=easingMap[easingKey]||'ease-in-out'; 247 var effect=String(slider.dataset.effect||'fade'),tileDensity=String(slider.dataset.tileDensity||'medium'); 248 var tileEffect=effect==='tiles'||effect==='tiles-wave'||effect==='tiles-random'; 249 var autoplay=slider.dataset.autoplay!=='0',loop=slider.dataset.loop!=='0',random=slider.dataset.random==='1'; 250 if(CFG.respectReducedMotion&&CFG.sliderStopReducedMotion&&window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches)autoplay=false; 251 var pauseHover=slider.dataset.pause==='1',pauseHidden=slider.dataset.pauseHidden==='1',pauseOffscreen=slider.dataset.pauseOffscreen==='1',swipe=slider.dataset.swipe==='1',keyboard=slider.dataset.keyboard==='1'; 252 var swipeThreshold=Math.max(20,parseInt(slider.dataset.swipeThreshold||'45',10)),progress=qs('.rbfbp6-slider-progress',slider),visited={}; 253 slider.style.setProperty('--rb-slider-duration',transition+'ms'); 254 slider.style.setProperty('--rb-slider-ease',easing); 255 slider.style.setProperty('--rb-slider-interval',interval+'ms'); 256 if(CFG.sliderPreloadNext){slides.slice(0,2).forEach(function(sl){var im=qs('img',sl);if(im){try{im.loading='eager';if(im.decode)im.decode().catch(function(){})}catch(e){}}})} 257 258 function markVisited(i){visited[i]=true} 259 function allVisited(){for(var i=0;i<slides.length;i++)if(!visited[i])return false;return true} 260 function randomIndex(){var candidates=[];for(var i=0;i<slides.length;i++)if(i!==index&&(loop||!visited[i]))candidates.push(i);if(!candidates.length)return -1;return candidates[Math.floor(Math.random()*candidates.length)]} 261 function targetIndex(delta){if(random&&delta>0)return randomIndex();var n=index+delta;if(loop)return(n+slides.length)%slides.length;if(n<0||n>=slides.length)return-1;return n} 262 function updateControls(){var prev=qs('.rbfbp6-slider-arrow.prev',slider),next=qs('.rbfbp6-slider-arrow.next',slider);if(prev)prev.disabled=!loop&&!random&&index===0;
262if(next)next.disabled=!loop&&!random&&index===slides.length-1} 263 function resetProgress(run){if(!progress)return;progress.classList.remove('is-running');void progress.offsetWidth;if(run&&autoplay)progress.classList.add('is-running')} 264 var tileTimer=null; 265 function finishShow(i){ 266 index=i;markVisited(index); 267 slides.forEach(function(s,n){var active=n===index;s.classList.toggle('is-active',active);s.setAttribute('aria-hidden',active?'false':'true')}); 268 dots.forEach(function(d,n){d.classList.toggle('is-active',n===index);d.setAttribute('aria-current',n===index?'true':'false')}); 269 updateControls(); 270 var media=qs('img,video',slides[index]); 271 if(media){if(media.tagName==='IMG'&&!media.complete)media.addEventListener('load',layoutSides,{once:true});if(media.tagName==='VIDEO'&&!(media.videoWidth&&media.videoHeight))media.addEventListener('loadedmetadata',layoutSides,{once:true})} 272 if(boxMode==='current')requestAnimationFrame(function(){layoutSides();setTimeout(layoutSides,60)}); 273 if(CFG.sliderPreloadNext){var ni=(index+1)%slides.length,im=qs('img',slides[ni]);if(im){try{im.loading='eager';if(im.decode)im.decode().catch(function(){})}catch(e){}}} 274 initAds(slider);return true; 275 } 276 function clearTileLayer(){if(tileTimer){clearTimeout(tileTimer);tileTimer=null}qsa('.rbfbp6-tile-layer',slider).forEach(function(x){x.remove()})} 277 function objectFitGeometry(img,w,h){var nw=img.naturalWidth||w,nh=img.naturalHeight||h,fit=(getComputedStyle(img).objectFit||'contain').toLowerCase(),dw=w,dh=h;if(nw>0&&nh>0&&fit!=='fill'){var contain=Math.min(w/nw,h/nh),cover=Math.max(w/nw,h/nh),scale=fit==='cover'?cover:contain;if(fit==='scale-down')scale=Math.min(1,contain);dw=nw*scale;dh=nh*scale}return{w:dw,h:dh,x:(w-dw)/2,y:(h-dh)/2}} 278 function tileTransition(i){ 279 var target=slides[i],img=qs('img',target);if(!img||!img.src)return finishShow(i);clearTileLayer(); 280 var rect=slider.getBoundingClientRect(),w=Math.max(1,Math.round(rect.width)),h=Math.max(1,Math.round(rect.height));if(w<2||h<2)return finishShow(i); 281 var grids={large:[4,5],medium:[6,8],fine:[8,10]},g=grids[tileDensity]||grids.medium,rows=g[0],cols=g[1],count=rows*cols; 282 var cellMs=Math.max(120,Math.round(transition*.62)),delayWindow=Math.max(0,transition-cellMs),geo=objectFitGeometry(img,w,h),url=img.currentSrc||img.src; 283 var layer=document.createElement('div');layer.className='rbfbp6-tile-layer';layer.setAttribute('aria-hidden','true'); 284 var order=[];for(var z=0;z<count;z++)order.push(z);if(effect==='tiles-random'){for(var a=order.length-1;a>0;a--){var b=Math.floor(Math.random()*(a+1)),tmp=order[a];order[a]=order[b];order[b]=tmp}} 285 var ranks={};order.forEach(function(v,n){ranks[v]=n}); 286 for(var r=0;r<rows;r++)for(var c=0;c<cols;c++){ 287 var idx=r*cols+c,cell=document.createElement('i'),x=c*w/cols,y=r*h/rows,rank;if(effect==='tiles-wave')rank=r+c;else rank=ranks[idx]; 288 var maxRank=effect==='tiles-wave'?Math.max(1,rows+cols-2):Math.max(1,count-1),delay=Math.round(delayWindow*(rank/maxRank)); 289 cell.className='rbfbp6-tile';cell.style.left=(c*100/cols)+'%';cell.style.top=(r*100/rows)+'%';cell.style.width=(100/cols+.08)+'%';cell.style.height=(100/rows+.08)+'%'; 290 cell.style.backgroundImage='url("'+String(url).replace(/"/g,'\\"')+'")';cell.style.backgroundSize=geo.w+'px '+geo.h+'px';cell.style.backgroundPosition=(geo.x-x)+'px '+(geo.y-y)+'px'; 291 cell.style.setProperty('--rb-tile-ms',cellMs+'ms');cell.style.setProperty('--rb-tile-delay',delay+'ms');cell.style.setProperty('--rb-tile-ease',easing);layer.appendChild(cell) 292 } 293 slider.appendChild(layer);requestAnimationFrame(function(){requestAnimationFrame(function(){layer.classList.add('is-running')})}); 294 tileTimer=setTimeout(function(){slider.classList.add('rbfbp6-tile-finalizing');finishShow(i);clearTileLayer();requestAnimationFrame(function(){requestAnimationFrame(function(){slider.classList.remove('rbfbp6-tile-finalizing')})})},transition+40);return true; 295 } 296 function show(i,source){if(i<0||i>=slides.length)return false;if(i===index&&source!=='init'&&source!=='sync')return true;var reduced=CFG.respectReducedMotion&&window.matchMedia&&window.matchMedia('(prefers-reduced-motion: reduce)').matches;if(tileEffect&&source!=='init'&&!reduced)return tileTransition(i);clearTileLayer();return finishShow(i)} 297 function ownStop(){if(timer){clearTimeout(timer);timer=null}resetProgress(false)} 298 function ownStart(){ownStop();if(!autoplay)return;if(!loop&&!random&&index>=slides.length-1)return;if(random&&!loop&&allVisited())return;resetProgress(true);
298timer=setTimeout(function(){var ni=targetIndex(1);if(ni<0){ownStop();return}show(ni,'auto');ownStart()},interval)} 299 function stop(){if(slider._rbfbpSyncGroup){slider._rbfbpSyncGroup.stop();return}ownStop()} 300 function start(){if(slider._rbfbpSyncGroup){slider._rbfbpSyncGroup.start();return}ownStart()} 301 function go(delta){if(slider._rbfbpSyncGroup){slider._rbfbpSyncGroup.go(delta);return}var ni=targetIndex(delta);if(ni<0)return;show(ni,'manual');start()} 302 303 qsa('a.rbfbp6-link',slider).forEach(function(a){a.addEventListener('click',function(e){e.stopPropagation()})}); 304 var controller={slider:slider,slides:slides,interval:interval,autoplay:autoplay,loop:loop,random:random,show:show,ownStop:ownStop,ownStart:ownStart,start:start,stop:stop,go:go,getIndex:function(){return index},resetProgress:resetProgress}; 305 slider._rbfbpController=controller;controllers.push(controller); 306 307 var prev=qs('.rbfbp6-slider-arrow.prev',slider),next=qs('.rbfbp6-slider-arrow.next',slider); 308 if(prev)prev.addEventListener('click',function(e){e.preventDefault();e.stopPropagation();go(-1)}); 309 if(next)next.addEventListener('click',function(e){e.preventDefault();e.stopPropagation();go(1)}); 310 dots.forEach(function(d){d.addEventListener('click',function(e){e.preventDefault();e.stopPropagation();var n=parseInt(d.dataset.index||'0',10);if(n===index)return;if(slider._rbfbpSyncGroup){slider._rbfbpSyncGroup.show(n,'dot');slider._rbfbpSyncGroup.start()}else{show(n,'dot');start()}})}); 311 if(pauseHover){slider.addEventListener('mouseenter',stop);slider.addEventListener('mouseleave',start)} 312 if(pauseHidden)document.addEventListener('visibilitychange',function(){if(document.hidden)stop();else start()}); 313 if(pauseOffscreen&&'IntersectionObserver' in window){var sio=new IntersectionObserver(function(es){es.forEach(function(e){if(e.isIntersecting&&e.intersectionRatio>.05)start();else stop()})},{threshold:[0,.05]});sio.observe(slider)} 314 if(swipe&&window.PointerEvent){ 315 var sx=0,sy=0,pid=null; 316 slider.addEventListener('pointerdown',function(e){if(e.pointerType==='mouse'&&e.button!==0)return;if(e.target&&e.target.closest&&e.target.closest('a,button')){pid=null;return}pid=e.pointerId;sx=e.clientX;sy=e.clientY;try{slider.setPointerCapture(pid)}catch(_){}}); 317 slider.addEventListener('pointerup',function(e){if(pid!==e.pointerId)return;var dx=e.clientX-sx,dy=e.clientY-sy;try{slider.releasePointerCapture(pid)}catch(_){}pid=null;if(Math.abs(dx)>=swipeThreshold&&Math.abs(dx)>Math.abs(dy)){if(dx<0)go(1);else go(-1)}}); 318 slider.addEventListener('pointercancel',function(){pid=null}) 319 } 320 if(keyboard){slider.addEventListener('keydown',function(e){if(e.key==='ArrowLeft'){e.preventDefault();go(-1)}else if(e.key==='ArrowRight'){e.preventDefault();go(1)}else if(e.key==='Home'){e.preventDefault();if(slider._rbfbpSyncGroup){slider._rbfbpSyncGroup.show(0,'key');slider._rbfbpSyncGroup.start()}else{show(0,'key');start()}}else if(e.key==='End'){e.preventDefault();var last=slides.length-1;if(slider._rbfbpSyncGroup){slider._rbfbpSyncGroup.show(last,'key');slider._rbfbpSyncGroup.start()}else{show(last,'key');start()}}})} 321 if(boxMode==='first'){var fm=qs('.rbfbp6-slide img, .rbfbp6-slide video',slider);if(fm){try{if(fm.tagName==='IMG')fm.loading='eager'}catch(e){}}} 322 markVisited(index);show(index,'init');ownStart(); 323 }); 324 325 if(CFG.sliderSyncSides!==false){ 326 var leftSlider=qs('.rbfbp6-side-left .rbfbp6-slider'),rightSlider=qs('.rbfbp6-side-right .rbfbp6-slider'); 327 var lc=leftSlider&&leftSlider._rbfbpController,rc=rightSlider&&rightSlider._rbfbpController; 328 if(lc&&rc){ 329 lc.ownStop();rc.ownStop(); 330 var count=Math.min(lc.slides.length,rc.slides.length),groupIndex=Math.min(lc.getIndex(),Math.max(0,count-1)),groupTimer=null,groupInterval=Math.max(2000,parseInt(lc.interval||rc.interval||6000,10)); 331 var group={ 332 stop:function(){if(groupTimer){clearTimeout(groupTimer);groupTimer=null}lc.resetProgress(false);rc.resetProgress(false)}, 333 show:function(i,source){if(count<1)return;groupIndex=((parseInt(i,10)%count)+count)%count;lc.show(groupIndex,'sync');rc.show(groupIndex,'sync');requestAnimationFrame(layoutSides)}, 334 nextIndex:function(delta){if(count<1)return-1;if((lc.random||rc.random)&&delta>0&&count>1){var n=groupIndex;while(n===groupIndex)n=Math.floor(Math.random()*count);return n}var n2=groupIndex+delta;if(lc.loop&&rc.loop)return(n2+count)%count;if(n2<0||n2>=count)return-1;return n2}, 335 go:function(delta){var n=this.nextIndex(delta);if(n<0)return;this.show(n,'manual');this.start()}, 336 start:function(){var self=this;this.stop();if(!(lc.autoplay&&rc.autoplay))return;lc.resetProgress(true);rc.resetProgress(true);groupTimer=setTimeout(function(){var n=self.nextIndex(1);if(n<0){self.stop();return}self.show(n,'auto');self.start()},groupInterval)} 337 }; 338 leftSlider._rbfbpSyncGroup=group;rightSlider._rbfbpSyncGroup=group;group.show(groupIndex,'init');group.start(); 339 leftSlider.classList.add('rbfbp6-slider-synced');rightSlider.classList.add('rbfbp6-slider-synced'); 340 } 341 } 342 } 343 344 function initAds(root){ 345 qsa('ins.adsbygoogle',root||document).forEach(function(ins){ 346 if(ins.dataset.adsbygoogleStatus||ins.dataset.rbfbpInit)return;var r=ins.getBoundingClientRect(),cs=getComputedStyle(ins);if(cs.display==='none'||cs.visibility==='hidden'||r.width<1)return;
347 try{(window.adsbygoogle=window.adsbygoogle||[]).push({});ins.dataset.rbfbpInit='1'}catch(e){log('adsense init',e);var errBox=ins.closest('[data-rbfbp-placement]');if(errBox)track(errBox.getAttribute('data-rbfbp-placement'),'error',errBox)} 348 if(CFG.adsFallbackEnabled){setTimeout(function(){ 349 var status=ins.getAttribute('data-ad-status')||ins.dataset.adsbygoogleStatus||'',empty=!status&&!ins.innerHTML.trim();if(status!=='unfilled'&&!empty)return; 350 var box=ins.closest('[data-rbfbp-placement]'),url=box&&box.dataset.fallback;if(!box||!url)return; 351 var host=ins.closest('.rbfbp6-slide')||ins.closest('.rbfbp6-html')||qs('.rbfbp6-side-frame',box)||qs('.rbfbp6-main-inner',box)||box; 352 if(!host||qs('.rbfbp6-ad-fallback',host))return; 353 var img=document.createElement('img');img.className='rbfbp6-ad-fallback';img.src=url;img.alt='Rezervni oglas';img.decoding='async'; 354 var html=ins.closest('.rbfbp6-html');if(html)html.style.display='none';host.appendChild(img);box.classList.add('rbfbp6-has-ad-fallback');layoutSides(); 355 },Math.max(1,parseInt(CFG.adsFallbackSeconds||4,10))*1000)} 356 }) 357 } 358 359 function init(){ 360 if(CFG.respectReducedMotion===false)document.documentElement.classList.add('rbfbp6-allow-motion'); 361 var ms=Math.max(0,parseInt(CFG.animationMs||350,10));qsa('.rbfbp6-animation-fade,.rbfbp6-animation-slide').forEach(function(x){x.style.animationDuration=ms+'ms'}); 362 var delay=Math.max(0,parseInt(CFG.showDelay||0,10));if(delay>0){qsa('[data-rbfbp-placement]').forEach(function(x){x.style.visibility='hidden';x.style.opacity='0'});setTimeout(function(){qsa('[data-rbfbp-placement]').forEach(function(x){x.style.visibility='';x.style.opacity=''});layoutSides();setTimeout(function(){initAds(document)},60)},delay*1000)} 363 applyFrequencyCap();bindClose();initSliders();bindTracking();layoutSides();setTimeout(function(){initAds(document)},80); 364 qsa('.rbfbp6-side img,.rbfbp6-side video').forEach(function(m){m.addEventListener('load',layoutSides);m.addEventListener('loadedmetadata',layoutSides)}); 365 window.addEventListener('load',layoutSides,{once:true});window.addEventListener('resize',debounce(layoutSides,100));window.addEventListener('orientationchange',debounce(layoutSides,120)); 366 window.addEventListener('pagehide',function(){flushTracking(true)});document.addEventListener('visibilitychange',function(){if(document.hidden)flushTracking(true)}); 367 if(document.fonts&&document.fonts.ready)document.fonts.ready.then(layoutSides).catch(function(){}); 368 if(!CFG.performanceMode&&'ResizeObserver' in window){var ro=new ResizeObserver(debounce(layoutSides,80));['main','.site-main','.content-area','.site-content'].forEach(function(sel){var el=qs(sel);if(el)ro.observe(el)})} 369 setTimeout(layoutSides,250);if(!CFG.performanceMode)setTimeout(layoutSides,1000); 370 } 371 if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init(); 372})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.