您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
测试
// ==UserScript==
// @name 学习助手
// @namespace https://www.cnblogs.com/zhengzhijian/p/16599154.html
// @version 0.5
// @description 测试
// @author 宽于律己、严于律人
// @crontab * 1-23 once * *
// @match *://*.zte.com.cn/*
// ==/UserScript==
(function () {
"use strict";
var button = document.createElement("button"); //创建一个按钮
button.textContent = "一键开启躺平学习模式"; //按钮内容
button.style.width = "200px"; //按钮宽度
button.style.height = "28px"; //按钮高度
button.style.textAlign = "center !important"; //文本居中
button.style.lineHeight = "25px"; //文本行高
button.style.color = "white"; //按钮文字颜色
button.style.background = "#e33e33"; //按钮底色
button.style.border = "1px solid #e33e33"; //边框属性
button.style.borderRadius = "4px"; //按钮四个角弧度
button.addEventListener("click", clickBotton); //监听按钮点击事件
function clickBotton() {
alert('开始准备开始躺平学习模式 ')
preventDefult();
}
var like_comment = document.getElementById("divHead2"); //getElementsByClassName 返回的是数组,所以要用[] 下标
like_comment.appendChild(button); //把按钮加入到 x 的子节点中
})();