Skip to content

Commit

Permalink
Improved dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
elrumo committed Oct 10, 2021
1 parent 12f1aa6 commit 2a3c04f
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<p class="coral-Body--XS">
Sponsored by
</p>
<NativeAd :adPosition="'H3 Description Desktop'" :adId="'iconbar-js-h3'" :key="$route.fullPath + 'ad'"/>
<NativeAd :adPosition="'H3 Description Desktop'" :adId="'iconbar-js-h3'"/>
</div>

</div>
Expand Down
10 changes: 8 additions & 2 deletions website/macos-big-sur-icons/src/components/Hero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
<div class="hero-text-area" v-if="iconsEmpty">


<div class="ad-hero mobile-hidden">
<NativeAd :adPosition="'Hero Top'" :adId="'iconbar-js-hero'" :key="$route.fullPath + 'ad'"/>
<div
class="ad-hero mobile-hidden"
>
<NativeAd
:adPosition="'Hero Top'"
:adId="'iconbar-js-hero'"
:key="$route.fullPath + 'ad'"
/>
</div>

<div class="desktop-hidden m-t-20"></div>
Expand Down
146 changes: 82 additions & 64 deletions website/macos-big-sur-icons/src/components/NativeAd.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<template>
<!-- <div id="native-js" class="banner-01"></div> -->
<div :class="{fullWidth: fullWidth, 'mobile-hidden': true}">
<p v-if="sponsored" class="coral-Detail coral-Detail--S coral-Detail--light opacity-50">
Sponsored
</p>
<div
@click="adClick({position: adPosition, type: 'Native'})"
class="native-ad-wrapper"
:id="adId">
:id="adId"
>
</div>
</div>
</template>
Expand Down Expand Up @@ -35,22 +37,38 @@ export default {
mounted: function(){
let parent = this
var adId = parent.adId
this.$nextTick(function () {
let parent = this
// parent.getAd()
getAd()
})
var adId = parent.adId
function getAd(el){
try {
if (typeof _bsa !== 'undefined' && !parent.isAd) {
// if (typeof _bsa !== 'undefined' && _bsa) {
// _bsa.init('custom', 'CVADC53U', 'placement:SITENAME',
// {
// target: '.banner-01',
// template: `
// <a href="##link##" class="native-banner" style="background: ##backgroundColor##">
// <img class="native-img" src="##logo##">
// <div class="native-details" style="color: ##textColor##">
// <span class="native-company">Sponsored by ##company##</span>
// <span class="native-desc">##description##</span>
// </div>
// <span class="native-cta" style="color: ##ctaTextColor##; background-color: ##ctaBackgroundColor##">##callToAction##</span>
// </a>
// `,
// }); }
// <a href="##statlink##" target="_blank" rel="noopener sponsored" id="`+adId+`customAd" class="bsa-link coral-card">
if (typeof _bsa !== 'undefined' && _bsa) {
_bsa.init('custom', 'CESDC2QN', 'placement:macosiconscom',
{
target: '#'+adId,
template: `
<a href="##statlink##" target="_blank" rel="noopener sponsored" id="`+adId+`customAd" class="bsa-link coral-card">
<a href="##link##" target="_blank" rel="noopener sponsored" id="`+adId+`customAd" class="bsa-link coral-card">
<div class="bsa-icon" style="background-image: url(##image##); background-color: ##backgroundColor##;"></div>
<div class="bsa-desc">##company## - ##tagline##</div>
</a>
Expand All @@ -62,64 +80,64 @@ export default {
}
}
// var attempts = 0
// function adExist(){
// var adExists = document.getElementById(adId).children.length
// console.log();
// setTimeout(() => {
// if (attempts >= 15) return;
// if (adExists == 0) {
// try {
// attempts++
// getAd()
// adExist()
// } catch (error) {
// getAd()
// attempts++
// adExist()
// parent.isAd = false
// }
// } else return
// }, 1500);
// }
// let el = document.getElementById(adId+"customAd")
// window.BSANativeCallback = (a) => {
// const total = a.ads.length;
// if (!total) {
// getAd(el)
// parent.isAd = true
// }
// }
// if (!parent.isAd) {
// // // console.log(parent.isAd);
// // setTimeout(() =>{
// // if (!_bsa.exists(el)) {
// // getAd(el)
// // }
// // }, 500)
// 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)
var attempts = 0
function adExist(){
var adExists = document.getElementById(adId).children.length
console.log();
setTimeout(() => {
if (attempts >= 15) return;
if (adExists == 0) {
try {
attempts++
getAd()
adExist()
} catch (error) {
getAd()
attempts++
adExist()
parent.isAd = false
}
} else return
}, 1500);
}
let el = document.getElementById(adId+"customAd")
window.BSANativeCallback = (a) => {
const total = a.ads.length;
if (!total) {
getAd(el)
parent.isAd = true
}
}
if (!parent.isAd) {
// console.log(parent.isAd);
setTimeout(() =>{
if (!_bsa.exists(el)) {
getAd(el)
}
}, 500)
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)
},
Expand Down
23 changes: 21 additions & 2 deletions website/macos-big-sur-icons/src/components/StickyBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,22 @@ export default {
})
},
watch:{
$route (to, from){
// console.log(to);
// console.log(from);
// console.log(_bsa);
_bsa.reload('.card-ad2')
// this.getAd()
}
},
methods:{
...mapActions(['showEl', 'setSelectedIcon', 'addClickCount', 'adClick']),
getAd(el){
console.log('Hi');
try {
if (typeof _bsa !== 'undefined' && _bsa) {
if (typeof _bsa !== 'undefined') {
_bsa.init('custom', 'CESDC2QN', 'placement:macosiconscom',
{
target: '.card-ad2',
Expand All @@ -105,6 +114,16 @@ export default {
} catch (error) {
console.log("error: ", error);
}
setTimeout(() => {
let ad = document.querySelector('.bsa-link')
if (ad == null) {
console.log('no ad');
getAd()
console.log('no ad');
}
}, 1500);
},
closeBanner(){
Expand Down

1 comment on commit 2a3c04f

@vercel
Copy link

@vercel vercel bot commented on 2a3c04f Oct 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.