MediaWiki:Mobile.js

Version fra 23. nov. 2023, 13:46 af Diversen (diskussion | bidrag) Diversen (diskussion | bidrag) (Oprettede siden med "→‎All JavaScript here will be loaded for users of the mobile site: // Debounce function in ES5 syntax function debounce(func, wait) { var timeout; return function() { var context = this, args = arguments; clearTimeout(timeout); timeout = setTimeout(function() { func.apply(context, args); }, wait); }; } // Function to reload the page function reloadPage() { window.location.reload(); } // Set up the resi...")
(forskel) ←Ældre version | Nuværende version (forskel) | Nyere version → (forskel)

Bemærk: Efter at have gemt er du måske nødt til at tømme din browsers cache for at kunne se ændringerne.

  • Firefox / Safari: Hold Shift nede og klik på Reload, eller tryk enten Ctrl-F5 eller Ctrl-R (⌘-R på en Mac).
  • Google Chrome: Tryk Ctrl-Shift-R (⌘-Shift-R på en Mac).
  • Internet Explorer / Edge: Hold Ctrl nede og klik på Refresh, eller tryk på Ctrl-F5.
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files
/* All JavaScript here will be loaded for users of the mobile site */

  // Debounce function in ES5 syntax
function debounce(func, wait) {
    var timeout;
    return function() {
        var context = this, args = arguments;
        clearTimeout(timeout);
        timeout = setTimeout(function() {
            func.apply(context, args);
        }, wait);
    };
}

// Function to reload the page
function reloadPage() {
    window.location.reload();
}

// Set up the resize event listener with debounce
window.addEventListener('resize', debounce(reloadPage, 250)); // 250 milliseconds