MediaWiki:HideVideos.js

/*                        Hide Videos module                         */ /* original and somewhat unfunctioning script by Master Ceadeus 27   */ /* The miniscript to create a button is all that remains from the    */ /* previous version, and it was written by Master Ceadeus 27 alone. */ /* The actual functioning script was re-written by User:RansomTime. */ /* function hideVideos is the functioning script (and one of two   */ /* "function"s in this script.                                        */ // /* Added to Monster Hunter Fanon Wiki 8/17/2014                       /* Originally found here /* By Master Ceadeus 27 | Idea, button load script, original function /* and RansomTime | Functioning function function hideVideos {        // Toggles videos        videos = document.getElementsByClassName("article-thumb");        if ( videos.length === 0 ) {         return;        } // no videos        var disp = "none"; // Default case is to hide them        if (videos[0].style.display == "none") {                // if we've already hidden, we want to show again                disp = "block";        }        for ( var i = 0; i < videos.length; i++ ) {                videos[i].style.display = disp;                $("a#hv").text("Show videos"); }       //changes text if (videos[0].style.display == "block") { $("a#hv").text("Hide videos"); } } $(document).ready(function hvbuttonAddition { var hvbutton = 'Hide videos'; if (wgNamespaceNumber === 0) {      $(".WikiaPageHeader").append(hvbutton);        } }); /* end hide videos script */