「MediaWiki:Citizen.js」の版間の差分
MediaWikiインターフェイスページ
その他の操作
細 「MediaWiki:Citizen.js」を保護しました ([編集=管理者のみ許可] (無期限) [移動=管理者のみ許可] (無期限)) |
編集の要約なし |
||
| 2行目: | 2行目: | ||
(function() { | (function() { | ||
function initGoogleMaps() { | function initGoogleMaps() { | ||
document.querySelectorAll(".map-embed").forEach(function (el) { | |||
const name = el.dataset.name; | |||
if (!name) return; | |||
const src = `https://www.google.com/maps/embed/v1/place?key=AIzaSyDOA7e6S9arQa6NvnsFYXxGjX9P_ycwoyM&q=${encodeURIComponent(name)}&zoom=16&maptype=roadmap&language=ja®ion=JP`; | |||
const iframe = document.createElement("iframe"); | |||
iframe.width = "100%"; | |||
iframe.height = "400"; | |||
iframe.style.border = "0"; | |||
iframe.loading = "lazy"; | |||
iframe.allowFullscreen = true; | |||
iframe.referrerPolicy = "no-referrer-when-downgrade"; | |||
iframe.src = src; | |||
el.innerHTML = ""; | |||
el.appendChild(iframe); | |||
}); | }); | ||
} | } | ||
2025年10月30日 (木) 17:56時点における版
// GoogleMap表示
(function() {
function initGoogleMaps() {
document.querySelectorAll(".map-embed").forEach(function (el) {
const name = el.dataset.name;
if (!name) return;
const src = `https://www.google.com/maps/embed/v1/place?key=AIzaSyDOA7e6S9arQa6NvnsFYXxGjX9P_ycwoyM&q=${encodeURIComponent(name)}&zoom=16&maptype=roadmap&language=ja®ion=JP`;
const iframe = document.createElement("iframe");
iframe.width = "100%";
iframe.height = "400";
iframe.style.border = "0";
iframe.loading = "lazy";
iframe.allowFullscreen = true;
iframe.referrerPolicy = "no-referrer-when-downgrade";
iframe.src = src;
el.innerHTML = "";
el.appendChild(iframe);
});
}
// DOM準備後に実行
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", initGoogleMaps);
} else {
initGoogleMaps();
}
})();