From 1975612a64a914a0a0ab3c0ad0b2206880ff23da Mon Sep 17 00:00:00 2001 From: jolheiser Date: Fri, 4 Feb 2022 22:36:22 -0600 Subject: [PATCH] Initial commit Signed-off-by: jolheiser --- .gitignore | 1 + LICENSE | 19 +++++++++++++++++++ README.md | 20 ++++++++++++++++++++ canopy.js | 29 +++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 canopy.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62c8935 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ec2045e --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..e0bfdb5 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# Dynmap JS + +Add `canopy.js` to `index.html` like so: + +```diff + ... + + + + + + + ++ + ... +``` + +## License + +[MIT](LICENSE) \ No newline at end of file diff --git a/canopy.js b/canopy.js new file mode 100644 index 0000000..55f379b --- /dev/null +++ b/canopy.js @@ -0,0 +1,29 @@ +$(document).ready(() => { + console.log('Initializing Canopy...'); + + // Markers All/None + exists('.leaflet-control-layers-overlays', () => { + $('.leaflet-control-layers-overlays').prepend(''); + + 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); + } +} \ No newline at end of file