您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Brings back the old line-height, colors, padding, borders, etc. of StackExchange websites like StackOverflow, SuperUser, ServerFault, etc.
当前为
您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
- // ==UserScript==
- // @name Revert StackExchange Formatting
- // @namespace https://github.com/Prid13/Revert-StackExchange-Formatting
- // @version 1.0
- // @description Brings back the old line-height, colors, padding, borders, etc. of StackExchange websites like StackOverflow, SuperUser, ServerFault, etc.
- // @author Prid
- // @include /^https://(?:[^/]+\.)?(?:(?:stackoverflow|serverfault|superuser|stackexchange|askubuntu|stackapps)\.com|mathoverflow\.net)//
- // @run-at document-start
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var style = "";
- var values = {
- line_height: 1.3,
- code_block_bgcol: "#eff0f1",
- code_block_padding: "12px 8px",
- code_block_radius: "3px",
- inline_code_bgcol: "#e4e6e8",
- inline_code_padding: "1px 5px",
- inline_code_radius: "0px",
- comment_code_bgcol: "#eff0f1",
- comment_code_padding: "1px 5px",
- };
- buildCSS();
- injectCSS();
- function buildCSS(){
- var line_height = values.line_height;
- // paragraphs (revert line-height)
- style += ".s-prose { line-height: " + line_height + "!important; }";
- // ADDITIONAL REVERSIONS
- // code blocks
- style += ".s-prose pre:not(.s-code-block) { ";
- style += "background-color: " + values.code_block_bgcol + "!important;";
- style += "padding: " + values.code_block_padding + "!important;";
- style += "border-radius: " + values.code_block_radius + "!important;";
- style += "}";
- // transparent bg on code lines within code blocks
- style += ".s-prose pre:not(.s-code-block) code { background-color: transparent!important; }";
- // inline code
- style += ".s-prose code:not(.s-code-block) {";
- style += "background-color: " + values.inline_code_bgcol + "!important;";
- style += "padding: " + values.inline_code_padding + "!important;";
- style += "border-radius: " + values.inline_code_radius + "!important;";
- style += "}";
- // comment inline code
- style += ".comment-text code {";
- style += "background-color: " + values.comment_code_bgcol + "!important;";
- style += "padding: " + values.comment_code_padding + "!important;"; // padding is same
- style += "}";
- }
- function injectCSS(){
- // credit: https://stackoverflow.com/a/13436780/3705191
- var cssStyle = document.createElement('style');
- cssStyle.type = 'text/css';
- var rules = document.createTextNode(style);
- cssStyle.appendChild(rules);
- document.getElementsByTagName("head")[0].appendChild(cssStyle);
- }
- })();