Przełącz menu
Przełącz menu użytkownika
Nie jesteś zalogowany
Twój adres IP będzie publicznie widoczny, jeśli dokonasz jakichkolwiek zmian.

MediaWiki:Common.js: Różnice pomiędzy wersjami

Strona MediaWiki
mNie podano opisu zmian
Znaczniki: Z urządzenia mobilnego Z wersji mobilnej (przeglądarkowej)
mNie podano opisu zmian
Znaczniki: Z urządzenia mobilnego Z wersji mobilnej (przeglądarkowej)
Linia 67: Linia 67:
*/
*/


$(function () {
document.addEventListener('DOMContentLoaded', function() {
     var customLinkDesktop = $('<li id="custom-footer-privacy-link"><a href="#" onclick="illow.showWidget(); return false;">Privacy Control Center</a></li>');
     // Function to create and return the new list item
    var customLinkMobile = $('<li id="custom-footer-privacy-link-mobile"><a href="#" onclick="illow.showWidget(); return false;">Privacy Control Center</a></li>');
    function createNewListItem() {
 
        var li = document.createElement('li');
    // For Desktop
        li.id = 'custom-footer-privacy-link'; // Ensure the ID is unique
    if (!$('body').hasClass('skin-minerva')) { // Assuming non-Minerva skins are for desktop
        li.style.display = 'inline-block'; // Ensure it's visible on mobile
         $('#footer-places-privacy').after(customLinkDesktop);
        var a = document.createElement('a');
        a.href = "#";
        a.onclick = function() { illow.showWidget(); return false; }; // Adjust as per your actual function
        a.textContent = "Privacy Control Center";
        li.appendChild(a);
         return li;
     }
     }


     // For Mobile - Adjust based on Minerva's structure
     // Desktop version
     if ($('body').hasClass('skin-minerva')) {
    var desktopFooterPlaces = document.querySelector('#footer-places');
         $('#footer-places-privacy').after(customLinkMobile);
     if (desktopFooterPlaces && !document.querySelector('#custom-footer-privacy-link')) {
         var newListItemDesktop = createNewListItem();
        var privacyPolicyLink = document.querySelector('#footer-places-privacy');
        if (privacyPolicyLink) {
            desktopFooterPlaces.insertBefore(newListItemDesktop, privacyPolicyLink.nextSibling);
        }
     }
     }
});


$(document).ready(function() {
    // Mobile version
     var customLink = $('<li id="custom-footer-privacy-link-mobile"><a href="#" onclick="illow.showWidget(); return false;">Privacy Control Center</a></li>');
    var mobileFooterPlaces = document.querySelector('.footer-places');
 
     if (mobileFooterPlaces && !document.querySelector('#custom-footer-privacy-link-mobile')) {
    // Since we know the mobile skin only displays two specific items, we target one for placement.
        var newListItemMobile = createNewListItem();
    if ($('#footer-places-privacy').length) {
        newListItemMobile.id = 'custom-footer-privacy-link-mobile'; // Different ID for mobile
        // Directly after "Polityka prywatności"
         var mobilePrivacyPolicyLink = document.querySelector('#footer-places-privacy');
         $('#footer-places-privacy').after(customLink);
        if (mobilePrivacyPolicyLink) {
    } else if ($('#footer-places-desktop-toggle').length) {
            mobileFooterPlaces.insertBefore(newListItemMobile, mobilePrivacyPolicyLink.nextSibling);
         // As a fallback, place it before "Wersja standardowa" if for some reason the above ID is not found.
        }
         $('#footer-places-desktop-toggle').before(customLink);
         // Ensure the new list item is visible on mobile
         newListItemMobile.style.display = 'inline-block'; // Override any 'display: none' from CSS
     }
     }
});
$('#custom-footer-privacy-link-mobile').css({
    'display': 'block', // or 'inline-block' depending on your layout needs
    'visibility': 'visible',
    'opacity': 1
});
});

Wersja z 00:47, 24 lut 2024

/* Umieszczony tutaj kod JavaScript zostanie załadowany przez każdego użytkownika, podczas każdego ładowania strony. */

// linki z tagiem a i klasą extiw będą otwierane w nowej zakładce
mw.hook('wikipage.content').add(function($content) {
    $content.find('a.extiw').attr('target', '_blank');
});

