|
8 | 8 | // @updateURL https://raw.githubusercontent.com/IITC-CE/Community-plugins/master/dist/NvlblNm/s2check.meta.js |
9 | 9 | // @homepageURL https://gitlab.com/NvlblNm/pogo-s2/ |
10 | 10 | // @supportURL https://discord.gg/niawayfarer |
11 | | -// @version 0.106 |
| 11 | +// @version 0.107 |
12 | 12 | // @description Pokemon Go tools over IITC. Support in #tools-chat on https://discord.gg/niawayfarer |
13 | 13 | // @match https://intel.ingress.com/* |
14 | 14 | // @grant none |
|
5329 | 5329 |
|
5330 | 5330 | const formContent = `<div class="pogo-s2-popup"><form id="submit-to-pogo-s2"> |
5331 | 5331 | <label>Type |
5332 | | - <select name="pokestopType"> |
| 5332 | + <select id="pogo-s2-pokestopType" name="pokestopType"> |
5333 | 5333 | <option value="pokestops">PokéStop</option> |
5334 | 5334 | <option value="gyms">Gym</option> |
5335 | 5335 | <option value="powerspots">Power Spot</option> |
5336 | 5336 | <option value="notpogo">Not in PoGo</option> |
5337 | 5337 | </select> |
5338 | 5338 | </label> |
5339 | 5339 | <label>Title |
5340 | | - <input name="pokestopTitle" type="text" autocomplete="off" placeholder="Title (required)" required value="${title}"> |
| 5340 | + <input id="pogo-s2-pokestopTitle" name="pokestopTitle" type="text" autocomplete="off" placeholder="Title (required)" required value="${title}"> |
5341 | 5341 | </label> |
5342 | 5342 | <label>Latitude |
5343 | | - <input name="pokestopLatitude" type="text" autocomplete="off" placeholder="Latitude (required)" required value="${lat}"> |
| 5343 | + <input id="pogo-s2-pokestopLatitude" name="pokestopLatitude" type="text" autocomplete="off" placeholder="Latitude (required)" required value="${lat}"> |
5344 | 5344 | </label> |
5345 | 5345 | <label>Longitude |
5346 | | - <input name="pokestopLongitude" type="text" autocomplete="off" placeholder="Longitude (required)" required value="${lng}"> |
| 5346 | + <input id="pogo-s2-pokestopLongitude" name="pokestopLongitude" type="text" autocomplete="off" placeholder="Longitude (required)" required value="${lng}"> |
5347 | 5347 | </label> |
5348 | 5348 | <label>Image Url |
5349 | 5349 | <input name="pokestopImageUrl" type="text" autocomplete="off" placeholder="http://?.googleusercontent.com/***" value="${imageUrl}"> |
|
5353 | 5353 |
|
5354 | 5354 | window.pokestoppopup.setContent(formContent) |
5355 | 5355 | window.pokestoppopup.openOn(map) |
| 5356 | + |
| 5357 | + const rootNode = window.pokestoppopup.getElement().getRootNode() |
| 5358 | + const titleInput = rootNode.getElementById('pogo-s2-pokestopTitle') |
| 5359 | + titleInput.addEventListener('change', (ev) => { |
| 5360 | + try { |
| 5361 | + const asUrl = new URL(ev.target.value) |
| 5362 | + if (asUrl.host === 'campfire.onelink.me') { |
| 5363 | + const params = new URLSearchParams( |
| 5364 | + atob(asUrl.searchParams.get('deep_link_sub1')) |
| 5365 | + ) |
| 5366 | + const lat = params.get('lat') |
| 5367 | + const lng = params.get('lng') |
| 5368 | + rootNode.getElementById( |
| 5369 | + 'pogo-s2-pokestopLatitude' |
| 5370 | + ).value = lat |
| 5371 | + rootNode.getElementById( |
| 5372 | + 'pogo-s2-pokestopLongitude' |
| 5373 | + ).value = lng |
| 5374 | + rootNode.getElementById('pogo-s2-pokestopType').value = |
| 5375 | + 'powerspots' |
| 5376 | + titleInput.value = 'Powerspot ' |
| 5377 | + titleInput.focus() |
| 5378 | + } |
| 5379 | + } catch (e) {} |
| 5380 | + }) |
5356 | 5381 | } |
5357 | 5382 |
|
5358 | 5383 | window.submitNewStop = function () { |
|
0 commit comments