User:Matma Rex/rater-ve.js

importScript( 'User:Kephir/gadgets/rater.js' );

mw.loader.using( 'ext.visualEditor.desktopArticleTarget.init', function {	mw.libs.ve.addPlugin( function  { // Define a command that opens the Rater popup ve.ui.KephirRater = function VeUiMyWarningPopupCommand { ve.ui.KephirRater.super.call( this, 'kephirRater' ); };		OO.inheritClass( ve.ui.KephirRater, ve.ui.Command ); ve.ui.KephirRater.prototype.execute = function { $( '#p-kephir-rater' ).click; return true; };		ve.ui.commandRegistry.register( new ve.ui.KephirRater );

// Define a tool that runs the command ve.ui.KephirRaterTool = function VeUiKephirRaterTool { ve.ui.KephirRaterTool.super.apply( this, arguments ); };		OO.inheritClass( ve.ui.KephirRaterTool, ve.ui.Tool ); ve.ui.KephirRaterTool.static.name = 'kephirRater'; ve.ui.KephirRaterTool.static.title = 'Assess article using Rater'; // TODO: The tool appears under the 'Insert' menu, which makes no sense. // Unfortunately there is currently no way to place it somewhere more sensible // (the only other options are even sillier, like the text style menu). ve.ui.KephirRaterTool.static.group = 'insert'; ve.ui.KephirRaterTool.static.commandName = 'kephirRater'; ve.ui.toolFactory.register( ve.ui.KephirRaterTool ); } ); } );