/* Opinia DSA */
window.Userback = window.Userback || {};
Userback.access_token = '4796|88831|3S2WfgkWf8v2sBL2pd0NJxOI8QHu2swcDq6oDLcScFi56Z3xqk';
(function(d) {
	var s = d.createElement('script');s.async = true;
	s.src = 'https://static.userback.io/widget/v1.js';
	(d.head || d.body).appendChild(s);
})(document);

/* RODO */
(function() {
    var scriptElement = document.createElement('script');
    scriptElement.src = "https://platform.illow.io/banner.js?siteId=44c89d68-4273-42c8-9e9f-cf98fb4c4d09";
    document.head.appendChild(scriptElement);
})();

/* opcje ciasteczek */
/*
mw.loader.using('mediawiki.util', function () {
    $(document).ready(function () {
        var customLink = $('<li id="custom-footer-privacy-link"><a href="#" onclick="illow.showWidget(); return false;" class="bannerLink">Ustawienia prywatności</a></li>');
        $('#footer-places').append(customLink);
    });
});
*/
/* opcje ciasteczek w trybie mobilnym */
/*
mw.loader.using(['mediawiki.util', 'mobilefrontend'], function () {
    $(document).ready(function () {
        var customLinkHtml = '<li id="custom-footer-privacy-link-mobile"><a href="#" onclick="illow.showWidget(); return false;" class="bannerLink">Privacy Control Center</a></li>';

        // For Desktop
        $('#footer-places').append(customLinkHtml);

        // For MobileFrontend
        var mobileMenu = $('.mw-mf-footer-items');
        if (mobileMenu.length) {
            mobileMenu.append(customLinkHtml);
        }
    });
});
*/

// This script should be added to MediaWiki:Common.js or an equivalent site-wide script file.
// This script should be added to MediaWiki:Common.js or an equivalent site-wide script file.
/*
$(function () {
    var customLink = $('<li id="custom-footer-privacy-link"><a href="#" onclick="illow.showWidget(); return false;">Privacy Control Center</a></li>');

    // For Desktop
    $('#footer-places-privacy').after(customLink);

    // For Mobile
    // Check if MobileFrontend is active by looking for a mobile-specific class or ID
    if ($('body').hasClass('skin-minerva') || $('#mw-mf-display-toggle').length > 0) {
        // This ensures the code executes in a mobile context
        $('#footer-places-privacy').after(customLink.clone());
    }
});
*/

document.addEventListener('DOMContentLoaded', function() {
    // Function to create and return the new list item
    function createNewListItem() {
        var li = document.createElement('li');
        li.id = 'custom-footer-privacy-link'; // Ensure the ID is unique
        li.style.display = 'inline-block'; // Ensure it's visible on mobile
        var a = document.createElement('a');
        a.href = "#";
        a.onclick = function() { illow.showWidget(); return false; }; // Adjust as per your actual function
        a.textContent = "Privacy Control Center";
        li.appendChild(a);
        return li;
    }

    // Desktop version
    var desktopFooterPlaces = document.querySelector('#footer-places');
    if (desktopFooterPlaces && !document.querySelector('#custom-footer-privacy-link')) {
        var newListItemDesktop = createNewListItem();
        var privacyPolicyLink = document.querySelector('#footer-places-privacy');
        if (privacyPolicyLink) {
            desktopFooterPlaces.insertBefore(newListItemDesktop, privacyPolicyLink.nextSibling);
        }
    }

    // Mobile version
    var mobileFooterPlaces = document.querySelector('.footer-places');
    if (mobileFooterPlaces && !document.querySelector('#custom-footer-privacy-link-mobile')) {
        var newListItemMobile = createNewListItem();
        newListItemMobile.id = 'custom-footer-privacy-link-mobile'; // Different ID for mobile
        var mobilePrivacyPolicyLink = document.querySelector('#footer-places-privacy');
        if (mobilePrivacyPolicyLink) {
            mobileFooterPlaces.insertBefore(newListItemMobile, mobilePrivacyPolicyLink.nextSibling);
        }
        // Ensure the new list item is visible on mobile
        newListItemMobile.style.display = 'inline-block'; // Override any 'display: none' from CSS
    }
});