User:Syunsyunminmin/Twinkle/twinklexfd.js: Difference between revisions
Jump to navigation
Jump to search
-markXfdPagesAsPatrolled |
-ChangeTags |
||
Line 751: | Line 751: | ||
talk_page.setWatchlist(Twinkle.getPref('xfdWatchPage')); | talk_page.setWatchlist(Twinkle.getPref('xfdWatchPage')); | ||
talk_page.setFollowRedirect(true); // should never be needed, but if the article is moved, we would want to follow the redirect | talk_page.setFollowRedirect(true); // should never be needed, but if the article is moved, we would want to follow the redirect | ||
talk_page.setCallbackParameters(params); | talk_page.setCallbackParameters(params); | ||
talk_page.newSection(null, function() { | talk_page.newSection(null, function() { | ||
Line 927: | Line 926: | ||
usertalkpage.setAppendText(notifytext); | usertalkpage.setAppendText(notifytext); | ||
usertalkpage.setEditSummary(editSummary); | usertalkpage.setEditSummary(editSummary); | ||
usertalkpage.setCreateOption('recreate'); | usertalkpage.setCreateOption('recreate'); | ||
// Different pref for RfD target notifications | // Different pref for RfD target notifications | ||
Line 1,040: | Line 1,038: | ||
} | } | ||
usl.log(appendText, editsummary); | usl.log(appendText, editsummary); | ||
}, | }, | ||
Line 1,091: | Line 1,088: | ||
var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Adding deletion tag to article'); | var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Adding deletion tag to article'); | ||
wikipedia_page.setFollowRedirect(true); // should never be needed, but if the article is moved, we would want to follow the redirect | wikipedia_page.setFollowRedirect(true); // should never be needed, but if the article is moved, we would want to follow the redirect | ||
wikipedia_page.setCallbackParameters(apiobj.params); | wikipedia_page.setCallbackParameters(apiobj.params); | ||
wikipedia_page.load(Twinkle.xfd.callbacks.afd.taggingArticle); | wikipedia_page.load(Twinkle.xfd.callbacks.afd.taggingArticle); | ||
Line 1,175: | Line 1,171: | ||
pageobj.setPageText(Twinkle.xfd.callbacks.getDiscussionWikitext('afd', params)); | pageobj.setPageText(Twinkle.xfd.callbacks.getDiscussionWikitext('afd', params)); | ||
pageobj.setEditSummary('Creating deletion discussion page for [[:' + Morebits.pageNameNorm + ']]. | pageobj.setEditSummary('Creating deletion discussion page for [[:' + Morebits.pageNameNorm + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | ||
pageobj.setCreateOption('createonly'); | pageobj.setCreateOption('createonly'); | ||
Line 1,219: | Line 1,214: | ||
pageobj.setPageText(text); | pageobj.setPageText(text); | ||
pageobj.setEditSummary('Adding [[:' + params.discussionpage + ']]. | pageobj.setEditSummary('Adding [[:' + params.discussionpage + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchList')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchList')); | ||
pageobj.setCreateOption('recreate'); | pageobj.setCreateOption('recreate'); | ||
Line 1,229: | Line 1,223: | ||
var text = pageobj.getPageText().replace('directly below this line -->', 'directly below this line -->\n{{' + discussionPage + '}}'); | var text = pageobj.getPageText().replace('directly below this line -->', 'directly below this line -->\n{{' + discussionPage + '}}'); | ||
pageobj.setPageText(text); | pageobj.setPageText(text); | ||
pageobj.setEditSummary('Listing [[:' + discussionPage + ']]. | pageobj.setEditSummary('Listing [[:' + discussionPage + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setCreateOption('nocreate'); | pageobj.setCreateOption('nocreate'); | ||
pageobj.save(); | pageobj.save(); | ||
Line 1,375: | Line 1,368: | ||
if (pageobj.canEdit() && ['wikitext', 'sanitized-css'].indexOf(pageobj.getContentModel()) !== -1) { | if (pageobj.canEdit() && ['wikitext', 'sanitized-css'].indexOf(pageobj.getContentModel()) !== -1) { | ||
pageobj.setPageText(params.tagText + text); | pageobj.setPageText(params.tagText + text); | ||
pageobj.setEditSummary('Nominated for deletion; see [[:' + params.discussionpage + ']]. | pageobj.setEditSummary('Nominated for deletion; see [[:' + params.discussionpage + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | ||
if (params.scribunto) { | if (params.scribunto) { | ||
Line 1,404: | Line 1,396: | ||
if (pageobj.canEdit() && ['wikitext', 'sanitized-css'].indexOf(pageobj.getContentModel()) !== -1) { | if (pageobj.canEdit() && ['wikitext', 'sanitized-css'].indexOf(pageobj.getContentModel()) !== -1) { | ||
pageobj.setPageText(params.tagText + text); | pageobj.setPageText(params.tagText + text); | ||
pageobj.setEditSummary('Listed for merging with [[:' + params.otherTemplateName + ']]; see [[:' + params.discussionpage + ']]. | pageobj.setEditSummary('Listed for merging with [[:' + params.otherTemplateName + ']]; see [[:' + params.discussionpage + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | ||
if (params.scribunto) { | if (params.scribunto) { | ||
Line 1,436: | Line 1,427: | ||
pageobj.setPageText(text); | pageobj.setPageText(text); | ||
pageobj.setEditSummary('Adding ' + (params.xfdcat === 'tfd' ? 'deletion nomination' : 'merge listing') + ' of [[:' + Morebits.pageNameNorm + ']]. | pageobj.setEditSummary('Adding ' + (params.xfdcat === 'tfd' ? 'deletion nomination' : 'merge listing') + ' of [[:' + Morebits.pageNameNorm + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | ||
pageobj.setCreateOption('recreate'); | pageobj.setCreateOption('recreate'); | ||
Line 1,535: | Line 1,525: | ||
if (pageobj.canEdit() && ['wikitext', 'javascript', 'css', 'sanitized-css'].indexOf(pageobj.getContentModel()) !== -1) { | if (pageobj.canEdit() && ['wikitext', 'javascript', 'css', 'sanitized-css'].indexOf(pageobj.getContentModel()) !== -1) { | ||
pageobj.setPageText(params.tagText + text); | pageobj.setPageText(params.tagText + text); | ||
pageobj.setEditSummary('Nominated for deletion; see [[:' + params.discussionpage + ']]. | pageobj.setEditSummary('Nominated for deletion; see [[:' + params.discussionpage + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | ||
pageobj.setCreateOption('nocreate'); | pageobj.setCreateOption('nocreate'); | ||
Line 1,548: | Line 1,537: | ||
pageobj.setPageText(Twinkle.xfd.callbacks.getDiscussionWikitext('mfd', params)); | pageobj.setPageText(Twinkle.xfd.callbacks.getDiscussionWikitext('mfd', params)); | ||
pageobj.setEditSummary('Creating deletion discussion page for [[:' + Morebits.pageNameNorm + ']]. | pageobj.setEditSummary('Creating deletion discussion page for [[:' + Morebits.pageNameNorm + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | ||
pageobj.setCreateOption('createonly'); | pageobj.setCreateOption('createonly'); | ||
Line 1,575: | Line 1,563: | ||
pageobj.setPageText(text); | pageobj.setPageText(text); | ||
pageobj.setEditSummary('Adding [[:' + params.discussionpage + ']]. | pageobj.setEditSummary('Adding [[:' + params.discussionpage + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchList')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchList')); | ||
pageobj.setCreateOption('recreate'); | pageobj.setCreateOption('recreate'); | ||
Line 1,621: | Line 1,608: | ||
pageobj.setPageText(params.tagText + text); | pageobj.setPageText(params.tagText + text); | ||
pageobj.setEditSummary('Listed for discussion at [[:' + params.discussionpage + ']]. | pageobj.setEditSummary('Listed for discussion at [[:' + params.discussionpage + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | ||
pageobj.setCreateOption('recreate'); // it might be possible for a file to exist without a description page | pageobj.setCreateOption('recreate'); // it might be possible for a file to exist without a description page | ||
Line 1,669: | Line 1,655: | ||
pageobj.setPageText(text + '\n\n' + Twinkle.xfd.callbacks.getDiscussionWikitext('ffd', params)); | pageobj.setPageText(text + '\n\n' + Twinkle.xfd.callbacks.getDiscussionWikitext('ffd', params)); | ||
pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']]. | pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | ||
pageobj.setCreateOption('recreate'); | pageobj.setCreateOption('recreate'); | ||
Line 1,747: | Line 1,732: | ||
pageobj.setPageText(params.tagText + text); | pageobj.setPageText(params.tagText + text); | ||
pageobj.setEditSummary(editsummary); | pageobj.setEditSummary(editsummary); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | ||
pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title | pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title | ||
Line 1,776: | Line 1,760: | ||
pageobj.setPageText(text); | pageobj.setPageText(text); | ||
pageobj.setEditSummary('Adding ' + params.action + ' nomination of [[:' + Morebits.pageNameNorm + ']]. | pageobj.setEditSummary('Adding ' + params.action + ' nomination of [[:' + Morebits.pageNameNorm + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | ||
pageobj.setCreateOption('recreate'); | pageobj.setCreateOption('recreate'); | ||
Line 1,795: | Line 1,778: | ||
if (pageobj.canEdit()) { | if (pageobj.canEdit()) { | ||
pageobj.setPageText(params.tagText + text); | pageobj.setPageText(params.tagText + text); | ||
pageobj.setEditSummary('Listed for speedy renaming; see [[WP:CFDS|Categories for discussion/Speedy]]. | pageobj.setEditSummary('Listed for speedy renaming; see [[WP:CFDS|Categories for discussion/Speedy]]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | ||
pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title | pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title | ||
Line 1,821: | Line 1,803: | ||
pageobj.setPageText(text); | pageobj.setPageText(text); | ||
pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']]. | pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | ||
pageobj.setCreateOption('recreate'); | pageobj.setCreateOption('recreate'); | ||
Line 1,917: | Line 1,898: | ||
if (pageobj.canEdit()) { | if (pageobj.canEdit()) { | ||
pageobj.setPageText(params.tagText + text + '\n}}'); | pageobj.setPageText(params.tagText + text + '\n}}'); | ||
pageobj.setEditSummary('Listed for discussion at [[:' + params.discussionpage + ']]. | pageobj.setEditSummary('Listed for discussion at [[:' + params.discussionpage + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchPage')); | ||
pageobj.setCreateOption('nocreate'); | pageobj.setCreateOption('nocreate'); | ||
Line 1,946: | Line 1,926: | ||
pageobj.setPageText(text); | pageobj.setPageText(text); | ||
pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']]. | pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | ||
pageobj.setCreateOption('recreate'); | pageobj.setCreateOption('recreate'); | ||
Line 1,997: | Line 1,976: | ||
pageobj.setAppendText('\n\n' + Twinkle.xfd.callbacks.getDiscussionWikitext('rm', params)); | pageobj.setAppendText('\n\n' + Twinkle.xfd.callbacks.getDiscussionWikitext('rm', params)); | ||
pageobj.setEditSummary('Proposing move' + (params.newname ? ' to [[:' + params.newname + ']]' : '') | pageobj.setEditSummary('Proposing move' + (params.newname ? ' to [[:' + params.newname + ']]' : '') + ' ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.setCreateOption('recreate'); // since the talk page need not exist | pageobj.setCreateOption('recreate'); // since the talk page need not exist | ||
pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | pageobj.setWatchlist(Twinkle.getPref('xfdWatchDiscussion')); | ||
Line 2,020: | Line 1,998: | ||
} | } | ||
pageobj.setPageText(newtext); | pageobj.setPageText(newtext); | ||
pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']]. | pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']]. ([[Help:Twinkle|Twinkle]]使用)'); | ||
pageobj.save(function() { | pageobj.save(function() { | ||
Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki | Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki |