CSDN 移除 APP 打开

自动展开内容,移除讨厌的 APP 内打开

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         CSDN 移除 APP 打开
// @namespace    http://tampermonkey.net/
// @version      0.2.4
// @description  自动展开内容,移除讨厌的 APP 内打开
// @author       sl00p
// @match        https://blog.csdn.net/*
// @match        https://www.csdn.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    // Skill main page
    var mainInter = setInterval(function() {
        var enter = document.getElementById("guid-btn-enter");
        if(enter && enter !== undefined) {
            enter.click();
            clearInterval(mainInter);
        }
    }, 50);
    var interval = setInterval(function() {
        var listNodes = document.getElementsByClassName("container-fluid container-blog app-open-box");
        for(var idx = 0; idx < listNodes.length; ++idx) {
            listNodes[idx].className = "container-fluid bdinsert"
        }
        if(listNodes.length === 0) {
            clearInterval(interval);
        }
    }, 50);
    // Remove all app download url.
    var removeInter = setInterval(function() {
        var removeNodes = ["flag col-md-4", "btn_app_link"];
        for(var idx = 0; idx < removeNodes.length; ++idx) {
            var nodes = document.getElementsByClassName(removeNodes[idx]);
            for(var jdx = 0; jdx < nodes.length; ++jdx) {
                if(nodes[jdx] !== undefined) {
                    nodes[jdx].remove();
                }
            }
        }
        if(removeNodes.length === 0) {
            clearInterval(removeInter);
        }
    }, 50);
    // Use real img url.
    setTimeout(function() {
        var imgNodes = document.getElementsByClassName("has");
        for(var idx = 0; idx < imgNodes.length; ++idx) {
            imgNodes[idx].setAttribute.src = imgNodes[idx].attributes["data-src"];
        }
        document.getElementsByClassName("read_more_btn")[0].click();
    }, 50);
    // If has pop windows, click cancel.
    // FixMe if has better choice.
    setInterval(function() {
        var popNodes = document.getElementsByClassName("read_more_btn_app_prompt_btn_cancel");
        for(var idx = 0; idx < popNodes.length; ++idx) {
           popNodes[idx].click();
        }
    }, 10);
})();