MediaWiki:Common.js

From Zymonic
Revision as of 13:32, 25 October 2019 by Jbree (talk | contribs) (Test change)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After publishing, 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: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
$(function() {
    var get_links_element = document.getElementById("get_links");
    var titles = [];
    var title_table = '<table align="right" width="400"><tr><th>Page Links</th></tr>';
    var all_links = document.links;
    var i;
    var y = [];
    for (i = 0; i < all_links.length; i++) {
        var div = document.getElementById("mw-content-text").contains(all_links[i]);
        if (div == 1) {
            var title_name = all_links[i].title;
            if (title_name.includes("Edit section: ") == 0) {
                if (title_name.includes(" (page does not exist)") == 0) {
                    var i2;
                    for (i2 = 0; i2 < titles.length; i2++) {
                        if (titles[i2] == title_name) {
                            title_name = '';
                        }
                    }
                    if (title_name !== '') {
                        if (title_name !== 'Enlarge') {
                            if (all_links[i].innerHTML !== 'Mark this page as patrolled') {
                                titles.push(title_name);
                                var html_parser = '<a href="/wiki/' + title_name + '" title="' + title_name + '">' + title_name + '</a>';

                                title_table = title_table + '<tr align="center"><td>' + html_parser + '</td></tr>';
                            }
                        }
                    }
                }
            }
        }
    }
    title_table = title_table + '</table>';
    if (title_table !== '<table align="right" width="400"><tr><th>Page Links</th></tr></table>') {
        get_links_element.innerHTML = title_table;
    }
    document.getElementById("footer-icons").style.display = "none";
}());