Sanereddit will remove the sidebar/bloatbar on the right, and expand the linklist and comments to the appropriate width, allowing reddit to be used in a sane manner.
当前为
// ==UserScript==
// @name sanereddit
// @namespace sanereddit
// @version 1.1
// @grant none
// @description Sanereddit will remove the sidebar/bloatbar on the right, and expand the linklist and comments to the appropriate width, allowing reddit to be used in a sane manner.
// ==/UserScript==
(function () {
var sideBar = document.getElementsByClassName('side') [0];
var linkList = document.getElementsByClassName('linklisting') [0];
var commentarea = document.getElementsByClassName('commentarea')[0];
var comments = document.getElementsByClassName('comment');
var mds = document.getElementsByClassName('md');
var root= document.compatMode=='BackCompat'? document.body : document.documentElement;
function go() {
sideBar.style.display = 'none';
linkList.style.width = '100%';
commentarea.style.width='100%';
var i = 0;
for (i = 0; i < comments.length; i++) {
comments[i].style.width = '100%';
}
for (i = 0; i < mds.length; i++) {
var elem = mds[i];
var rect = elem.getBoundingClientRect();
var marginRight = 30;
elem.style.maxWidth = (root.clientWidth - rect.left - marginRight) + 'px';
}
}
// Attach it the resize event
window.addEventListener('resize', function (event) {
go();
});
// Run it once initially
go();
}());