Doba před listopadem a po něm z finančního pohledu

23. 11. 2009
Doba čtení: 5 minut

Sdílet

Ilustrační obrázek
Autor: Depositphotos – gunnar3000
Ilustrační obrázek
Ještě stále potkáváme ty, kteří se zasněným pohledem do oblak, vzpomínají na dobu před sametovou revolucí v roce 1989, kdy rohlík stál 0,30 Kčs a chleba byl za 4,40 Kčs.

Nostalgie je však střídána nepříjemnou vzpomínkou na dlouhé fronty, kdy koupit čerstvý chleba bylo otázkou buď velmi dobrého přátelství s pekařem, nebo trpělivosti vystát si brzy ráno dlouhou řadu na chleba, který byl stejně již po 12 hodinách nepoživatelný.

Zpochybnit dobu před rokem 1989 jako časy levných nákupů není zase až tak obtížné. Cena 0,30 Kčs za rohlík, se možná zdá lákavá, mnohem hůře však zní tehdejší průměrný plat, který v roce 1989 dosahoval výše 3170 korun československých. To průměrná mzda z roku 2008, která činila 23 542 korun českých, zní už mnohem lépe a dokazuje, že od roku 1989 vzrostla průměrná mzda několikanásobně.

Srovnání mezd tehdy a nyní

Stejně jako dnes, i tehdy se mzdy lišily především podle odvětví. Nepříznivé v porovnání s dneškem byly mzdy především k ženám, které měly v roce 1989 o polovinu nižší příjmy než muži. Nejzajímavější výplatní pásky domů nosili především horníci, dělníci zaměstnaní v hutnickém průmyslu, ve stavebnictví nebo dokonce zemědělci. Všichni tito dosahovali průměrné měsíční mzdy 4000 Kčs, ale například zmiňovaný horník, přinesl domů často až 8000 Kčs.

Naproti tomu dnes je nejlépe placeným oborem peněžnictví a pojišťovnictví, kde průměrná mzda dosahuje 44 475 Kč. Následuje IT s průměrnou mzdou 41 631 Kč. Zatímco za komunismu měli často řadoví pracovníci vyšší plat než jejich nadřízení, dnes jsou v průměru nejlépe placené právě cizojazyčně nazvané pozice, nejlépe manažeři. Naopak zemědělství, které před rokem 1989 patřilo k nejlépe placenému odvětví, se dnes řadí k nejhůře výdělečným činnostem. Průměrná mzda dnešního zemědělce je 17 016 Kč. O něco lépe si dnes vedou administrativní a podpůrné činnosti, které dosahují průměrné mzdy 16 376 Kč, nejhůře jsou na tom snad zaměstnanci v oboru ubytování a stravování, kteří si průměrně sáhnou pouze na 13 041 Kč.

V roce 1989 mezi nejméně výdělečné činnosti patřily obory ve školství, výzkumu a zdravotnictví. Je pravdou, že i dnes odvětví jako je školství nebo zdravotnictví, nepatří zrovna k nejlépe placeným oborům. Lékař si v roce 1989 vydělal 3000 korun, učitel 2800 korun. Kupodivu velmi zle na tom byli herci, jejichž plat se pohyboval kolem 2000 korun. Dnes si lidé ve zdravotnictví vydělají v průměru 22 394 Kč a učitelé 22 638 Kč. Nutno podotknout, že nízká průměrná mzda zdravotníků je ovlivněna především nízkým příjmem sester a nižšího zdravotního personálu.

Zálohy vymřely

Rozdíl není pouze ve výši mzdy, ale také v její podobě a způsobu vyplacení. Zatímco dnes nám zaměstnavatel pohodlně zasílá mzdu na účet, před revolucí si zaměstnanec poslušně vystál frontu u okýnka, kde dostal mzdu v hotovosti. A zatímco nám v peněžence šustí většinou bankovky a minimum minci, v roce 1989 jsme si mohli přímo pořídit pytlík na haléře. Trvalo však nějakou dobu, než haléřům definitivně odzvonilo. V roce 1993 jsme se rozloučili s pětihaléřem, rok 2003 se stal osudným desetihaléři a dvacetihaléři. A teprve nedávno jsme přestali používat poslední hodnotu haléře, tzv. padesátníky. Z psychologického hlediska se může také zdát být lákavá vidina, kdy zaměstnancům za komunistů byl vyplacen plat dvakrát v měsíci. Bohužel jeho výška však nebyla dvojnásobná, pouze se rozdělila na dvě části. Pokud byla průměrná mzda 3170 Kčs, pak zaměstnanec na konci měsíce dostal zálohu ve výši 500 až 700 Kčs a v první polovině měsíce si přišel vyzvednout druhou zbývající část.

