Skip to content
Snippets Groups Projects
Commit b329d305 authored by Hugo Hörnquist's avatar Hugo Hörnquist
Browse files

Add show alternate.

parent 774c0db8
No related branches found
No related tags found
No related merge requests found
// ==UserScript==
// @name Show alternate links
// @namespace http://hugo.hornquist.se
// @version 0.1.0
// @description Show alternate links
// @author hugo@lysator.liu.se
// @match *
// @updateURL https://git.lysator.liu.se/hugo/web-monkey-scripts/raw/master/show-alternate/index.js
// @downloadURL https://git.lysator.liu.se/hugo/web-monkey-scripts/raw/master/show-alternate/index.js
// @source https://git.lysator.liu.se/hugo/web-monkey-scripts/-/tree/master/show-alternate
// @grant GM_addStyle
// ==/UserScript==
(function () {
'use strict';
let id = `id-${Math.random()}`
let outer = document.createElement('div');
let inner = document.createElement('div');
outer.id = id
let ul = document.createElement('ul');
outer.appendChild(inner);
inner.appendChild(ul);
for (let link of document.querySelectorAll('link[rel=alternate]')) {
let li = document.createElement('li');
let a = document.createElement('a')
a.href = link.href
a.textContent = `${link.type} - ${link.title}`
li.appendChild(a)
ul.appendChild(li)
}
GM_addStyle(`
#${id} {
margin: 0 !important;
position: absolute;
top: 0;
right: 0;
background: red;
}
#${id} > div {
display: none;
}
#${id}:hover > div {
display: block;
}
`)
})();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment