init
This commit is contained in:
commit
3730cb2f67
28
ad-snippet.html
Normal file
28
ad-snippet.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!-- 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>
|
Loading…
Reference in New Issue
Block a user