Skip to content

Instantly share code, notes, and snippets.

@jdlrobson
Created March 31, 2015 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdlrobson/9952d2939abdae72ede2 to your computer and use it in GitHub Desktop.
Save jdlrobson/9952d2939abdae72ede2 to your computer and use it in GitHub Desktop.
GatherPowerAdminTool
/*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