RocketMap
RocketMap copied to clipboard
custom.js configurable linkbutton
My first coding project, still learning. Be nice please :p i wanna thank @Qualimiox for inspiring me to do this PR.
Description
Set values in custom.js to configure/show button
// customLink Button Settings
const customLinkButtonEnabled = true // Default: False.
const customLinkTitle = 'Test' // Default: ''
const customLinkUrl = 'http://test.nl' // Default: ''
Todo/Doesn't work yet
- [x] Make the button show even if people decided to remove stats/status/whatever button
document.getelementbytag / appendchild stuff?
Done
- [x] Title/URL configurable in custom.js
- [x] Enable/disable in custom.js
- [x] Make the scss-file grab the right url from custom.js (no idea how)
- [x] Make the link use css + fontawesome
Motivation and Context
How Has This Been Tested?
Locally with lots of frustration
Screenshots (if appropriate):
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)~~
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)~~
Checklist:
- [x] My code follows the code style of this project.~~
- [ ] My change requires a change to the documentation.~~
- [ ] I have updated the documentation accordingly.~~
Review again please.
Changes made + tested, works now. Need review+test
Just tested this some more. On /stats /status pages this stuff will error @ browser console:
jquery.min.js:2 jQuery.Deferred exception: Cannot read property 'insertAdjacentHTML' of null TypeError: Cannot read property 'insertAdjacentHTML' of null
at HTMLDocument.<anonymous> (https://map.tjielup.nl/static/1d458ea/dist/js/custom.min.js:5:7682)
at j (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:29999)
at k (https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js:2:30313) undefined
Which makes sense because there is no 'stats' button there :eyes: maybe this stuff should be added in config.ini/map.html instead?