From 8dd050b5760bee9b67064f4e5c36dce84331cd8a Mon Sep 17 00:00:00 2001 From: blankie Date: Sun, 21 May 2023 10:34:50 +0700 Subject: [PATCH] Update Elements with ID lister to 1.0.3 - Ignore elements not inside - Broaden hidden element check --- Elements with ID lister.user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Elements with ID lister.user.js b/Elements with ID lister.user.js index 500692b..2fa2337 100644 --- a/Elements with ID lister.user.js +++ b/Elements with ID lister.user.js @@ -6,7 +6,7 @@ // @grant GM_getResourceURL // @require https://cdn.jsdelivr.net/npm/dialog-polyfill@0.5.6/dist/dialog-polyfill.min.js#sha256-cec1a2e320aab77e28bad4ad6bc5e532a6ef5757345c19bb5158aa880b7162a6 // @resource dialogPolyfillCSS https://cdn.jsdelivr.net/npm/dialog-polyfill@0.5.6/dist/dialog-polyfill.min.css#sha256-4dcb3ab62e545f30bf06a4824c253641ee889ca85ca28d5447590557922496ab -// @version 1.0.2 +// @version 1.0.3 // @author blankie // @description A userscript that adds a "Show elements popup" option to the Monkey Menu which lists all elements with an ID // @inject-into content @@ -122,9 +122,9 @@ function hideElementList() { function getElementList() { let elements = []; - for (let element of document.querySelectorAll("[id]")) { + for (let element of document.body.querySelectorAll("[id]")) { let rect = element.getBoundingClientRect(); - if (rect.x === 0 && rect.y === 0 && rect.right === 0 && rect.bottom === 0 && rect.width === 0 && rect.height === 0) { + if (rect.height === 0 || rect.width === 0) { continue; } elements.push(getElementListItem(element));