User:Tark/userpagenotice.js

From Team Fortress Wiki
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
var anonUserSpaceNotice = {
    init: function() {
        var isArticle = mw.config.get("wgIsArticle");
        var isUserNamespace = mw.config.get("wgCanonicalNamespace") == "User";
        var isValid = mw.config.get("wgCurRevisionId") !== 0;

        if (isArticle && isUserNamespace && isValid) {
            var notice = '<table class="eninfo fmbox plainlinks"style=padding:.5em><tr><td style="padding:2px 0 2px 0;text-align:center"><a href=/wiki/File:Warning_blue.png class=image><img alt="Warning blue.png"data-file-height=256 data-file-width=256 height=56 src=/w/images/thumb/8/81/Warning_blue.png/56px-Warning_blue.png srcset="/w/images/thumb/8/81/Warning_blue.png/84px-Warning_blue.png 1.5x, /w/images/thumb/8/81/Warning_blue.png/112px-Warning_blue.png 2x"width=56></a><td style=width:100%;padding:.25em><div style=padding-left:.5em;text-align:left><div style="font-size:1.5em;margin:.25em 0"><b>This page has been created by a user and is not part of the encyclopedia.</b></div><div>This page is <b>not part of the main wiki content</b>. Please note that it may not adhere to all the stylistic guidelines applicable to official pages.</div><div>Editors can create pages for various purposes, as long as they adhere to our <a href=/wiki/Help:Style_guide/User_pages title="Help:Style guide/User pages">rules for user-created pages</a>. If you mistook this page for an official one, or if you were linked here from a third-party website (i.e., not from a link within this wiki), <a href=/wiki/Team_Fortress_Wiki:Help_Desk title="Team Fortress Wiki:Help Desk">please let us know</a>.</div></div></table>';

            $('#bodyContent.mw-body-content').prepend(notice);
        }
    }
};

$(anonUserSpaceNotice.init);