// ==UserScript== // @name 游侠中文游戏添加标记 // @namespace 游侠中文游戏添加标记 // @version 0.5 // @description 游侠游戏中文非正版分流的游戏列表加颜色标记,左下角可以自定义颜色和加粗 // @author You // @include https://game.ali213.net/forum-77-*.html // @icon https://z3.ax1x.com/2021/12/03/oactfJ.png // @grant none // @downloadURL https://update.greasyfork.icu/scripts/436497/%E6%B8%B8%E4%BE%A0%E4%B8%AD%E6%96%87%E6%B8%B8%E6%88%8F%E6%B7%BB%E5%8A%A0%E6%A0%87%E8%AE%B0.user.js // @updateURL https://update.greasyfork.icu/scripts/436497/%E6%B8%B8%E4%BE%A0%E4%B8%AD%E6%96%87%E6%B8%B8%E6%88%8F%E6%B7%BB%E5%8A%A0%E6%A0%87%E8%AE%B0.meta.js // ==/UserScript== //点击关闭弹框 function closeBox(){ //恢复默认数据 let config = JSON.parse(localStorage.getItem("config"))//获取缓存的数据 let showtext = document.getElementById("showtext")//演示文字 let colorinput = document.getElementById("colorinput")//颜色选择框 let checkbox = document.getElementById("checkinput")//粗体选择框 let weight = config.weight?'bold':'normal' showtext.style.color = config.color//默认演示文字颜色 showtext.style.fontWeight = weight//默认演示文字粗细 colorinput.value = config.color//默认颜色选择器颜色 checkbox.checked = config.weight//默认是否打勾 let box = document.getElementById('box');//关闭弹框 box.style.display = 'none' } //点击保存按钮 function saveStyle(){ console.log("保存配置成功"); let colorinput = document.getElementById("colorinput")//颜色选择框 let checkbox = document.getElementById("checkinput")//粗体选择框 let item = `{"color":"`+colorinput.value+`","weight":`+checkbox.checked+`}` localStorage.setItem("config",item)//缓存添加保存的配置配置 setColor(colorinput.value,checkbox.checked)//设置游戏标签颜色和是否粗体 let box = document.getElementById('box');//关闭弹框 box.style.display = 'none' } //选择颜色框改变 function changeColor(el){ let showtext = document.getElementById("showtext")//演示文字 showtext.style.color = el.value//设置选择器颜色展示 //console.dir(el.value) } //粗细选择框 function changeChecked(el){ let weight = el.checked?'bold':'normal' let showtext = document.getElementById("showtext")//演示文字 showtext.style.fontWeight = weight//设置选择器颜色展示 } //添加按钮元素到页面 function addDom(color = "ff7e41",weight = true){ //添加的元素 let weightstyle = weight?'bold':'normal' let checked = weight?'checked':'' document.body.innerHTML = document.body.innerHTML += `