User:Writ Keeper/Scripts/teahouseTalkbackLink.js: Difference between revisions

Content deleted Content added
m addAfter
phase 2
Line 18:
if(link.href.substring(28,39) == "/User_talk:" && link.href.lastIndexOf("/") == 28)
{
var newLink = document.createElement("aform");
newLink.hrefmethod = link.href"post";
newLink.action = link.href + "?action=submit&section=new&preloadTitle=Teahouse%20Talkback";
newLink.innerHTML = "TB";
newLink.style.fontSizeid = "x-smallTBSubmit" + i;
newLink.innerHTML = '<a href="#" onclick="talkbackSubmit(' + i + '); return;" style="font-size:x-small;" title="Send a talkback!">TB</a>';
addAfter(newLink, link);
i++;
Line 30 ⟶ 31:
}
}
 
function talkbackSubmit(i)
{
var date = new Date();
submitForm = document.getElementById("TBSubmit" + i);
submitForm.innerHTML = '<input type="hidden" name="wpTextbox1" value="{{Wikipedia:Teahouse/Invitation|}}">\n<input type="hidden" name="wpSection" value="new">\n<input type="hidden" name="wpEditToken" value="' + mw.user.tokens.get( 'editToken' ) + '">\n<input type="hidden" name="wpStarttime" value="' + date.getYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds()'">\n<input type="hidden" name="wpEdittime" value="' + date.getYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds()'">\n<input type="hidden" name="wpSummary" value="Teahouse talkback: you\'ve got messages!">';
submitForm.submit();
}
 
function addAfter(newNode, oldNode)
{