360doc_anti_anti-copy_anti_anti-contextmenu

No login required, copy webpage conten and open reader mode in 360doc.com; lightly adjust webpage layout for better reading experience;

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         360doc_anti_anti-copy_anti_anti-contextmenu
// @namespace    https://github.com/Kyouichirou
// @version      1.0
// @description  No login required, copy webpage conten and open reader mode in 360doc.com; lightly adjust webpage layout for better reading experience;
// @author       HLA
// @match        http://www.360doc.com/content/*.shtml
// @license      MIT
// @grant        GM_addStyle
// @grant        unsafeWindow
// @compatiable  chrome; just test on chrome80+
// @run-at       document-start
// @noframes
// ==/UserScript==

(() => {
    "use strict";
    const css = `
    .a_left{
        padding-left: 140px !important;
    }
    #bgchange{
        width: 930px !important;
    }
    #artContent{
        text-align: justify !important;
        width: 920px !important;
        max-width: 930px !important;
        min-width: 920px !important;
    }
    #goTop2,
    .floatqrcode,
    #adarttopgoogle,
    .article_showall{
        display: none !important;
    }
    .articleMaxH .article_container{
        height: auto !important;
    }`;
    GM_addStyle(css);
    window.onload = () => {
        document.oncontextmenu = new Proxy(document.oncontextmenu, {
            apply(t, tg, args) {
                return null;
            },
        });
        unsafeWindow.CopyMainContentObj = new Proxy(
            unsafeWindow.CopyMainContentObj,
            {
                get() {
                    return true;
                },
            }
        );
        new MutationObserver((event) => {
            event.forEach((e) => {
                if (e.addedNodes.length === 1) {
                    let i = e.addedNodes[0];
                    const c = i.className;
                    let l = "";
                    if (
                        !(
                            (c &&
                                typeof c === "string" &&
                                c.includes("artfullscreen")) ||
                            ((l = i.localName) &&
                                l &&
                                typeof l === "string" &&
                                l.includes("artfullscreen"))
                        )
                    ) {
                        i.remove();
                        i = null;
                    }
                }
            });
        }).observe(document.body, { childList: true });
    };
})();