Skip to content

Commit

Permalink
Footerscripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bonny committed May 16, 2024
1 parent 87d95fc commit f1a9c1e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 42 deletions.
86 changes: 45 additions & 41 deletions resources/views/components/events-map.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,6 @@
<script src="https://cdn.jsdelivr.net/npm/leaflet.locatecontrol@0.81.0/dist/L.Control.Locate.min.js" charset="utf-8">
</script>
<script>
(function() {
// Select the node that will be observed for mutations
const targetNode = document.body;
if (targetNode === null) {
console.log("No target node found for mutation observer.", targetNode);
return;
}
// Options for the observer (which mutations to observe)
const config = {
attributes: false,
childList: true,
subtree: false,
};
// Callback function to execute when mutations are observed
const callback = (mutationList, observer) => {
// console.log("Mutation list: ", mutationList);
for (const mutation of mutationList) {
if (mutation.type === "childList") {
// console.log("A child node has been added or removed.");
// console.log("added nodes: ", mutation.addedNodes);
// Check for class "adsbygoogle.adsbygoogle-noablate".
for (const node of mutation.addedNodes) {
if (node.classList.contains("adsbygoogle-noablate")) {
console.log("Found sticky ad: ", node);
}
}
}
}
};
// Create an observer instance linked to the callback function
const observer = new MutationObserver(callback);
// Start observing the target node for configured mutations
observer.observe(targetNode, config);
})
();
L.Control.ExpandButton = L.Control.extend({
onAdd: function(map) {
var html = L.DomUtil.create('div');
Expand Down Expand Up @@ -347,6 +306,51 @@ class EventsMap {
</script>
@endpush

@push('footerscripts')
<script>
(function() {
// Select the node that will be observed for mutations
const targetNode = document.body;
if (targetNode === null) {
console.log("No target node found for mutation observer.", targetNode);
return;
}
// Options for the observer (which mutations to observe)
const config = {
attributes: false,
childList: true,
subtree: false,
};
// Callback function to execute when mutations are observed
const callback = (mutationList, observer) => {
// console.log("Mutation list: ", mutationList);
for (const mutation of mutationList) {
if (mutation.type === "childList") {
// console.log("A child node has been added or removed.");
// console.log("added nodes: ", mutation.addedNodes);
// Check for class "adsbygoogle.adsbygoogle-noablate".
for (const node of mutation.addedNodes) {
if (node.classList.contains("adsbygoogle-noablate")) {
console.log("Found sticky ad: ", node);
}
}
}
}
};
// Create an observer instance linked to the callback function
const observer = new MutationObserver(callback);
// Start observing the target node for configured mutations
observer.observe(targetNode, config);
})
();
</script>
@endpush

@push('styles')
<style>
.EventsMap__container {
Expand Down
3 changes: 2 additions & 1 deletion resources/views/layouts/web.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function gtag() {
{{--
Pixel,
ladda via JS för att minimera laddning via bots.
--}}
--}}
@php
$pixelUrl = sprintf(
'%1$s/pixel?path=%2$s&rand=%3$s',
Expand All @@ -194,6 +194,7 @@ function gtag() {
]);
</script>

@stack('footerscripts')
</body>

</html>

0 comments on commit f1a9c1e

Please sign in to comment.