Greasy Fork

Greasy Fork is available in English.

Hide pics

Hide pics so that don't be seen by leaders.

当前为 2020-08-24 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Hide pics
// @namespace    http://greasyfork.icu/
// @version      0.1
// @description  Hide pics so that don't be seen by leaders.
// @author       JMRY
// @include      *://*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
	var show=true;

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

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

	style.innerHTML=`.toggleImg{
		position:fixed;left:0px;bottom:0px;z-index:999999;opacity:0;
	}
	.toggleImg:hover{
		opacity:1;
	}
	.toggleImg:active{
		opacity:1;
	}
	.hideImg{
		opacity:0.05;
	}`;

	head.appendChild(style);

	function showImg(){
		if(show==false){
			document.getElementById('toggleImg').innerHTML='■PIC SHIFT+`';
			document.getElementById('toggleImg').style='';
			show=true;
		}else{
			document.getElementById('toggleImg').innerHTML='□PIC SHIFT+`';
			document.getElementById('toggleImg').style='opacity:1;';
			show=false;
		}

		if(show==false){
			imgStyle=`img, video{
                opacity:0.05 !important;
            }
            body{
                opacity:0.5 !important;
            }
            *{
                font-weight:lighter !important;
            }
            .VideoCard{
                opacity:0.05 !important;
            }`;
		}else{
			imgStyle=`img, video{
            }
            body{
            }
            *{
            }
            .VideoCard{
            }`;
		}

		style.innerHTML=`.toggleImg{
		    position:fixed;left:0px;bottom:0px;z-index:999999;opacity:0;
	    }
	    .toggleImg:hover{
		    opacity:1;
	    }
	    .toggleImg:active{
		    opacity:1;
	    }
	    ${imgStyle}`;
	}

	var toggleBu=document.createElement('button');
	toggleBu.id='toggleImg';
    toggleBu.classList.add('toggleImg');
	toggleBu.onclick=function(){
		showImg();
	};
    window.onkeypress=function(e){
        if (e.shiftKey==true && e.code=='Backquote'){
            showImg();
        }
    }
	toggleBu.innerHTML='■PIC SHIFT+`';

	body.appendChild(toggleBu);
    window.onload=()=>{
        setTimeout(()=>{
            console.log('Auto init status');
            for(var i=0; i<10; i++){
                showImg();
            }
        },1000);
    }
})();