뷰페이지 및 댓글에 주소복사 버튼 달기

1. 그누순정 basic / gallery 5.5 버전 이상의 "짧은 주소"에만 해당하며 나머지 조건에서는는 테스트해 보지도 않았고 테스트해 볼 생각 자체도 없으니 감안해서 사용하세요.
----------
2. 폰트어썸에서 깃발을 사용하였는데 바꾸고 싶다면 https://fontawesome.com/v4/icons/ 에서 재주껏 바꾸시기 바랍니다.
----------
3. view.skin.php 의 가장 하단이나 또는 view.tail.skin.php 에 아래의 코드를 입력합니다.
[ pc ]
[code]
<script>
document.write("<textarea id='copyUrl' style='display:none'></textarea>");
document.querySelector("#bo_v_top ul").insertAdjacentHTML("afterbegin", "<li><span id='urlSpan' class='btn_b01 btn' style='cursor:pointer' title='주소복사'><i class='fa fa-flag' aria-hidden='true'></i></span></li>");
function urlCopy() {
document.querySelector("#copyUrl").style.display = "block";
document.querySelector("#copyUrl").value = arguments[0];
document.querySelector("#copyUrl").select();
document.execCommand("copy");
document.querySelector("#copyUrl").style.display = "none";
alert("주소가 복사되었습니다");
}
document.querySelector("#urlSpan").onclick = () => {
urlCopy(String(location.href).split("?")[0]);
}
for (i of document.querySelectorAll("#bo_vc article .cm_wrap")) {
i.insertAdjacentHTML("afterbegin", "<span class='btn_b01 btn' style='position:relative;z-index:" + (Number(i.querySelector("header").style.zIndex) + 1) + ";float:right;cursor:pointer' title='주소복사'><i class='fa fa-flag' aria-hidden='true'></i></span>");
i.querySelector("span").onclick = function() {
urlCopy(String(location.href).split("?")[0] + "?#" + this.parentElement.parentElement.id);
}
}
</script>
[/code]
----------
[ 모바일 ]
[code]
<script>
document.write("<textarea id='copyUrl' style='display:none'></textarea>");
document.querySelector("#container ul").insertAdjacentHTML("afterbegin", "<li><span id='urlSpan' class='btn_b03 btn' style='cursor:pointer' title='주소복사'><i class='fa fa-flag' aria-hidden='true'></i></span></li>");
function urlCopy() {
document.querySelector("#copyUrl").style.display = "block";
document.querySelector("#copyUrl").value = arguments[0];
document.querySelector("#copyUrl").select();
document.execCommand("copy");
document.querySelector("#copyUrl").style.display = "none";
alert("주소가 복사되었습니다");
}
document.querySelector("#urlSpan").onclick = () => {
urlCopy(String(location.href).split("?")[0]);
}
for (i of document.querySelectorAll("#bo_vc article .comment_inner")) {
i.insertAdjacentHTML("afterbegin", "<span class='btn_cm_opt btn_b03 btn' style='position:relative;z-index:1;float:right;margin-top:-5px;margin-right:20px;cursor:pointer' title='주소복사'><i class='fa fa-flag' aria-hidden='true'></i></span>");
i.querySelector("span").onclick = function() {
urlCopy(String(location.href).split("?")[0] + "?#" + this.parentElement.parentElement.id);
}
}
</script>
[/code]
댓글 11개
감사 합니다.
@들레아빠 감사합니다
좋아요 추천합니다.
@푸른산타 청산타님 감사합니다
오늘도 상큼한 비타민같은 팁을 주셨어요~ 감사합니다!!
@헛둘헛둘
비타민 칭찬 감사합니다
버튼을 리스트에 넣을 수 있는 방법은 없나요?
리스트 옆에 버튼을 넣었으면 좋겠어요
@채연아빠
https://sir.kr/qa/
좋은 글 감사합니다. 행복하세요.~ 추천쿡 기본이죠.ㅎㅎㅎㅎ
@하늘뚱
감사합니다.
감사합니다.
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4427 | ||
| 2274 | 2년 전 | 2066 | ||
| 2273 |
|
2년 전 | 1487 | |
| 2272 | 2년 전 | 2469 | ||
| 2271 | 2년 전 | 2070 | ||
| 2270 |
|
2년 전 | 2090 | |
| 2269 |
|
2년 전 | 1892 | |
| 2268 | 2년 전 | 3850 | ||
| 2267 | 2년 전 | 2901 | ||
| 2266 |
|
2년 전 | 2124 | |
| 2265 | 2년 전 | 1643 | ||
| 2264 | 2년 전 | 2123 | ||
| 2263 | 2년 전 | 1992 | ||
| 2262 | 2년 전 | 1541 | ||
| 2261 |
|
2년 전 | 1452 | |
| 2260 | 2년 전 | 2441 | ||
| 2259 |
welcome
|
2년 전 | 1778 | |
| 2258 |
welcome
|
2년 전 | 1307 | |
| 2257 | 2년 전 | 3056 | ||
| 2256 | 2년 전 | 1317 | ||
| 2255 |
|
2년 전 | 1825 | |
| 2254 | 2년 전 | 1798 | ||
| 2253 |
welcome
|
2년 전 | 1572 | |
| 2252 |
welcome
|
2년 전 | 1343 | |
| 2251 | 2년 전 | 2397 | ||
| 2250 | 2년 전 | 2032 | ||
| 2249 | 2년 전 | 1819 | ||
| 2248 | 2년 전 | 1632 | ||
| 2247 | 2년 전 | 2056 | ||
| 2246 | 2년 전 | 2467 | ||
| 2245 | 2년 전 | 1921 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기