2019年2月9日 星期六

PTT 精華區 CSS 修復

如果用一般瀏覽器開啟 PTT 的精華區時,大多會感覺排版跑掉




所以我花了一點時間研究 PTTChrome 的顯示方法,發現還蠻好修復的,不過手機上就不能保證了
調整結果:


感覺好多了  ^_^

以下是 Tampermonkey 腳本,有需要可以自己拿去
// ==UserScript==
// @name Ptt 網頁版精華區頁面修復
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Ptt 網頁版精華區的格式會跑掉
// @author danny50610
// @match https://www.ptt.cc/man/*
// @grant none
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
if (!head) { return; }
style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
head.appendChild(style);
}
(function() {
'use strict';
addGlobalStyle("\
.m-ent { \
padding: 0; \
}\
.title a { \
white-space: pre;\
font-family: MingLiu, SymMingLiU, monospace;\
text-decoration: none;\
display: block;\
font-size: 1.75rem;\
line-height: 1.75rem;\
}\
");
})();
view raw gistfile1.txt hosted with ❤ by GitHub

沒有留言:

張貼留言