-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from ma10/add-copy-link-button-20240405
ガイドライン項目やチェック内容の見出しにリンクをコピーするボタンを追加
- Loading branch information
Showing
9 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
const buttonLabel = 'Copy Link'; | ||
const sections = document.querySelectorAll('section.permalink'); | ||
|
||
sections.forEach(section => { | ||
const header = section.querySelector('h2'); | ||
if (header) { | ||
const button = document.createElement('button'); | ||
button.textContent = buttonLabel; | ||
button.className = 'copy-link'; | ||
button.onclick = function () { | ||
navigator.clipboard.writeText(location.origin + location.pathname + '#' + section.id); | ||
}; | ||
header.appendChild(button); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
document.addEventListener('DOMContentLoaded', function () { | ||
const buttonLabel = 'リンクをコピー'; | ||
const sections = document.querySelectorAll('section.permalink'); | ||
|
||
sections.forEach(section => { | ||
const header = section.querySelector('h2'); | ||
if (header) { | ||
const button = document.createElement('button'); | ||
button.textContent = buttonLabel; | ||
button.className = 'copy-link'; | ||
button.onclick = function () { | ||
navigator.clipboard.writeText(location.origin + location.pathname + '#' + section.id); | ||
}; | ||
header.appendChild(button); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters