Skip to content

Commit

Permalink
Fixed ads
Browse files Browse the repository at this point in the history
  • Loading branch information
elrumo committed May 11, 2021
1 parent fd630e6 commit ebf633a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 21 deletions.
2 changes: 1 addition & 1 deletion website/macos-big-sur-icons/src/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ export default {
getAd()
parent.isAdOn = true
}
}, 80);
}, 500);
}
getAd()
Expand Down
66 changes: 46 additions & 20 deletions website/macos-big-sur-icons/src/components/NativeAd.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,49 @@ export default {
},
mounted: function(){
let parent = this
function getAd(el){
if (typeof _bsa !== 'undefined' && !parent.isAd) {
_bsa.init('custom', 'CESDC2QN', 'placement:macosiconscom',
{
target: '#iconbar-js',
template: `
<a href="##statlink##" target="_blank" rel="noopener sponsored" id="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>
`
}
);
try {
if (typeof _bsa !== 'undefined' && !parent.isAd) {
_bsa.init('custom', 'CESDC2QN', 'placement:macosiconscom',
{
target: '#iconbar-js',
template: `
<a href="##statlink##" target="_blank" rel="noopener sponsored" id="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>
`
}
);
}
} catch (error) {
}
}
var attempts = 0
function adExist(){
var adExists = document.getElementById("iconbar-js").children.length
console.log();
setTimeout(() => {
if (attempts >= 4) return;
if (adExists == 0) {
try {
getAd()
console.log("attempts: ", attempts);
attempts++
adExist()
} catch (error) {
getAd()
attempts++
adExist()
parent.isAd = false
}
} else return
}, 800);
}
let el = document.getElementById("customAd")
Expand All @@ -56,15 +81,16 @@ export default {
}
}
getAd(el)
// getAd(el)
if (!parent.isAd) {
// console.log(parent.isAd);
setTimeout(() =>{
if (!_bsa.exists(el)) {
getAd(el)
}
}, 800)
// // console.log(parent.isAd);
// setTimeout(() =>{
// if (!_bsa.exists(el)) {
// getAd(el)
// }
// }, 500)
adExist()
}
},
Expand Down

1 comment on commit ebf633a

@vercel
Copy link

@vercel vercel bot commented on ebf633a May 11, 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.