Srovnání cen

Český statistický úřad na svých stránkách zveřejnil průměrné ceny zboží v roce 1989. Každý si tak snadno spočítá, že si nyní může koupit více spotřebního zboží než před revolucí. Například tolik oblíbený televizor stál v roce 1985 15 200 korun, loni šlo pořídit televizor s úhlopříčkou 70 cm cca. za 9087 korun. Nedostatkovým zbožím byly také pračky. Zatímco v roce 1985 taková pračka stála jeden tehdejší průměrný plat, loni si za průměrnou mzdu mohli lidé koupit pračky hned dvě.

Našli bychom jenom málo surovin nebo zboží, které by dnes v konečném důsledku bylo k mání za vyšší cenu než v roce 1989. Výjimka ale potvrzuje pravidlo – a v tomto případě je tou výjimkou mléko. Zatímco v roce 1989 jsme si mohli koupit za jeden průměrný plat 1585 litrů mléka, v loňském roce jsme za průměrný plat pořídili pouze 1354 litrů mléka.

K poklesu cen došlo také v oblasti cestování. Cena zájezdu do Bulharska se v roce 1989 pohybovala mezi 3000 až 5000 korunami. Dnes si pohodlně zaletíte do Bulharska už za 15 000 korun. Cestování, před rokem 1989 a po něm, je však téma na samostatnou kapitolu. Na rozdíl od doby komunismu, dnes již turisté cestují do mnoha zajímavějších a vzdálenějších lokalit než je Bulharsko. Hlavní rozdíl je v naprosté svobodě pohybu. Pokud máte dostatek peněz na účtu a shovívavého nadřízeného, který vám bez problému dá dovolenou, kdy si přejete, můžete v podstatě okamžitě vycestovat. To před rokem 1989 jste jakoukoliv cestu mimo území Bulharska, Polska, Maďarska, Rumunska a Německé demokratické republiky, museli plánovat téměř rok dopředu a o svém odjezdu jste stejně neměli dlouho jasno. Vycestovat jsme mohli jen s povolením od Státní banky československé a to na základě vystavení devizového příslibu. O něj jsme si mohli požádat do konce února a teprve na jaře banka rozhodla, jestli vám bude udělen. K tomu, aby vám byl devizový příslib udělen, jste také často potřebovali doporučení ze škol, od zaměstnavatele nebo z uličního výboru. A ani tak jste si nemohli být jisti, zdali na jaře sbalíte kufry či ne.

Paradoxní byly i ceny v autobazaru, které byly mnohdy vyšší než za nová vozidla. Nejoblíbenějším autem byla Škoda 100 nebo 105. Vůz stál zhruba 64 600 korun, což mohlo být až 20 průměrných platů. Srovnatelným s tímto vozem je dnešní Škoda Fabia, na kterou musíme šetřit v průměru o polovinu méně. Nové auto si nemohl dovolit téměř nikdo, prakticky každý kupoval ojetinu. Ojetinou je myšleno auto starší pět let, auto vyrobené před rokem bychom v bazaru jen těžko hledali. Co bychom tam naopak našli snadno a téměř každý den, byly dlouhé fronty. Zvláštní, již zmíněnou anomálií, byly ceny za ojeté automobily, které často přesahovaly nové vozy. Bylo to dáno tím, že stejný typ vozu se vyráběl i deset let a postupně zdražoval.

školení - jarní novinky 25

Co nám (ne)chybí?

