diff --git a/bin/aliases b/bin/aliases index a01e0d4..ca4a41b 100755 --- a/bin/aliases +++ b/bin/aliases @@ -51,6 +51,7 @@ a qutainer 'qutebrowser --temp-basedir' a re 'systemctl reboot -i' a rmdirs 'ff -t d -x rmdir -p' a rmlinks 'ff -t l -x rm' +a rssb 'curl rss-bridge.github.io/rss-bridge/General/Public_Hosts | pup text{} | grep https | shuf -n1 | clip' a s 'doas env "PATH=$PATH"' a sre 'systemctl soft-reboot' a ssh 'kitty +kitten ssh' diff --git a/qutebrowser/greasemonkey/minifocs.js b/qutebrowser/greasemonkey/enclosures.js similarity index 62% rename from qutebrowser/greasemonkey/minifocs.js rename to qutebrowser/greasemonkey/enclosures.js index 3319cdb..0aacd4b 100644 --- a/qutebrowser/greasemonkey/minifocs.js +++ b/qutebrowser/greasemonkey/enclosures.js @@ -1,6 +1,7 @@ // ==UserScript== // @name EnclosureExpand -// @include https://minifocs.fly.dev/* +// @include https://minifocs.fly.dev/*/entry/* +// @include https://minifocs.fly.dev/share/* // ==/UserScript== const details = document.querySelector("details.entry-enclosures"); details.setAttribute("open", ""); diff --git a/qutebrowser/greasemonkey/headings.js b/qutebrowser/greasemonkey/headings.js new file mode 100644 index 0000000..793f83a --- /dev/null +++ b/qutebrowser/greasemonkey/headings.js @@ -0,0 +1,30 @@ +// ==UserScript== +// @name AnchorHeadings +// @include https://minifocs.fly.dev/*/entry/* +// @include https://minifocs.fly.dev/share/* +// ==/UserScript== +var tagNames = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']; +var tagSelector = tagNames.join(); +var $elements = document.querySelectorAll(tagSelector); + +for ($element of $elements) { + var id = $element.id; + + if (!id) { + // Check if heading has any nested elements with id + var $innerElement = $element.querySelector('[id]'); + if ($innerElement) { id = $innerElement.id; } + else { continue; } + } + + // Create anchor if not already present + if (!$element.querySelector('[href]')) + $element.appendChild(createAnchor(id)); +} + +function createAnchor(id) { + var $link = document.createElement('a'); + $link.href = '#' + id; + $link.appendChild(document.createTextNode('♯')); + return $link; +}