Initial commit

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2022-02-04 22:36:22 -06:00
commit 1975612a64
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
4 changed files with 69 additions and 0 deletions

1
.gitignore vendored 100644
View File

@ -0,0 +1 @@
.idea/

19
LICENSE 100644
View File

@ -0,0 +1,19 @@
Copyright (c) 2022 John Olheiser
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

20
README.md 100644
View File

@ -0,0 +1,20 @@
# Dynmap JS
Add `canopy.js` to `index.html` like so:
```diff
...
<script type="text/javascript" src="version.js?_=3.3-beta-4-617"></script>
<script type="text/javascript" src="js/jquery.json.js?_=3.3-beta-4-617"></script>
<script type="text/javascript" src="js/jquery.mousewheel.js?_=3.3-beta-4-617"></script>
<script type="text/javascript" src="js/minecraft.js?_=3.3-beta-4-617"></script>
<script type="text/javascript" src="js/map.js?_=3.3-beta-4-617"></script>
<script type="text/javascript" src="js/hdmap.js?_=3.3-beta-4-617"></script>
<script type="text/javascript" src="standalone/config.js?_=3.3-beta-4-617"></script>
+ <script type="text/javascript" src="js/canopy.js"></script>
...
```
## License
[MIT](LICENSE)

29
canopy.js 100644
View File

@ -0,0 +1,29 @@
$(document).ready(() => {
console.log('Initializing Canopy...');
// Markers All/None
exists('.leaflet-control-layers-overlays', () => {
$('.leaflet-control-layers-overlays').prepend('<label><div><a href="#" id="toggleAllMarkers">All</a><span>&nbsp;|&nbsp;</span><a href="#" id="toggleNoneMarkers">None</a></div></label><label><hr/></label>');
const $markers = $('.leaflet-control-layers-selector');
$('#toggleAllMarkers').on('click', () => {
$markers.prop('checked', false);
$markers.click();
});
$('#toggleNoneMarkers').on('click', () => {
$markers.prop('checked', true);
$markers.click();
});
});
});
function exists(selector, callback) {
if ($(selector).length) {
callback();
} else {
setTimeout(() => {
exists(selector, callback);
}, 500);
}
}