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';
const NBE = {
init: function() {
this.addPortlet();
this.addLinks();
},
addPortlet: function() {
let navigation, portletId = 'p-nbe', portletText = 'NBE', nextNodeId;
switch (mw.config.get('skin')) {
case 'vector':
case 'vector-2022':
navigation = '#right-navigation';
nextNodeId = 'p-cactions';
break;
case 'timeless':
navigation = '#page-tools .sidebar-inner';
nextNodeId = 'p-userpagetools';
break;
default:
return; // Exit if skin is not supported
}
const root = document.querySelector(navigation);
if (!root) return;
// Add the portlet if it doesn't already exist
if (!document.getElementById(portletId)) {
mw.util.addPortlet(portletId, portletText, '#' + nextNodeId);
}
},
addLinks: function() {
if (enableMissingCoordinates === '1') {
this.addLink('#', 'Missing Coordinates', 'missing-coordinates', 'Mark as missing coordinates.');
}
if (enableMissingInfo === '1') {
this.addLink('#', 'Missing Information', 'missing-information', 'Mark as missing information.');
}
if (enableUnreferenced === '1') {
this.addLink('#', 'Unreferenced', 'unreferenced', 'Mark as unreferenced.');
}
},
addLink: function(task, text, id, tooltip) {
const portletId = 'p-nbe';
mw.util.addPortletLink(portletId, task, text, id, tooltip);
}
};
// Initialize the NBE functionality
NBE.init();