Dlouhé fronty na nekvalitní avšak nedostatkové zboží, prázdné regály v obchodech, skvělé vztahy s prodejci, pokud jste nechtěli na pračku čekat i několik let a samozřejmě nezapomenutelné barevné igelitky ze západu, které dnes dostáváme většinu zdarma k nákupu a po použití je vyhazujeme. V roce 1989 se k nákupu využívaly plátěné tašky a barevné igelitky s potisky byly dováženy ze západu. Snem každé hospodyňky bylo mít tuto tzv. igelitku sladěnou s oblečením jako módní doplněk.

Ještě jedna věc se změnila. Dnes už víme, že mandarinky nerostou pouze na Vánoce

Autor článku

Specializuji se na psychologii, pracovně právní problematiku a zavádění moderních manažerských metod. Studuji žurnalistiku, politologii a chystám se na práva.

`; if (youtubeIframe !== null && iinfoVastUrls.length > 0) { const re = /embed\/(.*)\?/; const youtubeId = youtubeIframe.src.match(re)[1]; const youtubeImg = 'https://img.youtube.com/vi/' + youtubeId + '/hqdefault.jpg'; let thumbWrap = `
play
`; youtubeIframe.after(document.createRange().createContextualFragment(thumbWrap)); youtubeIframe.style.display = 'none'; const youtubeThumb = document.getElementById('ytPrerollThumb') let prerollAdInitialized = false; youtubeThumb.addEventListener('click', () => { youtubeThumb.remove(); playPrerollAd(); }); } let adsManager; let adsLoader; let adDisplayContainer; let iinfoPrerollPosition; let iinfoVastUrlIndex = 0; let adVolume = 0; let prerollWidth = 480; let prerollHeight = 320; let prerollDocument; let videoContent; let prerollLastError = 303; let prerollContainer; let prerollPaused = false; function playPrerollAd() { youtubeIframe.after(document.createRange().createContextualFragment(videoEl)); iinfoPrerollPosition = document.getElementById('iinfoPrerollPosition'); document.getElementById('preroll-iframe').srcdoc = '
'; document.getElementById('preroll-iframe').onload = function () { setupIframe(); } prerollContainer = document.getElementsByClassName('preroll-container-iframe')[0]; } function setupIframe() { prerollDocument = document.getElementById('preroll-iframe').contentWindow.document; let el = prerollDocument.createElement('style'); prerollDocument.head.appendChild(el); el.innerText = "#adContainer>div:nth-of-type(1),#adContainer>div:nth-of-type(1) > iframe { width: 99% !important;height: 99% !important;max-width: 100%;}#videoContent,body{ width:100vw;height:100vh}body{ font-family:'Helvetica Neue',Arial,sans-serif}#videoContent{ overflow:hidden;background:#000}#adMuteBtn{ width:35px;height:35px;border:0;background:0 0;display:none;position:absolute;fill:rgba(230,230,230,1);bottom:20px;right:25px}"; videoContent = prerollDocument.getElementById('contentElement'); videoContent.style.display = 'none'; videoContent.volume = 1; videoContent.muted = false; const playPromise = videoContent.play(); if (playPromise !== undefined) { playPromise.then(function () { console.log('PREROLL sound allowed'); // setUpIMA(true); videoContent.volume = 1; videoContent.muted = false; setUpIMA(); }).catch(function () { console.log('PREROLL sound forbidden'); videoContent.volume = 0; videoContent.muted = true; setUpIMA(); }); } } function setupDimensions() { prerollWidth = Math.min(iinfoPrerollPosition.offsetWidth, 480); prerollHeight = Math.min(iinfoPrerollPosition.offsetHeight, 320); } function setUpIMA() { google.ima.settings.setDisableCustomPlaybackForIOS10Plus(true); google.ima.settings.setLocale('cs'); google.ima.settings.setNumRedirects(10); // Create the ad display container. createAdDisplayContainer(); // Create ads loader. adsLoader = new google.ima.AdsLoader(adDisplayContainer); // Listen and respond to ads loaded and error events. adsLoader.addEventListener( google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, onAdsManagerLoaded, false); adsLoader.addEventListener( google.ima.AdErrorEvent.Type.AD_ERROR, onAdError, false); // An event listener to tell the SDK that our content video // is completed so the SDK can play any post-roll ads. const contentEndedListener = function () { adsLoader.contentComplete(); }; videoContent.onended = contentEndedListener; // Request video ads. const adsRequest = new google.ima.AdsRequest(); adsRequest.adTagUrl = iinfoVastUrls[iinfoVastUrlIndex]; console.log('Preroll advert: ' + iinfoVastUrls[iinfoVastUrlIndex]); videoContent.muted = false; videoContent.volume = 1; // Specify the linear and nonlinear slot sizes. This helps the SDK to // select the correct creative if multiple are returned. // adsRequest.linearAdSlotWidth = prerollWidth; // adsRequest.linearAdSlotHeight = prerollHeight; adsRequest.nonLinearAdSlotWidth = 0; adsRequest.nonLinearAdSlotHeight = 0; adsLoader.requestAds(adsRequest); } function createAdDisplayContainer() { // We assume the adContainer is the DOM id of the element that will house // the ads. prerollDocument.getElementById('videoContent').style.display = 'none'; adDisplayContainer = new google.ima.AdDisplayContainer( prerollDocument.getElementById('adContainer'), videoContent); } function unmutePrerollAdvert() { adVolume = !adVolume; if (adVolume) { adsManager.setVolume(0.3); prerollDocument.getElementById('adMuteBtn').innerHTML = ''; } else { adsManager.setVolume(0); prerollDocument.getElementById('adMuteBtn').innerHTML = ''; } } function onAdsManagerLoaded(adsManagerLoadedEvent) { // Get the ads manager. const adsRenderingSettings = new google.ima.AdsRenderingSettings(); adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete = true; adsRenderingSettings.loadVideoTimeout = 12000; // videoContent should be set to the content video element. adsManager = adsManagerLoadedEvent.getAdsManager(videoContent, adsRenderingSettings); // Add listeners to the required events. adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, onAdError); adsManager.addEventListener( google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, onContentPauseRequested); adsManager.addEventListener( google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, onContentResumeRequested); adsManager.addEventListener( google.ima.AdEvent.Type.ALL_ADS_COMPLETED, onAdEvent); // Listen to any additional events, if necessary. adsManager.addEventListener(google.ima.AdEvent.Type.LOADED, onAdEvent); adsManager.addEventListener(google.ima.AdEvent.Type.STARTED, onAdEvent); adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE, onAdEvent); playAds(); } function playAds() { // Initialize the container. Must be done through a user action on mobile // devices. videoContent.load(); adDisplayContainer.initialize(); // setupDimensions(); try { // Initialize the ads manager. Ad rules playlist will start at this time. adsManager.init(1920, 1080, google.ima.ViewMode.NORMAL); // Call play to start showing the ad. Single video and overlay ads will // start at this time; the call will be ignored for ad rules. adsManager.start(); // window.addEventListener('resize', function (event) { // if (adsManager) { // setupDimensions(); // adsManager.resize(prerollWidth, prerollHeight, google.ima.ViewMode.NORMAL); // } // }); } catch (adError) { // An error may be thrown if there was a problem with the VAST response. // videoContent.play(); } } function onAdEvent(adEvent) { const ad = adEvent.getAd(); console.log('Preroll event: ' + adEvent.type); switch (adEvent.type) { case google.ima.AdEvent.Type.LOADED: if (!ad.isLinear()) { videoContent.play(); } prerollDocument.getElementById('adContainer').style.width = '100%'; prerollDocument.getElementById('adContainer').style.maxWidth = '640px'; prerollDocument.getElementById('adContainer').style.height = '360px'; break; case google.ima.AdEvent.Type.STARTED: window.addEventListener('scroll', onActiveView); if (ad.isLinear()) { intervalTimer = setInterval( function () { // Example: const remainingTime = adsManager.getRemainingTime(); // adsManager.pause(); }, 300); // every 300ms } prerollDocument.getElementById('adMuteBtn').style.display = 'block'; break; case google.ima.AdEvent.Type.ALL_ADS_COMPLETED: if (ad.isLinear()) { clearInterval(intervalTimer); } if (prerollLastError === 303) { playYtVideo(); } break; case google.ima.AdEvent.Type.COMPLETE: if (ad.isLinear()) { clearInterval(intervalTimer); } playYtVideo(); break; } } function onAdError(adErrorEvent) { console.log(adErrorEvent.getError()); prerollLastError = adErrorEvent.getError().getErrorCode(); if (!loadNext()) { playYtVideo(); } } function loadNext() { iinfoVastUrlIndex++; if (iinfoVastUrlIndex 0.0) { if (prerollPaused) { adsManager.resume(); prerollPaused = false; } return true; } else { if (!prerollPaused) { adsManager.pause(); prerollPaused = true; } } } return false; } function playYtVideo() { iinfoPrerollPosition.remove(); youtubeIframe.style.display = 'block'; youtubeIframe.src += '&autoplay=1&mute=1'; } }
Upozorníme vás na články, které by vám neměly uniknout (maximálně 2x týdně).

'; document.getElementById('outstream-iframe').onload = function () { setupIframe(); } replayScreen = document.getElementById('iinfoOutstreamReplay'); iinfoOutstreamPosition = document.getElementById('iinfoOutstreamPosition'); outstreamContainer = document.getElementsByClassName('outstream-container')[0]; setupReplayScreen(); } function setupIframe() { outstreamDocument = document.getElementById('outstream-iframe').contentWindow.document; let el = outstreamDocument.createElement('style'); outstreamDocument.head.appendChild(el); el.innerText = "#adContainer>div:nth-of-type(1),#adContainer>div:nth-of-type(1) > iframe { width: 99% !important;height: 99% !important;max-width: 100%;}#videoContent,body{ width:100vw;height:100vh}body{ font-family:'Helvetica Neue',Arial,sans-serif}#videoContent{ overflow:hidden;background:#000}#adMuteBtn{ width:35px;height:35px;border:0;background:0 0;display:none;position:absolute;fill:rgba(230,230,230,1);bottom:-5px;right:25px}"; videoContent = outstreamDocument.getElementById('contentElement'); videoContent.style.display = 'none'; videoContent.volume = 1; videoContent.muted = false; if ( location.href.indexOf('rejstriky.finance.cz') !== -1 || location.href.indexOf('finance-rejstrik') !== -1 || location.href.indexOf('firmy.euro.cz') !== -1 || location.href.indexOf('euro-rejstrik') !== -1 || location.href.indexOf('/rejstrik/') !== -1 || location.href.indexOf('/rejstrik-firem/') !== -1) { outstreamDirectPlayed = true; soundAllowed = true; iinfoVastUrlIndex = 0; } if (!outstreamDirectPlayed) { console.log('OUTSTREAM direct'); setUpIMA(true); } else { if (soundAllowed) { const playPromise = videoContent.play(); if (playPromise !== undefined) { playPromise.then(function () { console.log('OUTSTREAM sound allowed'); setUpIMA(false); }).catch(function () { console.log('OUTSTREAM sound forbidden'); renderBanner(); }); } } else { renderBanner(); } } } function getWrapper() { let articleWrapper = document.querySelector('.rs-outstream-placeholder'); // Outstream Placeholder from RedSys manipulation if (articleWrapper && articleWrapper.style.display !== 'block') { articleWrapper.innerHTML = ""; articleWrapper.style.display = 'block'; } // Don't render OutStream on homepages if (articleWrapper === null) { if (document.querySelector('body.p-index')) { return null; } } if (articleWrapper === null) { articleWrapper = document.getElementById('iinfo-outstream'); } if (articleWrapper === null) { articleWrapper = document.querySelector('.layout-main__content .detail__article p:nth-of-type(6)'); } if (articleWrapper === null) { // Euro, Autobible, Zdravi articleWrapper = document.querySelector('.o-article .o-article__text p:nth-of-type(6)'); } if (articleWrapper === null) { articleWrapper = document.getElementById('sidebar'); } if (!articleWrapper) { console.error("Outstream wrapper of article was not found."); } return articleWrapper; } function setupDimensions() { outstreamWidth = Math.min(iinfoOutstreamPosition.offsetWidth, 480); outstreamHeight = Math.min(iinfoOutstreamPosition.offsetHeight, 320); } /** * Sets up IMA ad display container, ads loader, and makes an ad request. */ function setUpIMA(direct) { google.ima.settings.setDisableCustomPlaybackForIOS10Plus(true); google.ima.settings.setLocale('cs'); google.ima.settings.setNumRedirects(10); // Create the ad display container. createAdDisplayContainer(); // Create ads loader. adsLoader = new google.ima.AdsLoader(adDisplayContainer); // Listen and respond to ads loaded and error events. adsLoader.addEventListener( google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, onAdsManagerLoaded, false); adsLoader.addEventListener( google.ima.AdErrorEvent.Type.AD_ERROR, onAdError, false); // An event listener to tell the SDK that our content video // is completed so the SDK can play any post-roll ads. const contentEndedListener = function () { adsLoader.contentComplete(); }; videoContent.onended = contentEndedListener; // Request video ads. const adsRequest = new google.ima.AdsRequest(); if (direct) { adsRequest.adTagUrl = directVast; console.log('Outstream DIRECT CAMPAING advert: ' + directVast); videoContent.muted = true; videoContent.volume = 0; outstreamDirectPlayed = true; } else { adsRequest.adTagUrl = iinfoVastUrls[iinfoVastUrlIndex]; console.log('Outstream advert: ' + iinfoVastUrls[iinfoVastUrlIndex]); videoContent.muted = false; videoContent.volume = 1; } // Specify the linear and nonlinear slot sizes. This helps the SDK to // select the correct creative if multiple are returned. // adsRequest.linearAdSlotWidth = outstreamWidth; // adsRequest.linearAdSlotHeight = outstreamHeight; adsRequest.nonLinearAdSlotWidth = 0; adsRequest.nonLinearAdSlotHeight = 0; adsLoader.requestAds(adsRequest); } function setupReplayScreen() { replayScreen.addEventListener('click', function () { iinfoOutstreamPosition.remove(); iinfoVastUrlIndex = 0; outstreamInit(); }); } /** * Sets the 'adContainer' div as the IMA ad display container. */ function createAdDisplayContainer() { // We assume the adContainer is the DOM id of the element that will house // the ads. outstreamDocument.getElementById('videoContent').style.display = 'none'; adDisplayContainer = new google.ima.AdDisplayContainer( outstreamDocument.getElementById('adContainer'), videoContent); } function unmuteAdvert() { adVolume = !adVolume; if (adVolume) { adsManager.setVolume(0.3); outstreamDocument.getElementById('adMuteBtn').innerHTML = ''; } else { adsManager.setVolume(0); outstreamDocument.getElementById('adMuteBtn').innerHTML = ''; } } /** * Loads the video content and initializes IMA ad playback. */ function playAds() { // Initialize the container. Must be done through a user action on mobile // devices. videoContent.load(); adDisplayContainer.initialize(); // setupDimensions(); try { // Initialize the ads manager. Ad rules playlist will start at this time. adsManager.init(1920, 1080, google.ima.ViewMode.NORMAL); // Call play to start showing the ad. Single video and overlay ads will // start at this time; the call will be ignored for ad rules. adsManager.start(); // window.addEventListener('resize', function (event) { // if (adsManager) { // setupDimensions(); // adsManager.resize(outstreamWidth, outstreamHeight, google.ima.ViewMode.NORMAL); // } // }); } catch (adError) { // An error may be thrown if there was a problem with the VAST response. // videoContent.play(); } } /** * Handles the ad manager loading and sets ad event listeners. * @param { !google.ima.AdsManagerLoadedEvent } adsManagerLoadedEvent */ function onAdsManagerLoaded(adsManagerLoadedEvent) { // Get the ads manager. const adsRenderingSettings = new google.ima.AdsRenderingSettings(); adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete = true; adsRenderingSettings.loadVideoTimeout = 12000; // videoContent should be set to the content video element. adsManager = adsManagerLoadedEvent.getAdsManager(videoContent, adsRenderingSettings); // Add listeners to the required events. adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, onAdError); adsManager.addEventListener( google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED, onContentPauseRequested); adsManager.addEventListener( google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED, onContentResumeRequested); adsManager.addEventListener( google.ima.AdEvent.Type.ALL_ADS_COMPLETED, onAdEvent); // Listen to any additional events, if necessary. adsManager.addEventListener(google.ima.AdEvent.Type.LOADED, onAdEvent); adsManager.addEventListener(google.ima.AdEvent.Type.STARTED, onAdEvent); adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE, onAdEvent); playAds(); } /** * Handles actions taken in response to ad events. * @param { !google.ima.AdEvent } adEvent */ function onAdEvent(adEvent) { // Retrieve the ad from the event. Some events (for example, // ALL_ADS_COMPLETED) don't have ad object associated. const ad = adEvent.getAd(); console.log('Outstream event: ' + adEvent.type); switch (adEvent.type) { case google.ima.AdEvent.Type.LOADED: // This is the first event sent for an ad - it is possible to // determine whether the ad is a video ad or an overlay. if (!ad.isLinear()) { // Position AdDisplayContainer correctly for overlay. // Use ad.width and ad.height. videoContent.play(); } outstreamDocument.getElementById('adContainer').style.width = '100%'; outstreamDocument.getElementById('adContainer').style.maxWidth = '640px'; outstreamDocument.getElementById('adContainer').style.height = '360px'; break; case google.ima.AdEvent.Type.STARTED: window.addEventListener('scroll', onActiveView); // This event indicates the ad has started - the video player // can adjust the UI, for example display a pause button and // remaining time. if (ad.isLinear()) { // For a linear ad, a timer can be started to poll for // the remaining time. intervalTimer = setInterval( function () { // Example: const remainingTime = adsManager.getRemainingTime(); // adsManager.pause(); }, 300); // every 300ms } outstreamDocument.getElementById('adMuteBtn').style.display = 'block'; break; case google.ima.AdEvent.Type.ALL_ADS_COMPLETED: if (ad.isLinear()) { clearInterval(intervalTimer); } if (outstreamLastError === 303) { if (isBanner) { renderBanner(); } else { replayScreen.style.display = 'flex'; } } break; case google.ima.AdEvent.Type.COMPLETE: // This event indicates the ad has finished - the video player // can perform appropriate UI actions, such as removing the timer for // remaining time detection. if (ad.isLinear()) { clearInterval(intervalTimer); } if (isBanner) { renderBanner(); } else { replayScreen.style.display = 'flex'; } break; } } /** * Handles ad errors. * @param { !google.ima.AdErrorEvent } adErrorEvent */ function onAdError(adErrorEvent) { // Handle the error logging. console.log(adErrorEvent.getError()); outstreamLastError = adErrorEvent.getError().getErrorCode(); if (!loadNext()) { renderBanner(); } } function renderBanner() { if (isBanner) { console.log('Outstream: Render Banner'); iinfoOutstreamPosition.innerHTML = ""; iinfoOutstreamPosition.style.height = "330px"; iinfoOutstreamPosition.appendChild(bannerDiv); } else { console.log('Outstream: Banner is not set'); } } function loadNext() { iinfoVastUrlIndex++; if (iinfoVastUrlIndex 0.0) { if (outstreamPaused) { adsManager.resume(); outstreamPaused = false; } return true; } else { if (!outstreamPaused) { adsManager.pause(); outstreamPaused = true; } } } return false; } let outstreamInitInterval; if (typeof cpexPackage !== "undefined") { outstreamInitInterval = setInterval(tryToInitializeOutstream, 100); } else { const wrapper = getWrapper(); if (wrapper) { let outstreamInitialized = false; window.addEventListener('scroll', () => { if (!outstreamInitialized) { const containerOffset = wrapper.getBoundingClientRect(); const windowHeight = window.innerHeight; if (containerOffset.top 0.0) { outstreamInit(); outstreamInitialized = true; } } }); } } function tryToInitializeOutstream() { const wrapper = getWrapper(); if (wrapper) { const containerOffset = wrapper.getBoundingClientRect(); const windowHeight = window.innerHeight; if (containerOffset.top 0.0) { if (cpexPackage.adserver.displayed) { clearInterval(outstreamInitInterval); outstreamInit(); } } } else { clearInterval(outstreamInitInterval); } } }