From 9facb2239811ed0c7ea22fe93fb8fde0bf0bdf37 Mon Sep 17 00:00:00 2001 From: elrumo Date: Mon, 24 May 2021 11:59:44 +0100 Subject: [PATCH] Fixed ad issue --- .../src/components/H3_Description.vue | 2 +- .../src/components/Hero.vue | 6 ++- .../src/components/Home.vue | 17 ++++---- .../src/components/NativeAd.vue | 42 +++++++++++++------ .../src/components/carbon.css | 12 +++++- .../src/views/BlogHome.vue | 2 +- .../src/views/BlogPost.vue | 1 + .../src/views/ResourceView.vue | 1 + .../src/views/UserProfile.vue | 4 +- 9 files changed, 59 insertions(+), 28 deletions(-) diff --git a/website/macos-big-sur-icons/src/components/H3_Description.vue b/website/macos-big-sur-icons/src/components/H3_Description.vue index d7e09543..abdeb9d6 100644 --- a/website/macos-big-sur-icons/src/components/H3_Description.vue +++ b/website/macos-big-sur-icons/src/components/H3_Description.vue @@ -18,7 +18,7 @@ Sponsored by

- + - +
@@ -218,9 +218,11 @@ export default { } #iconbar-js{ + height: 42px; + overflow: hidden; transition: 0.3s; - height: 40px; } + #iconbar-js:hover{ transform: translateY(-3px); opacity: 1; diff --git a/website/macos-big-sur-icons/src/components/Home.vue b/website/macos-big-sur-icons/src/components/Home.vue index 7e232b7a..f64f23f4 100644 --- a/website/macos-big-sur-icons/src/components/Home.vue +++ b/website/macos-big-sur-icons/src/components/Home.vue @@ -116,7 +116,7 @@
- +

The site is temporarily down for maintenance purposes.
@@ -142,10 +142,10 @@
- -
+ +
-
+
@@ -182,9 +182,8 @@
- - +
@@ -210,8 +209,10 @@ import dotenv from 'dotenv'; // Used to access env varaibles dotenv.config() // TODO: remove credentials -const VUE_APP_PARSE_APP_ID = process.env.VUE_APP_PARSE_APP_ID -const VUE_APP_PARSE_JAVASCRIPT_KEY = process.env.VUE_APP_PARSE_JAVASCRIPT_KEY +const VUE_APP_PARSE_APP_ID = "macOSicons" +const VUE_APP_PARSE_JAVASCRIPT_KEY = "macOSicons" +// const VUE_APP_PARSE_APP_ID = process.env.VUE_APP_PARSE_APP_ID +// const VUE_APP_PARSE_JAVASCRIPT_KEY = process.env.VUE_APP_PARSE_JAVASCRIPT_KEY Parse.initialize(VUE_APP_PARSE_APP_ID, VUE_APP_PARSE_JAVASCRIPT_KEY) Parse.serverURL = 'https://media.macosicons.com/parse' diff --git a/website/macos-big-sur-icons/src/components/NativeAd.vue b/website/macos-big-sur-icons/src/components/NativeAd.vue index 40dc4222..db6284c3 100644 --- a/website/macos-big-sur-icons/src/components/NativeAd.vue +++ b/website/macos-big-sur-icons/src/components/NativeAd.vue @@ -1,10 +1,9 @@ @@ -15,7 +14,8 @@ export default { props:{ sponsored:'', - fullWidth:'' + fullWidth:'', + adId: '', }, components:{}, @@ -28,15 +28,16 @@ export default { mounted: function(){ let parent = this + var adId = parent.adId function getAd(el){ try { if (typeof _bsa !== 'undefined' && !parent.isAd) { _bsa.init('custom', 'CESDC2QN', 'placement:macosiconscom', { - target: '#iconbar-js', + target: '#'+adId, template: ` - +
##company## - ##tagline##
@@ -48,12 +49,14 @@ export default { } } + getAd() + var attempts = 0 function adExist(){ - var adExists = document.getElementById("iconbar-js").children.length + var adExists = document.getElementById(adId).children.length console.log(); setTimeout(() => { - if (attempts >= 4) return; + if (attempts >= 15) return; if (adExists == 0) { try { attempts++ @@ -67,10 +70,10 @@ export default { } } else return - }, 800); + }, 1500); } - let el = document.getElementById("customAd") + let el = document.getElementById(adId+"customAd") window.BSANativeCallback = (a) => { const total = a.ads.length; @@ -80,8 +83,6 @@ export default { } } - // getAd(el) - if (!parent.isAd) { // // console.log(parent.isAd); // setTimeout(() =>{ @@ -92,6 +93,23 @@ export default { adExist() } + setTimeout(() =>{ + let nodeList = document.querySelector("#"+adId).children + + nodeList.forEach((el)=> { + let newNodeList = document.querySelector("#"+adId).children + + if(newNodeList.length > 1){ + console.log(newNodeList.length); + el.parentNode.removeChild(el); + } else{ + console.log(newNodeList.length); + return + } + + }); + }, 1200) + }, methods:{ diff --git a/website/macos-big-sur-icons/src/components/carbon.css b/website/macos-big-sur-icons/src/components/carbon.css index ab64a0b7..e9515974 100644 --- a/website/macos-big-sur-icons/src/components/carbon.css +++ b/website/macos-big-sur-icons/src/components/carbon.css @@ -294,6 +294,11 @@ overflow: hidden; } +.native-ad-wrapper{ + overflow: hidden; + height: 42px; +} + .icon-list-area .carbon-img img { width: auto; height: 100%; @@ -316,7 +321,7 @@ grid-template-rows: auto 19px; gap: 5px; margin: auto; - max-height: 180px; + max-height: 200px; } .icon-list-area #carbonads span { @@ -343,6 +348,11 @@ } +.carbon-card-ad > div{ + position: absolute; + top: 0px; +} + /* card-grid-nativeAd START */ /* //////////////////////////////////// */ diff --git a/website/macos-big-sur-icons/src/views/BlogHome.vue b/website/macos-big-sur-icons/src/views/BlogHome.vue index c82d0c34..d0ec33a7 100644 --- a/website/macos-big-sur-icons/src/views/BlogHome.vue +++ b/website/macos-big-sur-icons/src/views/BlogHome.vue @@ -6,7 +6,7 @@
- + diff --git a/website/macos-big-sur-icons/src/views/BlogPost.vue b/website/macos-big-sur-icons/src/views/BlogPost.vue index 32d5b03a..bc52aef2 100644 --- a/website/macos-big-sur-icons/src/views/BlogPost.vue +++ b/website/macos-big-sur-icons/src/views/BlogPost.vue @@ -26,6 +26,7 @@