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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html lang="ja">
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>画像ダウンロード</title>
|
| 8 |
+
<style>
|
| 9 |
+
body {
|
| 10 |
+
font-family: Arial, sans-serif;
|
| 11 |
+
background-color: #f4f4f9;
|
| 12 |
+
margin: 0;
|
| 13 |
+
padding: 0;
|
| 14 |
+
display: flex;
|
| 15 |
+
flex-wrap: wrap;
|
| 16 |
+
justify-content: center;
|
| 17 |
+
gap: 20px;
|
| 18 |
+
padding: 20px;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
.image-box {
|
| 22 |
+
border: 2px solid #ddd;
|
| 23 |
+
border-radius: 10px;
|
| 24 |
+
padding: 15px;
|
| 25 |
+
background-color: #fff;
|
| 26 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 27 |
+
text-align: center;
|
| 28 |
+
max-width: 300px;
|
| 29 |
+
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.image-box:hover {
|
| 33 |
+
transform: translateY(-5px);
|
| 34 |
+
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
.image-box img {
|
| 38 |
+
max-width: 100%;
|
| 39 |
+
height: auto;
|
| 40 |
+
border-radius: 5px;
|
| 41 |
+
object-fit: cover;
|
| 42 |
+
/* 画像の小さい方を200pxに合わせる */
|
| 43 |
+
mix-height: 200px;
|
| 44 |
+
mix-width: 200px;
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
.download-button, .copy-button {
|
| 48 |
+
margin-top: 10px;
|
| 49 |
+
display: inline-block;
|
| 50 |
+
padding: 12px 25px;
|
| 51 |
+
background-color: #4CAF50;
|
| 52 |
+
color: white;
|
| 53 |
+
text-decoration: none;
|
| 54 |
+
border-radius: 25px;
|
| 55 |
+
font-size: 16px;
|
| 56 |
+
transition: background-color 0.3s ease, transform 0.2s ease;
|
| 57 |
+
}
|
| 58 |
+
.copy-button{
|
| 59 |
+
background-color: #4287f5 !important;
|
| 60 |
+
cursor: pointer;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
.download-button:hover, .copy-button:hover {
|
| 64 |
+
background-color: #45a049;
|
| 65 |
+
transform: translateY(-2px);
|
| 66 |
+
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
#loading {
|
| 70 |
+
position: fixed;
|
| 71 |
+
top: 0;
|
| 72 |
+
left: 0;
|
| 73 |
+
width: 100%;
|
| 74 |
+
height: 100%;
|
| 75 |
+
background-color: rgba(255, 255, 255, 0.8);
|
| 76 |
+
display: flex;
|
| 77 |
+
justify-content: center;
|
| 78 |
+
align-items: center;
|
| 79 |
+
font-size: 24px;
|
| 80 |
+
color: #333;
|
| 81 |
+
z-index: 1000;
|
| 82 |
+
transition: opacity 1s ease, visibility 1s ease; /* フェードアウトのためのスタイル */
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
#loading.hidden {
|
| 86 |
+
opacity: 0;
|
| 87 |
+
visibility: hidden;
|
| 88 |
+
}
|
| 89 |
+
</style>
|
| 90 |
+
</head>
|
| 91 |
+
<body>
|
| 92 |
+
|
| 93 |
+
<!-- ローディング表示 -->
|
| 94 |
+
<div id="loading">Loading...</div>
|
| 95 |
+
|
| 96 |
+
<script>
|
| 97 |
+
let number = 5; // 画像の数
|
| 98 |
+
|
| 99 |
+
let imagesLoaded = 0; // 読み込まれた画像の数
|
| 100 |
+
|
| 101 |
+
for (let i = 1; i <= number; i++) {
|
| 102 |
+
// 新しいdiv要素を作成
|
| 103 |
+
let imageBox = document.createElement('div');
|
| 104 |
+
imageBox.className = 'image-box';
|
| 105 |
+
|
| 106 |
+
// 画像要素を作成
|
| 107 |
+
let img = document.createElement('img');
|
| 108 |
+
img.src = location.href + "/marker/" + i + ".png"; // 画像のパスを動的に設定
|
| 109 |
+
img.alt = "画像";
|
| 110 |
+
|
| 111 |
+
// 画像の読み込み完了イベントを設定
|
| 112 |
+
img.onload = function() {
|
| 113 |
+
imagesLoaded++;
|
| 114 |
+
if (imagesLoaded === number) {
|
| 115 |
+
// 全ての画像が読み込まれたらローディング画面をフェードアウトさせる
|
| 116 |
+
setTimeout(function() {
|
| 117 |
+
document.getElementById('loading').classList.add('hidden');
|
| 118 |
+
}, 500); // 少し遅らせてからフェードアウト開始
|
| 119 |
+
}
|
| 120 |
+
};
|
| 121 |
+
|
| 122 |
+
// divに画像を追加
|
| 123 |
+
imageBox.appendChild(img);
|
| 124 |
+
document.body.appendChild(imageBox); // 画像をbodyに追加
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
// ダウンロードリンクを作成
|
| 130 |
+
let downloadLink = document.createElement('a');
|
| 131 |
+
downloadLink.href = location.href + "/marker/" + i + ".png";
|
| 132 |
+
downloadLink.download = '';
|
| 133 |
+
downloadLink.className = 'download-button';
|
| 134 |
+
downloadLink.textContent = 'ダウンロード';
|
| 135 |
+
|
| 136 |
+
// コピーリンクボタンを作成
|
| 137 |
+
let copyButton = document.createElement('button');
|
| 138 |
+
copyButton.className = 'copy-button';
|
| 139 |
+
copyButton.textContent = 'URLをコピー';
|
| 140 |
+
|
| 141 |
+
// コピーボタンのクリックイベント
|
| 142 |
+
copyButton.onclick = function() {
|
| 143 |
+
const imageUrl = location.href + "/marker/" + i + ".png";
|
| 144 |
+
navigator.clipboard.writeText(imageUrl).then(function() {
|
| 145 |
+
alert('URLがコピーされました: \n' + imageUrl);
|
| 146 |
+
}, function(err) {
|
| 147 |
+
alert('コピーに失敗しました: ', err);
|
| 148 |
+
});
|
| 149 |
+
};
|
| 150 |
+
|
| 151 |
+
// divに画像、ダウンロードボタン、コピーリンクを追加
|
| 152 |
+
imageBox.appendChild(img);
|
| 153 |
+
imageBox.appendChild(document.createElement('br'));
|
| 154 |
+
imageBox.appendChild(downloadLink);
|
| 155 |
+
imageBox.appendChild(document.createElement('br'));
|
| 156 |
+
imageBox.appendChild(copyButton);
|
| 157 |
+
|
| 158 |
+
// bodyにdivを追加
|
| 159 |
+
document.body.appendChild(imageBox);
|
| 160 |
+
});
|
| 161 |
+
</script>
|
| 162 |
+
|
| 163 |
+
</body>
|
| 164 |
+
</html>
|