您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Trimmer for Old Reddit
当前为
// ==UserScript== // @name Trim Old Reddit // @namespace stgeorge // @description Trimmer for Old Reddit // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js // @match *://old.reddit.com/* // @match *://www.reddit.com/* // @grant GM.xmlHttpRequest // @version 1.3 // @run-at document-start // ==/UserScript== (function() { let side = null; const SHOW_FIRST = true; const BETTER_HEADER = true; const HEADER_KEEP = [ 'news','worldnews','Jokes','books' ]; const HEADER_ADD = { ysk:'youshouldknow', cool:'coolguides', next:'nextfuckinglevel', 'new': top.location.href.replace('old','www'), hbros:'humansbeingbros', abros:'animalsbeingbros', }; const HEADER_REPLACE = { explainlikeimfive:'eli5', todayilearned:'til', LifeProTips:'lpt', AskReddit:'ask', }; function betterHeader() { let template = null; let i = 0; let bars = $('ul.sr-bar'); bars.find('li').each(function(k,v) { let li = $(this); if (template == null && i > 0) { template = li.clone(true); template.removeClass('selected'); } ++i; let a = li.find('a:first'); let t = a.text(); if (HEADER_KEEP.indexOf(t) == -1 && !HEADER_REPLACE[t]) { li.remove(); } else { a.attr('title', t); if (HEADER_REPLACE[t]) { a.text(HEADER_REPLACE[t]); a.attr('title',t); } } }); let bar = bars.last(); $.each(HEADER_ADD, function(k,v) { let x = template.clone(true); let a = x.find('a'); a.attr('id', k); a.text(k); a.attr('href',v.indexOf('/') != -1 ? v : '/r/'+v); a.attr('title',v); x.appendTo(bar); }); $('#header *').css({'background-color':'white','color':'black'}); } function trim() { $('.infobar').remove(); $('.footer-parent').remove(); $('#sr-header-area').siblings().remove(); let content = $('.content[role="main"]'); $(`<style> .selected { color: blue !important; } #new { color: red !important; } #header { height: revert !important; position: initial !important; } .thing { background-color:white; } .link { margin-right: revert !important; } body div.content { margin: 5px !important; } .sitetable { border-bottom: 0 !important; border-left: 0 !important; border-right:solid 1px #eeeeff !important; margin-right: revert !important; } .listing-page #siteTable { margin-right: 0; } .side { background: url('') !important; background-color: transparent; box-shadow: revert; width:59%; margin:5px; height:1000px; overflow-y:auto; padding-top: 0; } .side .commentarea { margin-right: revert !important; } .side:before { content: revert !important; background: revert !important; } .side:after { content: ''; } </style>`).appendTo('head'); content.css({ width:'40%', height: '1000px', 'overflow-y': 'auto', resize:'horizontal', margin: '0', }); side = $('.side'); side.empty(); let w = $('<div id="body-wrapper" style="display:flex"></div>'); $('#header').after(w); w.append(content); w.append(side); let curbg = 'white'; let first = null; $('.entry a').add('.search-result a').add('a.title') .each(function(k,v) { let t = $(this).closest('.thing'); if (t.length == 0) t = $(this).closest('.search-result'); let a = $(this); let href = a.attr('href'); if (href.indexOf('/comments/') != -1) { a.on('click', function(e) { e.preventDefault(); e.stopPropagation(); t.css({'background-color':'#eeeeff'}); t.addClass('clicked'); t.siblings().css({'background-color':curbg}); t.siblings().removeClass('clicked'); loadComment(href); }); if (first === null && !t.hasClass('stickied')) first = a; } }); if (SHOW_FIRST && first) first.click(); } function loadComment(u) { GM.xmlHttpRequest({ method: "GET", url: u, onload: function(response) { side.html($.parseHTML(response.responseText)); let c = side.find('.content[role="main"]').detach(); side.empty(); side.append(c); c.css({margin:'10px'}); side.find('.infobar').detach(); side.scrollTop(0); } }); } setTimeout(function() { if (document.URL.indexOf('www.reddit.com') != -1) { $('#email-verification-tooltip-id'). before($('<button title="Old Reddit" id="old-button" type="button">OLD</button>')); let old = $('#old-button'); old.css({ margin: '10px', border: 'solid 1px #0079d3', padding: '5px', 'border-radius': '4px', color: '#0079d3', 'font-weight': 'bold' }); old.on('click', function() { top.location.hostname = 'old.reddit.com'; }); return; } if (document.URL.indexOf('/comments/') != -1) return; trim(); betterHeader(); }, 1000); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址