User:Darth Culator/global.js

// 

//Skin Switch Button for monobook to oasis and vice versa //and for monobook and oasis to wikiamobile //Imported from w:c:tardis:Forum:Easy_switching_between_monobook,_wikia_and_wikiamobile $( function {	if ( !document.getElementById( 'ca-skins' ) ) {		if ( skin === 'oasis' || skin === 'wikia' ) {			$( 'MB' ).appendTo( '#AccountNavigation' ); $( 'WM' ).appendTo( '#AccountNavigation' );		} else {			$( 'Oasis' ).appendTo( '#p-cactions > .pBody > ul' ); $( 'Mobile</li>' ).appendTo( '#p-cactions > .pBody > ul' );		} 	} } );

//Make gadgets universal //All following functions import Gadgets that I use from Wookieepedia's MediaWiki namespace

////Ajax Undo importScriptPage( 'AjaxUndo/code.js', 'dev' );

////Contribs Range //Loading pages at the whims of Wikipedia is a bad idea. Commenting out until I set up a local copy. //Strike that, the gadget loads the MediaWiki version and Wikipedia is more reliable than Wikia and I can't be arsed to maintain a local one. importScriptURI('http://en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-contribsrange.js&action=raw&ctype=text/javascript');

////Edit Intro Button var EditIntroButtonText = 'Edit intro'; importScriptPage( 'EditIntroButton/code.js', 'dev' );

////Fast Old Image Revision Delete function fdImageCheckdelete { if( wgCanonicalNamespace === 'File' && wgAction === 'delete' ) { if( window.location.href.match( /&oldimage=/ ) ) { $( '#mw-filedelete-submit' ).click; }	} } $( fdImageCheckdelete );

////Purge Button //var PurgeButtonText = 'New Purge'; //importScriptPage('PurgeButton/code.js', 'dev');

////Fast Delete Buttons (fewer than the ones in the Wookieepedia Gadgets) importScriptPage('FastDelete/code.js', 'dev'); var fdButtons = []; fdButtons[fdButtons.length] = { 'summary': '1.5 Unused image', 'label': 'uu'}; fdButtons[fdButtons.length] = { 'summary': '3.5 Unnecessary redirect', 'label': 'UR'};

//Grunny's hybrid purge button var PurgeButtonText = 'Purge'; importScriptPage('User:Grunny/pb-test.js', 'starwars');

//InactiveUsers edited for main namespace only importScriptPage('MediaWiki:Gadget-inactiveusers.js', 'starwars');

//Highlight Duplicate Links (not bothering with the flaky Gadget settings) importScriptPage('MediaWiki:Gadget-duplinks.js', 'starwars');

//Batch delete importScriptPage('AjaxBatchDelete/code.js', 'dev');

//Reference Tooltips (ditto) mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-ReferenceTooltips.js&action=raw&ctype=text/javascript' ); mw.loader.load( '//en.wikipedia.org/w/index.php?title=MediaWiki:Gadget-ReferenceTooltips.css&action=raw&ctype=text/css', 'text/css' ); mw.util.addCSS( '.referencetooltip > li > sup { display: none; }' );

//Null Edit Button ! function (mw, $) { "use strict"; var $cc = $("#mw-content-text"), messages = { en: { text: "Null Edit", tooltip: "Null Edit this page", success: "Null Edit successful!", failed: "Null Edit failed!" },           es: { text: "Edición vacía", tooltip: "Editar esta página sin hacer cambios", success: "Edición vacía exitosa!", failed: "Edición vacía fallado" },           pl: { text: "Pusta edycja", tooltip: "Pusta edycja na tej stronie", success: "Pusta edycja sukces!", failed: "Pusta edycja zawiodly!" },           sv: { text: "Tom redigera", tooltip: "Tom redigera denna sid", success: "Tom redigera framgångsrik!", failed: "Tom redigera misslyckades!" }       };    // Localisation: User Lang > Wiki Lang > English messages = $.extend(messages.en, messages[mw.config.get("wgContentLanguage")], messages[mw.config.get("wgUserLanguage")]); // Add the button function addButton { var $sel, $button = $('').find("a") .attr({               href: "#",                accesskey: "0",                id: "ca-null-edit",                title: messages.title            }).text(messages.text).click(edit).end; $sel = mw.config.get("skin") === "oasis" ? $("a[data-id='history']").closest("ul") : $("#ca-edit").parent; $sel.append($button); }   // Show results function showResult(message, result) { if (mw.config.get("skin") === "oasis") window.GlobalNotification.show(message, result); else window.alert(message); }   // Get the page function getPage { $('#ca-null-edit').html('<img id="null-edit-throbber" src="' + mw.config.get('stylepath') + '/common/images/ajax.gif" /> Getting page...'); $cc.load(window.location.href + " #mw-content-text > *", function {            $("#ca-null-edit").parent.remove;            addButton;            // Fix collapsibles, sortables and tabber            $cc.find(".mw-collapsible").makeCollapsible;            if ($cc.find("table.sortable").length)                $cc.find("table.sortable").tablesorter;            if ($cc.find(".tabber").length)                tabberAutomaticOnLoad;            // Allow users to add custom callback functions if needed            var neCallAgain = window.NullEditCallAgain || [];            neCallAgain.forEach(function(v){ v; });           // Fade-in the page slowly            $cc.fadeToggle(3000);            // Success notification            showResult(messages.success, "confirm");        }); }   function onError { $("#ca-null-edit").parent.remove; addButton; $cc.fadeIn; showResult(messages.failed, "error"); }   // Ajax edit the page function edit(e) { $cc.fadeToggle(1400); e.preventDefault; $('#ca-null-edit').html('<img id="null-edit-throbber" src="' + mw.config.get('stylepath') + '/common/images/ajax.gif" /> Editing...'); new mw.Api.post({           format: 'json',            action: 'edit',            title: mw.config.get('wgPageName'),            token: mw.user.tokens.get('editToken'),            prependtext: ''        }) .done(function {           getPage;        }) .fail(function {           onError;        }); }   // Init $(function {        if (!$("#ca-null-edit").length && $("#ca-edit, a[data-id='editprofile'], a[data-id='leavemessage']").length)            addButton;    }); }(mediaWiki, jQuery);

// Will this work in global.js rather than wikia.js? Let's find out. GLOBAL ALL THE THINGS. Array.from(document.querySelectorAll('.featured-video-wrapper')).forEach(x=>x.parentNode.removeChild(x))

//