Site Notice
hello, world
Difference between revisions of "MediaWiki:Js-InPageEdit-v2.js/uninstall.js"
From Project-EPB Commons
m (机智的小鱼君 moved page MediaWiki:Js-InPageEdit-v2.js/test/uninstall.js to MediaWiki:Js-InPageEdit-v2.js/uninstall.js without leaving a redirect) |
([InPageEdit] 没有编辑摘要) |
||
Line 6: | Line 6: | ||
}).done(function (data) { | }).done(function (data) { | ||
var wikitext = data.parse.wikitext['*'], | var wikitext = data.parse.wikitext['*'], | ||
− | finalText = wikitext.replace(/mw\.loader\.load\((\s)*(\'|\")https:\/\/common\.wjghj\.cn\/js\/InPageEdit-v2(\'|\")(\s)*\)(\;)?/ig, ''); | + | finalText = wikitext.replace(/mw\.loader\.load\((\s)*(\'|\")https:\/\/common\.wjghj\.cn\/js\/InPageEdit-v2(\'|\")(\s)*\)(\;)?(\n)?/ig, ''); |
console.info('[InPageEdit] Uninstall - Submitting...\n' + finalText); | console.info('[InPageEdit] Uninstall - Submitting...\n' + finalText); | ||
new mw.Api().post({ | new mw.Api().post({ | ||
Line 16: | Line 16: | ||
}).done(function () { | }).done(function () { | ||
console.info('[InPageEdit] Uninstall - Done\nWanna see you againg.'); | console.info('[InPageEdit] Uninstall - Done\nWanna see you againg.'); | ||
+ | if (confirm('Erase your InPageEdit personnal settings?')) { | ||
+ | $.cookie('InPageEditVersion','',{expires:0}); | ||
+ | $.cookie('InPageEditPreference','',{expires:0}); | ||
+ | } | ||
alert(' \\(QwQ) \nInPageEdit-v2 should be uninstalled from your personal js.\nBye bye, wanna see you again!'); | alert(' \\(QwQ) \nInPageEdit-v2 should be uninstalled from your personal js.\nBye bye, wanna see you again!'); | ||
window.location.reload(true); | window.location.reload(true); |
Revision as of 01:04, 5 November 2019
if (confirm('∑(O.o) Are you sure you want to uninstall InPageEdit-v2 from your personal js?')) {
new mw.Api().get({
action: 'parse',
prop: 'wikitext',
page: 'User:' + mw.config.get('wgUserName') + '/common.js'
}).done(function (data) {
var wikitext = data.parse.wikitext['*'],
finalText = wikitext.replace(/mw\.loader\.load\((\s)*(\'|\")https:\/\/common\.wjghj\.cn\/js\/InPageEdit-v2(\'|\")(\s)*\)(\;)?(\n)?/ig, '');
console.info('[InPageEdit] Uninstall - Submitting...\n' + finalText);
new mw.Api().post({
action: 'edit',
title: 'User:' + mw.config.get('wgUserName') + '/common.js',
text: finalText,
summary: 'Uninstall InPageEdit',
token: mw.user.tokens.get('editToken')
}).done(function () {
console.info('[InPageEdit] Uninstall - Done\nWanna see you againg.');
if (confirm('Erase your InPageEdit personnal settings?')) {
$.cookie('InPageEditVersion','',{expires:0});
$.cookie('InPageEditPreference','',{expires:0});
}
alert(' \\(QwQ) \nInPageEdit-v2 should be uninstalled from your personal js.\nBye bye, wanna see you again!');
window.location.reload(true);
});
});
}