MediaWiki

MediaWiki:Group-Grouse.js

From Grouse House Wiki

Revision as of 23:23, 18 February 2024 by Mel (talk | contribs)

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.
/* Alert if using Internet Explorer */

function isIE() {
    const ua = window.navigator.userAgent; //Check the userAgent property of the window.navigator object
    const msie = ua.indexOf('MSIE '); // IE 10 or older
    const trident = ua.indexOf('Trident/'); //IE 11
    const chrome = ua.indexOf('chrome'); //IE 11
    
    return (msie > 0 || trident > 0 || chrome > 0);
}


//function to show alert if it's IE
function ShowIEAlert(){
    if(isIE()){
       alert("User is using IE");
    }
}

$(function() {
    $('h2.c-header.active span.mw-headline').each(function () {
        var $header = $(this);
        var $headername = $header.html();
        $headernameu = $headername.split(' ').join('_');
$headernameu = $headernameu.replace("'", "\\'").replace("?", "\\?").replace("!", "\\!");

        var $secondheader = "#" + $headernameu + "_2";

        var $editsection = $( $secondheader ).next().children('a').attr("href");

        $header.after('[Edit]');
        $header.next().css( 'font-size', '0.6em').css( 'margin-left', '1em');

        $("a[href*='" + $secondheader + "']").hide();
    });
 });

$(function() {
    $('h2.c-header.hidden span.mw-headline').each(function () {
        var $header = $(this);
        var $headername = $header.html();
        $headernameu = $headername.split(' ').join('_');
$headernameu = $headernameu.replace("'", "\\'").replace("?", "\\?").replace("!", "\\!");

        var $secondheader = "#" + $headernameu + "_2";

        var $editsection = $( $secondheader ).next().children('a').attr("href");
        
        $header.after('[Edit]');
        $header.next().css( 'font-size', '0.6em').css( 'margin-left', '1em');

        $("a[href='" + $secondheader + "']").hide();
    });
 });

$(function() {
    $('h2.h-static span.mw-headline').each(function () {
        var $header = $(this);
        var $headername = $header.html();
        $headernameu = $headername.split(' ').join('_');
$headernameu = $headernameu.replace("'", "\\'").replace("?", "\\?").replace("!", "\\!");

        var $secondheader = "#" + $headernameu + "_2";

        var $editsection = $( $secondheader ).next().children('a').attr("href");

        $header.after('[Edit]');
        $header.next().css( 'font-size', '0.6em').css( 'margin-left', '1em');

        var $pagename = $('h1#firstHeading').html();
        $pagenameu = $pagename.split(' ').join('_');
        
        $toclink = "https://grousehouse.wiki/" + $pagenameu + $secondheader;

        $("a[href*='" + $secondheader + "']").hide();
    });
 });

$(function() {
    $('h3.c-header.active span.mw-headline').each(function () {
        var $header = $(this);
        var $headername = $header.html();
        $headernameu = $headername.split(' ').join('_');
$headernameu = $headernameu.replace("'", "\\'").replace("?", "\\?").replace("!", "\\!");

        var $secondheader = "#" + $headernameu + "_2";

        var $editsection = $( $secondheader ).next().children('a').attr("href");

        $header.after('[Edit]');
        $header.next().css( 'font-size', '0.6em').css( 'margin-left', '1em');

        $("a[href*='" + $secondheader + "']").hide();
    });
 });

$(function() {
    $('h3.c-header.hidden span.mw-headline').each(function () {
        var $header = $(this);
        var $headername = $header.html();
        $headernameu = $headername.split(' ').join('_');
$headernameu = $headernameu.replace("'", "\\'").replace("?", "\\?").replace("!", "\\!");

        var $secondheader = "#" + $headernameu + "_2";

        var $editsection = $( $secondheader ).next().children('a').attr("href");

        $header.after('[Edit]');
        $header.next().css( 'font-size', '0.6em').css( 'margin-left', '1em');

        var $pagename = $('h1#firstHeading').html();
        $pagenameu = $pagename.split(' ').join('_');
        
        $toclink = "https://grousehouse.wiki/" + $pagenameu + $secondheader;

        $("a[href*='" + $secondheader + "']").hide();
    });
 });

$(function() {
    $('h3.h-static span.mw-headline').each(function () {
        var $header = $(this);
        var $headername = $header.html();
        $headernameu = $headername.split(' ').join('_');
$headernameu = $headernameu.replace("'", "\\'").replace("?", "\\?").replace("!", "\\!");

        var $secondheader = "#" + $headernameu + "_2";

        var $editsection = $( $secondheader ).next().children('a').attr("href");

        $header.after('[Edit]');
        $header.next().css( 'font-size', '0.6em').css( 'margin-left', '1em');

        var $pagename = $('h1#firstHeading').html();
        $pagenameu = $pagename.split(' ').join('_');
        
        $toclink = "https://grousehouse.wiki/" + $pagenameu + $secondheader;

        $("a[href*='" + $secondheader + "']").hide();
    });
 });