|
|
| (同じ利用者による、間の13版が非表示) |
| 1行目: |
1行目: |
| (function() {
| |
| console.log("Citizen.js loaded");
| |
|
| |
|
| function handleNewMaps(maps) {
| |
| maps.forEach(function(el, index){
| |
| console.log("Map element found:", el, el.dataset.coords);
| |
| });
| |
| }
| |
|
| |
| // DOMの変化を監視
| |
| var observer = new MutationObserver(function(mutationsList) {
| |
| mutationsList.forEach(function(mutation) {
| |
| mutation.addedNodes.forEach(function(node) {
| |
| if (node.nodeType === 1 && node.matches('.googlemap')) {
| |
| handleNewMaps([node]);
| |
| }
| |
| if (node.querySelectorAll) {
| |
| handleNewMaps(node.querySelectorAll('.googlemap'));
| |
| }
| |
| });
| |
| });
| |
| });
| |
|
| |
| observer.observe(document.body, { childList: true, subtree: true });
| |
| })();
| |