Greasy Fork

Greasy Fork is available in English.

抖音时间管理

自用抖音时间管理

当前为 2023-02-05 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         抖音时间管理
// @description  自用抖音时间管理
// @namespace    http://tampermonkey.net/
// @version      2023.2.6
// @author       You
// @match        *://*.douyin.com/*
// @icon         https://lf1-cdn-tos.bytegoofy.com/goofy/ies/douyin_web/public/favicon.ico
// @grant        none
// @license      AGPL License
// ==/UserScript==


//定时
     window.onload=function (){try{

        //把左边直接删了
        document.getElementsByClassName("N_HNXA04")[0].parentNode.removeChild(document.getElementsByClassName("N_HNXA04")[0]);

         //抖音最近默认进来是静音的,直接打开他的小喇叭
         //document.getElementsByClassName("xgplayer-volume")[0].getAttributeNode("data-state").value="normal";//small
         //document.getElementsByClassName("xgplayer-icon")[4].click();
         //document.getElementsByTagName("xg-right-grid")[0].getElementsByTagName("xg-icon")[2].getElementsByTagName("div")[0].click();//好像又不会了,下次做个判断吧

         //自动打开评论区
         document.getElementsByClassName("tzVl3l7w")[0].click();

}catch(err){console.log("呃呃,哈哈了,你小子不在主页进来的吧");}}


var index = 0;//如果只刷一个视频就只有一个索引,开始第二个的时候就会出现三个索引【0,1,2】当前一般是【1】
var i = 1;
var sj="00:00"
var 延迟时间=5*60*1000;
setTimeout(function (){
    var div = document.createElement("div");
    div.innerText="5分钟到了-----------------------------------------------------";
    //div.style.background= "red";
    //div.style.width= "100%";
    //div.style.height= "100%";
    div.setAttribute('id','kun'); //设置标签属性
    var fu = document.getElementById("slidelist");//找到想成为的父标签
    var one=fu.firstChild;// 获取父标签的第一个子元素
    fu.insertBefore(div,one); // 在父标签的第一个子元素,前插入div标签

    //改一下样式
    do{
    let style=`
	ul.JTui1eE0{
        transition: all 20s ;
		width: 300px;
		background-color: #5f6175a8;
		border-radius: 8px;
		margin: 0px 10px;
		box-shadow: 0 0px 9px 1px #fff;							 /*阴影     水平偏移 垂直偏移  模糊  阴影大小*/
	}
    #kun{
        width:100%;
        height: 100%;
        animation:ikun 5s infinite;
    }
    @keyframes ikun {
    	0% {background-color: red;}
    	50% {background-color: #06f;}
		100% {background-color: red;}
	}
    `;
    let ele=document.createElement("style");
    ele.innerHTML=style;
    document.getElementsByTagName('head')[0].appendChild(ele);
    }while(false);


    for (let i=0; i<3600; i++)task(i);


    function task(i) {setTimeout( function () {
        try{
            //获取视频个数   要么是1个要么是3个 三个的时候 当前看的是第二个
            if(document.getElementsByClassName('time-current').length==3){index=1;}
            //判断这一秒的时间是否大过上一秒的时间  大过说明看完了 该润了
            if(sj>document.getElementsByClassName('time-current')[index].innerText){alert("够钟死心了");window.opener = null; window.open('', '_self'); window.close();}
            //刷新时间值
            sj=document.getElementsByClassName('time-current')[index].innerText;
        }
        catch(err){console.error(err);}

        try{
            document.getElementsByClassName("time")[index].innerHTML = "---------5分钟到了+"+i+"秒"+sj+">?"+document.getElementsByClassName('time-current')[index].innerText;i++;
        }
        catch(err){console.log("离谱");}

    }, 1000 * i);};

},延迟时间);//在5分钟后执行代码--------------------------------------------------------------------------------------------------------



do{//样式----------------------------------------------------------------------------------------------
    let style=`
    /*消失吧哈哈哈*/
	div.MFb3tP0s div.JTui1eE0:nth-last-child(n+4),	/*收藏 和 合作*/
	.QUUswvJ3{			/*客户端推荐*/
		display: none;
	}
    `;
    //cursor:pointer;变小手   :hover碰到触发    transition: all .5s;过渡动画0.5秒   display: flex;弹性盒子

    let ele=document.createElement("style");
    ele.innerHTML=style;
    document.getElementsByTagName('head')[0].appendChild(ele);
}while(false);






////创建一个p元素
//var para = document.createElement("span");
//para.innerText="我是新标签";
//获取div
//var div=document.getElementsByClassName("xgplayer-time")[0];
//添加标签
//iv.appendChild(para);





//setTimeout(function(){alert("Hello");window.opener = null; window.open('', '_self'); window.close();},5*60*1000);//在一定时间后执行代码

//setTimeout(() => {
//        console.log(document.getElementsByClassName('time-current')[0].innerText);
//    }, 1000);//每隔一段时间后执行代码
//setInterval(function shijian(){for(let i=5;i>0;i--){console.log(document.getElementsByClassName('time-current')[0].innerText);}},1000)//每隔一段时间后执行代码