From d9ab785667ad4683d28e61334f1a8e58360f7b5d Mon Sep 17 00:00:00 2001 From: Phantop Date: Fri, 21 Jun 2024 09:14:00 -0400 Subject: [PATCH] remove that plaintext adjustment script cuz it sucked --- qutebrowser/greasemonkey/plaintext.js | 35 --------------------------- 1 file changed, 35 deletions(-) delete mode 100644 qutebrowser/greasemonkey/plaintext.js diff --git a/qutebrowser/greasemonkey/plaintext.js b/qutebrowser/greasemonkey/plaintext.js deleted file mode 100644 index b2af599..0000000 --- a/qutebrowser/greasemonkey/plaintext.js +++ /dev/null @@ -1,35 +0,0 @@ -// ==UserScript== -// @name PlainText -// @description Makes links in plain text one-click to open -// @include *.txt -// @include *.xml -// ==/UserScript== -const rss = document.querySelector('rss'); - -if (rss) { - for (const link of document.querySelectorAll('link')) { - link.addEventListener('click', function() { window.open(this.textContent); }); - link.style = 'text-decorator: underline;'; - } -} -else { - const text = document.body.innerText; - - const regexpLinks = /http[s]?:\/\/[^;, \n\t]*/ - const regexpLinksAll = /http[s]?:\/\/[^;, \n\t]*/g - const links = [...text.matchAll(regexpLinksAll)] - const pieces = text.split(regexpLinks) - const combined = pieces.reduce((acc, text, index) => { acc.push(text); links[index] && acc.push(links[index]); return acc; }, []) - - const newText = '
' +
-        combined
-        .map((piece) => {
-            if (!regexpLinks.test(piece)) {
-                return piece;
-            }
-            return `${piece}`;
-        })
-        .join('')
-        + '
'; - document.body.innerHTML = newText; -}