Skip to content
Snippets Groups Projects
Commit 44b7eda1 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

disable script completely if disabled in config

parent 15de8c00
No related branches found
No related tags found
1 merge request!2242Translated using Weblate (Danish)
...@@ -85,7 +85,6 @@ function initialize() { ...@@ -85,7 +85,6 @@ function initialize() {
let promise_fetch = verify(); let promise_fetch = verify();
if (typeof promise_fetch !== "undefined" && link !== "#") { if (typeof promise_fetch !== "undefined" && link !== "#") {
console.log(link);
promise_fetch.then((response) => { promise_fetch.then((response) => {
if (!newtab) { if (!newtab) {
if (top) { if (top) {
......
...@@ -8,6 +8,10 @@ class Statistics { ...@@ -8,6 +8,10 @@ class Statistics {
constructor() { constructor() {
let performance = window.performance.getEntriesByType('navigation')[0]; let performance = window.performance.getEntriesByType('navigation')[0];
try {
let statistics_enabled = document.querySelector("meta[name=statistics-enabled]").content;
if (statistics_enabled != 1) return; // Disable statistics if those are not enabled
} catch (error) { }
if (performance.loadEventEnd != 0) { if (performance.loadEventEnd != 0) {
this.#init(); this.#init();
} else { } else {
...@@ -24,6 +28,7 @@ class Statistics { ...@@ -24,6 +28,7 @@ class Statistics {
#init() { #init() {
setTimeout(this.pageLoad.bind(this), 60000); setTimeout(this.pageLoad.bind(this), 60000);
document.addEventListener("visibilitychange", this.pageLoad.bind(this));
document.querySelectorAll("a").forEach(anchor => { document.querySelectorAll("a").forEach(anchor => {
anchor.addEventListener("click", e => this.pageLeave(e.target.closest("a").href)); anchor.addEventListener("click", e => this.pageLeave(e.target.closest("a").href));
}); });
......
...@@ -63,7 +63,6 @@ function reportJSAvailabilityForAuthenticatedSearch() { ...@@ -63,7 +63,6 @@ function reportJSAvailabilityForAuthenticatedSearch() {
function backButtons() { function backButtons() {
document.querySelectorAll(".back-button").forEach(button => { document.querySelectorAll(".back-button").forEach(button => {
button.style.display = "block"; button.style.display = "block";
console.log(button);
button.addEventListener("click", e => { button.addEventListener("click", e => {
let href = button.href; let href = button.href;
// Use the defined URL on the button if there is one // Use the defined URL on the button if there is one
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
<meta name="searchkey" content="{{ $metager->getSearchUid() }}" /> <meta name="searchkey" content="{{ $metager->getSearchUid() }}" />
<meta name="referrer" content="origin-when-cross-origin"> <meta name="referrer" content="origin-when-cross-origin">
<meta name="age-meta-label" content="age=18" /> <meta name="age-meta-label" content="age=18" />
<meta name="statistics-enabled" content="{{ config("metager.matomo.enabled") }}">
{{-- Add Advertisement Scripts if Yahoo is enabled --}} {{-- Add Advertisement Scripts if Yahoo is enabled --}}
@if (app(\App\Models\Configuration\Searchengines::class)->getEnabledSearchengine('yahoo') !== null) @if (app(\App\Models\Configuration\Searchengines::class)->getEnabledSearchengine('yahoo') !== null)
<meta name="source_tag" <meta name="source_tag"
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<meta name="revisit-after" content="7 days" /> <meta name="revisit-after" content="7 days" />
<meta name="audience" content="all" /> <meta name="audience" content="all" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="statistics-enabled" content="{{ config("metager.matomo.enabled") }}">
<link href="/favicon.ico" rel="icon" type="image/x-icon" /> <link href="/favicon.ico" rel="icon" type="image/x-icon" />
<link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
@foreach(LaravelLocalization::getSupportedLocales() as $locale => $locale_data) @foreach(LaravelLocalization::getSupportedLocales() as $locale => $locale_data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment