手机端豆瓣网页修改

修改部分跳转链接,去除了部分按钮

目前为 2021-11-04 提交的版本。查看 最新版本

// ==UserScript==
// @name         手机端豆瓣网页修改
// @namespace    移动端豆瓣页面优化
// @version      1.0
// @description  修改部分跳转链接,去除了部分按钮
// @author       fukvqz
// @match        https://m.douban.com/group/*
// @match        https://m.douban.com/people/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';
    if (window.location.href.indexOf('topic') > 0) {
        try { document.getElementById('tbl-next-up').remove(); } catch (e) { }
        document.querySelector('.more_topic + section').remove();
        document.querySelector('.note-content + div').remove();
        document.querySelectorAll('.more_topic')[1].nextElementSibling.remove();
        //try {document.querySelector('.TalionNav-static').remove();} catch(e) {}
        document.querySelector('.TalionNav-static .icon-wrap').removeAttribute('href');
        document.querySelector('.TalionNav-static .info').removeAttribute('href');
        document.querySelector('.TalionNav-static .btn').remove();
        // document.querySelector('.TalionNav-primary .logo').removeAttribute('href');
        document.querySelector('.opreations').remove();
        var thcm = document.querySelectorAll('.meta-text .extra-info');
        for (let i = 0; i < thcm.length; i++) { thcm[i].parentNode.removeAttribute('href'); }
        var rppl = document.querySelectorAll('.meta-text');
        for (let i = 0; i < rppl.length; i++) { rppl[i].firstElementChild.href = rppl[i].firstElementChild.href.split('=')[3]; }
        var rppi = document.querySelectorAll('.reply-meta');
        for (let i = 0; i < rppi.length; i++) { rppi[i].firstElementChild.href = rppi[i].firstElementChild.href.split('=')[3]; }
        // document.querySelector('.show-all').remove();
        var saa = document.querySelector('.show-all a');
        //document.querySelector('.nav-btns a').href
        saa.href = '/to_pc/?url=' + window.location.href + '#sep';
        // saa.href = 'https://www.douban.com' + saa.href.split('=')[3];
        saa.innerText = saa.innerText.split(' ')[0];
        var moia = document.querySelectorAll("span[class='oia']");
        for (let i = 0; i < moia.length; i++) { moia[i].remove(); }
        try { document.querySelector('.oia-prompt-box .prompt .opt .cancel').click(); } catch (e) { }
        var owp = document.querySelectorAll('.oia-wrap');
        owp[0].remove();
        owp[2].remove();
        owp[1].firstElementChild.href = owp[1].firstElementChild.href.split('=')[3];
        document.querySelector('.oia-wrap .oia-btn').innerText = '查看小组更多内容';
        var jn = document.querySelectorAll('.join');
        for (let i = 0; i < jn.length; i++) { jn[i].remove(); }
        var tpitm = document.querySelectorAll('.more_topic .topic-content .topic-item a');
        for (let i = 0; i < tpitm.length; i++) { tpitm[i].href = tpitm[i].href.split('=')[2].split('&')[0]; }
        document.querySelector('.download-app').remove();
        var sm = document.querySelectorAll('.show-more a');
        for (let i = 0; i < sm.length; i++) { sm[i].href = sm[i].href.split('=')[2].split('&')[0]; }
    }
    else {
        if (window.location.href.indexOf('people') > 0) {
            document.querySelector('.TalionNav-static .icon-wrap').removeAttribute('href');
            document.querySelector('.TalionNav-static .info').removeAttribute('href');
            document.querySelector('.TalionNav-static .btn').remove();
            // document.querySelector('.TalionNav-primary .logo').removeAttribute('href');
            // document.querySelectorAll('.load-more')[1].remove();
            var style = document.createElement('style');
            style.innerHTML = '.load-more ~ .load-more {display: none;}';
            document.head.appendChild(style);
            document.querySelector('.download-app').remove();
        }
        else {
            var moia = document.querySelectorAll("span[class='oia']");
            for (let i = 0; i < moia.length; i++) { moia[i].remove(); }
            document.querySelector('.TalionNav-static .icon-wrap').removeAttribute('href');
            document.querySelector('.TalionNav-static .info').removeAttribute('href');
            document.querySelector('.TalionNav-static .btn').remove();
            // document.querySelector('.TalionNav-primary .logo').removeAttribute('href');
            var oiag = document.querySelector('.oia-wrap .oia-btn');
            oiag.href = 'https://www.douban.com' + oiag.href.split('=')[3] + '/discussion';
            oiag.innerText = '查看小组更多内容';
            var itcn = document.querySelectorAll('.topic-item .item-containor');
            for (let i = 0; i < itcn.length; i++) {
                if (itcn[i].href.indexOf('to_app') > 0) {
                    itcn[i].href = itcn[i].href.split('=')[2].split('&')[0];
                }
            }
            document.querySelector('.download-app').remove();
            // try { document.querySelector('.btn-group').remove(); } catch (e) { }
            var style = document.createElement('style');
            style.innerHTML = '.btn-group {display: none;}';
            document.head.appendChild(style);
        }
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址