לדלג לתוכן

משתמש:Freddy9/common.js

מתוך ויקיפדיה, האנציקלופדיה החופשית

הערה: לאחר הפרסום, ייתכן שיהיה צורך לנקות את זיכרון המטמון (cache) של הדפדפן כדי להבחין בשינויים.

  • פיירפוקס / ספארי: להחזיק את המקש Shift בעת לחיצה על טעינה מחדש (Reload) או ללחוץ על צירוף המקשים Ctrl-F5 או Ctrl-R (במחשב מק: ⌘-R).
  • גוגל כרום: ללחוץ על צירוף המקשים Ctrl-Shift-R (במחשב מק: ⌘-Shift-R).
  • אדג': להחזיק את המקש Ctrl בעת לחיצה על רענן (Refresh) או ללחוץ על צירוף המקשים Ctrl-F5.
importUserScript(16);

// Check if we're on a diff page by looking for the differences-nextlink element
if ($("#differences-nextlink").length > 0) {
    $(document).keydown(function(e) {
        // Check if Command+Option+N (on macOS) or Ctrl+Alt+N (on Windows/Linux) is pressed
        if ((e.ctrlKey || e.metaKey) && e.altKey && e.which == 192) {
            // Prevent the default action to avoid conflicts
            e.preventDefault();
            // Click the "Next change" button
            $("#differences-nextlink")[0].click();
        }
        
        // Check if Command+Option+N (on macOS) or Ctrl+Alt+K (on Windows/Linux) is pressed
        if ((e.ctrlKey || e.metaKey) && e.altKey && e.which == 75) {
            // Prevent the default action to avoid conflicts
            e.preventDefault();
            // Click the "Next change" button
            $("#differences-prevlink")[0].click();
        }
    });
}

// open language links on hover
//$("#p-lang-btn-checkbox").on("mouseenter", (e)=>{event.target.click()})

// give en direct link

let enLangLink = document.querySelector(".interlanguage-link a[lang=en]");

if (enLangLink) {    
    // Clone the English link
    let enLinkClone = enLangLink.cloneNode(true);
    // Update the text to English
    enLinkClone.textContent = enLinkClone.title;   
    enLinkClone.style.fontSize='small'
    // Append the cloned link to the language links section
    document.getElementsByClassName("vector-page-titlebar")[0].append(enLinkClone);
}