RAZVOR has uploaded a new change for review.
https://gerrit.wikimedia.org/r/97363
Change subject: nc
......................................................................
nc
Change-Id: I1a81d16d6a7ed76658674396d0568c415326a8bf
---
M resources/mediawiki.page/mediawiki.page.image.pagination.js
1 file changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/63/97363/1
diff --git a/resources/mediawiki.page/mediawiki.page.image.pagination.js
b/resources/mediawiki.page/mediawiki.page.image.pagination.js
index 34a11dd..9377208 100755
--- a/resources/mediawiki.page/mediawiki.page.image.pagination.js
+++ b/resources/mediawiki.page/mediawiki.page.image.pagination.js
@@ -7,8 +7,7 @@
// Use jQuery's load function to specifically select and replace
table.multipageimage's child
// tr with the new page's table.multipageimage's tr element.
// table.multipageimage always has only one row.
-
- function loadPage( page ) {
+ function loadPage( page, hist ) {
var $multipageimage = $( 'table.multipageimage' ),
$spinner = $.createSpinner( {
size: 'large',
@@ -27,6 +26,15 @@
page + ' table.multipageimage tr',
ajaxifyPageNavigation
);
+
+ // Add new page of image to history. To preserve the
back-forwards chain in the browser,
+ // if the user gets here via the back/forward button, don't
update the history.
+
+ history.pushState( { 'url': page }, document.title,
page );
+
+
+ // Fire hook because the page's content has changed
+ mw.hook( 'wikipage.content' ).fire( $multipageimage );
}
function ajaxifyPageNavigation() {
@@ -47,6 +55,19 @@
// The presence of table.multipageimage signifies that this
file is a multi-page image
if( mw.config.get( 'wgNamespaceNumber' ) === 6 && $(
'table.multipageimage' ).length !== 0 ) {
ajaxifyPageNavigation();
+
+ // Set up history.pustState (if available), so that
when the user browses to a new page of
+ // the same file, the browser's history is updated. If
the user clicks the back/forward button
+ // in the midst of navigating a file's pages, load the
page inline.
+
+ history.replaceState( { url:
window.location.href }, '' );
+ $( window ).on( 'popstate', function ( e ) {
+ var state = e.originalEvent.state;
+ if ( state ) {
+ loadPage( state.url, true );
+ }
+ });
+
}
} );
}( mediaWiki, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/97363
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a81d16d6a7ed76658674396d0568c415326a8bf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: RAZVOR <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits