Greasy Fork

Greasy Fork is available in English.

百度贴吧-宽版

隐藏侧边栏,拓宽贴子的显示宽度,图片变得更清晰,贴吧链接不跳转直接打开,移动版页面自动跳转为PC版

当前为 2021-04-06 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         百度贴吧-宽版
// @namespace    http://tampermonkey.net/
// @version      0.5.1
// @description  隐藏侧边栏,拓宽贴子的显示宽度,图片变得更清晰,贴吧链接不跳转直接打开,移动版页面自动跳转为PC版
// @author       AN drew
// @match        https://tieba.baidu.com/*
// @grant        GM_addStyle
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    GM_addStyle('.tb_rich_poster .poster_success{left:349px!important}'); //发表成功提示居中

    //移动版页面自动跳转为PC版
    if(window.location.pathname.indexOf('/mo') > -1)
    {
        var reg = new RegExp('(^|&)' + 'tid' + '=([^&]*)(&|$)', 'i');
        var r = window.location.search.substr(1).match(reg);
        if (r != null) {
            window.location.href='https://tieba.baidu.com/p/'+r[2];
        }
    }

    setInterval(()=>{

        if(window.location.href.indexOf('/p/')!= -1)
        {
            //帖子内容变宽
            $('.replace_div').css('height','auto');
            $('.replace_tip').css('display','none');
            $('.right_section').hide();
            if(!$('.left_section').hasClass('wide'))
            {
                $('.left_section').width($('.pb_content').width());
                $('#j_core_title_wrap').width($('.pb_content').width()); //标题栏
                $('#j_p_postlist').width($('.pb_content').width()); //内容列表
                $('.left_section').addClass('wide');
            }

            $('.l_post_bright').each(function(){
                if(!$(this).hasClass('wide'))
                {
                    $(this).width($('.pb_content').width());
                    $(this).find('.d_post_content_main').width($('.pb_content').width() - 153);
                    $(this).find('.d_post_content_main .p_content').width($('.pb_content').width() - 173);
                    $(this).find('.core_reply_tail').width($('.pb_content').width() - 168);
                    $(this).find('.core_reply_wrapper').width($('.pb_content').width() - 168);
                    $(this).find('.core_reply_wrapper').width($('.pb_content').width() - 168);
                    $(this).find('.lzl_editor_container_s').width($('.pb_content').width() - 173);

                    if( $(this).find('.core_reply_wrapper').css('width')!=undefined  && parseInt( $(this).find('.core_reply_wrapper').css('width'))  >= 800)
                    {
                        $(this).addClass('wide');
                    }
                }
                $(this).find('.edui-container').width($('.pb_content').width() - 203);
                $(this).find('.p_content .edui-editor-body').width($('.pb_content').width() - 203);
                $(this).find('.editor_for_container.editor_lzl_container').width($('.pb_content').width() - 203);
                $(this).find('.lzl_simple_wrapper').width($('.pb_content').width() - 203);
                $(this).find('.lzl_panel_wrapper').width($('.pb_content').width() - 203);
            })

            //图片变清晰
            $('.p_content img.BDE_Image').each(function(){
                if(!$(this).hasClass('origin'))
                {
                    let imglink = $(this).attr('src').substring($(this).attr('src').lastIndexOf('/'));
                    $(this).attr('src','http://tiebapic.baidu.com/forum/pic/item'+imglink);
                    $(this).css('max-width', '875px;')
                    $(this).removeAttr('width');
                    $(this).removeAttr('height');
                    $(this).addClass('origin');
                    $(this).wrap('<div>');
                }
            });

            //发表回复变宽
            $('.poster_head').width($('.pb_content').width() - 40);
            $('.old_style_wrapper').width($('.pb_content').width() - 70);
            $('.old_style_wrapper .edui-container').width($('.pb_content').width() - 70);
            $('.edui-toolbar').width($('.pb_content').width() - 70);
            $('.old_style_wrapper .edui-editor-body').width($('.pb_content').width() - 70);
            $('#ueditor_replace').width($('.old_style_wrapper .edui-editor-body').width() - 20);
            $('.poster_component').width($('.pb_content').width() - 40);

            if($('.tbui_aside_fbar_button tbui_fbar_props').length==0)
            {
                $('.tb_rich_poster').css('margin','0px');
                $('.editor_wrapper').css('margin-left','20px');
            }
        }
        else
        {
            //吧内首页变宽
            $('#aside').hide();
            $('#content_wrap').width($('.forum_content').width());
            $('#content_leftList').attr('style','background:white');

            //图片放大
            $('.media_disp').width($('.forum_content').width() - 120);
            $('.enter_pb_wrapper').css({'left':'850px',
                                        'margin-top':'-32px'});

            //图片变清晰
            $('img.j_retract').each(function(){
                if(!$(this).hasClass('origin'))
                {
                    let imglink = $(this).attr('src').substring($(this).attr('src').lastIndexOf('/'));
                    $(this).attr('src','http://tiebapic.baidu.com/forum/pic/item'+imglink);
                    $(this).css('max-width', '875px;')
                    $(this).removeAttr('width');
                    $(this).removeAttr('height');
                    $(this).addClass('origin');
                    $(this).wrap('<div>');
                }
            });

            //发表回复变宽
            if( !$('html').hasClass('tb-ueditor-fullscreen')) //正常状态
            {
                $('.poster_head').width($('.forum_content').width() - 40);
                $('.j_title_wrap').width($('.forum_content').width() - 40);
                $('.editor_title').width($('.forum_content').width() - 130);
                $('.old_style_wrapper').width($('.forum_content').width() - 40);
                $('.old_style_wrapper .edui-container').width($('.forum_content').width() - 40);
                $('.edui-toolbar').width($('.forum_content').width() - 70);
                $('.edui-editor-body').width($('.forum_content').width() - 42);
            }
            else //全屏模式
            {
                $('.poster_head').removeAttr('style');
                $('.j_title_wrap').removeAttr('style');
                $('.editor_title').removeAttr('style');
                $('.old_style_wrapper').removeAttr('style');
                $('.old_style_wrapper .edui-container').removeAttr('style');
                $('.edui-toolbar').removeAttr('style');
                $('.edui-editor-body').removeAttr('style');
            }
        }

        //隐藏下载按钮
        $('.tbui_aside_fbar_button.tbui_fbar_down').hide();

        //贴吧链接不跳转直接打开
        $('.j-no-opener-url').each(function(){
            $(this).attr('href',$(this).text());
        });

        //隐藏广告
        $('.pull_right.label_text').closest('li').hide();
        $('.fengchao-wrap-feed').hide();
        $('.label_text').closest('.l_post').hide();
        $('.banner_theme').hide();

        //隐藏回复框会员特权提示
        $('.tb_poster_placeholder').hide();

    },1);

})();