When JavaScript disabled do not show RevisionSlider

As suggested in a comment in T135198, do not show anything above the
diff when JavaScript disabled instead of always putting a message
there.

Change-Id: I1c66fa4a9fa6e90f8318de3a4f656d629000d9ca
This commit is contained in:
Leszek Manicki 2016-05-31 16:03:08 +02:00 committed by Addshore
parent 225f48ac52
commit f9d9a4a4b7
5 changed files with 7 additions and 11 deletions

View file

@ -38,6 +38,7 @@ class RevisionSliderHooks {
$out = RequestContext::getMain()->getOutput(); $out = RequestContext::getMain()->getOutput();
$out->addModules( 'ext.RevisionSlider.init' ); $out->addModules( 'ext.RevisionSlider.init' );
$out->addModuleStyles( 'ext.RevisionSlider.noscript' );
$out->addJsConfigVars( 'extRevisionSliderOldRev', $oldRev->getId() ); $out->addJsConfigVars( 'extRevisionSliderOldRev', $oldRev->getId() );
$out->addJsConfigVars( 'extRevisionSliderNewRev', $newRev->getId() ); $out->addJsConfigVars( 'extRevisionSliderNewRev', $newRev->getId() );
$out->addJsConfigVars( 'extRevisionSliderTimeOffset', intval( $timeOffset ) ); $out->addJsConfigVars( 'extRevisionSliderTimeOffset', intval( $timeOffset ) );
@ -55,15 +56,6 @@ class RevisionSliderHooks {
'style' => 'text-align: center', 'style' => 'text-align: center',
], ],
( new Message( 'revisionslider-loading-placeholder' ) )->parse() ( new Message( 'revisionslider-loading-placeholder' ) )->parse()
) .
Html::rawElement(
'noscript',
[],
Html::element(
'p',
[ 'style' => 'text-align: center' ],
( new Message( 'revisionslider-loading-noscript' ) )->parse()
)
) )
) )
); );

View file

@ -43,6 +43,9 @@
], ],
"position": "top" "position": "top"
}, },
"ext.RevisionSlider.noscript": {
"styles": "modules/ext.RevisionSlider.noscript.css"
},
"ext.RevisionSlider.fetchRevisions": { "ext.RevisionSlider.fetchRevisions": {
"scripts": [ "scripts": [
"modules/ext.RevisionSlider.fetchRevisions.js" "modules/ext.RevisionSlider.fetchRevisions.js"

View file

@ -15,7 +15,6 @@
"revisionslider-loading-placeholder": "The revision slider is loading.", "revisionslider-loading-placeholder": "The revision slider is loading.",
"revisionslider-loading-failed": "The revision slider failed to load.", "revisionslider-loading-failed": "The revision slider failed to load.",
"revisionslider-loading-out-of-range": "The revision slider failed to load as the requested revisions are not in the top 500 versions of the page.", "revisionslider-loading-out-of-range": "The revision slider failed to load as the requested revisions are not in the top 500 versions of the page.",
"revisionslider-loading-noscript": "As you have JavaScript disabled the revision slider will not be able to load.",
"revisionslider-arrow-tooltip-newer": "See newer revisions", "revisionslider-arrow-tooltip-newer": "See newer revisions",
"revisionslider-arrow-tooltip-older": "See older revisions" "revisionslider-arrow-tooltip-older": "See older revisions"
} }

View file

@ -16,7 +16,6 @@
"revisionslider-loading-placeholder": "Message shown while the RevisionSlider is still loading on a diff page. Once loaded the message is removed.", "revisionslider-loading-placeholder": "Message shown while the RevisionSlider is still loading on a diff page. Once loaded the message is removed.",
"revisionslider-loading-failed": "Message shown if the RevisionSlider fails to initially load.", "revisionslider-loading-failed": "Message shown if the RevisionSlider fails to initially load.",
"revisionslider-loading-out-of-range": "Message shown if the RevisionSlider fails to initially load due to revisions being requested that are not in the most recent 500 revisions.", "revisionslider-loading-out-of-range": "Message shown if the RevisionSlider fails to initially load due to revisions being requested that are not in the most recent 500 revisions.",
"revisionslider-loading-noscript": "Message shown while the RevisionSlider is trying to load but when JavaScript is disabled and thus it will not be successful.",
"revisionslider-arrow-tooltip-newer": "Text shown after hovering the button scrolling to newer revisions.", "revisionslider-arrow-tooltip-newer": "Text shown after hovering the button scrolling to newer revisions.",
"revisionslider-arrow-tooltip-older": "Text shown after hovering the button scrolling to older revisions." "revisionslider-arrow-tooltip-older": "Text shown after hovering the button scrolling to older revisions."
} }

View file

@ -0,0 +1,3 @@
.client-nojs #mw-revision-slider-container {
display: none;
}