Skip to content

Commit

Permalink
docs: fix carbon ads refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
krisk committed Feb 19, 2024
1 parent 5388661 commit 43eebfa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/.vuepress/layouts/components/CarbonAds.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { isNullish } from '@sapphire/utilities'
import { onMounted, ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import Demo from '../../components/Demo/Demo.vue';
const SCRIPT_ID = '_carbonads_js'
const ACCOUNT_ID = 'CE7IC27U'
Expand All @@ -16,18 +17,18 @@ const route = useRoute()
const carbonAdsElementRef = ref<HTMLDivElement>()
async function loadCarbonAds() {
console.log("loadCarbonAds")
const s = document.createElement('script')
s.id = SCRIPT_ID
s.src = `//cdn.carbonads.com/carbon.js?serve=${ACCOUNT_ID}&placement=${PLACEMENT}`
carbonAdsElementRef?.value?.appendChild(s)
}
let hash = '';
onMounted(() => {
hash = window.location.hash
loadCarbonAds()
})
let hash = window.location.hash
watch(route, (to, from) => {
if (!isNullish(document.querySelector('#carbonads'))) {
if (window.location.hash == hash) {
Expand Down

0 comments on commit 43eebfa

Please sign in to comment.