Add a border to quotes
目前為
// ==UserScript==
// @name Foxlinks-style Quotes
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add a border to quotes
// @author sintrode
// @author Joshh
// @match https://*.websight.blue/thread/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=websight.blue
// @grant GM_addStyle
// @license MIT
// ==/UserScript==
(function() {
'use strict';
GM_addStyle("blockquote { border: var(--MsgTop) 2px solid; margin: 10px; border-radius: 5px; padding: 5px; }");
GM_addStyle("blockquote>p:first-of-type { padding: 4px; background-color: var(--MsgTop); border-radius: 3px 3px 0 0; margin: -5px 0 5px -5px; max-width: initial; width: calc(100% + 3px); }");
GM_addStyle(".standalone-blockquote { }");
GM_addStyle(".standalone-blockquote>p:first-of-type { background: none; margin-bottom: 0; display: inline; }");
const blockquotes = document.querySelectorAll('.message-contents blockquote > p:first-of-type');
for (const blockquote of blockquotes) {
const innerHTML = blockquote.innerHTML;
if(innerHTML.slice(0, 4) === 'From') {
const brIndex = innerHTML.indexOf("<br>");
if(brIndex !== -1) {
const html = innerHTML.slice(brIndex + 4);
const node = document.createElement('p');
node.innerHTML = html;
blockquote.innerHTML = innerHTML.slice(0, brIndex);
blockquote.parentNode.insertBefore(node, blockquote.nextSibling);
}
} else {
blockquote.parentNode.classList.add('standalone-blockquote');
}
}
})();