// ==UserScript== // @name 重命名网页版百度地图标注名称 // @namespace https://bbs.tampermonkey.net.cn/ // @version 0.1.0 // @description 标注地图后点击按钮即可修改标注名称(ฅ´ω`ฅ) // @include https://map.baidu.com/* // @author 张仨 // ==/UserScript== (function () { 'use strict'; var button = document.createElement("button"); //创建一个按钮 button.id = "id001"; //创建按钮id是必须的,我也不知道为啥(¬、¬) button.textContent = "点击修改"; //按钮文字 button.style.color="red"; //按钮字体颜色 button.style.width = "50%"; //按钮大小 button.style.align = "center"; //按钮居中对齐,好像不起作用 (¬、¬) button.onclick = function (){ //监听点击按钮事件,执行以下代码 document.getElementById("us_infoWnd_title").disabled = false; //找到"id"取消只读 }; var x = document.getElementsByClassName('toolscontainer')[0]; //插入按钮的位置('class') x.appendChild(button); //应该是按钮创建在末尾的意思? } )();