// ==UserScript== // @name 抖音工具箱(自动点赞/下载视频) // @namespace http://tampermonkey.net/ // @version 0.1 // @description 基于网页版抖音的工具箱,功能目前开发中 // @author Kolento // @match *://live.douyin.com/* // @match *://www.baidu.com/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; let page = document.getElementsByTagName('body')[0]; console.log('page',page) // 点赞按钮 let kolento = document.createElement("div"); kolento.className="kolento kolento-btn"; kolento.innerHTML='

开始

点赞

' page.append(kolento); // 视频下载 let kolentoDownload = document.createElement("div"); kolentoDownload.className="kolento-download kolento-btn"; kolentoDownload.innerHTML='视频
下载' page.append(kolentoDownload); // 使用说明 let kolentoTips = document.createElement("div"); kolentoTips.className="kolento-tips kolento-btn"; kolentoTips.innerHTML='使用
说明' page.append(kolentoTips); // 弹窗节点 let kolentoPop = document.createElement("div"); kolentoPop.className="kolento-pop"; kolentoPop.innerHTML= `
by kolento 【点击关闭】
` page.append(kolentoPop); // 点击数 let total = document.createElement("div"); total.className="total"; total.innerHTML='

点击数:

0

'; kolento.append(total); // 初始化点击数 var timeBox; let totalNum = 0; let num = document.getElementsByClassName('kolento-all')[0]; num.innerHTML=totalNum; // 获取目标元素 let target = document.getElementsByClassName('Zs4Pv2bD'); let text = document.getElementsByClassName('kolento-p1'); // 点赞事件 kolento.onclick=function(){ if(text[0].innerHTML.indexOf('开始')>-1){ // 执行点赞脚本 text[0].innerHTML='停止' timeBox = setInterval(()=>{ totalNum++; num.innerHTML=totalNum; // target[0].click(); },50) }else{ clearInterval(timeBox); text[0].innerHTML='开始' } } // 使用说明-打开 kolentoTips.onclick=function(){ kolentoPop.className="kolento-pop kolento-pop-on"; } // 使用说明-关闭 let close = document.getElementById('close-kolento'); close.onclick=function(){ kolentoPop.className="kolento-pop"; } function addGlobalStyle(css) { var head, style; head = document.getElementsByTagName('head')[0]; if (!head) { return; } style = document.createElement('style'); style.type = 'text/css'; style.innerHTML = css; head.appendChild(style); } addGlobalStyle( ` .kolento-btn { font-size: 14px; position: fixed; top: 70px;right: 30px; z-index: 500; cursor: pointer; background: #3eaf7c; border-radius: 50%; color: #fff; width: 46px;height: 46px; line-height: 16px; text-align: center; display: flex; align-items: center; justify-content: center; transition: all ease 0.3s; } .kolento-download { top:124px; } .kolento-tips { top:178px; } .kolento-btn:hover { background-color: #4abf8a; } .kolento-btn:hover .total { opacity:1; position: fixed; right:84px; } .total { font-size: 14px; position: fixed; top: 79px; right: 70px; z-index: 500; background: #3eaf7c; color: #fff; text-align: center; display: flex; align-items: center; justify-content: center; transition: all ease 0.3s; padding: 5px 8px; border-radius: 20px; opacity:0; width:100px; } .total p { color:#fff; } .kolento-pop { position:fixed; top:50%; left:50%; margin:0 0 0 -250px; width:500px; border-radius:20px; z-index:-1; opacity:0; transition:all ease 0.3s; } .kolento-pop-on { z-index:500; opacity:1; top:40%; } #kolento-box { background:rgba(0,0,0,0.5); padding:20px; color:#fff; border-radius:25px; } .tip-list { margin:6px 0; font-size:16px; } .bykolento { text-align:right; margin-top:20px; } #close-kolento { cursor:pointer; } ` ); })();