User:JJPMaster/easysymblock.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes.
- Internet Explorer: hold down the Ctrl key and click the Refresh or Reload button, or press Ctrl+F5.
- Firefox: hold down the Shift key while clicking Reload; alternatively press Ctrl+F5 or Ctrl-Shift-R.
- Opera, Konqueror and Safari users can just click the Reload button.
- Chrome: press Ctrl+F5 or Shift+F5
if(mw.config.get("wgNamespaceNumber") == 2 && !(mw.config.get("wgPageName").includes("/"))) {
mw.util.addPortletLink("p-cactions", "#", "Symbolically block", "p-symblock", "Symbolically block");
}
mw.loader.load("//en.uncyclopedia.co/w/index.php?title=User:JJPMaster/easysymhardblock.js&action=raw&ctype=text/javascript");
mw.loader.load("//en.uncyclopedia.co/w/index.php?title=User:JJPMaster/easysymunblock.js&action=raw&ctype=text/javascript");
mw.loader.load("//en.uncyclopedia.co/w/index.php?title=User:JJPMaster/easysymipblock.js&action=raw&ctype=text/javascript");
var params;
$("#p-symblock").click(function() {
var date = prompt("What date do you want this block to expire (yyyy-mm-dd)? If you don't want it to expire, click Cancel.");
var reason = prompt("Why do you want to block this person?");
if(date !== null && date !== "") {
if(reason !== null && reason !== "") {
params = {
action: 'edit',
title: mw.config.get("wgPageName") + "/common.js",
text: `
const dateInPast = function (firstDate, secondDate) {
if (firstDate.setHours(0, 0, 0, 0) <= secondDate.setHours(0, 0, 0, 0)) {
localStorage.removeItem("sb_2b1d632e49dbff953d903cbb5af6dbeea12fe8d1");
localStorage.removeItem("sb_c409561930c527cf6cfceff3369f09ca4a47f0d3");
return false;
}
// localStorage.setItem("sb_2b1d632e49dbff953d903cbb5af6dbeea12fe8d1", "6583c0693b0c2ede5a90e65c8ed2da8bb96eec65");
document.body.innerHTML = '';
alert("You are currently unable to edit and will not be able to until ` + date + `. The reason provided was: ` + reason + `");
const endDate = new Date('` + date + `');
const currentDate = new Date();
dateInPast(endDate, currentDate);`,
summary: "[[UN:SB|Symbolically blocking]] user (automated)",
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
});
params = {
action: 'edit',
title: "Uncyclopedia:Symbolic block/Log",
appendtext: `\r\n* {{user|` + mw.config.get("wgTitle") + `}} - Reason: ` + reason + ` (Expires: ` + date + `): Blocked on ` + new Date().toString(),
summary: "+[[User:" + mw.config.get("wgTitle") + "|" + mw.config.get("wgTitle") + "]] (automated)",
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
params = {
action: 'protect',
title: mw.config.get("wgPageName") + "/common.js",
protections: 'edit=sysop|move=sysop',
expiry: date,
reason: 'Limiting one of the options slightly (automated)',
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
});
});
}
else {
params = {
action: 'edit',
title: mw.config.get("wgPageName") + "/common.js",
text: `
const dateInPast = function (firstDate, secondDate) {
if (firstDate.setHours(0, 0, 0, 0) <= secondDate.setHours(0, 0, 0, 0)) {
localStorage.removeItem("sb_2b1d632e49dbff953d903cbb5af6dbeea12fe8d1");
return false;
}
// localStorage.setItem("sb_2b1d632e49dbff953d903cbb5af6dbeea12fe8d1", "6583c0693b0c2ede5a90e65c8ed2da8bb96eec65");
document.body.innerHTML = '';
alert("You have been symbolically blocked. Love, ` + mw.config.get("wgUserName") + `");
};
const endDate = new Date('` + date + `');
const currentDate = new Date();
dateInPast(endDate, currentDate);`,
summary: "[[UN:SB|Symbolically blocking]] user (automated)",
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
});
params = {
action: 'edit',
title: "Uncyclopedia:Symbolic block/Log",
appendtext: `\r\n* {{user|` + mw.config.get("wgTitle") + `}} - Reason: None specified (Expires: ` + date + `): Blocked on ` + new Date().toString(),
summary: "+[[User:" + mw.config.get("wgTitle") + "|" + mw.config.get("wgTitle") + "]] (automated)",
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
params = {
action: 'protect',
title: mw.config.get("wgPageName") + "/common.js",
protections: 'edit=sysop|move=sysop',
expiry: date,
reason: 'Limiting one of the options slightly (automated)',
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
});
});
}
}
else {
if(reason !== null && reason !== "") {
params = {
action: 'edit',
title: mw.config.get("wgPageName") + "/common.js",
text: `
// localStorage.setItem("sb_2b1d632e49dbff953d903cbb5af6dbeea12fe8d1", "6583c0693b0c2ede5a90e65c8ed2da8bb96eec65");
document.body.innerHTML = '';
alert("You are currently unable to edit. The reason provided was: ` + reason + `");
`,
summary: "[[UN:SB|Symbolically blocking]] user (automated)",
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
});
params = {
action: 'edit',
title: "Uncyclopedia:Symbolic block/Log",
appendtext: `\r\n* {{user|` + mw.config.get("wgTitle") + `}} - Reason: ` + reason + ` (Expires: Never): Blocked on ` + new Date().toString(),
summary: "+[[User:" + mw.config.get("wgTitle") + "|" + mw.config.get("wgTitle") + "]] (automated)",
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
params = {
action: 'protect',
title: mw.config.get("wgPageName") + "/common.js",
protections: 'edit=sysop|move=sysop',
expiry: 'infinite',
reason: 'Limiting one of the options slightly (automated)',
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
});
});
}
else {
params = {
action: 'edit',
title: mw.config.get("wgPageName") + "/common.js",
text: `
// localStorage.setItem("sb_2b1d632e49dbff953d903cbb5af6dbeea12fe8d1", "6583c0693b0c2ede5a90e65c8ed2da8bb96eec65");
document.body.innerHTML = '';
alert("You have been symbolically blocked. Love, ` + mw.config.get("wgUserName") + `");
`,
summary: "[[UN:SB|Symbolically blocking]] user (automated)",
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
});
params = {
action: 'edit',
title: "Uncyclopedia:Symbolic block/Log",
appendtext: `\r\n* {{user|` + mw.config.get("wgTitle") + `}} - Reason: None specified (Expires: Never): Blocked on ` + new Date().toString(),
summary: "+[[User:" + mw.config.get("wgTitle") + "|" + mw.config.get("wgTitle") + "]] (automated)",
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
params = {
action: 'protect',
title: mw.config.get("wgPageName") + "/common.js",
protections: 'edit=sysop|move=sysop',
expiry: 'infinite',
reason: 'Limiting one of the options slightly (automated)',
format: 'json'
},
api = new mw.Api();
api.postWithToken( 'csrf', params ).done( function ( data ) {
console.log( data );
});
});
}
}
});