MediaWiki

Group-Grouse.js: Difference between revisions

From Grouse House Wiki

No edit summary
No edit summary
Line 136: Line 136:
     modal.style.display = "block";
     modal.style.display = "block";
     modalpreview.src = adulturl;
     modalpreview.src = adulturl;
     previewbutton.addEventListener("click", function() {
     previewbutton.addEventListener("click", function() {
     modalpreview.style.display = "block";
     modalpreview.style.display = "block";
Line 141: Line 142:
     previewinput.style.display = "block";
     previewinput.style.display = "block";
     decorinformation.style.display = "none";
     decorinformation.style.display = "none";
     }
     });
 
     modaldropdown.addEventListener("change", function() {
     modaldropdown.addEventListener("change", function() {
     if (modaldropdown.options[modaldropdown.selectedIndex].text === "Adult") {
     if (modaldropdown.options[modaldropdown.selectedIndex].text === "Adult") {
       modalpreview.src = adulturl;
       modalpreview.src = adulturl;

Revision as of 05:44, 23 February 2024

$(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();
    });
 });

/* Testing */

var modal = document.getElementById('decorModal');
var modalclose = document.getElementsByClassName('modalclose')[0];
var previewbutton = document.getElementById('previewbutton');
var modaldropdown = document.getElementById('previewoptions');
var modalpreview = document.getElementById('decorpreviewimg');
var backbutton = document.getElementById('backbutton');
var previewinput = document.getElementById('previewinput');
var decorinfo = document.getElementById('decorinformation');

function decorModal(decorname, decordesc, descobt, adulturl, motherlyurl, relaxedurl, sentinelurl, adolurl, pupurl, pupbrachyurl, pupconjoinedurl, pupnewbornurl, puppolycurl, puppolymurl, pupsirenurl, pupyoungurl) {
    modal.style.display = "block";
    modalpreview.src = adulturl;

    previewbutton.addEventListener("click", function() {
    modalpreview.style.display = "block";
    backbutton.style.display = "block";
    previewinput.style.display = "block";
    decorinformation.style.display = "none";
    });

    modaldropdown.addEventListener("change", function() {
    if (modaldropdown.options[modaldropdown.selectedIndex].text === "Adult") {
       modalpreview.src = adulturl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Adult [Motherly]") {
       modalpreview.src = motherlyurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Adult [Relaxed]") {
       modalpreview.src = relaxedurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Adult [Sentinel]") {
       modalpreview.src = sentinelurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Adolescent") {
       modalpreview.src = adolurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Pup") {
       modalpreview.src = pupurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Pup [Brachycephaly]") {
       modalpreview.src = pupbrachyurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Pup [Conjoined Twins]") {
       modalpreview.src = pupconjoinedurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Pup [Newborn]") {
       modalpreview.src = pupnewbornurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Pup [Polycephaly]") {
       modalpreview.src = puppolycurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Pup [Polymelia]") {
       modalpreview.src = puppolymurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Pup [Sirenomelia]") {
       modalpreview.src = pupsirenurl;
    } else if (modaldropdown.options[modaldropdown.selectedIndex].text === "Pup [Young]") {
       modalpreview.src = pupyoungurl;
    } 
    });
}

window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
    modaldropdown.selectedIndex = 0;
    modalpreview.src = " ";
  } else if (event.target === modalclose) {
    modal.style.display = "none";
    modaldropdown.selectedIndex = 0;
    modalpreview.src = " ";
  }
}