Created
March 31, 2015 23:37
-
-
Save jdlrobson/9952d2939abdae72ede2 to your computer and use it in GitHub Desktop.
GatherPowerAdminTool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jshint unused:vars */ | |
( function ( M, $ ) { | |
function init() { | |
var collection = mw.config.get( 'wgGatherCollections' ); | |
if ( collection[0] ) { | |
collection = collection[0]; | |
} | |
mw.loader.using( 'ext.gather.watchstar' ).done( function() { | |
$( '<button class="mw-ui-button mw-ui-destructive">OH NOOOO! Hide it!</button>' ) | |
.on( 'click', function () { | |
var api, | |
Api = M.require( 'ext.gather.watchstar/CollectionsApi' ), | |
promptRes = window.confirm( 'Are you sure this collection warrants hiding?' ); | |
if ( promptRes ) { | |
Api = | |
api = new Api(); | |
api.hideCollection( collection.id ).done( function () { | |
$( '#content_wrapper' ).empty().append( | |
$( '<img>' ).attr( 'src', 'https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Censored_rubber_stamp.svg/550px-Censored_rubber_stamp.svg.png' ) | |
) | |
} ); | |
} | |
} ) | |
.css( { display: 'block', margin: 'auto' } ) | |
.prependTo( '#content_wrapper' ); | |
} ); | |
} | |
if ( mw.config.get( 'wgTitle' ).indexOf( 'Gather' ) === 0 & | |
mw.config.get( 'wgNamespaceNumber' ) === -1 ) { | |
init(); | |
} | |
}( mw.mobileFrontend, jQuery ) ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment