// ==UserScript== // @name 网页版百度地图黑暗模式切换+重命名标注+去扫码广告 // @namespace https://bbs.tampermonkey.net.cn/ // @version 0.2.2 // @description 标注地图后点击按钮即可修改标注名称,去除扫码下载app广告,右下角增加黑暗模式切换按钮(ฅ´ω`ฅ) // @include https://map.baidu.com/* // @run-at document-start // @grant GM_addStyle // @grant unsafeWindow // @downloadURL https://bbs.tampermonkey.net.cn/forum.php?mod=viewthread&tid=1153 // @supportURL https://bbs.tampermonkey.net.cn/forum.php?mod=viewthread&tid=1153 // @homepageURL https://bbs.tampermonkey.net.cn/forum.php?mod=viewthread&tid=1153 // @author 张仨 // @require https://cdn.jsdelivr.net/npm/darkmode-js@1.5.7/lib/darkmode-js.min.js // ==/UserScript== unsafeWindow.onload=function(){ 'use strict'; var button,beasetag; button = document.createElement("div"); beasetag = document.querySelector("body"); beasetag.appendChild(button); button.innerHTML = ""; button.style = "position:fixed;bottom:920px;right:290px;width:70px;height:0px;opacity:1;color:white;text-align:center;line-height:60px;cursor:pointer"; document.getElementById('id001').onclick = function(){ document.getElementById("us_infoWnd_title").disabled = false; } new Darkmode().showWidget(); const options = { bottom: '80px', right: '50px', left: 'unset', time: '0.5s', mixColor: '#fff', backgroundColor: '#fff', buttonColorDark: '#100f2c', buttonColorLight: '#fff', saveInCookies: false, label: '🌓', autoMatchOsTheme: true } const darkmode = new Darkmode(options); darkmode.showWidget(); GM_addStyle('.darkmode-layer, .darkmode-toggle {z-index:999;}') //layer:层数,toggle:切换,z-index:提高层数(简化处理下李恒道gg给的代码,发现能正常运行且效果一致) GM_addStyle('#activity-banner-panel{display:none !important}') //百度地图去app扫码框(使用GM_*函数在沙盒环境中运行需在前面@grant) GM_addStyle('.poiLeadDownloadCard{display:none !important}') //百度地图去app扫码框 }