User:Euphoria/common.js: Difference between revisions
From Test Wiki
Content deleted Content added
Images Tags: Mobile edit Mobile web edit |
addButtonToSidebar Tags: Mobile edit Mobile web edit |
||
| Line 1: | Line 1: | ||
// ==UserScript== |
|||
| ⚫ | |||
// @namespace WikipediaUserScripts |
|||
// @description Finds articles in a category that lack images and logs them to the console. |
|||
// @include /^https:\/\/en\.wikipedia\.org\/wiki\/Category:.+/ |
|||
// @version 1 |
|||
// @grant none |
|||
// ==/UserScript== |
|||
(function() { |
(function() { |
||
'use strict'; |
'use strict'; |
||
| Line 27: | Line 36: | ||
} |
} |
||
// Add a button to the |
// Add a button to the sidebar |
||
function |
function addButtonToSidebar() { |
||
var sidebar = document.getElementById('mw-panel'); |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
if (sidebar) { |
|||
const referenceNode = document.getElementById('mw-content-text'); |
|||
var button = document.createElement('button'); |
|||
button.textContent = 'Find Articles Without Images'; |
|||
| ⚫ | |||
button.style.width = '90%'; |
|||
| ⚫ | |||
var container = document.createElement('div'); |
|||
container.style.textAlign = 'center'; |
|||
container.appendChild(button); |
|||
sidebar.appendChild(container); |
|||
} |
|||
} |
} |
||
// Add the button when the script loads |
// Add the button when the script loads |
||
addButtonToSidebar(); |
|||
})(); |
})(); |
||