Create lwn-blockquotes.user.js

This commit is contained in:
Tobias Schmidl 2020-01-28 12:42:18 +01:00 committed by GitHub
parent c34a675235
commit 335b4111a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

27
lwn-blockquotes.user.js Normal file
View file

@ -0,0 +1,27 @@
// ==UserScript==
// @name LWN-Blockquotes
// @namespace https://www.schtobia.de/
// @version 0.1
// @description Format the Blockquotes correctly on LWN. This is important for Reader View.
// @author Tobias Schmidl
// @match https://lwn.net/Articles/*
// @grant none
// @downloadURL https://github.com/schtobia/greasemonkey/raw/master/lwn-blockquotes.user.js
// @updateURL https://github.com/schtobia/greasemonkey/raw/master/lwn-blockquotes.user.js
// ==/UserScript==
(function() {
'use strict';
for (let cur_quote of document.getElementsByClassName('BigQuote'))
{
const style_before = window.getComputedStyle(cur_quote);
const margin_left = style_before.getPropertyValue("margin-left"),
margin_right = style_before.getPropertyValue("margin-right"),
margin_top = style_before.getPropertyValue("margin-top"),
margin_bottom = style_before.getPropertyValue("margin-bottom"),
color = style_before.getPropertyValue("color");
cur_quote.outerHTML = cur_quote.outerHTML.replace(/^<div /,"<blockquote ").replace(/<\/div>$/,"</blockquote>");
cur_quote.style = style_before;
}
})();