mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Remove obsolete browser support checks for HTML5 History API
It is available in all browsers we support. Change-Id: I6c860eadd91e6e4061ed0364be0dc8c7b750d3e7
This commit is contained in:
parent
237ffde471
commit
133cacc42d
|
@ -236,13 +236,9 @@
|
|||
|
||||
function loadTitle( title, importTitle ) {
|
||||
var specialTitle = mw.Title.newFromText( 'Special:CollabPad/' + title.toString() );
|
||||
if ( history.pushState ) {
|
||||
// TODO: Handle popstate
|
||||
history.pushState( { tag: 'collabTarget', title: title.toString() }, '', specialTitle.getUrl() );
|
||||
showPage( title, importTitle );
|
||||
} else {
|
||||
location.href = specialTitle.getUrl( { import: importTitle } );
|
||||
}
|
||||
// TODO: Handle popstate
|
||||
history.pushState( { tag: 'collabTarget', title: title.toString() }, '', specialTitle.getUrl() );
|
||||
showPage( title, importTitle );
|
||||
}
|
||||
|
||||
function getRandomTitle() {
|
||||
|
@ -326,9 +322,7 @@
|
|||
} );
|
||||
|
||||
// Tag current state
|
||||
if ( history.replaceState ) {
|
||||
history.replaceState( { tag: 'collabTarget', title: pageName }, '', location.href );
|
||||
}
|
||||
history.replaceState( { tag: 'collabTarget', title: pageName }, '', location.href );
|
||||
window.addEventListener( 'popstate', function ( e ) {
|
||||
if ( e.state && e.state.tag === 'collabTarget' ) {
|
||||
if ( e.state.title ) {
|
||||
|
|
|
@ -71,13 +71,11 @@ ve.init.mw.DesktopArticleTarget = function VeInitMwDesktopArticleTarget( config
|
|||
.addClass( 've-init-mw-desktopArticleTarget' )
|
||||
.append( this.$originalContent );
|
||||
|
||||
if ( history.replaceState ) {
|
||||
// We replace the current state with one that's marked with our tag. This way, when users
|
||||
// use the Back button to exit the editor we can restore Read mode. This is because we want
|
||||
// to ignore foreign states in onWindowPopState. Without this, the Read state is foreign.
|
||||
// FIXME: There should be a much better solution than this.
|
||||
history.replaceState( this.popState, '', this.currentUri );
|
||||
}
|
||||
// We replace the current state with one that's marked with our tag. This way, when users
|
||||
// use the Back button to exit the editor we can restore Read mode. This is because we want
|
||||
// to ignore foreign states in onWindowPopState. Without this, the Read state is foreign.
|
||||
// FIXME: There should be a much better solution than this.
|
||||
history.replaceState( this.popState, '', this.currentUri );
|
||||
|
||||
this.setupSkinTabs();
|
||||
|
||||
|
@ -1086,7 +1084,6 @@ ve.init.mw.DesktopArticleTarget.prototype.updateHistoryState = function () {
|
|||
// permalink then it will be there already and the constructor called #activate)
|
||||
if (
|
||||
!this.actFromPopState &&
|
||||
history.pushState &&
|
||||
(
|
||||
this.currentUri.query.veaction !== veaction ||
|
||||
this.currentUri.query.section !== section
|
||||
|
@ -1132,7 +1129,7 @@ ve.init.mw.DesktopArticleTarget.prototype.restorePage = function () {
|
|||
this.emit( 'restorePage' );
|
||||
|
||||
// Push article url into history
|
||||
if ( !this.actFromPopState && history.pushState ) {
|
||||
if ( !this.actFromPopState ) {
|
||||
// Remove the VisualEditor query parameters
|
||||
var uri = this.currentUri;
|
||||
if ( 'veaction' in uri.query ) {
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
active = false;
|
||||
updateTabs( false );
|
||||
// Push read tab URL to history
|
||||
if ( history.pushState && $( '#ca-view a' ).length ) {
|
||||
if ( $( '#ca-view a' ).length ) {
|
||||
history.pushState( { tag: 'visualeditor' }, '', new mw.Uri( $( '#ca-view a' ).attr( 'href' ) ) );
|
||||
}
|
||||
clearLoading();
|
||||
|
@ -636,14 +636,12 @@
|
|||
|
||||
if ( !active ) {
|
||||
if ( uri.query.action !== 'edit' && !( uri.query.veaction in veactionToMode ) ) {
|
||||
if ( history.pushState ) {
|
||||
// Replace the current state with one that is tagged as ours, to prevent the
|
||||
// back button from breaking when used to exit VE. FIXME: there should be a better
|
||||
// way to do this. See also similar code in the DesktopArticleTarget constructor.
|
||||
history.replaceState( { tag: 'visualeditor' }, '', uri );
|
||||
// Set action=edit or veaction=edit/editsource
|
||||
history.pushState( { tag: 'visualeditor' }, '', mode === 'source' ? veEditSourceUri : veEditUri );
|
||||
}
|
||||
// Replace the current state with one that is tagged as ours, to prevent the
|
||||
// back button from breaking when used to exit VE. FIXME: there should be a better
|
||||
// way to do this. See also similar code in the DesktopArticleTarget constructor.
|
||||
history.replaceState( { tag: 'visualeditor' }, '', uri );
|
||||
// Set action=edit or veaction=edit/editsource
|
||||
history.pushState( { tag: 'visualeditor' }, '', mode === 'source' ? veEditSourceUri : veEditUri );
|
||||
|
||||
// Update mw.Uri instance
|
||||
uri = veEditUri;
|
||||
|
@ -1257,14 +1255,12 @@
|
|||
|
||||
if ( !active ) {
|
||||
if ( uri.query.action !== 'edit' && !( uri.query.veaction in veactionToMode ) ) {
|
||||
if ( history.pushState ) {
|
||||
// Replace the current state with one that is tagged as ours, to prevent the
|
||||
// back button from breaking when used to exit VE. FIXME: there should be a better
|
||||
// way to do this. See also similar code in the DesktopArticleTarget constructor.
|
||||
history.replaceState( { tag: 'visualeditor' }, '', uri );
|
||||
// Use linkUri
|
||||
history.pushState( { tag: 'visualeditor' }, '', linkUri );
|
||||
}
|
||||
// Replace the current state with one that is tagged as ours, to prevent the
|
||||
// back button from breaking when used to exit VE. FIXME: there should be a better
|
||||
// way to do this. See also similar code in the DesktopArticleTarget constructor.
|
||||
history.replaceState( { tag: 'visualeditor' }, '', uri );
|
||||
// Use linkUri
|
||||
history.pushState( { tag: 'visualeditor' }, '', linkUri );
|
||||
}
|
||||
// Update mw.Uri instance
|
||||
uri = linkUri;
|
||||
|
@ -1706,9 +1702,7 @@
|
|||
|
||||
delete uri.query.venotify;
|
||||
// Get rid of the ?venotify= from the URL
|
||||
if ( history.replaceState ) {
|
||||
history.replaceState( null, '', uri );
|
||||
}
|
||||
history.replaceState( null, '', uri );
|
||||
}
|
||||
} );
|
||||
}() );
|
||||
|
|
|
@ -94,10 +94,8 @@
|
|||
} );
|
||||
}
|
||||
|
||||
if ( history.replaceState ) {
|
||||
uri.query.diffmode = mode;
|
||||
history.replaceState( history.state, '', uri );
|
||||
}
|
||||
uri.query.diffmode = mode;
|
||||
history.replaceState( history.state, '', uri );
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue