mirror of
https://github.com/Phantop/dotfiles
synced 2024-11-22 06:42:46 +00:00
qute: clean up miniflux js tweaks
This commit is contained in:
parent
c310eb04ad
commit
a524a83d24
|
@ -1,7 +0,0 @@
|
||||||
// ==UserScript==
|
|
||||||
// @name EnclosureExpand
|
|
||||||
// @include https://minifocs.fly.dev/*/entry/*
|
|
||||||
// @include https://minifocs.fly.dev/share/*
|
|
||||||
// ==/UserScript==
|
|
||||||
const details = document.querySelector("details.entry-enclosures");
|
|
||||||
details.setAttribute("open", "");
|
|
|
@ -1,31 +0,0 @@
|
||||||
// ==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.id = 'grease-anchor';
|
|
||||||
$link.appendChild(document.createTextNode('#'));
|
|
||||||
return $link;
|
|
||||||
}
|
|
30
qutebrowser/greasemonkey/miniflux.js
Normal file
30
qutebrowser/greasemonkey/miniflux.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
// ==UserScript==
|
||||||
|
// @name Miniflux Tweaks
|
||||||
|
// @include https://minifocs.fly.dev/*/entry/*
|
||||||
|
// @include https://minifocs.fly.dev/share/*
|
||||||
|
// ==/UserScript==
|
||||||
|
var headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].join();
|
||||||
|
var $elements = document.querySelectorAll(headings);
|
||||||
|
|
||||||
|
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]')) {
|
||||||
|
var $link = document.createElement('a');
|
||||||
|
$link.href = '#' + id;
|
||||||
|
$link.id = 'grease-anchor';
|
||||||
|
$link.appendChild(document.createTextNode('#'));
|
||||||
|
$element.appendChild($link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var details = document.querySelector("details.entry-enclosures");
|
||||||
|
details.setAttribute("open", "");
|
Loading…
Reference in a new issue