mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 11:40:43 +00:00
8c6676f939
This pulls out some of the code around revisions into a decoupled and tested module. Change-Id: Ib2a4f96f0e0b9a96ec85d300d97cd52dcaffe89e
35 lines
846 B
PHP
Executable file
35 lines
846 B
PHP
Executable file
<?php
|
|
|
|
/**
|
|
* RevisionSlider extension hooks
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @license GPL-2.0+
|
|
*/
|
|
class RevisionSliderHooks {
|
|
public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
|
|
if ( self::isRevisionPage( $skin->getContext()->getRequest() ) ) {
|
|
$out->addModules( 'ext.RevisionSlider.init' );
|
|
}
|
|
}
|
|
|
|
private static function isRevisionPage( WebRequest $request ) {
|
|
return $request->getVal( 'action' ) === 'history' || $request->getVal( 'type' ) === 'revision';
|
|
}
|
|
|
|
public static function onResourceLoaderTestModules( array &$testModules, ResourceLoader $rl ) {
|
|
$testModules['qunit']['ext.RevisionSlider.tests'] = [
|
|
'scripts' => [
|
|
'tests/RevisionSlider.Revision.test.js',
|
|
],
|
|
'dependencies' => [
|
|
'ext.RevisionSlider.Revision'
|
|
],
|
|
'localBasePath' => __DIR__,
|
|
];
|
|
|
|
return true;
|
|
}
|
|
}
|