MediaWiki:Common.js: Difference between revisions

From Flashpoint Datahub
Jump to navigation Jump to search
(Open external links in a new window if wiki page is being framed inside the Flashpoint Help Manual)
 
m (Add boilerplate)
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */
// If wiki page is framed (e.g. in the Flashpoint Help Menu), open external links in a new window
// If wiki page is framed (e.g. in the Flashpoint Help Menu), open external links in a new window
if (window.location != window.parent.location) {
$(function () {
    document.querySelectorAll("a.external").forEach(elem => elem.setAttribute("target", "_blank"));
    if (window.location != window.parent.location) {
}
        document.querySelectorAll("a.external").forEach(elem => elem.setAttribute("target", "_blank"));
    }
}());

Revision as of 12:09, 13 August 2022

/* Any JavaScript here will be loaded for all users on every page load. */
// If wiki page is framed (e.g. in the Flashpoint Help Menu), open external links in a new window
$(function () {
    if (window.location != window.parent.location) {
        document.querySelectorAll("a.external").forEach(elem => elem.setAttribute("target", "_blank"));
    }
}());