Greasy Fork

来自缓存

Greasy Fork is available in English.

百度文库界面清理

try to take over the world!

当前为 2017-05-25 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         百度文库界面清理
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://wenku.baidu.com/*
// @match        https://wenku.baidu.com/*
// @grant        none
// @grant        GM_log
// ==/UserScript==

(function() {
    'use strict';
    var content = document.getElementById( 'reader-container-inner-1');
    //console.log(document.body);

    //document.body.innerHTML=content.innerHTML;
    var para = document.createElement("div");
    para.innerHTML = '<div style="position:fixed;left:10px;top:50px;border:solid 2px red;padding:10px;z-index:999;" id="mmPrint">清理界面</div>';
    document.body.appendChild(para);

    document.getElementById("mmPrint").onclick=function(){
        //alert("print");
        //删除兄弟节点,删除父节点的兄弟节点
        removeBrother(content);
        //点击全屏按钮
        document.getElementsByClassName('top-right-fullScreen')[0].click();
        //window.print();
    };

    function removeBrother(elm) {
        if(elm === null || elm.parentNode === null || elm === document.body){
            return;
        }
        var p = elm.parentNode.children;
        for(var i =0,pl= p.length;i<pl;i++) {
            if(p[i] !== elm && p[i].tagName.toLowerCase() !== "script")
                p[i].innerHTML="";
        }
        removeBrother(elm.parentNode);


    }
    // Your code here...
})();