MediaWiki:Gadget-friendlytalkback.js: Difference between revisions
Content added Content deleted
imported>Amalthea (v2.0-675-gf30bb99: welcome: Add {{welcometest}}; talkback: Add AFC help desk talkbacks) |
imported>Amalthea (v2.0-689-g073eb2e: talkback: Add {{please see}}; protect: Make tag expiry work for PC protection. Update protection templates; warn: Use {{{2}}} parameter for extra message; morebits: use wgRelevantUserName to get user) |
||
Line 16: | Line 16: | ||
Twinkle.talkback = function() { |
Twinkle.talkback = function() { |
||
if ( !mw.config.get('wgRelevantUserName') ) { |
|||
if ( Morebits.getPageAssociatedUser() === false ) { |
|||
return; |
return; |
||
} |
} |
||
Line 24: | Line 24: | ||
Twinkle.talkback.callback = function( ) { |
Twinkle.talkback.callback = function( ) { |
||
if( |
if( mw.config.get('wgRelevantUserName') === mw.config.get("wgUserName") && !confirm("Is it really so bad that you're talking back to yourself?") ){ |
||
return; |
return; |
||
} |
} |
||
Line 50: | Line 50: | ||
label: "Talkback: other page", |
label: "Talkback: other page", |
||
value: "other" |
value: "other" |
||
}, |
|||
{ |
|||
label: "\"Please see\"", |
|||
value: "see" |
|||
}, |
}, |
||
{ |
{ |
||
Line 105: | Line 109: | ||
if ($el.length) { |
if ($el.length) { |
||
Twinkle.talkback.optout = |
Twinkle.talkback.optout = mw.config.get('wgRelevantUserName') + " prefers not to receive talkbacks"; |
||
var url = $el.text(); |
var url = $el.text(); |
||
if (url.indexOf("reason=") > -1) { |
if (url.indexOf("reason=") > -1) { |
||
Line 287: | Line 291: | ||
label:"Subject of email (optional)", |
label:"Subject of email (optional)", |
||
tooltip:"The subject line of the email you sent." |
tooltip:"The subject line of the email you sent." |
||
}); |
|||
break; |
|||
case "see": |
|||
work_area.append({ |
|||
type:"input", |
|||
name:"page", |
|||
label:"Full page name", |
|||
tooltip:"The full page name of where the discussion is being held. For example: 'Wikipedia talk:Twinkle'.", |
|||
value: prev_page |
|||
}); |
|||
work_area.append({ |
|||
type:"input", |
|||
name:"section", |
|||
label:"Linked section (optional)", |
|||
tooltip:"The section heading where the discussion is being held. For example: 'Merge proposal'.", |
|||
value: prev_section |
|||
}); |
}); |
||
break; |
break; |
||
Line 311: | Line 331: | ||
var page = null; |
var page = null; |
||
var section = e.target.section.value; |
var section = e.target.section.value; |
||
var fullUserTalkPageName = mw.config.get("wgFormattedNamespaces")[ mw.config.get("wgNamespaceIds").user_talk ] + ":" + |
var fullUserTalkPageName = mw.config.get("wgFormattedNamespaces")[ mw.config.get("wgNamespaceIds").user_talk ] + ":" + mw.config.get('wgRelevantUserName'); |
||
if( tbtarget === "usertalk" || tbtarget === "other" ) { |
if( tbtarget === "usertalk" || tbtarget === "other" || tbtarget === "see" ) { |
||
page = e.target.page.value; |
page = e.target.page.value; |
||
Line 402: | Line 422: | ||
talkpage.setEditSummary("Notification: You've got mail" + Twinkle.getPref("summaryAd")); |
talkpage.setEditSummary("Notification: You've got mail" + Twinkle.getPref("summaryAd")); |
||
} else if ( tbtarget === "see" ) { |
|||
text = "\n\n{{subst:Please see|location=" + tbPageName; |
|||
if (section) { |
|||
text += "#" + section; |
|||
} |
|||
text += "|more=" + message.trim() + "}}"; |
|||
talkpage.setEditSummary("Please check the discussion at [[" + tbPageName + "#" + section + "]]" + Twinkle.getPref("summaryAd")); |
|||
} else { |
} else { |
||
//clean talkback heading: strip section header markers, were erroneously suggested in the documentation |
//clean talkback heading: strip section header markers, were erroneously suggested in the documentation |