mirror of
https://github.com/Phantop/dotfiles
synced 2024-12-22 21:26:47 +00:00
qute: clean miniflux greasemonkey + heading anchors
This commit is contained in:
parent
6944997a8a
commit
2c2d5b9ce9
|
@ -51,6 +51,7 @@ a qutainer 'qutebrowser --temp-basedir'
|
||||||
a re 'systemctl reboot -i'
|
a re 'systemctl reboot -i'
|
||||||
a rmdirs 'ff -t d -x rmdir -p'
|
a rmdirs 'ff -t d -x rmdir -p'
|
||||||
a rmlinks 'ff -t l -x rm'
|
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 s 'doas env "PATH=$PATH"'
|
||||||
a sre 'systemctl soft-reboot'
|
a sre 'systemctl soft-reboot'
|
||||||
a ssh 'kitty +kitten ssh'
|
a ssh 'kitty +kitten ssh'
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name EnclosureExpand
|
// @name EnclosureExpand
|
||||||
// @include https://minifocs.fly.dev/*
|
// @include https://minifocs.fly.dev/*/entry/*
|
||||||
|
// @include https://minifocs.fly.dev/share/*
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
const details = document.querySelector("details.entry-enclosures");
|
const details = document.querySelector("details.entry-enclosures");
|
||||||
details.setAttribute("open", "");
|
details.setAttribute("open", "");
|
30
qutebrowser/greasemonkey/headings.js
Normal file
30
qutebrowser/greasemonkey/headings.js
Normal file
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in a new issue