├── .gitignore ├── LICENSE ├── README.md ├── Readme ├── demo0.png ├── demo1.png ├── demo2.png ├── demo_editLocations.png ├── demo_editTitle.png └── demo_multimap_and_multipoints.png └── Scripts ├── OPR_China_Map_Helper.meta.js └── OPR_China_Map_Helper.user.js /.gitignore: -------------------------------------------------------------------------------- 1 | Scripts/OPR_China_Map_Helper_backup.js 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Ingrass 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OPR中国地图工具 / OPR China Map Helper 2 | 3 | 连到各种地图,包括百度、腾讯、高德等。
4 | 支持审核 "edit",支持多个地点同时查询。
5 | Provides links to other maps, especially for maps useful in China.
6 | Supports multiple locations in "edit".
7 | 8 | #### script url: https://github.com/Ingrass/OPR-Tools/raw/master/Scripts/OPR_China_Map_Helper.user.js 9 | 10 | # 書籤小程式 bookmarklet (iOS Safari/Android Chrome等 可使用) 11 | 執行內容是載入上述 script 12 | 13 | ` 14 | javascript:(function(F,i,r,e,k,u,I,E){if(F.getElementById(k))return;E=F[i+'NS']&&F.documentElement.namespaceURI;E=E?F[i+'NS'](E,'script'):F[i]('script');E[r]('id',k);E[r]('src',I);E[r](k,u);(F[e]('head')[0]||F[e]('body')[0]).appendChild(E);})(document,'createElement','setAttribute','getElementsByTagName','MyScript2','4','https://cdn.jsdelivr.net/gh/Ingrass/OPR-Tools/Scripts/OPR_China_Map_Helper.user.js?'+Math.floor(Date.now()/100000000)); 15 | ` 16 | 17 | #### 安裝方法可參考: 18 | - https://sspai.com/post/26196 19 | - https://kknews.cc/tech/69p22kl.html 20 | 21 | #### Android上如何用 userscript 22 | https://telegra.ph/Android上如何用-userscript-07-12 23 | 24 | --- 25 | 26 | ![readme](Readme/demo0.png) 27 | ![readme](Readme/demo1.png) 28 | ![readme](Readme/demo2.png) 29 | ![readme](Readme/demo_editTitle.png) 30 | ![readme](Readme/demo_editLocations.png) 31 | ![readme](Readme/demo_multimap_and_multipoints.png) 32 | -------------------------------------------------------------------------------- /Readme/demo0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ingrass/OPR-Tools/e585068ac17b0e8079a2a7a3111895040ef37982/Readme/demo0.png -------------------------------------------------------------------------------- /Readme/demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ingrass/OPR-Tools/e585068ac17b0e8079a2a7a3111895040ef37982/Readme/demo1.png -------------------------------------------------------------------------------- /Readme/demo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ingrass/OPR-Tools/e585068ac17b0e8079a2a7a3111895040ef37982/Readme/demo2.png -------------------------------------------------------------------------------- /Readme/demo_editLocations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ingrass/OPR-Tools/e585068ac17b0e8079a2a7a3111895040ef37982/Readme/demo_editLocations.png -------------------------------------------------------------------------------- /Readme/demo_editTitle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ingrass/OPR-Tools/e585068ac17b0e8079a2a7a3111895040ef37982/Readme/demo_editTitle.png -------------------------------------------------------------------------------- /Readme/demo_multimap_and_multipoints.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ingrass/OPR-Tools/e585068ac17b0e8079a2a7a3111895040ef37982/Readme/demo_multimap_and_multipoints.png -------------------------------------------------------------------------------- /Scripts/OPR_China_Map_Helper.meta.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name OPR China Map Helper 3 | // @version 1.5 4 | // @category Info 5 | // @namespace https://github.com/Ingrass/OPR-Tools/ 6 | // @updateURL https://github.com/Ingrass/OPR-Tools/raw/master/Scripts/OPR_China_Map_Helper.meta.js 7 | // @downloadURL https://github.com/Ingrass/OPR-Tools/raw/master/Scripts/OPR_China_Map_Helper.user.js 8 | // @description Add some buttons for China map in OPR 9 | // @author Ethern Triomphe346 lokpro 记忆的残骸 stdssr convoi 10 | // @include https://wayfarer.nianticlabs.com/* 11 | // @grant none 12 | // @require https://cdn.jsdelivr.net/npm/prcoords@1.0.5/js/PRCoords.min.js 13 | // ==/UserScript== 14 | -------------------------------------------------------------------------------- /Scripts/OPR_China_Map_Helper.user.js: -------------------------------------------------------------------------------- 1 | // ==UserScript== 2 | // @name OPR China Map Helper 3 | // @version 1.5 4 | // @category Info 5 | // @namespace https://github.com/Ingrass/OPR-Tools/ 6 | // @updateURL https://github.com/Ingrass/OPR-Tools/raw/master/Scripts/OPR_China_Map_Helper.meta.js 7 | // @downloadURL https://github.com/Ingrass/OPR-Tools/raw/master/Scripts/OPR_China_Map_Helper.user.js 8 | // @description Add some buttons for China map in OPR 9 | // @author Ethern Triomphe346 lokpro 记忆的残骸 stdssr convoi 10 | // @include https://wayfarer.nianticlabs.com/* 11 | // @grant none 12 | // @require https://cdn.jsdelivr.net/npm/prcoords@1.0.5/js/PRCoords.min.js 13 | // ==/UserScript== 14 | 15 | /* 16 | v1.5 21/4/2025 17 | - fix 腾讯 map url 18 | 19 | v1.4 17/5/2024 20 | - fix button字色在drak mode也是黑的問題 21 | 22 | v1.3 23 | - fix 座標不正確問題 24 | 25 | v1.2 27/8/2021 26 | - 修復 "審EDIT" 的 tools 顯示 27 | - 修改 @include 為 *(全站),因為新網站是不會跳頁的,必須在任何一個子網址進入都要載入 script 28 | 29 | v1.0 13/8/2021 30 | - 適用最新版 OPR(Wayfarer) 31 | 32 | v0.9 10/5/2021 33 | - 適用審PHOTO的情況 34 | 35 | v0.8 21/12/2020 36 | - 可顯示/隱藏按鈕 37 | 38 | v0.7.3 16/12/2020 39 | - 拿掉 copy 功能;因功能雞肋且為它需要調用一個 lib 40 | 41 | v0.7.2 31/10/2020 42 | - 適用Edit文字的情況 43 | 44 | v0.7 21/10/2020 45 | - 因應 Wayfarer變數名稱轉變 的修正 46 | 47 | v0.6 12/10/2019 48 | - 修复 Title Edit 的搜索功能 49 | 50 | v0.5.8 12/10/2019 51 | - 增加对 Wayfarer 编辑的外部地图辅助 buttons (Gmap被移除,可使用地图左下Google标识跳转) 52 | 53 | v0.5.7 12/10/2019 54 | - 适配 Niantic Wayfarer 美术风格 55 | - 调整 button 位置 56 | - 修复搜索功能 57 | - 暂时下线 v0.5.6 的更新,还不明确edit样式,有条件想测试的朋友可以取消181行注释并提供反馈 58 | 59 | v0.5.6 11/10/2019 60 | - 修復新的 OPR "Edit" 的外部地圖輔助 buttons 61 | 62 | v0.5.5 11/10/2019 63 | - 适用新的 OPR 地址 64 | 65 | v0.5.4 18/9/2019 66 | - brainstorming.azurewebsites.net uses https 67 | 68 | v0.5.3 6/7/2019 69 | - Require PRCoords instead of GpsUtil. Thanks to @shizhao mentioned that in #1. 70 | - Use https on external links whenever possible 71 | - Upgrade Clipboard to 2.0.4 and adapt to new usage signature 72 | - Fix underline on Copy button on hover 73 | 74 | v0.5.2 18/4/2019 75 | brainstorming.azurewebsites.net 取代 kitten-114.getforge.io,kitten-114.getforge.io 將會停用 76 | 77 | v0.5.1.2 78 | intel地址更改 79 | 80 | v0.5 81 | - 支援審核 'Edit' 82 | - 改寫結構 83 | - GpsUtil 封裝成一個 function 84 | - 可呈現多個 location 的地圖按鈕 85 | - 對 title edit 加入 Google 和 百度 search 的按鈕 86 | */ 87 | 88 | (function(){ 89 | 90 | window.ChinaMapHelper = { 91 | BUTTONS: [ 92 | { name:"intel", fn:"get_intel_link" }, 93 | { name:"百度", fn:"get_baidu_link" }, 94 | { name:"腾讯", fn:"get_tencent_link" }, 95 | { name:"高德", fn:"get_autonavi_link" }, 96 | { name:"OSM", fn:"get_OSM_link" }, 97 | { name:"百/腾", fn:"get_BaiduQQ_link" }, 98 | { name:"百/腾/高", fn:"get_BTA_link" }, 99 | { name:"百/腾/高/OSM+", fn:"get_BTAO_link" }, 100 | ], 101 | 102 | loadSettings(){ 103 | let defaultVal = {buttonsToShow:["intel","百度","腾讯","高德","OSM","百/腾"]}; 104 | let settings = localStorage.getItem( "OPRChinaMapHelperSettings" ); 105 | if( settings ){ 106 | this.settings = JSON.parse(settings); 107 | }else{ 108 | this.settings = defaultVal; 109 | } 110 | }, 111 | 112 | saveSettings(){ 113 | localStorage.setItem( "OPRChinaMapHelperSettings", JSON.stringify(this.settings) ); 114 | }, 115 | 116 | updateButtonsDisplay(){ 117 | let buttonsToShow = this.settings.buttonsToShow; 118 | var css = ""; 119 | 120 | this.BUTTONS.forEach( (b,i)=>{ 121 | let show = buttonsToShow.includes( b.name ); 122 | 123 | css += /*css*/` 124 | .ChinaMapHelper .mapHelperButton:nth-child(${i+2}) { 125 | display: ${show?"inline-block":"none"}; 126 | } 127 | 128 | .mapHelperEditMode .ChinaMapHelper .mapHelperButton:nth-child(${i+2}) .checkbox:after { 129 | content: "${show?"☑":"☐"}"; 130 | } 131 | `; 132 | }); 133 | 134 | var node = document.createElement('style'); 135 | node.appendChild(document.createTextNode(css)); 136 | document.getElementsByTagName('head')[0].appendChild(node); 137 | }, 138 | 139 | toggleButtonShow( index ){ 140 | let name = this.BUTTONS[index].name; 141 | let buttonsToShow = this.settings.buttonsToShow; 142 | 143 | if( buttonsToShow.includes( name ) ){ 144 | this.settings.buttonsToShow = buttonsToShow.filter( n=>n!=name ); 145 | }else{ 146 | buttonsToShow.push( name ); 147 | } 148 | this.saveSettings(); 149 | this.updateButtonsDisplay(); 150 | }, 151 | }; 152 | 153 | function LinkInfo(portalInfo={}){ 154 | this.lng = portalInfo.lng; 155 | this.lat = portalInfo.lat; 156 | this.title = portalInfo.title || ""; 157 | this.otherLocations = portalInfo.otherLocations || []; 158 | } 159 | 160 | LinkInfo.prototype. genButtons = function(){ 161 | let html = /*html*/`+`; 164 | 165 | ChinaMapHelper.BUTTONS.forEach( (b,i)=>{ 166 | html += /*html*/` 167 | 173 | ${b.name}`; 174 | } ); 175 | 176 | return html; 177 | }; 178 | 179 | LinkInfo.prototype.get_tencent_link = function() { 180 | var gcj = PRCoords.wgs_gcj({ lat: this.lat, lon: this.lng}); 181 | return "https://apis.map.qq.com/uri/v1/marker?marker=coord:" + gcj.lat + "," + gcj.lon + ";title:marker"; 182 | }; 183 | 184 | LinkInfo.prototype.get_baidu_link = function() { 185 | return "https://api.map.baidu.com/marker?location=" + this.lat + "," + this.lng + "&title=" 186 | + encodeURIComponent(this.title).replace(/\'/g,"%27") + "&content=Application&output=html&coord_type=wgs84"; 187 | }; 188 | 189 | LinkInfo.prototype.get_OSM_link = function() { 190 | return "https://www.openstreetmap.org/?mlat=" + this.lat + "&mlon=" + this.lng + "&zoom=16"; 191 | }; 192 | 193 | //AutoNavi (高德地图) 194 | LinkInfo.prototype.get_autonavi_link = function() { 195 | return "https://uri.amap.com/marker?position=" + this.lng + "," + this.lat + "&name=" 196 | + encodeURIComponent(this.title).replace(/\'/g,"%27") + "&coordinate=wgs84&callnative=0"; 197 | }; 198 | 199 | LinkInfo.prototype.get_intel_link = function() { 200 | return "https://intel.ingress.com/intel?z=16&ll=" + this.lat + "," + this.lng +"&pll="+this.lat+","+this.lng; 201 | }; 202 | 203 | LinkInfo.prototype.get_GoogleMap_link = function() { 204 | return "https://maps.google.com/?q=@" + this.lat + "," + this.lng; 205 | }; 206 | 207 | LinkInfo.prototype.get_BaiduQQ_link = function() { 208 | var s = this.otherLocations.map(x => x.lat + "," + x.lng).join(); 209 | return "https://brainstorming.azurewebsites.net/index.html#" + this.lat + "," + this.lng+"," +(s||"0"); 210 | }; 211 | 212 | // Baidu, Tencent, AutoNavi 213 | LinkInfo.prototype.get_BTA_link = function() { 214 | var s = this.otherLocations.map(x => x.lat + "," + x.lng).join(); 215 | return "https://brainstorming.azurewebsites.net/index3.html#" + this.lat + "," + this.lng+"," +(s||"0"); 216 | }; 217 | 218 | // Baidu, Tencent, AutoNavi, OSM 219 | LinkInfo.prototype.get_BTAO_link = function() { 220 | var s = this.otherLocations.map(x => x.lat + "," + x.lng).join(); 221 | return "https://brainstorming.azurewebsites.net/index5.html#" + this.lat + "," + this.lng+"," +(s||"0"); 222 | }; 223 | 224 | /** 225 | * 為了 script 獨立執行時,沒有 @require 到 PRCoords 226 | */ 227 | (function( scriptsrc ){ 228 | return new Promise( (resolve,reject)=>{ 229 | if(window.PRCoords){ 230 | resolve(); 231 | }else{ 232 | var script = document.createElement("script"); 233 | script.src = scriptsrc; 234 | script.onload = resolve; 235 | script.onerror = reject; 236 | 237 | document.head.appendChild(script); 238 | } 239 | }); 240 | })("https://cdn.jsdelivr.net/npm/prcoords@1.0.5/js/PRCoords.min.js").then( ()=>{ 241 | 242 | setInterval(function(){ 243 | if( ! location.href.includes("new/review") ) return; 244 | if( document.querySelector(".mapHelperButton") ) return; 245 | 246 | // 取得 lat, lng 247 | let linkInfo1; 248 | try { 249 | let t0 = document.querySelector("nia-map").__ngContext__; 250 | let t1 = t0[t0.length-1]; 251 | 252 | linkInfo1 = new LinkInfo(); 253 | linkInfo1.lat = t1._latitude._value; 254 | linkInfo1.lng = t1._longitude._value; 255 | } catch(e) { 256 | // console.log( e ); 257 | return; 258 | } 259 | // info OK 260 | 261 | // console.log( linkInfo1 ); 262 | var div = document.createElement('div'); 263 | div.className = "ChinaMapHelper"; 264 | div.innerHTML = linkInfo1.genButtons(); 265 | 266 | // 要加入在這麼多地方是因為:方便不同習慣的人、手機版比較好找、有些是審PHOTO/EDIT時特有 267 | document.querySelectorAll( [ 268 | "app-should-be-wayspot .wf-review-card", 269 | "#location-accuracy-card .wf-review-card__footer", 270 | "#check-duplicates-card", 271 | "#title-description-card", 272 | ".review-photo__info", // PHOTO 273 | ".review-edit-info>.ng-star-inserted", // EDIT 274 | ].join() ).forEach( node=>{ 275 | node.appendChild( div.cloneNode(true) ); 276 | } ); 277 | 278 | ChinaMapHelper.loadSettings(); 279 | ChinaMapHelper.updateButtonsDisplay(); 280 | 281 | var css = /*css*/` 282 | .ChinaMapHelper{ 283 | display: inline-block; 284 | } 285 | .ChinaMapHelper .mapHelperButton, 286 | .ChinaMapHelper .button-settings{ 287 | display: inline-block; 288 | min-width: auto; 289 | padding: 7px 6px; 290 | margin-right: 5px; 291 | margin-top: 5px; 292 | margin-bottom: 5px; 293 | } 294 | 295 | .mapHelperEditMode .ChinaMapHelper .mapHelperButton{ 296 | display: inline-block !important; 297 | padding-left: 0px; 298 | } 299 | 300 | .mapHelperEditMode .ChinaMapHelper .mapHelperButton{ 301 | display: inline-block !important; 302 | padding-left: 0px; 303 | } 304 | 305 | .ChinaMapHelper .checkbox{ 306 | display: none; 307 | } 308 | .mapHelperEditMode .ChinaMapHelper .checkbox{ 309 | display: inline; 310 | } 311 | 312 | .mapHelperEditMode .ChinaMapHelper .checkbox:after { 313 | padding: 0.7em; 314 | margin: 0; 315 | background-color: #00000033; 316 | } 317 | 318 | .multiPointsTable{ 319 | width: 100%; 320 | } 321 | `; 322 | var node = document.createElement('style'); 323 | node.appendChild(document.createTextNode(css)); 324 | document.getElementsByTagName('head')[0].appendChild(node); 325 | 326 | // add "Search" to "edit" texts 327 | document.querySelectorAll(".titleEditBox.poi-edit-box .poi-edit-text").forEach(function(box) { 328 | var p = box.querySelector("p") || box; 329 | var searchTerm = encodeURIComponent(p.innerText).replace(/\'/g,"%27"); 330 | var span = document.createElement('span'); 331 | span.style.cssFloat = "right"; 332 | span.innerHTML = 333 | "🔍" 334 | p.appendChild(span); 335 | }); 336 | 337 | }, 1999); 338 | }); 339 | 340 | })(); 341 | --------------------------------------------------------------------------------