Spaces:
Runtime error
Runtime error
Update src/addons/addons/save-to-google/userscript.js
Browse files
src/addons/addons/save-to-google/userscript.js
CHANGED
@@ -250,41 +250,54 @@ export default async ({ addon, console, msg }) => {
|
|
250 |
fileName.style.fontWeight = "bold";
|
251 |
fileItem.appendChild(fileName);
|
252 |
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
|
286 |
-
|
287 |
-
|
|
|
288 |
|
289 |
// 操作ボタン
|
290 |
const buttonContainer = document.createElement("div");
|
|
|
250 |
fileName.style.fontWeight = "bold";
|
251 |
fileItem.appendChild(fileName);
|
252 |
|
253 |
+
// 共有リンク
|
254 |
+
const linkContainer = document.createElement("div");
|
255 |
+
linkContainer.style.display = "flex";
|
256 |
+
linkContainer.style.alignItems = "center";
|
257 |
+
linkContainer.style.gap = "0.5rem";
|
258 |
+
linkContainer.style.marginBottom = "0.5rem";
|
259 |
+
|
260 |
+
const linkLabel = document.createElement("div");
|
261 |
+
linkLabel.textContent = "共有リンク:";
|
262 |
+
linkLabel.style.fontSize = "0.9em";
|
263 |
+
linkLabel.style.color = "#666";
|
264 |
+
linkContainer.appendChild(linkLabel);
|
265 |
+
|
266 |
+
const linkUrlContainer = document.createElement("div");
|
267 |
+
linkUrlContainer.style.display = "flex";
|
268 |
+
linkUrlContainer.style.alignItems = "center";
|
269 |
+
linkUrlContainer.style.gap = "0.25rem";
|
270 |
+
linkUrlContainer.style.flexGrow = "1";
|
271 |
+
|
272 |
+
const linkUrl = document.createElement("a");
|
273 |
+
linkUrl.href = `${SHORT_URL}${project.id}`;
|
274 |
+
linkUrl.textContent = `${SHORT_URL}${project.id}`;
|
275 |
+
linkUrl.target = "_blank";
|
276 |
+
linkUrl.rel = "noopener noreferrer";
|
277 |
+
linkUrl.style.fontSize = "0.9em";
|
278 |
+
linkUrl.style.wordBreak = "break-all";
|
279 |
+
linkUrl.style.color = "#4d97ff";
|
280 |
+
linkUrl.style.textDecoration = "none";
|
281 |
+
linkUrl.style.borderBottom = "1px dashed #4d97ff";
|
282 |
+
linkUrlContainer.appendChild(linkUrl);
|
283 |
+
|
284 |
+
const copyButton = document.createElement("button");
|
285 |
+
copyButton.textContent = "コピー";
|
286 |
+
copyButton.className = "button";
|
287 |
+
copyButton.style.fontSize = "0.8em";
|
288 |
+
copyButton.style.padding = "0.2rem 0.5rem";
|
289 |
+
copyButton.style.whiteSpace = "nowrap";
|
290 |
+
|
291 |
+
copyButton.addEventListener("click", (e) => {
|
292 |
+
e.stopPropagation();
|
293 |
+
navigator.clipboard.writeText(`${SHORT_URL}${project.id}`)
|
294 |
+
.then(() => showAlert(addon, "success", "リンクをクリップボードにコピーしました"))
|
295 |
+
.catch(() => showAlert(addon, "error", "リンクのコピーに失敗しました"));
|
296 |
+
});
|
297 |
|
298 |
+
linkUrlContainer.appendChild(copyButton);
|
299 |
+
linkContainer.appendChild(linkUrlContainer);
|
300 |
+
fileItem.appendChild(linkContainer);
|
301 |
|
302 |
// 操作ボタン
|
303 |
const buttonContainer = document.createElement("div");
|