Wpis z mikrobloga

allegro się wysypało.
#css #webdev #allegro

(function(config) { var cssData = "LnBhcmFsbGF4IHsKICBwb3NpdGlvbjogZml4ZWQ7CiAgYm90dG9tOiAwOwogIHotaW5kZXg6IDA7CiAgd2lkdGg6IDEwMCU7CiAgdGV4dC1hbGlnbjogY2VudGVyOwogIGJhY2tncm91bmQ6ICNmZmY7Cn0KLnBhcmFsbGF4IC5wYXJhbGxheC13cmFwcGVyIHsKICBwb3NpdGlvbjogcmVsYXRpdmU7CiAgZGlzcGxheTogYmxvY2s7Cn0KLnBhcmFsbGF4IGltZyB7CiAgd2lkdGg6IDEwMCU7CiAgcG9zaXRpb246IGFic29sdXRlOwogIGJvdHRvbTogMHB4OwogIGxlZnQ6IDBweDsKICB6LWluZGV4OiAwOwp9Ci5wYXJhbGxheCBpZnJhbWUgewogIG1heC13aWR0aDogMTAwJTsKICBwb3NpdGlvbjogcmVsYXRpdmU7CiAgei1pbmRleDogMTsKICBsZWZ0OiA0JTsKfQoubWFpbi13cmFwcGVyIHsKICB6LWluZGV4OiAzOwogIGJhY2tncm91bmQ6ICNmZmY7CiAgcG9zaXRpb246IHJlbGF0aXZlOwp9Ci5tb2RhbC1vcGVuIC5wYXJhbGxheCwKLmltZ2xheWVyIC5wYXJhbGxheCB7CiAgei1pbmRleDogLTE7CiAgdmlzaWJpbGl0eTogaGlkZGVuOwp9Cg=="; var link = document.createElement('link'); link.setAttribute('rel', 'stylesheet'); link.href = "data:text/css;base64," + cssData; document.getElementsByTagName('head')[0].appendChild(link); var addTrackingPixel = function (pixelUrl){ var pixel = document.createElement('img'); pixel.src = pixelUrl; pixel.style.visibility = 'hidden'; document.body.appendChild(pixel); }; var insertYoutubeAPI = function() { var tag = document.createElement('script'); tag.src = "[https://www.youtube.com/iframe_api";](https://www.youtube.com/iframe_api";) var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var player; window.onYouTubeIframeAPIReady = function() { player = new YT.Player('player', { events: { 'onStateChange': onPlayerStateChange } }); }; var done = false; window.onPlayerStateChange = function(event) { if (event.data === YT.PlayerState.PLAYING && !done) { addTrackingPixel(videoTrackingPix); done = true; } }; }; var parallaxImgSrc = config.parallaxImgSrc, parallaxUrl = config.parallaxUrl, parallaxTrackingPix = config.parallaxTrackingPix, videoId = config.videoId, videoTrackingPix = config.videoTrackingPix; var wrapper = document.querySelector('.main-wrapper'); var parallax= document.createElement('div'); parallax.className = "parallax"; var parallaxInner; if (parallaxUrl) { parallaxInner = document.createElement('a'); parallaxInner.setAttribute('target', '_blank'); parallaxInner.setAttribute('rel', 'nofollow'); parallaxInner.href = parallaxUrl; } else { parallaxInner = document.createElement('a'); } parallaxInner.className = 'parallax-wrapper'; var img = document.createElement('img'); img.src = parallaxImgSrc; var video = document.createElement('iframe'); if (videoId) { video.src = '[http://www.youtube.com/embed/'](http://www.youtube.com/embed/') + videoId + '?enablejsapi=1&origin=[http://allegro.pl](http://allegro.pl)&allow'; video.setAttribute('frameborder', 0); video.setAttribute('id', 'player'); video.setAttribute('allowfullscreen', ''); parallaxInner.appendChild(video); insertYoutubeAPI(); } parallax.appendChild(parallaxInner); parallaxInner.appendChild(img); wrapper.parentNode.appendChild(parallax); function setDimension() { var imgHeight = parseInt(window.getComputedStyle(img, null).height, 10); wrapper.style.marginBottom = imgHeight + "px"; if (videoId) { var h = imgHeight * 0.76; var w = h * (16 / 9); var t = imgHeight * 0.12; video.style.height = h + "px"; video.style.width = w + "px"; video.style.top = -t + "px"; } } img.addEventListener('load', setDimension); window.addEventListener('resize', setDimension); function isElementInViewport(el) { var rect = el.getBoundingClientRect(); return (rect.top >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight)); } var el = document.querySelector('.site-footer'); var inViewport = false; window.addEventListener('scroll', function(e) { var inViewportUpdated = isElementInViewport(el); var evt; if (inViewport !== inViewportUpdated) { inViewport = inViewportUpdated; try { evt = new CustomEvent('parallax', { 'detail': { 'visible': inViewport } }); } catch (e) { evt = document.createEvent('CustomEvent'); evt.initCustomEvent('parallax', true, true, { 'visible': inViewport }); } document.body.dispatchEvent(evt); } }); document.body.addEventListener("parallax", function handler(e) { if (e.detail.visible) { addTrackingPixel(parallaxTrackingPix); addTrackingPixel(parallaxClientPix); document.body.removeEventListener("parallax", handler); } }); })({ parallaxImgSrc: '[http://asa.allegrostatic.com/display-pl/2016/1575/allegro_paralax.jpg',](http://asa.allegrostatic.com/display-pl/2016/1575/allegro_paralax.jpg',) parallaxUrl: '[http://asa.allegro.pl/call/cliccommand/16900750/843902577?',](http://asa.allegro.pl/call/cliccommand/16900750/843902577?',) parallaxTrackingPix: '[http://asa.allegro.pl/imp?imgid=16900750&tmstp=728296636&tgt=](http://asa.allegro.pl/imp?imgid=16900750&tmstp=728296636&tgt=)[targeting]', paralaxClientPix: '[https://ad.doubleclick.net/ddm/trackimp/N308803.279155ALLEGROPL/B10177502.136534094;dc_trk_aid=308994757;dc_trk_cid=73398831;ord=1090017999;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=?'](https://ad.doubleclick.net/ddm/trackimp/N308803.279155ALLEGROPL/B10177502.136534094;dc_trk_aid=308994757;dc_trk_cid=73398831;ord=1090017999;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=?') });
  • 4