28 lines
981 B
HTML
28 lines
981 B
HTML
<!-- Add To Head in Component -->
|
|
<script type="text/discourse-plugin" version="0.8.16">
|
|
api.onPageChange(() => {
|
|
updateTopAd();
|
|
});
|
|
|
|
function updateTopAd() {
|
|
fetch('https://slowtwitch.com/wp-admin/admin-ajax.php?action=aa-server-select&p=forum-ads')
|
|
.then(function(e) {
|
|
return e.text();
|
|
})
|
|
.then(function(body) {
|
|
var server_parser = new DOMParser();
|
|
var doc = server_parser.parseFromString(body, "text/html");
|
|
var ad_html_content = doc.querySelector('div');
|
|
var ad_image = ad_html_content.querySelector('img');
|
|
ad_image.removeAttribute('width');
|
|
ad_image.removeAttribute('height');
|
|
ad_image.style.width = '100%';
|
|
var ad_box = document.querySelector('#forum-ads-box');
|
|
ad_box.innerHTML = ad_html_content.innerHTML;
|
|
});
|
|
}
|
|
</script>
|
|
<!-- Add To House Ads HTML -->
|
|
<div id="forum-ads-box">
|
|
|
|
</div> |