Greasy Fork is available in English.

💯 懒人专用系列 ——— 知乎增强

⭕知乎视频下载。⭕屏蔽广告,用户和视频,可选根据关键词屏蔽。⭕关闭侧边栏。⭕外链直接跳转。⭕标记文章,标记视频。❌拒绝收费。⭕持续更新。

// ==UserScript==
// @name         💯 懒人专用系列 ——— 知乎增强
// @namespace    lr-toolbox-ZHPro
// @version      1.0.12
// @description  ⭕知乎视频下载。⭕屏蔽广告,用户和视频,可选根据关键词屏蔽。⭕关闭侧边栏。⭕外链直接跳转。⭕标记文章,标记视频。❌拒绝收费。⭕持续更新。
// @author       lanhaha
// @icon         https://static.zhihu.com/heifetz/favicon.ico
// @match        *://*.zhihu.com/*
// @require      https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/crypto-js/4.1.1/crypto-js.min.js
// @grant        GM_registerMenuCommand
// @grant        GM_unregisterMenuCommand
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @grant        GM_download
// @grant        GM_setClipboard
// @grant        GM_xmlhttpRequest
// @grant        GM_openInTab
// @connect      api.typechrome.com
// @connect      gitlab.com
// @run-at       document-start
// ==/UserScript==

/*
***********************************************************
应Greasyfork.org网站规则要求,
懒人脚本将视频解析、音乐下载、视频下载等功能拆分为多个脚本:
https://greasyfork.org/zh-CN/scripts/467776
https://greasyfork.org/zh-CN/scripts/469604
https://greasyfork.org/zh-CN/scripts/469689
https://greasyfork.org/zh-CN/scripts/468015
https://greasyfork.org/zh-CN/scripts/469521
可自行分别安装。
***********************************************************
*/

