User:Macaw*/NBE.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | This user script seems to have a documentation page at User:Macaw*/NBE. |
// NBE or Not Bad Edits was created by Macaw*
// CONFIGURATION: Enable features by setting to '1' or '0'
const enableMissingCoordinates = '1';
const enableUnreferenced = '1';
const enableMissingInfo = '1';
// Check if the feature for missing coordinates is enabled
if (enableMissingCoordinates === '1') {
mw.loader.using('mediawiki.util', function () {
mw.hook('wikipage.content').add(function () {
const link = mw.util.addPortletLink('p-cactions', '#', 'Missing Coordinates', 'Missing Coordinates', 'Mark as missing coordinates.');
$(link).click(function (event) {
event.preventDefault(); // Prevent default link behavior
// Prompt for missing coordinates and update the edit form
const userInput = prompt("What is the general location of the missing coordinates?");
if (userInput !== null) {
document.editform.wpTextbox1.value = `{{coord missing|${userInput}}}\n` + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = "Added Missing Coordinates Template with [[User:Macaw*/NBE|Not Bad Edits]]";
document.editform.submit(); // Submit the edit form
}
});
});
});
}
// Check if the feature for missing information is enabled
if (enableMissingInfo === '1') {
mw.loader.using('mediawiki.util', function () {
mw.hook('wikipage.content').add(function () {
const link = mw.util.addPortletLink('p-cactions', '#', 'Missing Information', 'Missing Information', 'Mark as missing information.');
$(link).click(function (event) {
event.preventDefault(); // Prevent default link behavior
// Prompt for missing information and update the edit form
const userInput = prompt("What information is this page missing?");
if (userInput !== null) {
document.editform.wpTextbox1.value = `{{Missing information|${userInput}}}\n` + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = "Added Missing Information Template with [[User:Macaw*/NBE|Not Bad Edits]]";
document.editform.submit(); // Submit the edit form
}
});
});
});
}
// Check if the feature for unreferenced content is enabled
if (enableUnreferenced === '1') {
mw.loader.using('mediawiki.util', function () {
mw.hook('wikipage.content').add(function () {
const link = mw.util.addPortletLink('p-cactions', '#', 'Unreferenced', 'Unreferenced', 'Mark as unreferenced.');
$(link).click(function (event) {
event.preventDefault(); // Prevent default link behavior
// Update the edit form for unreferenced content with the current date
const currentDate = new Date().toLocaleString('en-US', { year: 'numeric', month: 'long' });
document.editform.wpTextbox1.value = `{{Unreferenced|date=${currentDate}}}\n` + document.editform.wpTextbox1.value;
document.editform.wpSummary.value = "Added Unreferenced Template with [[User:Macaw*/NBE|Not Bad Edits]]";
document.editform.submit(); // Submit the edit form
});
});
});
}