Update Elements with ID lister to 1.0.11
- Fix links on sites with a <base>, such as https://mesonbuild.com/Running-Meson.html
This commit is contained in:
parent
bcf49c5774
commit
32ef114fa6
|
@ -6,7 +6,7 @@
|
||||||
// @grant GM_getResourceURL
|
// @grant GM_getResourceURL
|
||||||
// @require https://cdn.jsdelivr.net/npm/dialog-polyfill@0.5.6/dist/dialog-polyfill.min.js#sha256-cec1a2e320aab77e28bad4ad6bc5e532a6ef5757345c19bb5158aa880b7162a6
|
// @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
|
// @resource dialogPolyfillCSS https://cdn.jsdelivr.net/npm/dialog-polyfill@0.5.6/dist/dialog-polyfill.min.css#sha256-4dcb3ab62e545f30bf06a4824c253641ee889ca85ca28d5447590557922496ab
|
||||||
// @version 1.0.10
|
// @version 1.0.11
|
||||||
// @author blankie
|
// @author blankie
|
||||||
// @description A userscript that adds a "Show elements popup" option to the Monkey Menu which lists all elements with an ID
|
// @description A userscript that adds a "Show elements popup" option to the Monkey Menu which lists all elements with an ID
|
||||||
// @inject-into content
|
// @inject-into content
|
||||||
|
@ -173,10 +173,13 @@ function shouldIgnoreElement(element) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getElementListItem(element) {
|
function getElementListItem(element) {
|
||||||
|
let newLocation = new URL(location.href);
|
||||||
|
|
||||||
let li = document.createElement("li");
|
let li = document.createElement("li");
|
||||||
|
|
||||||
let a = document.createElement("a");
|
let a = document.createElement("a");
|
||||||
a.href = a.innerText = "#" + element.id;
|
newLocation.hash = a.innerText = "#" + element.id;
|
||||||
|
a.href = newLocation.href;
|
||||||
a.addEventListener("click", function(e) {
|
a.addEventListener("click", function(e) {
|
||||||
if (e.ctrlKey) {
|
if (e.ctrlKey) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue