You've already forked AstralRinth
forked from didirus/AstralRinth
More reliably detect ad load faults (#661)
Detecting that ad has failed to load with timeout is not accurate and won't work on slow connections. This commit fixes that by changing detection to use 'onerror' event on <script> tag instead, which will be triggered if ad script fails to load due to blocking.
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
async
|
async
|
||||||
type="text/javascript"
|
type="text/javascript"
|
||||||
src="//cdn.carbonads.com/carbon.js?serve=CEAIKK3N&placement=modrinthcom"
|
src="//cdn.carbonads.com/carbon.js?serve=CEAIKK3N&placement=modrinthcom"
|
||||||
|
@error="onBlocked"
|
||||||
></script>
|
></script>
|
||||||
</client-only>
|
</client-only>
|
||||||
</div>
|
</div>
|
||||||
@@ -15,13 +16,8 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'Advertisement',
|
name: 'Advertisement',
|
||||||
data() {
|
methods: {
|
||||||
return {
|
onBlocked() {
|
||||||
isBlocked: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.$refs['carbon-script'].outerHTML += `
|
this.$refs['carbon-script'].outerHTML += `
|
||||||
<div id="info-popup">
|
<div id="info-popup">
|
||||||
<span>
|
<span>
|
||||||
@@ -53,7 +49,7 @@ export default {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}, 1000)
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user