diff --git a/svelte/src/file_viewer/AdHead.svelte b/svelte/src/file_viewer/AdHead.svelte new file mode 100644 index 0000000..d9e0da5 --- /dev/null +++ b/svelte/src/file_viewer/AdHead.svelte @@ -0,0 +1,44 @@ + + + + + {#if adsplus} + + {/if} + {#if adaround} + + {/if} + diff --git a/svelte/src/file_viewer/AdLeaderboard.svelte b/svelte/src/file_viewer/AdLeaderboard.svelte index 91191bd..416be76 100644 --- a/svelte/src/file_viewer/AdLeaderboard.svelte +++ b/svelte/src/file_viewer/AdLeaderboard.svelte @@ -1,41 +1,51 @@ - - {#if ad_type === "ads.plus"} - - {:else if ad_type === "adaround"} - - {/if} - - {#if ad_type === "publisherrest_1"} @@ -124,7 +128,7 @@ const ads_plus = () => { shopping_cart - {:else if ad_type === "a-ads"} + {:else if ad_type === "aads1"} import { createEventDispatcher, onMount, tick } from "svelte" +import { adsplus_load, adsplus_loaded, adaround_load } from "./AdHead.svelte" let dispatch = createEventDispatcher() let container let ad_type = "" let visible = false +let set_ad_type = (t) => { + ad_type = t + if (ad_type === "ads.plus") { + adsplus_load.set(true) + } else if (ad_type === "adaround") { + adaround_load.set(true) + } +} + + onMount(async () => { if (window.location.pathname === "/u/demo") { let url_ads = new URL(window.location.href).searchParams.get("ads") if (url_ads !== "") { - ad_type = url_ads + set_ad_type(url_ads) open() return } @@ -35,16 +46,16 @@ onMount(async () => { switch (Math.floor(Math.random() * 4)) { case 0: - ad_type = "a-ads" + set_ad_type("aads2") break case 1: - ad_type = "pixfuture" + set_ad_type("pixfuture") break case 2: - ad_type = "ads.plus" + set_ad_type("ads.plus") break case 3: - ad_type = "adaround" + set_ad_type("adaround") break } @@ -67,33 +78,27 @@ const close = () => { setTimeout(() => { visible = false }, 1000) } -const ads_plus = () => { - window.googletag = window.googletag || {cmd: []}; - googletag.cmd.push(function() { - googletag.defineSlot('/21673142571/299__pixeldrain.com__default__160x600_1', [160, 600], 'div-gpt-ad-pixeldraincom160x600_1').addService(googletag.pubads()); - googletag.pubads().collapseEmptyDivs(); - googletag.enableServices(); - }); - googletag.cmd.push(function() { googletag.display('div-gpt-ad-pixeldraincom160x600_1'); }); -} +adsplus_loaded.subscribe(v => { + if (v) { + window.googletag = window.googletag || {cmd: []}; + googletag.cmd.push(function() { + googletag.defineSlot('/21673142571/299__pixeldrain.com__default__160x600_1', [160, 600], 'div-gpt-ad-pixeldraincom160x600_1').addService(googletag.pubads()); + googletag.pubads().collapseEmptyDivs(); + googletag.enableServices(); + }); + googletag.cmd.push(function() { googletag.display('div-gpt-ad-pixeldraincom160x600_1'); }); + } +}) - - {#if ad_type === "ads.plus"} - - {:else if ad_type === "adaround"} - - {/if} - - {#if visible} close Close ad - {#if ad_type === "a-ads"} + {#if ad_type === "aads2"} { + + + menu