MediaWiki:Common.js: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
/* Unified Consent System JavaScript | /* Unified Consent System JavaScript v250822r3 | ||
* Single file for both EN and DE versions | * Single file for both EN and DE versions | ||
* Automatically detects language based on domain | * Automatically detects language based on domain | ||
*/ | */ | ||
/* Common JavaScript - Keep only consent system if needed */ | |||
// Language detection helper | // Language detection helper | ||
| Zeile 32: | Zeile 34: | ||
}; | }; | ||
function getString(key) { | function getString(key) { | ||
var lang = getCurrentLanguage(); | var lang = getCurrentLanguage(); | ||
| Zeile 43: | Zeile 44: | ||
if (!consentBox) return; | if (!consentBox) return; | ||
var dismissed = sessionStorage.getItem('consent-acquisition-dismissed'); | var dismissed = sessionStorage.getItem('consent-acquisition-dismissed'); | ||
| Zeile 49: | Zeile 49: | ||
consentBox.style.display = 'none'; | consentBox.style.display = 'none'; | ||
} else { | } else { | ||
consentBox.style.display = 'block'; | consentBox.style.display = 'block'; | ||
consentBox.classList.add('show'); | consentBox.classList.add('show'); | ||
} | } | ||
consentBox.addEventListener('click', function() { | consentBox.addEventListener('click', function() { | ||
sessionStorage.setItem('consent-acquisition-dismissed', 'true'); | sessionStorage.setItem('consent-acquisition-dismissed', 'true'); | ||
var targetPage = getCurrentLanguage() === 'de' ? | var targetPage = getCurrentLanguage() === 'de' ? | ||
'/wiki/Transformal_GmbH:Analyseeinstellungen' : | '/wiki/Transformal_GmbH:Analyseeinstellungen' : | ||
'/wiki/Transformal_GmbH:Analyses_preferences'; | '/wiki/Transformal_GmbH:Analyses_preferences'; | ||
window.location.href = targetPage; | window.location.href = targetPage; | ||
}); | }); | ||
| Zeile 69: | Zeile 63: | ||
// Convert template placeholders to actual checkboxes | // Convert template placeholders to actual checkboxes | ||
$(function() { | $(function() { | ||
$('.consent-option').each(function() { | $('.consent-option').each(function() { | ||
var $option = $(this); | var $option = $(this); | ||
if ($option.find('.consent-checkbox').length > 0) return; | if ($option.find('.consent-checkbox').length > 0) return; | ||
| Zeile 82: | Zeile 71: | ||
var status = $option.find('.consent-status-data').text().trim(); | var status = $option.find('.consent-status-data').text().trim(); | ||
var $checkboxRow = $option.find('.checkbox-row'); | var $checkboxRow = $option.find('.checkbox-row'); | ||
if (!$checkboxRow.length) return; | if (!$checkboxRow.length) return; | ||
var $container = $('<span class="checkbox-container"></span>'); | var $container = $('<span class="checkbox-container"></span>'); | ||
var $checkbox = $('<input>', { | var $checkbox = $('<input>', { | ||
| Zeile 107: | Zeile 94: | ||
$container.append($checkbox).append($label); | $container.append($checkbox).append($label); | ||
$checkboxRow.append($container); | $checkboxRow.append($container); | ||
$checkboxRow.find('.checkbox-placeholder').remove(); | $checkboxRow.find('.checkbox-placeholder').remove(); | ||
var saved = localStorage.getItem(consentId) === 'true'; | var saved = localStorage.getItem(consentId) === 'true'; | ||
$checkbox.prop('checked', saved); | $checkbox.prop('checked', saved); | ||
| Zeile 159: | Zeile 143: | ||
feedbackDiv.style.display = 'block'; | feedbackDiv.style.display = 'block'; | ||
setTimeout(function() { | setTimeout(function() { | ||
feedbackDiv.style.display = 'none'; | feedbackDiv.style.display = 'none'; | ||