Cameron_D
(Cameron:D)
24 Maggio 2018, 12:53am
5
However, with some modifications to the statcounter script you should be able to get it to run on each page load, this would probably be your starting point:
I think you can use the PluginAPI onPageChange function to do what you are looking for. See: Using the JS API
Here’s an example function:
<script type="text/discourse-plugin" version="0.8">
api.onPageChange(() =>{
randBackground();
});
function randBackground() {
$('body').css('background-color', '#'+(Math.random()*0xFFFFFF<<0).toString(16));
}
</script>
Update: If you are looking to apply similar changes to post bodies, see post #26 below .