-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
453 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<h1 class="title">Traffic in VATPAC airspace</h1> | ||
<div id="vatsim-map-iframe"></div> | ||
<script type="application/javascript"> | ||
console.log('vatsim-map'); | ||
|
||
const targetNode = document.documentElement; | ||
const config = { attributes: true, childList: false, subtree: false }; | ||
|
||
const callback = function(mutationsList, observer) { | ||
console.log("MutationObserver"); | ||
// Use traditional 'for loops' for IE 11 | ||
for(const mutation of mutationsList) { | ||
if (mutation.type === 'attributes') { | ||
if(mutation.attributeName === "class") { | ||
console.log(`theme observer: ${mutation.target.className}`); | ||
if(mutation.target.className === "theme--dark"){ | ||
setTheme("dark"); | ||
}else{ | ||
|
||
setTheme("light"); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
var theme = "false"; | ||
function setTheme(theme){ | ||
console.log('setTheme') | ||
var div = document.getElementById('vatsim-map-iframe'); | ||
if(theme == "dark"){ | ||
console.log(theme); | ||
div.innerHTML = '<iframe src="https://vatpac.cycloptivity.net/static/map.html?theme=dark" name="vatsim-map" id="vatsim-map__dark" scrolling="no" frameborder="0" width="100%" height="500px"></iframe>'; | ||
} | ||
|
||
if(theme == "light"){ | ||
console.log(theme); | ||
div.innerHTML = '<iframe src="https://vatpac.cycloptivity.net/static/map.html?theme=light" name="vatsim-map" id="vatsim-map__dark" scrolling="no" frameborder="0" width="100%" height="500px"></iframe>'; | ||
} | ||
}; | ||
|
||
setTheme("light"); | ||
const observer = new MutationObserver(callback); | ||
observer.observe(targetNode, config); | ||
|
||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Oops, something went wrong.