您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
一键将百度地图显示的公交线路导入 tpov_extract 脚本
// ==UserScript== // @name 百度地图 tpov 插件 // @namespace Violentmonkey Scripts // @match *://map.baidu.com/* // @match *://maps.baidu.com/* // @grant none // @version 1.0 // @author CyrilSLi // @description 一键将百度地图显示的公交线路导入 tpov_extract 脚本 // @license MIT // ==/UserScript== const tpovBtnId = "tpovExportBtn"; const tpovBtn = document.createElement("div"); tpovBtn.id = tpovBtnId; tpovBtn.style.display = "inline-block"; tpovBtn.style.float = "left"; tpovBtn.innerHTML = ` <a class="ui3-city-change-inner" style="padding: 0px 12px !important; color: black !important; font-weight: bold !important;">tpov 导出</a> `; tpovBtn.addEventListener("click", (ev) => { const params = new URLSearchParams(window.location.search); const tpovExport = `python tpov_extract.py baidu tpov-${params.get("sug_forward")}-${params.get("wd2")}-${SECKEY} baidu_extract.json`; navigator.clipboard.writeText(tpovExport); alert("以拷贝 " + tpovExport); }); const observer = new MutationObserver((muts) => { const params = new URLSearchParams(window.location.search); if (params.has("wd2") && params.has("sug_forward")) { const ctrlWrap = document.getElementById("ui3_control_wrap"); if (ctrlWrap && !ctrlWrap.contains(tpovBtn)) { const cityBtn = document.getElementById("ui3_city_change"); cityBtn.parentNode.insertBefore(tpovBtn, cityBtn.nextSibling); } } else { tpovBtn.remove(); } }); observer.observe(document.body, { attributes: false, childList: true, characterData: false, subtree:true });