mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-23 10:29:11 +00:00
Prefix browser title while replying/starting a new topic
We already do this while editing so that users can quickly see which tabs they are actively working on. This extends the functionality to the reply and new topic tools. Bug: T262066 Change-Id: Iae662ad26072617aad71e519bb6c3cbb19ef1246
This commit is contained in:
parent
22825f06e6
commit
40bd58859e
|
@ -119,6 +119,8 @@
|
|||
"discussiontools-newtopic-legacy-hint",
|
||||
"discussiontools-newtopic-placeholder-title",
|
||||
"discussiontools-newtopic-missing-title",
|
||||
"discussiontools-pagetitle-newtopic",
|
||||
"discussiontools-pagetitle-reply",
|
||||
"discussiontools-replylink",
|
||||
"discussiontools-replywidget-loading",
|
||||
"discussiontools-replywidget-watchthis",
|
||||
|
@ -135,6 +137,7 @@
|
|||
"discussiontools-topicsubscription-notify-unsubscribed-body",
|
||||
"discussiontools-topicsubscription-notify-unsubscribed-title",
|
||||
"minerva-talk-full-page",
|
||||
"pagetitle",
|
||||
"skin-view-edit"
|
||||
],
|
||||
"targets": [
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
"discussiontools-notification-subscribed-new-comment-view": "View comment",
|
||||
"discussiontools-pageframe-latestcomment": "Latest comment: $1 by $2 in topic $3",
|
||||
"discussiontools-pageframe-latestcomment-notopic": "Latest comment: $1 by $2",
|
||||
"discussiontools-pagetitle-newtopic": "Starting new topic on $1",
|
||||
"discussiontools-pagetitle-reply": "Replying on $1",
|
||||
"discussiontools-postedit-confirmation-published": "Your comment was published.",
|
||||
"discussiontools-postedit-confirmation-topicadded": "Your topic was added.",
|
||||
"discussiontools-preference-autotopicsub": "Automatically subscribe to topics",
|
||||
|
|
|
@ -69,6 +69,8 @@
|
|||
"discussiontools-notification-subscribed-new-comment-view": "Label for button to view a comment that was just posted.",
|
||||
"discussiontools-pageframe-latestcomment": "Label showing when the most recent comment was posted on a page. Parameter:\n* $1 – when the comment was posted, e.g. '1 hour ago'\n*2 – The user who posted the comment\n*3 – The title of the topic they posted in\n\nSee also: {{mw-msg|discussiontools-pageframe-latestcomment-notopic}}",
|
||||
"discussiontools-pageframe-latestcomment-notopic": "Label showing when the most recent comment was posted on a page, but in a section with no topic heading. Parameter:\n* $1 – when the comment was posted, e.g. '1 hour ago'\n*2 – The user who posted the comment\n\nSee also: {{mw-msg|discussiontools-pageframe-latestcomment}}",
|
||||
"discussiontools-pagetitle-newtopic": "Shown as page title when starting a new topic on a talk page. Parameters:\n* $1 - the name of the page the user is starting a new topic on. e.g. \"Starting new topic on Talk:Main Page\"\n{{Related|discussiontools-pagetitle-reply}}",
|
||||
"discussiontools-pagetitle-reply": "Shown as page title when composing a reply on a talk page. Parameters:\n* $1 - the name of the page the user is replying on. e.g. \"Replying on Talk:Main Page\"\n{{Related|discussiontools-pagetitle-newtopic}}",
|
||||
"discussiontools-postedit-confirmation-published": "{{gender}}\nSuccess message shown after a user publishes a comment on a page. Parameters:\n* $1 - the current user, for GENDER support\n\nSee also: {{msg-mw|postedit-confirmation-published}}",
|
||||
"discussiontools-postedit-confirmation-topicadded": "{{gender}}\nSuccess message shown after a user adds a new topic on a page. Parameters:\n* $1 - the current user, for GENDER support\n\nSee also: {{msg-mw|postedit-confirmation-published}}",
|
||||
"discussiontools-preference-autotopicsub": "Used in [[Special:Preferences]].\n\nUsed as label for checkbox to enable automatic topic subscription.\n\nThe help text for this checkbox is: {{msg-mw|discussiontools-preference-autotopicsub-help}}",
|
||||
|
|
|
@ -196,11 +196,13 @@ ReplyLinksController.prototype.focusLink = function ( $linkSet ) {
|
|||
ReplyLinksController.prototype.setActiveLink = function ( $linkSet ) {
|
||||
this.$activeLink = $linkSet;
|
||||
|
||||
var isNewTopic = false;
|
||||
var activeButton;
|
||||
if ( this.$activeLink.is( this.$replyLinkSets ) ) {
|
||||
this.$activeLink.addClass( 'ext-discussiontools-init-replylink-active' );
|
||||
activeButton = OO.ui.infuse( this.$activeLink.find( '.ext-discussiontools-init-replybutton' ) );
|
||||
} else if ( this.$addSectionLink && this.$activeLink.is( this.$addSectionLink ) ) {
|
||||
isNewTopic = true;
|
||||
// eslint-disable-next-line no-jquery/no-global-selector
|
||||
$( '#ca-addsection' ).addClass( 'selected' );
|
||||
// eslint-disable-next-line no-jquery/no-global-selector
|
||||
|
@ -209,6 +211,17 @@ ReplyLinksController.prototype.setActiveLink = function ( $linkSet ) {
|
|||
$( '#ca-view' ).removeClass( 'selected' );
|
||||
}
|
||||
|
||||
this.originalDocumentTitle = document.title;
|
||||
var title = mw.Title.newFromText( mw.config.get( 'wgRelevantPageName' ) );
|
||||
document.title = mw.msg( 'pagetitle',
|
||||
mw.msg(
|
||||
isNewTopic ?
|
||||
'discussiontools-pagetitle-newtopic' :
|
||||
'discussiontools-pagetitle-reply',
|
||||
title.getPrefixedText()
|
||||
)
|
||||
);
|
||||
|
||||
this.$pageContainer.addClass( 'ext-discussiontools-init-replylink-open' );
|
||||
this.$replyLinkSets.each( function () {
|
||||
var replyButton = infuseOrDummy( $( this ).find( '.ext-discussiontools-init-replybutton' ) );
|
||||
|
@ -241,6 +254,10 @@ ReplyLinksController.prototype.clearActiveLink = function () {
|
|||
$( '#ca-view' ).addClass( 'selected' );
|
||||
}
|
||||
|
||||
if ( this.originalDocumentTitle ) {
|
||||
document.title = this.originalDocumentTitle;
|
||||
}
|
||||
|
||||
this.$pageContainer.removeClass( 'ext-discussiontools-init-replylink-open' );
|
||||
this.$replyLinkSets.each( function () {
|
||||
var replyButton = infuseOrDummy( $( this ).find( '.ext-discussiontools-init-replybutton' ) );
|
||||
|
|
Loading…
Reference in a new issue