soiz1 commited on
Commit
2d2084c
·
verified ·
1 Parent(s): 4eb332e

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
- const linkContainer = document.createElement("div");
255
- linkContainer.style.display = "flex";
256
- linkContainer.style.flexDirection = "column";
257
- linkContainer.style.gap = "0.25rem";
258
- linkContainer.style.marginBottom = "0.5rem";
259
-
260
- const linkLabel = document.createElement("div");
261
- linkLabel.textContent = "共有リンク:";
262
- linkLabel.style.fontSize = "0.8em";
263
- linkLabel.style.color = "#666";
264
- linkContainer.appendChild(linkLabel);
265
-
266
- const linkUrl = document.createElement("div");
267
- linkUrl.textContent = `${SHORT_URL}${project.id}`;
268
- linkUrl.style.fontSize = "0.9em";
269
- linkUrl.style.wordBreak = "break-all";
270
- linkContainer.appendChild(linkUrl);
271
-
272
- const copyButton = document.createElement("button");
273
- copyButton.textContent = "リンクをコピー";
274
- copyButton.className = "button";
275
- copyButton.style.fontSize = "0.8em";
276
- copyButton.style.padding = "0.2rem 0.5rem";
277
- copyButton.style.width = "100%";
278
-
279
- copyButton.addEventListener("click", (e) => {
280
- e.stopPropagation();
281
- navigator.clipboard.writeText(`${SHORT_URL}${project.id}`)
282
- .then(() => showAlert(addon, "success", "リンクをクリップボードにコピーしました"))
283
- .catch(() => showAlert(addon, "error", "リンクのコピーに失敗しました"));
284
- });
 
 
 
 
 
 
 
 
 
 
 
 
285
 
286
- linkContainer.appendChild(copyButton);
287
- fileItem.appendChild(linkContainer);
 
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");