2023/6/12 19:20:21
当前为
// ==UserScript==
// @name 隐藏抖音顶部搜索栏
// @namespace 鼠标显示隐藏抖音header搜索
// @match https://www.douyin.com/*
// @namespace 476321082
// @license MIT
// @grant none
// @version 0.6
// @author -
// @description 2023/6/12 19:20:21
// ==/UserScript==
(function() {
'use strict';
// 获取顶栏元素
var header = document.getElementById("web-component-header");
// 创建一个包含两个按钮的容器元素
var container = document.createElement("div");
container.style.position = "fixed";
container.style.right = "10px";
container.style.top = "70px"; // 往下移动60px
container.style.zIndex = "9999";
// 创建显示按钮
var showBtn = document.createElement("button");
showBtn.innerText = "显示顶栏";
// 创建隐藏按钮
var hideBtn = document.createElement("button");
hideBtn.innerText = "隐藏顶栏";
// 设置两个按钮的样式和间距
var btnStyle = "display: block; margin: 1px;"; // 上下间距2px,换行显示
showBtn.style.cssText = btnStyle;
hideBtn.style.cssText = btnStyle;
// 添加两个按钮到容器元素
container.appendChild(showBtn);
container.appendChild(hideBtn);
// 添加容器元素到页面
document.body.appendChild(container);
// 定义显示和隐藏顶栏的函数
function showHeader() {
header.style.display = "block"; // 显示顶栏
}
function hideHeader() {
header.style.display = "none"; // 隐藏顶栏
}
// 给两个按钮添加点击和移入事件
showBtn.addEventListener("click", showHeader);
showBtn.addEventListener("mouseover", showHeader);
hideBtn.addEventListener("click", hideHeader);
hideBtn.addEventListener("mouseover", hideHeader);
})();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址