Content deleted Content added
Writ Keeper (talk | contribs) feex |
Writ Keeper (talk | contribs) rm span |
||
(6 intermediate revisions by the same user not shown) | |||
Line 11:
{
var $link = $($nodeList[i]);
var newLinkString = "
var
var newLinkHref = $link[0].title
if(newLinkHref.includes(pdne))
{▼
redlink = true;
newLinkHref = newLinkHref.replace(pdne, "");
}▼
var newLinkId = "TBsubmit" + i;
newLinkString += '<a href=' + (($link[0].href).replace("User_talk:", "Special:Contributions/")) + ' style="font-size:x-small; display:inline-block;">C</a>|'
newLinkString += '<a
$($link).after(newLinkString)
$("#" + newLinkId).click(
▲ {
}
}
}
}
function talkbackSubmit(
{
var page = event.data.page;
var redlink = event.data.redlink;
var questionTitle = prompt("Please enter the title of the question you're replying to (or just leave it blank):", ""),
sectionTitle = "{{Wikipedia:Teahouse/Teahouse talkback|WP:Teahouse|";
if (questionTitle === null)
{
Line 40 ⟶ 47:
sectionTitle += questionTitle + "|ts=~~" + "~~}}";
}
if(redlink)
{
var requestData =
minor: false,▼
text: sectionTitle,▼
section: 'new',▼
▲ summary: "Teahouse talkback: you've got messages!",
};▼
▲ {
success: function (data)▼
{
summary: "Teahouse talkback: you've got messages!"
if (data && data.edit && data.edit.result && data.edit.result === 'Success')▼
{▼
alert("Talkback posted!");▼
▲ }
else▼
{▼
alert('There was an error requesting the page edit. Code: ' + data.error.code + '": ' + data.error.info);▼
}▼
},▼
error: function ()▼
{▼
alert('There was an error using AJAX to edit the page.');▼
}
new mw.Api().create(page, requestData, sectionTitle).done(function(data)
▲ {
▲ {
▲ alert("Talkback posted!");
▲ }
▲ else
▲ {
alert('There was an error requesting the page create. Code: ' + data);
alert('There was an error using AJAX to create the page. Error: ' + data);
});
}
else
{
var requestData =
{
▲ minor: false,
▲ text: sectionTitle,
▲ section: 'new',
summary: "Teahouse talkback: you've got messages!"
new mw.Api().edit(page, function() {
return requestData;
if (data && data.result && data.result === 'Success')
{
alert("Talkback posted!");
}
else
{
▲ alert('There was an error requesting the page edit. Code: ' + data
}
}).fail(function(data) {
▲ alert('There was an error using AJAX to edit the page. Error: ' + data);
});
}
}
if (mw.config.get('wgPageName') === "Wikipedia:Teahouse")
{
mw.loader.using("mediawiki.api", function()
teahouseTalkbackLink();▼
{
▲ });
}
|