(function() {
    'use strict';

     /*--config--*/
    var Config ={

        couponUrl:window.location.href,

        couponHost:window.location.host,

        isMobile:/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent),

        removeVideo:GM_getValue('removeVideo','0'),

        removeAD:GM_getValue('removeAD','22'),

        downloadVideo:GM_getValue('downloadVideo','22'),

        removeRight:GM_getValue('removeRight','0'),

        changeLink:GM_getValue('changeLink','22'),

        removeKeyword:GM_getValue('removeKeyword','0'),

        removeAuthorName:GM_getValue('removeAuthorName','22'),

        specialColumn:GM_getValue('specialColumn','22'),

        videoTitle:GM_getValue('videoTitle','22'),

     }
    var {couponUrl,
         couponHost,
         isMobile,
         removeVideo,
         removeAD,
         downloadVideo,
         removeRight,
         changeLink,
         removeKeyword,
         removeAuthorName,
         specialColumn,
         videoTitle
        } = Config;
    /*--lang--*/
    var lang = {
        zhSet:'设置',
        zhVideoClose:'屏蔽视频',
        zhVideoDownload:'视频下载',
        zhADClose:'屏蔽广告',
        zhCloseLeft:'关闭侧边栏',
        zhChangeLink:'链接直接跳转',
        tipKeyword:'请输入关键词,用","号隔开',
        tipAuthorName:'请输入作者名,用","号隔开',
        zhKeywordClose:'关键词屏蔽',
        authorNameClose:'屏蔽用户',
        specialColumn:'标记文章',
        videoTitle:'标记视频',
        scriptsinstall:'脚本安装',
        scriptsuse:'使用方法',
        question:'常见问题',
        tggroup:'Telegram'
    };

    /*--create style--*/

    let timerHead = setInterval(function(){

        if(document.getElementsByTagName('head')[0]){

            clearInterval(timerHead);

            var domHead = document.getElementsByTagName('head')[0];

            domHead = document.getElementsByTagName('head')[0];

            var domStyle = document.createElement('style');

            domStyle.type = 'text/css';

            domStyle.rel = 'stylesheet';

            class BaseClass{

                constructor(){

                    GM_registerMenuCommand("设置", () => this.menuSet());

                    this.setStyle();

                }
                setStyle(){
                    let menuSetStyle = `
                        .zhmMask{
                            z-index:999999999;
                            background-color:#000;
                            position: fixed;top: 0;right: 0;bottom: 0;left: 0;
                            opacity:0.8;
                        }
                        .wrap-box{
                            z-index:1000000000;
                            position:fixed;;top: 50%;left: 50%;transform: translate(-50%, -200px);
                            width: 300px;
                            color: #555;
                            background-color: #fff;
                            border-radius: 5px;
                            overflow:hidden;
                            font:16px numFont,PingFangSC-Regular,Tahoma,Microsoft Yahei,sans-serif !important;
                            font-weight:400 !important;
                        }
                        .setWrapHead{
                            background-color:#f24443;height:40px;color:#fff;text-align:center;line-height:40px;
                        }
                        .setWrapLi{
                            margin:0px;padding:0px;
                        }
                        .setWrapLi li{
                            background-color: #fff;
                            border-bottom:1px solid #eee;
                            margin:0px !important;
                            padding:12px 20px;
                            display: flex;
                            justify-content: space-between;align-items: center;
                            list-style: none;
                        }

                        .setWrapLiContent{
                            display: flex;justify-content: space-between;align-items: center;
                        }
                        .setWrapSave{
                            position:absolute;top:-2px;right:10px;font-size:24px;cursor:pointer
                        }
                        .iconSetFoot{
                            position:absolute;bottom:0px;padding:10px 20px;width:100%;
                        z-index:1000000009;background:#fef9ef;
                        }
                        .iconSetFootLi{
                            margin:0px;padding:0px;
                        }

                        .iconSetFootLi li{
                            display: inline-flex;
                            padding:0px 2px;
                            justify-content: space-between;align-items: center;
                            font-size: 12px;
                        }
                        .iconSetFootLi li a{
                            color:#555;
                        }
                        .iconSetFootLi a:hover {
                            color:#fe6d73;
                        }
                        .iconSetPage{
                            z-index:1000000001;
                            position:absolute;top:0px;left:300px;
                            background:#fff;
                            width:300px;
                            height:100%;
                        }
                        .iconSetUlHead{
                        padding:0px;
                        margin:0px;
                        }
                        .iconSetPageHead{
                            border-bottom:1px solid #ccc;
                            height:40px;
                            line-height:40px;
                            display: flex;
                            justify-content: space-between;
                            align-items: center;
                            background-color:#fe6d73;
                            color:#fff;
                            font-size: 15px;
                        }
                        .iconSetPageLi{
                            margin:0px;padding:0px;
                        }
                        .iconSetPageLi li{
                            list-style: none;
                            padding:8px 20px;
                            border-bottom:1px solid #eee;
                        }
                        .zhihuSetPage{
                            z-index:1000000002;position:absolute;top:0px;left:300px;background:#fff;width:300px;height:100%;
                        }
                        .iconSetPageInput{
                            display: flex !important;justify-content: space-between;align-items: center;
                        }
                        .zhihuSetPageLi{
                            margin:0px;padding:0px;
                            height:258px;
                            overflow-y: scroll;
                        }

                        .zhihuSetPageContent{
                            display: flex !important;justify-content: space-between;align-items: center;
                        }

                        .zhm_circular{
                            width: 40px;height: 20px;border-radius: 16px;transition: .3s;cursor: pointer;box-shadow: 0 0 3px #999 inset;
                        }
                        .round-button{
                            width: 20px;height: 20px;;border-radius: 50%;box-shadow: 0 1px 5px rgba(0,0,0,.5);transition: .3s;position: relative;
                        }
                        .zhm_back{
                            border: solid #FFF; border-width: 0 3px 3px 0; display: inline-block; padding: 3px;transform: rotate(135deg);  -webkit-transform: rotate(135deg);margin-left:10px;cursor:pointer;
                        }
                        .to-right{
                            margin-left:20px; display: inline-block; padding: 3px;transform: rotate(-45deg); -webkit-transform: rotate(-45deg);cursor:pointer;

                        }
                        .iconSetSave{
                            font-size:24px;cursor:pointer;margin-right:5px;margin-bottom:4px;color:#FFF;
                        }
                        .zhm_set_page{
                            z-index:1000000003;
                            position:absolute;
                            top:0px;left:300px;
                            background:#fff;
                            width:300px;
                            height:100%;
                        }
                        .zhm_set_page_header{
                            border-bottom:1px solid #ccc;
                            height:40px;
                            line-height:40px;
                            display: flex;
                            justify-content: space-between;
                            align-items: center;
                            background-color:#fe6d73;
                            color:#fff;
                            font-size: 15px;
                        }
                        .zhm_set_page_content{
                            display: flex !important;justify-content: space-between;align-items: center;
                        }
                        .zhm_set_page_list{
                            margin:0px;padding:0px;
                            height: 220px;
                            overflow-y: scroll;
                        }

                        .zhm_set_page_list::-webkit-scrollbar {
                            /*滚动条整体样式*/
                            width : 0px;  /*高宽分别对应横竖滚动条的尺寸*/
                            height: 1px;
                        }
                        .zhm_set_page_list::-webkit-scrollbar-thumb {
                            /*滚动条里面小方块*/
                            border-radius   : 2px;
                            background-color: #fe6d73;
                        }
                        .zhm_set_page_list::-webkit-scrollbar-track {
                            /*滚动条里面轨道*/
                            box-shadow   : inset 0 0 5px rgba(0, 0, 0, 0.2);
                            background   : #ededed;
                            border-radius: 10px;
                        }
                        .zhm_set_page_list li{
                            /*border-bottom:1px solid #ccc;*/
                            padding:12px 20px;
                            display:block;
                            border-bottom:1px solid #eee;
                        }
                        li:last-child{
                            border-bottom:none;
                        }
                        .zhm_scroll{
                        overflow-y: scroll !important;
                        }
                        .zhm_scroll::-webkit-scrollbar {
                            /*滚动条整体样式*/
                            width : 0px;  /*高宽分别对应横竖滚动条的尺寸*/
                            height: 1px;
                        }
                        .zhm_scroll::-webkit-scrollbar-thumb {
                            /*滚动条里面小方块*/
                            border-radius   : 2px;
                            background-color: #fe6d73;
                        }
                        .zhm_scroll::-webkit-scrollbar-track {
                            /*滚动条里面轨道*/
                            box-shadow   : inset 0 0 5px rgba(0, 0, 0, 0.2);
                            background   : #ededed;
                            border-radius: 10px;
                        }
                        /*-form-*/
                        :root {
                            --base-color: #434a56;
                            --white-color-primary: #f7f8f8;
                            --white-color-secondary: #fefefe;
                            --gray-color-primary: #c2c2c2;
                            --gray-color-secondary: #c2c2c2;
                            --gray-color-tertiary: #676f79;
                            --active-color: #227c9d;
                            --valid-color: #c2c2c2;
                            --invalid-color: #f72f47;
                            --invalid-icon: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%3E%20%3Cpath%20d%3D%22M13.41%2012l4.3-4.29a1%201%200%201%200-1.42-1.42L12%2010.59l-4.29-4.3a1%201%200%200%200-1.42%201.42l4.3%204.29-4.3%204.29a1%201%200%200%200%200%201.42%201%201%200%200%200%201.42%200l4.29-4.3%204.29%204.3a1%201%200%200%200%201.42%200%201%201%200%200%200%200-1.42z%22%20fill%3D%22%23f72f47%22%20%2F%3E%3C%2Fsvg%3E");
                        }
                        .text-input {
                            font-size: 16px;
                            position: relative;
                            right:0px;
                            z-index: 0;
                        }
                        .text-input__body {
                            -webkit-appearance: none;
                            -moz-appearance: none;
                            appearance: none;
                            background-color: transparent;
                            border: 1px solid var(--gray-color-primary);
                            border-radius: 3px;
                            height: 1.7em;
                            line-height: 1.7;
                            overflow: hidden;
                            padding: 2px 1em;
                            text-overflow: ellipsis;
                            transition: background-color 0.3s;
                            width:55%;
                            font-size:14px;
                            box-sizing: initial;
                        }
                        .text-input__body:-ms-input-placeholder {
                            color: var(--gray-color-secondary);
                        }
                        .text-input__body::-moz-placeholder {
                            color: var(--gray-color-secondary);
                        }
                        .text-input__body::placeholder {
                            color: var(--gray-color-secondary);
                        }

                        .text-input__body[data-is-valid] {
                            padding-right: 1em;

                        }
                        .text-input__body[data-is-valid=true] {
                            border-color: var(--valid-color);
                        }
                        .text-input__body[data-is-valid=false] {
                            border-color: var(--invalid-color);
                            box-shadow: inset 0 0 0 1px var(--invalid-color);
                        }
                        .text-input__body:focus {
                            border-color: var(--active-color);
                            box-shadow: inset 0 0 0 1px var(--active-color);
                            outline: none;
                        }
                        .text-input__body:-webkit-autofill {
                            transition-delay: 9999s;
                            -webkit-transition-property: background-color;
                            transition-property: background-color;
                        }
                        .text-input__validator {
                            background-position: right 0.5em center;
                            background-repeat: no-repeat;
                            background-size: 1.5em;
                            display: inline-block;
                            height: 100%;
                            left: 0;
                            position: absolute;
                            top: 0;
                            width: 100%;
                            z-index: -1;
                        }
                        .text-input__body[data-is-valid=false] + .text-input__validator {
                            background-image: var(--invalid-icon);
                        }
                        .select-box {
                            box-sizing: inherit;
                            font-size: 16px;
                            position: relative;
                            transition: background-color 0.5s ease-out;
                            width:90px;
                        }
                        .select-box::after {
                            border-color: var(--gray-color-secondary) transparent transparent transparent;
                            border-style: solid;
                            border-width: 6px 4px 0;
                            bottom: 0;
                            content: "";
                            display: inline-block;
                            height: 0;
                            margin: auto 0;
                            pointer-events: none;
                            position: absolute;
                            right: -72px;
                            top: 0;
                            width: 0;
                            z-index: 1;
                        }
                        .select-box__body {
                            box-sizing: initial;
                            -webkit-appearance: none;
                            -moz-appearance: none;
                            appearance: none;
                            background-color: transparent;
                            border: 1px solid var(--gray-color-primary);
                            border-radius: 3px;
                            cursor: pointer;
                            height: 1.7em;
                            line-height: 1.7;
                            padding-left: 1em;
                            padding-right: calc(1em + 16px);
                            width: 140%;
                            font-size:14px;
                            padding-top:2px;
                            padding-bottom:2px;
                        }
                        .select-box__body[data-is-valid=true] {
                            border-color: var(--valid-color);
                            box-shadow: inset 0 0 0 1px var(--valid-color);
                        }
                        .select-box__body[data-is-valid=false] {
                            border-color: var(--invalid-color);
                            box-shadow: inset 0 0 0 1px var(--invalid-color);
                        }
                        .select-box__body.focus-visible {
                            border-color: var(--active-color);
                            box-shadow: inset 0 0 0 1px var(--active-color);
                            outline: none;
                        }
                        .select-box__body:-webkit-autofill {
                            transition-delay: 9999s;
                            -webkit-transition-property: background-color;
                            transition-property: background-color;
                        }
                        .textarea__body {
                            -webkit-appearance: none;
                            -moz-appearance: none;
                            appearance: none;
                            background-color: transparent;
                            border: 1px solid var(--gray-color-primary);
                            border-radius: 0;
                            box-sizing: initial;
                            font: inherit;
                            left: 0;
                            letter-spacing: inherit;
                            overflow: hidden;
                            padding: 1em;
                            position: absolute;
                            resize: none;
                            top: 0;
                            transition: background-color 0.5s ease-out;
                            width: 100%;
                            }
                        .textarea__body:only-child {
                            position: relative;
                            resize: vertical;
                        }
                        .textarea__body:focus {
                            border-color: var(--active-color);
                            box-shadow: inset 0 0 0 1px var(--active-color);
                            outline: none;
                        }
                        .textarea__body[data-is-valid=true] {
                            border-color: var(--valid-color);
                            box-shadow: inset 0 0 0 1px var(--valid-color);
                        }
                        .textarea__body[data-is-valid=false] {
                            border-color: var(--invalid-color);
                            box-shadow: inset 0 0 0 1px var(--invalid-color);
                        }

                        .textarea ._dummy-box {
                            border: 1px solid;
                            box-sizing: border-box;
                            min-height: 240px;
                            overflow: hidden;
                            overflow-wrap: break-word;
                            padding: 1em;
                            visibility: hidden;
                            white-space: pre-wrap;
                            word-wrap: break-word;
                        }
                        .toLeftMove{
                            nimation:moveToLeft 0.5s infinite;
                            -webkit-animation:moveToLeft 0.5s infinite; /*Safari and Chrome*/
                            animation-iteration-count:1;
                            animation-fill-mode: forwards;
                        }

                        @keyframes moveToLeft{
                            from {left:200px;}
                            to {left:0px;}
                        }

                        @-webkit-keyframes moveToLeft /*Safari and Chrome*/{
                            from {left:200px;}
                            to {left:0px;}
                        }

                        .toRightMove{
                            nimation:moveToRight 2s infinite;
                            -webkit-animation:moveToRight 2s infinite; /*Safari and Chrome*/
                            animation-iteration-count:1;
                            animation-fill-mode: forwards;
                        }
                        @keyframes moveToRight{
                            from {left:0px;}
                            to {left:2000px;}
                        }

                        @-webkit-keyframes moveToRight /*Safari and Chrome*/{
                            from {left:0px;}
                            to {left:200px;}
                        }

                    `;

                    domStyle .appendChild(document.createTextNode(menuSetStyle));

                    domHead.appendChild(domStyle);
                }
                menuSet(){
                    var _this = this;

                    var setListJson = [
                        {'optionName':lang.zhVideoClose,'optionID':'removeVideo','default':removeVideo},
                        {'optionName':lang.zhVideoDownload,'optionID':'downloadVideo','default':downloadVideo},
                        {'optionName':lang.zhADClose,'optionID':'removeAD','default':removeAD},
                        {'optionName':lang.zhCloseLeft,'optionID':'removeRight','default':removeRight},
                        {'optionName':lang.zhChangeLink,'optionID':'changeLink','default':changeLink},
                        {'optionName':lang.specialColumn,'optionID':'specialColumn','default':specialColumn},
                        {'optionName':lang.videoTitle,'optionID':'videoTitle','default':videoTitle},
                        {'optionName':lang.zhKeywordClose,'optionID':'removeKeyword','default':removeKeyword},
                        {'optionName':lang.authorNameClose,'optionID':'removeAuthorName','default':removeAuthorName}
                    ];


                    var setHtml = "<div id='setMask' class='zhmMask'></div>";

                    setHtml +="<div class='wrap-box' id='setWrap'>";

                    setHtml +="<ul class='iconSetUlHead'><li class='iconSetPageHead'><span></span><span>"+lang.zhSet+"</span><span class='iconSetSave'>×</span></li></ul>";

                    setHtml +="<ul class='setWrapLi'>";

                    for(var setN=0;setN<setListJson.length;setN++){

                        var listValue = setListJson[setN].default;

                        let backColor,arrowColor,switchBackCorlor;

                        if(listValue != 22){
                            backColor = '#fff';
                            arrowColor= '#EEE';
                            switchBackCorlor = '#FFF';

                        }else{
                            backColor = '#fe6d73';
                            arrowColor = '#CCC';
                            switchBackCorlor = '#FFE5E5';
                        }

                        if(setListJson[setN].optionID == ''){
                            arrowColor = '#EEE';
                        };
                        setHtml +="<li><span>"+setListJson[setN].optionName+"</span>";

                        setHtml +="<div class='setWrapLiContent'>";

                        setHtml +="<div class='zhm_circular' id='"+setListJson[setN].optionID+"' style='background-color: "+switchBackCorlor+";'><div class='round-button' style='background: "+backColor+";left: "+listValue+"px'></div></div>";

                        setHtml +="</div></li>";

                        if(setListJson[setN].optionID == 'removeKeyword'){

                            var keywordShow;

                            if(GM_getValue('removeKeyword','0') == '22'){

                                keywordShow = 'block';

                            }else{
                                keywordShow = 'none';
                            }

                            setHtml +="<div style='margin:5px 20px;display:"+keywordShow+";padding:5px 0px;' id='zhihuKeyword'><span class='text-input'><input value='"+GM_getValue('inputZhKeyword','')+"' id='inputZhKeyword' class='text-input__body' placeholder='"+lang.tipKeyword+"' style='width:88%'><span></div>";
                        }
                        if(setListJson[setN].optionID == 'removeAuthorName'){

                            var authorNameShow;

                            if(GM_getValue('removeAuthorName','0') == '22'){

                                authorNameShow = 'block';

                            }else{
                                authorNameShow = 'none';
                            }

                            setHtml +="<div style='margin:5px 20px;display:"+authorNameShow+";padding:5px 0px;' id='zhihuAuthorName'><span class='text-input'><input value='"+GM_getValue('inputZhAuthorName','')+"' id='inputZhAuthorName' class='text-input__body' placeholder='"+lang.tipAuthorName+"' style='width:88%'><span></div>";
                        }

                    }

                    setHtml +="</ul>";

                    setHtml +="<div style='height:60px;'></div>";

                    setHtml +="<div class='iconSetFoot' style=''>";

                    setHtml +="<ul class='iconSetFootLi'>";

                    setHtml +="<li><a href='https://gitlab.com/lanhaha/lanrenjiaoben' target='_blank'>"+lang.scriptsinstall+"</a></li>・<li><a href='https://gitlab.com/lanhaha/lanrenjiaoben#%E4%BD%BF%E7%94%A8' target='_blank'>"+lang.scriptsuse+"</a></li>・<li><a href='https://gitlab.com/lanhaha/lanrenjiaoben#%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98' target='_blank'>"+lang.question+"</a></li>・<li><a href='https://t.me/+sGo6ZZvy54wzYTll' target='_blank'>"+lang.tggroup+"</a></li>";

                    setHtml +='</ul>';

                    setHtml +='</div>';

                    setHtml += "</div>";

                    if(document.querySelector('#setMask')) return;

                    this.createElement('div','zhmMenu');

                    let zhmMenu = document.getElementById('zhmMenu');

                    zhmMenu.innerHTML = setHtml;

                    let timerZhmIcon = setInterval(function(){

                        if (document.querySelector('#zhmMenu')){

                            clearInterval(timerZhmIcon); // 取消定时器

                            let circular = document.querySelectorAll('.zhm_circular');

                            circular.forEach(function(item){

                                item.addEventListener('click', function(e){

                                    let buttonStyle = item.children[0].style;

                                    let left = buttonStyle.left;

                                    left = parseInt(left);

                                    let listLeftValue;

                                    if(left==0){

                                        buttonStyle.left = '22px';

                                        buttonStyle.background = '#fe6d73';

                                        item.style.background='#ffE5E5';

                                        if(item.nextSibling && item.nextSibling.getAttribute('data')){

                                            item.nextSibling.setAttribute('style','border: solid #ccc;border-width: 0 3px 3px 0;')
                                        }

                                        listLeftValue = 22;

                                    }else{

                                        buttonStyle.left = '0px';

                                        buttonStyle.background = '#fff';

                                        item.style.background='#fff';

                                        if(item.nextSibling){

                                            item.nextSibling.setAttribute('style','border: solid #EEE;border-width: 0 3px 3px 0;')

                                        }

                                        listLeftValue = 0;
                                    }

                                    let setListID = item.id;

                                    if(setListID == 'removeKeyword' && listLeftValue==22){

                                        document.querySelector('#zhihuKeyword').style.display='block';
                                    }

                                    if(setListID == 'removeKeyword' && listLeftValue==0){

                                        document.querySelector('#zhihuKeyword').style.display='none';
                                    }

                                    if(setListID == 'removeAuthorName' && listLeftValue==22){

                                        document.querySelector('#zhihuAuthorName').style.display='block';
                                    }

                                    if(setListID == 'removeAuthorName' && listLeftValue==0){

                                        document.querySelector('#zhihuAuthorName').style.display='none';

                                    }

                                    GM_setValue(setListID,listLeftValue);

                                })

                            });

                            document.querySelector('.iconSetSave').addEventListener('click',()=>{

                                let inputZhKeyword = document.getElementById('inputZhKeyword').value;

                                let inputAuthorName = document.getElementById('inputZhAuthorName').value;

                                if(inputZhKeyword != ''){

                                    GM_setValue('inputZhKeyword',inputZhKeyword);

                                }else{

                                    if(GM_getValue('inputZhKeyword')){

                                        GM_deleteValue('inputZhKeyword');
                                    }

                                }

                                if(inputAuthorName != ''){

                                    GM_setValue('inputZhAuthorName',inputAuthorName);

                                }else{

                                    if(GM_getValue('inputZhAuthorName')){

                                        GM_deleteValue('inputZhAuthorName');
                                    }

                                }

                                location.href=location.href;

                            })

                        }

                    })

                    }

                createElement(dom,domId){

                    var rootElement = document.body;

                    var newElement = document.createElement(dom);

                    newElement.id = domId;

                    var newElementHtmlContent = document.createTextNode('');

                    rootElement.appendChild(newElement);

                    newElement.appendChild(newElementHtmlContent);

                }

                request(method,url,data,isCookie=''){

                    let request = new XMLHttpRequest();

                    return new Promise((resolve,reject)=>{

                        request.onreadystatechange=function(){

                            if(request.readyState==4){

                                if(request.status==200){

                                    resolve(request.responseText);

                                }else{

                                    reject(request.status);
                                }

                            }
                        }

                        request.open(method,url);
                        //request.withCredentials = true;
                        if(isCookie){
                            request.withCredentials = true;
                        }
                        request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                        request.send(data);

                    })

                }

                setCookie(cname,cvalue,exdays){

                    var d = new Date();

                    d.setTime(d.getTime()+(exdays*24*60*60*1000));

                    var expires = "expires="+d.toGMTString();

                    document.cookie = cname+"="+cvalue+"; "+expires;
                }

                getCookie(cname){
                    var name = cname + "=";
                    var ca = document.cookie.split(';');
                    for(var i=0; i<ca.length; i++) {
                        var c = ca[i].trim();
                        if (c.indexOf(name)==0) { return c.substring(name.length,c.length); }
                    }
                    return "";
                }

                getQueryString(e) {
                    var t = new RegExp("(^|&)" + e + "=([^&]*)(&|$)");
                    var a = window.location.search.substr(1).match(t);
                    if (a != null) return a[2];
                    return "";
                }

                getUrlParams(url){
                    let reg = /([^?&+#]+)=([^?&+#]+)/g;
                    let obj={};
                    url.replace(reg,(res,$1,$2)=>{obj[$1]=$2});
                    return obj;
                }

                //all参数默认空,是真时返回为数组
                static getElement(css,all=''){

                    return new Promise((resolve,reject)=>{

                        let num = 0;

                        let timer = setInterval(function(){

                            num++

                            let dom;

                            if(all == false){

                                dom = document.querySelector(css);

                                if(dom){

                                    clearInterval(timer);

                                    resolve(dom);

                                }

                            }else{

                                dom = document.querySelectorAll(css);

                                if(dom.length>0){

                                    clearInterval(timer);

                                    resolve(dom);

                                }
                            }

                            if(num==20){
                                clearInterval(timer);
                                resolve(false);
                            }

                        },300)

                        })


                }

                static toast(msg,duration){

                    duration=isNaN(duration)?3000:duration;

                    let toastDom = document.createElement('div');

                    toastDom.innerHTML = msg;

                    toastDom.style.cssText='padding:2px 15px;min-height: 36px;line-height: 36px;text-align: center;transform: translate(-50%);border-radius: 4px;color: rgb(255, 255, 255);position: fixed;top: 50%;left: 50%;z-index: 9999999;background: rgb(0, 0, 0);font-size: 16px;'

                    document.body.appendChild(toastDom);

                    setTimeout(function() {

                        var d = 0.5;

                        toastDom.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';

                        toastDom.style.opacity = '0';

                        setTimeout(function() { document.body.removeChild(toastDom) }, d * 1000);

                    }, duration);

                }

                static LR_download(url,filename){

                    let ua = navigator.userAgent.toLowerCase();

                    console.log(ua.match(/version\/([\d.]+).*safari/));

                    if(ua.match(/version\/([\d.]+).*safari/)){

                        window.open(url);

                    }else{
                        console.log(url);
                        GM_download(url,filename);
                    }


                }

            }

            class ZhClass extends BaseClass{

                constructor(){
                    super();
                }
                showSpecialColumn(){

                    if(location.href == 'https://www.zhihu.com/'){

                        let cardRecommend = document.querySelectorAll('.Feed');

                        if(cardRecommend.length >0){

                            cardRecommend.forEach(function(item){

                                if(item.querySelector('.specialColumn')){
                                    return;
                                }

                                let dataZop = JSON.parse(item.getAttribute('data-za-extra-module'));

                                if(!dataZop)return;

                                let type = dataZop.card.content.type;

                                if(type == 'Post'){

                                    let title = item.querySelector('div>div>h2>span>a');

                                    if(!title)return;

                                    let newElement = document.createElement('button');

                                    newElement.className = 'specialColumn Button VoteButton VoteButton--up';

                                    newElement.style = 'line-height:20px;padding:0px 5px;margin-right:5px;border-radius:2px;';

                                    newElement.innerText = '文章';

                                    title.before(newElement);

                                }
                            })
                        }

                    }

                    if(location.href.match(/https?:\/\/www.zhihu.com\/search/)){
                        let n=0;

                        let timer= setInterval(function(){

                            let cardSearch = document.querySelectorAll('.SearchResult-Card');

                            if(n++>600){
                                clearInterval(timer);
                            }

                            if(cardSearch.length >0){

                                clearInterval(timer);

                                cardSearch.forEach(function(item){

                                    if(item.querySelector('.specialColumn')){
                                        return;
                                    }

                                    let dataZop = JSON.parse(item.getAttribute('data-za-extra-module'));

                                    if(!dataZop)return;

                                    let type = dataZop.card.content.type;

                                    console.log('search',type);

                                    if(type == 'Post'){

                                        let title = item.querySelector('div>div>h2>span>div>a');

                                        if(!title)return;

                                        let newElement = document.createElement('button');

                                        newElement.className = 'specialColumn Button VoteButton VoteButton--up';

                                        newElement.style = 'line-height:20px;padding:0px 5px;margin-right:5px;';

                                        newElement.innerText = '文章';

                                        title.before(newElement);

                                    }
                                })
                            }


                        })
                        }
                }

                showVideoTitle(){

                    if(location.href == 'https://www.zhihu.com/'){

                        let cardRecommend = document.querySelectorAll('.Feed');

                        if(cardRecommend.length >0){

                            cardRecommend.forEach(function(item){

                                if(item.querySelector('.videoTitle')){
                                    return;
                                }

                                let dataZop = JSON.parse(item.getAttribute('data-za-extra-module'));

                                if(!dataZop)return;

                                let hasVideo = dataZop.card.has_video;

                                if(hasVideo == true){

                                    let title;

                                    if(item.querySelector('div>div>h2>div>a')){

                                        title = item.querySelector('div>div>h2>div>a');

                                    }else if(item.querySelector('div>div>h2>span>a')){

                                        title = item.querySelector('div>div>h2>span>a');

                                    }else{

                                        return;
                                    }

                                    let newElement = document.createElement('button');

                                    newElement.className = 'videoTitle';

                                    newElement.style = 'background: rgba(255, 131, 86, 0.12);color: rgb(255, 73, 12);line-height:20px;padding:1px 6px;margin-right:5px;border-radius:2px;font-size:14px;';

                                    newElement.innerText = '视频';

                                    title.before(newElement);

                                }
                            })
                        }

                    }

                    if(location.href.match(/https?:\/\/www.zhihu.com\/search/)){

                        let n=0;

                        let timer= setInterval(function(){

                            let cardSearch = document.querySelectorAll('.SearchResult-Card');

                            if(n++>600){
                                clearInterval(timer);
                            }

                            if(cardSearch.length >0){

                                clearInterval(timer);

                                cardSearch.forEach(function(item){

                                    if(item.querySelector('.videoTitle')){
                                        return;
                                    }

                                    let dataZop = JSON.parse(item.getAttribute('data-za-extra-module'));

                                    if(!dataZop)return;

                                    let type = dataZop.card.content.type;

                                    if(type == 'Zvideo' ){

                                        let title = item.querySelector('div>div>h2>span>div>a');

                                        if(!title)return;

                                        let newElement = document.createElement('button');

                                        newElement.className = 'videoTitle';

                                        newElement.style = 'background: rgba(255, 131, 86, 0.12);color: rgb(255, 73, 12);line-height:20px;padding:1px 6px;margin-right:5px;border-radius:2px;font-size:14px;';

                                        newElement.innerText = '视频';

                                        title.before(newElement);

                                    }
                                })
                            }


                        })
                        }

                }

                removeVideo(){

                    let card = document.querySelectorAll('.Feed');

                    card.forEach(function(item){

                        let dataZop = JSON.parse(item.getAttribute('data-za-extra-module'));

                        let video = dataZop.card.content.video_id;

                        if(video){

                            item.parentNode.style='display:none;';

                        }
                    })

                }

                removeAD(){

                    let zhHideAD = `.Pc-card,.Pc-word{display:none !important;}.TopstoryItem--advertCard{display:none !important}`;

                    domStyle .appendChild(document.createTextNode(zhHideAD));

                    domHead.appendChild(domStyle);

                }

                downloadVideo(){

                    var _this = this;

                    let videTimer= setInterval(function(){

                        let videoDom = document.querySelectorAll('video');

                        if(videoDom.length>0){

                            for(let i=0;i<videoDom.length;i++){

                                let videoPlayUrl = videoDom[i].src?videoDom[i].src:false;

                                if(!videoPlayUrl)continue;

                                let videoItemParentDom = videoDom[i].parentNode.parentNode.parentNode;

                                if(!videoItemParentDom)continue;

                                let videoItemDom = videoItemParentDom.querySelector('._jro6t0:last-child > div:first-child');

                                if(!videoItemDom)continue;

                                if(videoItemDom.className == 'downloadVideo')continue;

                                let zhmVideoItemDom = videoItemDom.cloneNode(true);

                                zhmVideoItemDom.querySelector('._1tg8oir').innerText='下载';

                                zhmVideoItemDom.setAttribute('class','downloadVideo');

                                videoItemDom.before(zhmVideoItemDom);

                                 zhmVideoItemDom.addEventListener('click',function(e){

                                     //console.log(videoPlayUrl);

                                     let videoName = new Date().getTime()+'.mp4';

                                     BaseClass.LR_download(videoPlayUrl,videoName);

                                 })

                            }
                        }

                    },1000);


                }

                removeRight(){
                    if(location.href.match(/^https?:\/\/www\.zhihu\.com\/people\/.*/)){
                        return false;
                    }
                    let zhFullScreen = `.GlobalSideBar {display: none !important;}
                    .css-1qyytj7{display: none !important;}
                    .Question-sideColumn{display:none !important}
                    .Topstory-mainColumn{width:100% !important}
                    .Question-mainColumn{width:1000px !important}
                    .css-cazg48{margin: 0px 16px 0px 0px !important;}
                    .QuestionWaiting-mainColumn{width:100% !important;}
                    .css-1j5d3ll{padding-left:10px;}
                    .css-yhjwoe{justify-content: space-between !important;}
                    .AuthorInfo{max-width:1000px !important;};
                    `;
                    domStyle .appendChild(document.createTextNode(zhFullScreen));

                    domHead.appendChild(domStyle);
                }

                changeLink(){

                    if(couponUrl.indexOf('target') != -1){

                        let obj = this.getUrlParams(couponUrl);

                        if(obj.target == undefined) return;

                        let link = decodeURIComponent(obj.target);

                        location.href=link;
                    }
                }

                removeKeyword(){

                    var GMKeyword = GM_getValue('inputZhKeyword','0');

                    if(GMKeyword == '0' || GMKeyword == '') return;

                    let keyword = GMKeyword.split(',');

                    let content = document.querySelectorAll('.ContentItem');

                    keyword.forEach(function(item){

                        content.forEach(function(value){

                            let dataZop = JSON.parse(value.getAttribute('data-zop'));

                            if(dataZop && dataZop.title.indexOf(item) != -1){

                                let itemCard = value.parentNode.parentNode.parentNode;

                                let itemCardClass= itemCard.className;

                                if(itemCardClass.indexOf('TopstoryItem-isRecommend') != -1){

                                    itemCard.style='display:none';
                                }
                            }

                        })
                    })
                }

                removeAuthorName(){

                    var GMAuthorName = GM_getValue('inputZhAuthorName','0');

                    if(GMAuthorName == '0' || GMAuthorName == '') return;

                    let authorName = GMAuthorName.split(',');

                    //搜索页
                    if(location.href.match(/^https?:\/\/www.zhihu.com\/search/)){

                        let n=0;

                        let timer = setInterval(function(){

                            let userLink = document.querySelectorAll('.Card');

                            if(userLink.length > 5){

                                clearInterval(timer);

                                userLink.forEach(function(item){

                                    let author = item.querySelector('b');

                                    if(author){

                                        if(authorName.indexOf(author.innerText) != -1){

                                            item.style = 'display:none';
                                        }

                                    }

                                })

                            }else if(n>30){

                                clearInterval(timer);

                            }else{

                                n++;
                            }

                        },100)

                        }
                    //回答页
                    if(location.href.match(/^https?:\/\/www.zhihu.com\/question\/.*/)){

                        let itemDom = document.querySelectorAll('.List-item');

                        if(itemDom.length>0){

                            itemDom.forEach(function(item){

                                let content = item.querySelector('.ContentItem');

                                if(content){

                                    let dataZop = JSON.parse(content.getAttribute('data-zop'));

                                    if(authorName.indexOf(dataZop.authorName) != -1){

                                        item.style = 'display:none';

                                    }

                                }

                            })

                        }

                    }
                    //等你回答页
                    if(location.href == 'https://www.zhihu.com/question/waiting'){

                        setTimeout(function(){

                            let questionList = document.querySelectorAll('.jsNavigable');

                            if(questionList.length>0){

                                questionList.forEach(function(item){

                                    let authorDomText = item.querySelector('.css-tnsaxh').innerText;

                                    if(authorDomText){

                                        let author = authorDomText.replace('"','').replace('的提问','').replace(/(^\s+)|(\s+$)/g,'');

                                        if(author){

                                            if(authorName.indexOf(author) != -1){

                                                item.style='display:none;';

                                            }

                                        }

                                    }

                                })

                            }

                        },300)
                    }
                    //推荐页
                    if(location.href == 'https://www.zhihu.com/'){

                        let content = document.querySelectorAll('.ContentItem');

                        content.forEach(function(value){

                            let dataZop = JSON.parse(value.getAttribute('data-zop'));

                            if(authorName.indexOf(dataZop.authorName) != -1){

                                let itemCard = value.parentNode.parentNode.parentNode;

                                if(itemCard){

                                    itemCard.style='display:none';
                                }
                            }

                        })

                    }

                    //评论屏蔽
                    let n=0;

                    let timerCloseAuthor = setInterval(function(){

                        let commentDom = document.querySelector('.Comments-container')?document.querySelector('.Comments-container'):document.querySelector('.css-34podr');

                        //let commentBox = document.querySelector('.css-34podr');

                        if(commentDom){

                            let commentLi = commentDom.querySelectorAll('.css-1frn93x>div>div');

                            if(commentLi[0].className=='css-194v73m'){

                                commentLi.forEach(function(item){

                                    let commentAuthorNameDom = item.querySelector('.css-1rd0h6f');

                                    let commentAuthorName = commentAuthorNameDom.innerText;

                                    if(authorName.indexOf(commentAuthorName) != -1){

                                        item.style = 'display:none';
                                    }

                                })


                            }

                        }
                    })

                    }

                removeYanxuan(){

                    //回答页
                    if(location.href.match(/^https?:\/\/www.zhihu.com\/question\/.*/)){

                        let itemDom = document.querySelectorAll('.List-item');

                        if(itemDom.length>0){

                            itemDom.forEach(function(item){

                                let content = item.querySelector('.KfeCollection-OrdinaryLabel-content');

                                if(content && content.innerText.indexOf('盐选') != -1){

                                    item.style = 'display:none';

                                }
                            })

                        }

                        let answerCard = document.querySelector('.AnswerCard');

                        if(answerCard){

                            let content = answerCard.querySelector('.KfeCollection-OrdinaryLabel-content');

                            if(content && content.innerText.indexOf('盐选') != -1){

                                answerCard.style = 'display:none';
                            }
                        }

                    }

                    //搜索页
                    if(location.href.match(/^https?:\/\/www.zhihu.com\/search/)){

                        let num = 0;

                        let timer = setInterval(function(){

                            let cardList = document.querySelectorAll('.Card');

                            if(cardList.length > 5){

                                clearInterval(timer);

                                cardList.forEach(function(item){

                                    let type = item.querySelector('.KfeCollection-PcCollegeCard-type');

                                    if(type && type.innerText.indexOf('盐选专栏') != -1){

                                        item.style = 'display:none';
                                    }

                                    let author = item.querySelector('b');

                                    let authorYanxuan = ['故事档案局', '盐选推荐', '盐选科普', '盐选成长计划', '知乎盐选会员', '知乎盐选创作者', '盐选心理', '盐选健康必修课', '盐选奇妙物语', '盐选生活馆', '盐选职场', '盐选文学甄选', '盐选作者小管家', '盐选博物馆', '盐选点金', '盐选测评室', '盐选科技前沿', '盐选会员精品', '历史环游记'];

                                    if(author && authorYanxuan.indexOf(author.innerText) != -1){

                                        item.style = 'display:none';

                                    }

                                })

                            }else if(num>30){

                                clearInterval(timer);

                            }else{

                                num++;
                            }

                        },100)

                        }

                    //推荐页
                    if(location.href == 'https://www.zhihu.com/'){

                        let content = document.querySelectorAll('.ContentItem');

                        content.forEach(function(item){

                            let content = item.querySelector('.KfeCollection-OrdinaryLabel-content');

                            if(content && content.innerText.indexOf('盐选') != -1){

                                item.style = 'display:none';

                            }

                        })
                    }
                }

                closeAuthor(){
                    //通过定时器获取

                    let timerCloseAuthor = setInterval(function(){

                        let zhmCloseAuthorButton = document.querySelector('#zhmCloseAuthorButton');

                        if(zhmCloseAuthorButton)return;

                        let authorInfo = document.querySelector('.css-1rd6ukm');

                        if(authorInfo){

                            let userNameInfo = authorInfo.querySelector('.UserLink');

                            if(userNameInfo){

                                let userLinkInfo = userNameInfo.querySelector('.UserLink-link');

                                let authorNameLink = userLinkInfo.innerText;

                                let GMAuthorName = GM_getValue('inputZhAuthorName');

                                let authorArray = GMAuthorName?GMAuthorName.split(','):'';

                                let buttonClose = document.createElement('button');

                                buttonClose.innerHTML = authorArray.indexOf(authorNameLink) != -1?'已屏蔽':'屏蔽用户';

                                buttonClose.style = buttonClose.innerHTML == '已屏蔽'?'position:absolute;right:10px;background-color:#ff2e4d;border-color:#ff2e4d':'position:absolute;right:10px';

                                buttonClose.className='Button FollowButton FEfUrdfMIKpQDJDqkjte Button--primary Button--blue epMJl0lFQuYbC7jrwr_o JmYzaky7MEPMFcJDLNMG';

                                buttonClose.setAttribute('id','zhmCloseAuthorButton');

                                userNameInfo.appendChild(buttonClose);

                                userNameInfo.parentNode.style='line-height:35px';

                                buttonClose.addEventListener('click',function(){

                                    let zhmAuthorName;

                                    if(buttonClose.innerHTML=='已屏蔽'){

                                        for(let i=0;i<authorArray.length;i++){

                                            if(authorArray[i] == authorNameLink){

                                                authorArray.splice(i,1);

                                                break;
                                            }

                                        }

                                        zhmAuthorName = authorArray.toString();

                                    }else{

                                        zhmAuthorName= GM_getValue('inputZhAuthorName')?GM_getValue('inputZhAuthorName')+','+authorNameLink:authorNameLink;
                                    }

                                    GM_setValue('inputZhAuthorName',zhmAuthorName);

                                    GM_setValue('removeAuthorName','22');

                                    buttonClose.innerHTML = buttonClose.innerHTML == '已屏蔽'?'屏蔽用户':'已屏蔽';

                                    buttonClose.style = buttonClose.innerHTML == '已屏蔽'?'position:absolute;right:10px;background-color:#ff2e4d;border-color:#ff2e4d':'position:absolute;right:10px';

                                })
                            }

                        }
                    })

                    }
            }

            var baseClass = new BaseClass();

            function zhNiceFunc(){

                var zhClass = new ZhClass();

                //关闭登录弹框
                (async function(){

                    let loginModalWrapper = await BaseClass.getElement(".Modal-wrapper");

                    if(loginModalWrapper){

                        let closeButton = loginModalWrapper.querySelector('.Modal-closeButton');

                        if(closeButton){

                            closeButton.click();

                        }

                    }

                })()

                var zhData = [
                    {func:'removeVideo',isOpen:GM_getValue('removeVideo','0'),isOnscroll:1,onload:1},
                    {func:'removeAD',isOpen:GM_getValue('removeAD','22'),isOnscroll:0,onload:0},
                    {func:'downloadVideo',isOpen:GM_getValue('downloadVideo','22'),isOnscroll:0,onload:0},
                    {func:'removeRight',isOpen:GM_getValue('removeRight','0'),isOnscroll:0,onload:0},
                    {func:'changeLink',isOpen:GM_getValue('changeLink','22'),isOnscroll:0,onload:0},
                    {func:'removeKeyword',isOpen:GM_getValue('removeKeyword','0'),isOnscroll:1,onload:1},
                    {func:'showSpecialColumn',isOpen:GM_getValue('specialColumn','22'),isOnscroll:1,onload:1},
                    {func:'showVideoTitle',isOpen:GM_getValue('videoTitle','22'),isOnscroll:1,onload:1},
                    {func:'removeAuthorName',isOpen:GM_getValue('removeAuthorName',22),isOnscroll:1,onload:1},
                    {func:'removeYanxuan',isOpen:GM_getValue('removeYanxuan','0'),isOnscroll:1,onload:1},
                    {func:'closeAuthor',isOpen:GM_getValue('removeAuthorName',22),isOnscroll:0,onload:1},
                ]

                zhData.forEach(function(item){
                    if(item.isOpen==22 && item.onload==0){
                        zhClass[item.func]();
                    }
                })

                window.onload=function(){
                    zhData.forEach(function(item){
                        if(item.isOpen==22 && item.onload==1){
                            zhClass[item.func]();
                        }
                    })
                }
                window.onscroll = function(){

                    var scrollTop = document.documentElement.scrollTop;

                    if(scrollTop > 200){

                        zhData.forEach(function(item){
                            if(item.isOpen==22 && item.isOnscroll==1){

                                zhClass[item.func]();
                            }
                        })

                    }

                }

            }

            zhNiceFunc();

            //GM_deleteValue('installTime');return;

            if(isMobile)return;

        }

    })

})();