14,091
edits
(SV) |
(Trying an old version) |
||
Line 16: | Line 16: | ||
Twinkle.talkback = function() { | Twinkle.talkback = function() { | ||
if ( | if ( Morebits.getPageAssociatedUser() === false ) { | ||
return; | return; | ||
} | } | ||
Line 24: | Line 24: | ||
Twinkle.talkback.callback = function( ) { | Twinkle.talkback.callback = function( ) { | ||
if( | if( Morebits.getPageAssociatedUser() === 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" | ||
}, | }, | ||
{ | { | ||
Line 85: | Line 81: | ||
// Check whether the user has opted out from talkback | // Check whether the user has opted out from talkback | ||
var query = { | // TODO: wgCategories is only set on action=view (bug 45033) | ||
var wgcat = mw.config.get("wgCategories"); | |||
if (wgcat.length && wgcat.indexOf("Users who do not wish to receive talkbacks") === -1) { | |||
Twinkle.talkback.optout = false; | |||
} else { | |||
var query = { | |||
action: 'query', | |||
prop: 'extlinks', | |||
titles: mw.config.get('wgPageName'), | |||
elquery: 'userjs.invalid/noTalkback', | |||
ellimit: '1' | |||
}; | |||
var wpapi = new Morebits.wiki.api("Fetching talkback opt-out status", query, Twinkle.talkback.callback.optoutStatus); | |||
wpapi.post(); | |||
} | |||
}; | }; | ||
Line 103: | Line 105: | ||
if ($el.length) { | if ($el.length) { | ||
Twinkle.talkback.optout = | Twinkle.talkback.optout = Morebits.getPageAssociatedUser() + " prefers not to receive talkbacks"; | ||
var url = $el.text(); | var url = $el.text(); | ||
if (url.indexOf("reason=") > -1) { | if (url.indexOf("reason=") > -1) { | ||
Line 177: | Line 179: | ||
value: prev_page | value: prev_page | ||
}); | }); | ||
work_area.append({ | work_area.append({ | ||
type:"input", | type:"input", | ||
Line 190: | Line 192: | ||
type: "select", | type: "select", | ||
name: "noticeboard", | name: "noticeboard", | ||
label: "Noticeboard:" | label: "Noticeboard:" | ||
}); | }); | ||
noticeboard.append({ | noticeboard.append({ | ||
Line 209: | Line 202: | ||
type: "option", | type: "option", | ||
label: "WP:AN3 (Administrators' noticeboard/Edit warring)", | label: "WP:AN3 (Administrators' noticeboard/Edit warring)", | ||
selected: true, | |||
value: "an3" | value: "an3" | ||
}); | }); | ||
Line 216: | Line 210: | ||
selected: true, | selected: true, | ||
value: "ani" | value: "ani" | ||
}); | }); | ||
noticeboard.append({ | noticeboard.append({ | ||
Line 235: | Line 223: | ||
noticeboard.append({ | noticeboard.append({ | ||
type: "option", | type: "option", | ||
label: "WP: | label: "WP:OTRS/N (OTRS noticeboard)", | ||
value: " | value: "otrs" | ||
}); | }); | ||
noticeboard.append({ | noticeboard.append({ | ||
type: "option", | type: "option", | ||
label: "WP: | label: "WP:HD (Help desk)", | ||
value: " | value: "hd" | ||
}); | }); | ||
noticeboard.append({ | noticeboard.append({ | ||
Line 270: | Line 258: | ||
value: prev_page | value: prev_page | ||
}); | }); | ||
work_area.append({ | work_area.append({ | ||
type:"input", | type:"input", | ||
Line 285: | Line 273: | ||
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; | break; | ||
Line 325: | Line 297: | ||
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 ] + ":" + Morebits.getPageAssociatedUser(); | ||
if( tbtarget === "usertalk" || tbtarget === "other | if( tbtarget === "usertalk" || tbtarget === "other" ) { | ||
page = e.target.page.value; | page = e.target.page.value; | ||
if( tbtarget === "usertalk" ) { | if( tbtarget === "usertalk" ) { | ||
if( !page ) { | if( !page ) { | ||
Line 362: | Line 334: | ||
if ( tbtarget === "notice" ) { | if ( tbtarget === "notice" ) { | ||
switch (page) { | switch (page) { | ||
case "an": | case "an": | ||
text = "\n\n== " + Twinkle.getFriendlyPref("adminNoticeHeading") + " ==\n"; | text = "\n\n== " + Twinkle.getFriendlyPref("adminNoticeHeading") + " ==\n"; | ||
text += "{{subst:ANI-notice|thread=" + section + "|noticeboard= | text += "{{subst:ANI-notice|thread=" + section + "|noticeboard=Sarkarverse:Administrators' noticeboard}} ~~~~"; | ||
talkpage.setEditSummary( "Notice of discussion at [[ | talkpage.setEditSummary( "Notice of discussion at [[Sarkarverse:Administrators' noticeboard]]" + Twinkle.getPref("summaryAd") ); | ||
break; | break; | ||
case "an3": | case "an3": | ||
text = "\n\n{{subst:An3-notice|" + section + "}} ~~~~"; | text = "\n\n{{subst:An3-notice|" + section + "}} ~~~~"; | ||
talkpage.setEditSummary( "Notice of discussion at [[ | talkpage.setEditSummary( "Notice of discussion at [[Sarkarverse:Administrators' noticeboard/Edit warring]]" + Twinkle.getPref("summaryAd") ); | ||
break; | break; | ||
case "ani": | case "ani": | ||
text = "\n\n== " + Twinkle.getFriendlyPref("adminNoticeHeading") + " ==\n"; | text = "\n\n== " + Twinkle.getFriendlyPref("adminNoticeHeading") + " ==\n"; | ||
text += "{{subst:ANI-notice|thread=" + section + "|noticeboard= | text += "{{subst:ANI-notice|thread=" + section + "|noticeboard=Sarkarverse:Administrators' noticeboard/Incidents}} ~~~~"; | ||
talkpage.setEditSummary( "Notice of discussion at [[ | talkpage.setEditSummary( "Notice of discussion at [[Sarkarverse:Administrators' noticeboard/Incidents]]" + Twinkle.getPref("summaryAd") ); | ||
break; | break; | ||
case "coin": | case "coin": | ||
text = "\n\n{{subst:Coin-notice|thread=" + section + "}} ~~~~"; | text = "\n\n{{subst:Coin-notice|thread=" + section + "}} ~~~~"; | ||
talkpage.setEditSummary( "Notice of discussion at [[ | talkpage.setEditSummary( "Notice of discussion at [[Sarkarverse:Conflict of interest noticeboard]]" + Twinkle.getPref("summaryAd") ); | ||
break; | break; | ||
case "drn": | case "drn": | ||
text = "\n\n{{subst:DRN-notice|thread=" + section + "}} ~~~~"; | text = "\n\n{{subst:DRN-notice|thread=" + section + "}} ~~~~"; | ||
talkpage.setEditSummary( "Notice of discussion at [[ | talkpage.setEditSummary( "Notice of discussion at [[Sarkarverse:Dispute resolution noticeboard]]" + Twinkle.getPref("summaryAd") ); | ||
break; | break; | ||
case "hd": | case "hd": | ||
text = "\n\n== Your question at the Help desk ==\n"; | text = "\n\n== Your question at the Help desk ==\n"; | ||
text += "{{helpdeskreply|1=" + section + "|ts=~~~~~}}"; | text += "{{helpdeskreply|1=" + section + "|ts=~~~~~}}"; | ||
talkpage.setEditSummary( "You have replies at the [[ | talkpage.setEditSummary( "You have replies at the [[Sarkarverse:Help desk|Wikipedia help desk]]" + Twinkle.getPref("summaryAd") ); | ||
break; | break; | ||
case "otrs": | case "otrs": | ||
text = "\n\n{{OTRSreply|1=" + section + "|2=~~~~}}"; | text = "\n\n{{OTRSreply|1=" + section + "|2=~~~~}}"; | ||
talkpage.setEditSummary( "You have replies at the [[ | talkpage.setEditSummary( "You have replies at the [[Sarkarverse:OTRS noticeboard|OTRS noticeboard]]" + Twinkle.getPref("summaryAd") ); | ||
break; | break; | ||
case "th": | case "th": | ||
text = "\n\n== Teahouse talkback: you've got messages! ==\n{{WP:Teahouse/Teahouse talkback|WP:Teahouse/Questions|" + section + "|ts=~~~~}}"; | text = "\n\n== Teahouse talkback: you've got messages! ==\n{{WP:Teahouse/Teahouse talkback|WP:Teahouse/Questions|" + section + "|ts=~~~~}}"; | ||
talkpage.setEditSummary( "You have replies at the [[ | talkpage.setEditSummary( "You have replies at the [[Sarkarverse:Teahouse/Questions|Teahouse question board]]" + Twinkle.getPref("summaryAd") ); | ||
break; | break; | ||
default: | default: | ||
Line 417: | Line 385: | ||
talkpage.setEditSummary("Notification: You've got mail" + Twinkle.getPref("summaryAd")); | talkpage.setEditSummary("Notification: You've got mail" + 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 | |||
text = "\n\n==" + Twinkle.getFriendlyPref("talkbackHeading").replace( /^\s*=+\s*(.*?)\s*=+$\s*/, "$1" ) + "==\n{{talkback|"; | text = "\n\n==" + Twinkle.getFriendlyPref("talkbackHeading").replace( /^\s*=+\s*(.*?)\s*=+$\s*/, "$1" ) + "==\n{{talkback|"; | ||
text += tbPageName; | text += tbPageName; | ||
Line 443: | Line 402: | ||
} | } | ||
talkpage.setEditSummary("Talkback ([[" + (tbtarget === "other" ? "" : "User talk:") + tbPageName + | |||
(section ? ("#" + section) : "") + "]])" + Twinkle.getPref("summaryAd")); | |||
} | } | ||