您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
try to take over the world!
当前为
// ==UserScript== // @name 蓝湖 // @namespace http://tampermonkey.net/ // @version 0.2.8 // @description try to take over the world! // @author HolmesZhao // @match https://lanhuapp.com/web/ // @grant none // ==/UserScript== (function() { 'use strict'; // Your code here... var colorJson = { "BackgroundTitle": "FFFFFF", "Tip_Strong": "FFA317", "Disable": "B8BBC2", "LinkText": "3777FF", "Tip_Success": "07C16A", "NavigationBarBackground": "F9F9F9", "AccessoryTitle": "8F9396", "MainTitle": "292F3D", "Tip_Failure": "F8554F", "Tip_Weak": "FFF6D4", "Background": "F2F2F2", "Separator": "EEEEEE" } var fontJson = { "MMRegularFontName": "苹方-简 常规体", "MMMediumFontName": "苹方-简 中黑体", "MMSemiboldFontName": "苹方-简 中粗体" } var fontSizeJson = { "MMSpecialBigFontSize": "34pt", "MMSpecialMiddleFontSize": "24pt", "MMSpecialSmallFontSize": "21", "MMTitleFontSize": "18pt", "MMTitleTabSelectFontSize": "16pt", "MMTitleTabNormalFontSize": "15pt", "MMContentFontSize": "14pt", "MMAccessoryFontSize": "13pt", "MMDescriptionFontSize": "12pt", "MMLabelFontSize": "11pt", "MMMarkFontSize": "10pt", } var color = ''; var font = ''; var fontSize = ''; function changeColorText() { var copy_texts = document.getElementsByClassName('copy_text'); for (let index = 0; index < copy_texts.length; index++) { const element = copy_texts[index]; for (const key in colorJson) { if (colorJson.hasOwnProperty(key)) { const value = colorJson[key]; if (element.innerText.indexOf(value) != -1 || element.innerText.indexOf(value.toLowerCase()) != -1) { element.innerText = key; color = key; return; } } } } } function changeFontText() { var layer_names = document.getElementsByClassName('layer_name'); for (let index = 0; index < layer_names.length; index++) { const element = layer_names[index]; for (const key in fontJson) { if (fontJson.hasOwnProperty(key)) { const value = fontJson[key]; if (element.innerText.indexOf(value) != -1) { element.innerText = key; font = key; return; } } } } } function changeFontSizeText() { var item_titles = document.getElementsByClassName('item_title'); for (let index = 0; index < item_titles.length; index++) { const element = item_titles[index]; if (element.innerText.indexOf('字号') != -1) { let sizeDom = element.parentElement.getElementsByClassName('two')[0]; for (const key in fontSizeJson) { if (fontSizeJson.hasOwnProperty(key)) { const value = fontSizeJson[key]; if (sizeDom.innerText.indexOf(value) != -1) { sizeDom.innerText = key; fontSize = key; return; } } } } } } function changeText(params) { changeColorText(); changeFontText(); changeFontSizeText(); } function addButton(name, marginLeft, fun) { var txt = document.createTextNode(name); var btn = document.createElement('button'); btn.className = 'mmbutton'; btn.style = "z-index: 9999; font-size: large; position: fixed; top: 0pt; left: " + (marginLeft) + "px;"; btn.onclick = fun; btn.appendChild(txt); document.body.appendChild(btn); return btn.offsetWidth + btn.offsetLeft; }; function remove() { let style = document.getElementsByClassName('mu-paper mu-drawer mu-paper-round mu-paper-2 open right')[0].getAttribute('style'); if (style.indexOf('display') == -1) { drawerStyle = style; document.getElementsByClassName('mu-paper mu-drawer mu-paper-round mu-paper-2 open right')[0].setAttribute('style', 'display: none;'); } else { document.getElementsByClassName('mu-paper mu-drawer mu-paper-round mu-paper-2 open right')[0].setAttribute('style', drawerStyle); } }; function getFont() { font = font.split('Font')[0]; // [UIFont MMMediumFontWithFontSize:MMTitleFontSize] let fontCode = "[UIFont " + font + "FontWithFontSize:"+ fontSize +"]"; let btn = document.getElementsByClassName('mmbutton')[2]; let btnText = btn.innerText; let textarea = "<textarea id=\"copyFont\" style=\"opacity: 0;\">" + fontCode + "</textarea>"; btn.innerHTML = textarea; var element = document.getElementById("copyFont"); element.select(); // 选择对象 document.execCommand("Copy"); // 执行浏览器复制命令 btn.innerText = btnText }; function getSwiftFont() { font = font.split('Font')[0]; // .mmMediumFont(withFontSize: .contentFontSize) let fontCode = "." + font.charAt(0).toLowerCase() + font.charAt(0).toLowerCase() + font.slice(2) + "Font(withFontSize: ." + fontSize.charAt(2).toLowerCase() + fontSize.slice(3) + ")" let btn = document.getElementsByClassName('mmbutton')[4]; let btnText = btn.innerText; let textarea = "<textarea id=\"copyFont\" style=\"opacity: 0;\">" + fontCode + "</textarea>"; btn.innerHTML = textarea; var element = document.getElementById("copyFont"); element.select(); // 选择对象 document.execCommand("Copy"); // 执行浏览器复制命令 btn.innerText = btnText }; function getColor() { color = color.split('_').join(''); color = color.charAt(0).toLowerCase() + color.slice(1); // UIColor.mm_mainTitleColor let colorCode = "UIColor.mm_" + color + "Color"; let btn = document.getElementsByClassName('mmbutton')[3]; let btnText = btn.innerText; let textarea = "<textarea id=\"copyColor\" style=\"opacity: 0;\">" + colorCode + "</textarea>"; btn.innerHTML = textarea; var element = document.getElementById("copyColor"); element.select(); // 选择对象 document.execCommand("Copy"); // 执行浏览器复制命令 btn.innerText = btnText } function getSwiftColor() { color = color.split('_').join(''); color = color.charAt(0).toLowerCase() + color.slice(1); // .mm_mainTitle() let colorCode = ".mm_" + color + "()"; let btn = document.getElementsByClassName('mmbutton')[5]; let btnText = btn.innerText; let textarea = "<textarea id=\"copyColor\" style=\"opacity: 0;\">" + colorCode + "</textarea>"; btn.innerHTML = textarea; var element = document.getElementById("copyColor"); element.select(); // 选择对象 document.execCommand("Copy"); // 执行浏览器复制命令 btn.innerText = btnText } var drawerStyle = ''; var btnLeft = screen.width/5; var marginLeft = 30; btnLeft += marginLeft; btnLeft = addButton('点击开关抽屉', btnLeft, remove); btnLeft += marginLeft; btnLeft = addButton('点击更换文字', btnLeft, changeText); btnLeft += marginLeft; btnLeft = addButton('OC 字体', btnLeft, getFont); btnLeft += marginLeft; btnLeft = addButton('OC 颜色', btnLeft, getColor); btnLeft += marginLeft; btnLeft = addButton('Swift 字体', btnLeft, getSwiftFont); btnLeft += marginLeft; btnLeft = addButton('Swift 颜色', btnLeft, getSwiftColor); })();