mirror of
https://github.com/Phantop/dotfiles
synced 2025-12-07 12:43:32 +00:00
qute: move includes to subdir, improve miniflux js
This commit is contained in:
parent
b00211f24f
commit
1133de4d07
|
|
@ -1,10 +1,10 @@
|
|||
import platform
|
||||
|
||||
config.load_autoconfig(False)
|
||||
config.source('adblock.py')
|
||||
config.source('bindings.py')
|
||||
config.source('redirects.py')
|
||||
config.source('search.py')
|
||||
config.source('sites.py')
|
||||
config.source('theme.py')
|
||||
config.source('ui.py')
|
||||
config.source('include/adblock.py')
|
||||
config.source('include/bindings.py')
|
||||
config.source('include/redirects.py')
|
||||
config.source('include/search.py')
|
||||
config.source('include/sites.py')
|
||||
config.source('include/theme.py')
|
||||
config.source('include/ui.py')
|
||||
|
|
|
|||
|
|
@ -3,36 +3,35 @@
|
|||
// @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);
|
||||
const headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].join();
|
||||
const elements = document.querySelectorAll(headings);
|
||||
|
||||
for ($element of $elements) {
|
||||
var id = $element.id;
|
||||
for (const element of elements) {
|
||||
let id = element.id;
|
||||
|
||||
if (!id) {
|
||||
// Check if heading has any nested elements with id
|
||||
var $innerElement = $element.querySelector('[id]');
|
||||
if ($innerElement) { id = $innerElement.id; }
|
||||
const innerElement = element.querySelector('[id]');
|
||||
if (innerElement) { id = innerElement.id; }
|
||||
else {
|
||||
id = $element.tagName + '-' + $element.textContent
|
||||
id = element.tagName + '-' + element.textContent
|
||||
.replace(/\s+/g, '-') // Replace spaces with hyphens
|
||||
.replace(/[^\w-]/g, '') // Remove non-word chars (except hyphens)
|
||||
.replace(/--+/g, '-') // Replace multiple hyphens with single hyphen
|
||||
.replace(/^-+/, '') // Trim hyphens from start
|
||||
.replace(/-+$/, ''); // Trim hyphens from end
|
||||
$element.id = id;
|
||||
element.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
if (!element.querySelector('[href]')) {
|
||||
const 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", "");
|
||||
document.querySelector("details.entry-enclosures").setAttribute("open", "");
|
||||
|
|
|
|||
Loading…
Reference in a new issue