1/** 2 * Goodbye Banner (! mobilon nincs document mouseleave esemeny igy nem is jon fel) 3 * 4 * ! A kep es iframe jelenleg nincs merve, az inspiraciotar adminra tamoszkodott a banner_megjelent() fn, 5 * de egy ideje mindent az Adverticumban kezelunk, igy alapevtoen a kep es iframe funkcio nincs hasznalva 6 * 7 * Hasznalat: 8 * <div id="bannerGoodbye" data-type="goa" data-zone="zone3141434" data-width="960" data-height="720"></div> 9 * <div id="bannerGoodbye" data-type="image" data-zone="zone3141434" data-ct="http://index.hu" data-src="http://www.kazan-tudastar.hu/banners/Weishaupt_kalkul%C3%A1tor_banner_960x720/adverticum.html" data-width="960" data-height="720"></div> 10 * <div id="bannerGoodbye" data-type="iframe" data-zone="zone3141434" data-src="http://placehold.it/960x720" data-width="960" data-height="720"></div> 11 */ 12 13/* Nem tudom hogyan lehet a goa banner meretet betolteskor megadni, igy css-sel biralom felul */ 14 ;(function(){ 15 var css = 16 [ 17 '#bannerGoodbye iframe,', 18 '#bannerGoodbye img {position:absolute!important;top:0!important;left:0!important;right:0!important;bottom:0!important; display:block!important;width:100%!important;height:100%!important;}' 19 ].join('\n'); 20 var head = document.head || document.getElementsByTagName('head')[0]; 21 var style = document.createElement('style'); 22 23 style.type = 'text/css'; 24 if (style.styleSheet){ 25 style.styleSheet.cssText = css; 26 } else { 27 style.appendChild(document.createTextNode(css)); 28 } 29 30 head.appendChild(style); 31})(); 32 33;(function($){ 34 35 var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent); 36 37 var MEDIAAJANLAT = ( document.location.href.indexOf('mediaajanlat=goodbye') != -1 || document.location.href.indexOf('mediaajanlat=otp') != -1 || document.location.href.indexOf('sberbank=') != -1); 38 39 if ( ! MEDIAAJANLAT) 40 MEDIAAJANLAT = readCookie('otpdemo'); 41 if ( ! MEDIAAJANLAT) 42 MEDIAAJANLAT = readCookie('sberbank'); 43 44 var zoneToRemove = (screen.width < 779) ? document.getElementById('bannerGoodbye') : document.getElementById('bannerGoodbyeMobile'); 45 if (zoneToRemove) zoneToRemove.parentElement.removeChild(zoneToRemove); 46 47 var AD_PLACEHOLDER_ID = (screen.width < 779) ? 'bannerGoodbyeMobile' : 'bannerGoodbye'; 48 49 if ( ! document.getElementById(AD_PLACEHOLDER_ID)) 50 return; 51 52 var AD_PLACEHOLDER = document.getElementById(AD_PLACEHOLDER_ID); 53 var TYPE = AD_PLACEHOLDER.getAttribute('data-type'); 54 var ZONEID = AD_PLACEHOLDER.getAttribute('data-zone'); 55 var WIDTH = AD_PLACEHOLDER.getAttribute('data-width') || 960; 56 var HEIGHT = AD_PLACEHOLDER.getAttribute('data-height') || 720; 57 var SRC = AD_PLACEHOLDER.getAttribute('data-src') || null; 58 var CT = AD_PLACEHOLDER.getAttribute('data-ct') || null; 59 60 var WINDOW_WIDTH = window.innerWidth 61 || document.documentElement.clientWidth 62 || document.body.clientWidth; 63 64 var WINDOW_HEIGHT = window.innerHeight 65 || document.documentElement.clientHeight 66 || document.body.clientHeight; 67 68 if (WINDOW_WIDTH < WIDTH) 69 { 70 HEIGHT = HEIGHT * ( (WINDOW_WIDTH - 30) / WIDTH ); 71 WIDTH = WINDOW_WIDTH - 30; 72 } 73 74 if (WINDOW_HEIGHT < HEIGHT) 75 { 76 WIDTH = WIDTH * ( (WINDOW_HEIGHT - 30) / HEIGHT ); 77 HEIGHT = WINDOW_HEIGHT - 30; 78 } 79 80 81 82 function showAd(){ 83 84 var $ad = $(AD_PLACEHOLDER); 85 86 var $nodeHolder = $('<div/>') 87 .attr('id','ad-holder-'+ZONEID) 88 .attr('style','display:none;position:fixed;z-index:100001;top:50%;left:50%;width:'+WIDTH+'px;height:'+HEIGHT+'px;margin-left:-'+(WIDTH/2)+'px;margin-top:-'+(HEIGHT/2)+'px;') 89 ; 90 91 var $nodeOverlay = $('<div/>') 92 .attr('id','ad-overlay-'+ZONEID) 93 .attr('style','display:none;cursor:pointer;position:fixed;z-index:100000;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.75);') 94 .attr('title','Bezár') 95 ; 96 97 var $nodeClose = $('<div/>') 98 .attr('id','ad-close-'+ZONEID) 99 .attr('style','position:absolute;z-index:1000;width:54px;height:19px;right:5px;top:5px;cursor:pointer;background:url(//www.homeinfo.hu/assets/adclose.gif);') 100 ; 101 102 $ad 103 .before($nodeOverlay) 104 .wrap($nodeHolder) 105 .after($nodeClose); 106 ; 107
108 var $overlay = $('#'+'ad-overlay-'+ZONEID); 109 var $holder = $('#'+'ad-holder-'+ZONEID); 110 var $close = $('#'+'ad-close-'+ZONEID); 111 112 var closeHandler = function(e){ 113 $overlay.fadeOut(function(){$(this).remove();}); 114 $holder.slideUp(function(){$(this).remove();}); 115 }; 116 117 // Bind close 118 $('body') 119 .on('click',$overlay,closeHandler) 120 .on('click',$close,closeHandler) 121 ; 122 123 if (TYPE.toLowerCase() == 'goa'){ 124 // A placeholderbe beletoltjuk a GOA bannert async 125 window.goAdverticum3.onReady(function( goa3 ) { 126 var $ = goa3.getjQuery(); 127 128 $(AD_PLACEHOLDER).goa(ZONEID.replace('zone',''), { 129 p: 100, // zone priority 130 zP: "", // zone parameters 131 fP: "", // forward parameters 132 cT: "", // custom targeting parameters 133 banner : { width : WIDTH, height: HEIGHT } 134 }, ''); 135 136 goa3.on('invoke', function ( jQueryEvent, goa3Event ) { 137 var zone = goa3Event.zone; 138 if (zone.id != ZONEID.replace('zone','')) 139 return; 140 141 var $zone = $(AD_PLACEHOLDER); 142 var $banner; 143 144 // Banner meghatározása 145 if ($zone.find('iframe').length) 146 $banner = $zone.find('iframe'); 147 else if ($zone.find('img').length) 148 $banner = $zone.find('img'); 149 150 $banner.css({ 151 'display':'block', 152 'width':WIDTH + 'px', 153 'height':HEIGHT + 'px' 154 }); 155 156 // Show 157 $overlay.fadeIn(function(){ 158 $holder.fadeIn(function(){ 159 banner_megjelent(); 160 }); 161 }); 162 }); 163 164 }); 165 } 166 167 if (TYPE.toLowerCase() == 'iframe'){ 168 var iframe = document.createElement('iframe'); 169 iframe.width = WIDTH; 170 iframe.height = HEIGHT; 171 iframe.scrolling = 'no'; 172 iframe.frameBorder = 0; 173 iframe.src = SRC; 174 iframe.allow = 'autoplay; encrypted-media'; 175 iframe.allowfullscreen = ''; 176 AD_PLACEHOLDER.appendChild(iframe); 177 // Show 178 $overlay.fadeIn(function(){ 179 $holder.fadeIn(function(){ 180 banner_megjelent(); 181 }); 182 }); 183 } 184 if (TYPE.toLowerCase() == 'image'){ 185 var a = document.createElement('a'); 186 a.target = '_blank'; 187 a.href = CT; 188 var image = new Image(); 189 image.width = WIDTH; 190 image.height = HEIGHT; 191 image.src = SRC; 192 a.appendChild(image); 193 AD_PLACEHOLDER.appendChild(a); 194 // Show 195 $overlay.fadeIn(function(){ 196 $holder.fadeIn(function(){ 197 banner_megjelent(); 198 }); 199 }); 200 } 201 } 202 203 // DOM ready 204 $(function(){ 205 206 // A Cookie szerint megjelent mar a banner a felhasznalonak, igy eltavolitjuk a placeholdert es 'kilepunk' 207 if (readCookie(ZONEID)) { 208 AD_PLACEHOLDER.parentNode.removeChild(AD_PLACEHOLDER); 209 return; 210 } 211 212 var timeout = 1000*60*1; // 1 min 213 214 if (MEDIAAJANLAT) 215 timeout = 0; 216 217 setTimeout(function(){ 218 if (isMobile) 219 { 220 showAd(); 221 if ( ! MEDIAAJANLAT) 222 midnight_cookie(ZONEID, '1'); // expires cuurent day 223 } 224 else 225 { 226 $(document).on('mouseleave',function(){ 227 $(document).off('mouseleave'); 228 showAd(); 229 if ( ! MEDIAAJANLAT) 230 //setCookie(ZONEID, '1', 1); // expires 1 day 231 midnight_cookie(ZONEID, '1'); // expires current day 232 }); 233 } 234 },timeout); 235 }); 236 237 function readCookie(name) { 238 var nameEQ = name + "="; 239 var ca = document.cookie.split(';'); 240 for(var i=0;i < ca.length;i++) { 241 var c = ca[i]; 242 while (c.charAt(0)==' ') c = c.substring(1,c.length); 243 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 244 } 245 return null; 246 } 247 248 function setCookie(cname, cvalue, exdays) { 249 if (MEDIAAJANLAT) 250 return; 251 var d = new Date(); 252 d.setTime(d.getTime() + (exdays*24*60*60*1000)); 253 var expires = "expires="+ d.toUTCString(); 254 document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/"; 255 } 256 257 function midnight_cookie(name, value) 258 { 259 if (MEDIAAJANLAT) 260 return; 261 var now = new Date(); 262 var expire = new Date(); 263 expire.setFullYear(now.getFullYear()); 264 expire.setMonth(now.getMonth()); 265 expire.setDate(now.getDate()+1); 266 expire.setHours(0); 267 expire.setMinutes(0); 268 document.cookie = name+"="+value+"; expires=" + expire.toUTCString() +";path=/"; 269 } 270 271 /* Megjelenes statisztikahoz, elsosorban az inspiraciotaron */ 272 function banner_megjelent() { 273 if (MEDIAAJANLAT) 274 return; 275 276 if ( ! document.getElementById('gby-banner-id')) 277 return; 278 $.post("/kepgaleria-otletek/save.php?para=banner_megjelent", {id:document.getElementById('gby-banner-id').value}); 279 } 280 281 282 283})(jQuery);
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.