mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 17:51:09 +00:00
ReplyLinksController: url.searchParams -> searchParams
Cache the object property as we never use the rest of the URL. Change-Id: I1a0ec90b2a4366f126150469c72908ec22817d4f
This commit is contained in:
parent
62cff4900f
commit
fba7edbbeb
|
@ -144,7 +144,7 @@ ReplyLinksController.prototype.onAnyLinkClick = function ( e ) {
|
||||||
* @return {Object|null} `null` if not a new topic link, parameters otherwise
|
* @return {Object|null} `null` if not a new topic link, parameters otherwise
|
||||||
*/
|
*/
|
||||||
ReplyLinksController.prototype.parseNewTopicLink = function ( href ) {
|
ReplyLinksController.prototype.parseNewTopicLink = function ( href ) {
|
||||||
var url = new URL( href );
|
var searchParams = new URL( href ).searchParams;
|
||||||
|
|
||||||
var title = mw.Title.newFromText( utils.getTitleFromUrl( href ) || '' );
|
var title = mw.Title.newFromText( utils.getTitleFromUrl( href ) || '' );
|
||||||
if ( !title ) {
|
if ( !title ) {
|
||||||
|
@ -167,9 +167,9 @@ ReplyLinksController.prototype.parseNewTopicLink = function ( href ) {
|
||||||
} else if (
|
} else if (
|
||||||
// ?title=...&action=edit§ion=new
|
// ?title=...&action=edit§ion=new
|
||||||
// ?title=...&veaction=editsource§ion=new
|
// ?title=...&veaction=editsource§ion=new
|
||||||
( url.searchParams.get( 'action' ) === 'edit' || url.searchParams.get( 'veaction' ) === 'editsource' ) &&
|
( searchParams.get( 'action' ) === 'edit' || searchParams.get( 'veaction' ) === 'editsource' ) &&
|
||||||
url.searchParams.get( 'section' ) === 'new' &&
|
searchParams.get( 'section' ) === 'new' &&
|
||||||
url.searchParams.get( 'dtenable' ) !== '0'
|
searchParams.get( 'dtenable' ) !== '0'
|
||||||
) {
|
) {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
|
||||||
|
@ -184,21 +184,21 @@ ReplyLinksController.prototype.parseNewTopicLink = function ( href ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = {};
|
var data = {};
|
||||||
if ( url.searchParams.get( 'editintro' ) ) {
|
if ( searchParams.get( 'editintro' ) ) {
|
||||||
data.editintro = url.searchParams.get( 'editintro' );
|
data.editintro = searchParams.get( 'editintro' );
|
||||||
}
|
}
|
||||||
if ( url.searchParams.get( 'preload' ) ) {
|
if ( searchParams.get( 'preload' ) ) {
|
||||||
data.preload = url.searchParams.get( 'preload' );
|
data.preload = searchParams.get( 'preload' );
|
||||||
}
|
}
|
||||||
if ( mw.util.getArrayParam( 'preloadparams', url.searchParams ) ) {
|
if ( mw.util.getArrayParam( 'preloadparams', searchParams ) ) {
|
||||||
data.preloadparams = mw.util.getArrayParam( 'preloadparams', url.searchParams );
|
data.preloadparams = mw.util.getArrayParam( 'preloadparams', searchParams );
|
||||||
}
|
}
|
||||||
if ( url.searchParams.get( 'preloadtitle' ) ) {
|
if ( searchParams.get( 'preloadtitle' ) ) {
|
||||||
data.preloadtitle = url.searchParams.get( 'preloadtitle' );
|
data.preloadtitle = searchParams.get( 'preloadtitle' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle new topic with preloaded text only when requested (T269310)
|
// Handle new topic with preloaded text only when requested (T269310)
|
||||||
if ( !url.searchParams.get( 'dtpreload' ) && !$.isEmptyObject( data ) ) {
|
if ( !searchParams.get( 'dtpreload' ) && !$.isEmptyObject( data ) ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue