Skip to content

Commit

Permalink
remove Twinkle.copyvio.callbacks.tagginglua
Browse files Browse the repository at this point in the history
  • Loading branch information
sunafterrainwm committed May 9, 2021
1 parent f4a6ffc commit 85e2a76
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions modules/twinklecopyvio.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,25 @@ Twinkle.copyvio.callbacks = {
_addText: tag
}]);
} else if (mw.config.get('wgPageContentModel') === 'Scribunto') {
Twinkle.copyvio.callbacks.tagginglua(pageobj, tag);
new mw.Api().parse(tag, {
onlypst: 1
}).then(function (tag) {
var equals = '';
while (tag.indexOf(']' + equals + ']') !== -1) {
equals += '=';
}
tag = "require('Module:Module wikitext')._addText([" + equals + '[' + tag + ']' + equals + ']);';

pageobj.setPageText(tag);
pageobj.setEditSummary(wgULS('本页面疑似侵犯著作权', '本頁面疑似侵犯版權'));
pageobj.setChangeTags(Twinkle.changeTags);
pageobj.setWatchlist(Twinkle.getPref('copyvioWatchPage'));
// pageobj.setCreateOption('recreate');
pageobj.save();
}, function (err) {
mw.log.error(err);
Morebits.status.error(wgULS('错误', '錯誤'), wgULS('无法展开wikitext', '無法展開wikitext'));
});
return;
} else if (['javascript', 'css', 'sanitized-css'].indexOf(mw.config.get('wgPageContentModel')) > -1) {
tag = '/* _addText: ' + tag.replace(/\*\//g, '*/') + ' */';
Expand All @@ -143,27 +161,6 @@ Twinkle.copyvio.callbacks = {
pageobj.patrol();
}
},
tagginglua: function(pageobj, tag) {
new mw.Api().parse(tag, {
onlypst: 1
}).then(function (tag) {
var equals = '';
while (tag.indexOf(']' + equals + ']') !== -1) {
equals += '=';
}
tag = "require('Module:Module wikitext')._addText([" + equals + '[' + tag + ']' + equals + ']);';

pageobj.setPageText(tag);
pageobj.setEditSummary(wgULS('本页面疑似侵犯著作权', '本頁面疑似侵犯版權'));
pageobj.setChangeTags(Twinkle.changeTags);
pageobj.setWatchlist(Twinkle.getPref('copyvioWatchPage'));
// pageobj.setCreateOption('recreate');
pageobj.save();
}, function (err) {
mw.log.error(err);
Morebits.status.error(wgULS('错误', '錯誤'), wgULS('无法展开wikitext', '無法展開wikitext'));
});
},
copyvioList: function(pageobj) {
var text = pageobj.getPageText();
var output = '';
Expand Down

0 comments on commit 85e2a76

Please sign in to comment.