2016-04-19 12:45:09 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* RevisionSlider extension hooks
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
|
|
|
* @license GPL-2.0+
|
|
|
|
*/
|
|
|
|
class RevisionSliderHooks {
|
2016-04-28 10:18:52 +00:00
|
|
|
|
2016-05-03 11:29:02 +00:00
|
|
|
public static function onDiffViewHeader(
|
|
|
|
DifferenceEngine $diff,
|
|
|
|
Revision $oldRev,
|
|
|
|
Revision $newRev
|
|
|
|
) {
|
|
|
|
$out = RequestContext::getMain()->getOutput();
|
2016-05-03 11:44:01 +00:00
|
|
|
$out->addModules( 'ext.RevisionSlider.init' );
|
|
|
|
$out->addHTML( '<div id="revision-slider-container" style="min-height: 150px;">' );
|
2016-05-03 11:36:34 +00:00
|
|
|
$placeHolder = ( new Message( 'revisionslider-loading-placeholder' ) )->parse();
|
|
|
|
$out->addHTML(
|
|
|
|
'<p id="revision-slider-placeholder" style="text-align: center">' . $placeHolder. '</p>'
|
|
|
|
);
|
2016-05-03 12:10:41 +00:00
|
|
|
$noScriptMessage = ( new Message( 'revisionslider-loading-noscript' ) )->parse();
|
|
|
|
$out->addHTML(
|
|
|
|
'<noscript><p style="text-align: center" >' . $noScriptMessage . '</p></noscript>'
|
|
|
|
);
|
2016-05-03 11:36:34 +00:00
|
|
|
$out->addHTML( '</div>' );
|
2016-05-03 11:29:02 +00:00
|
|
|
}
|
|
|
|
|
2016-04-28 10:18:52 +00:00
|
|
|
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;
|
|
|
|
}
|
2016-04-19 12:45:09 +00:00
|
|
|
}
|