본문, 댓글에 syntax highlight 넣기 : 스마트에디터2 도 가능함 > 그누월드

본문 바로가기
사이트 내 전체검색

그누월드

본문, 댓글에 syntax highlight 넣기 : 스마트에디터2 도 가능함

페이지 정보

profile_image
작성자 비타주리
댓글 2건 조회 4,667회 작성일 21-12-01 22:15

본문

syntax highlight

[code]

<link rel=stylesheet href=//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/a11y-dark.min.css>

<script src=//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js></script>

<style>

pre { position:relative; -ms-overflow-style:none; }

pre::-webkit-scrollbar { display:none; }

.copyButton { position:absolute; cursor:pointer; top:10px; right:10px; }

</style>

<script>

copyImage = "http://www.mediaplayer.kr/main/wittazzurri/code/copy_hand.png";

copyMp3 = "http://www.mediaplayer.kr/main/wittazzurri/code/copy_sound.mp3";

document.write("<div class=cmt_contents style=display:none></div>");

commentZone = document.getElementsByClassName("cmt_contents");

cmtLimit = commentZone.length;

for (cmt = 0; cmt < cmtLimit; cmt++) commentZone[cmt].id = "cmt_num_" + (Number(cmt) + 1);

editorName = "<?php echo $board['bo_use_dhtml_editor'] ? $config['cf_editor'] : "none"; ?>";

function codeCopy() {

copyText.style.display = "block";

copyText.value = arguments[0].innerText.trim();

copyText.select();

document.execCommand("copy");

copyText.style.display = "none";

copySound.play();

alert("COPY CODE!!!");

}

function hlMode() {

this[arguments[0]].innerHTML = this[arguments[0]].innerHTML.replace(/\[code\]/gi, "<div name=code_" + arguments[0] + ">").replace(/\[\/code\]/gi, "</div>");

nameN = document.getElementsByName("code_" + arguments[0]);

for (n = 0; n < nameN.length; n++) {

if (arguments[0] == "bo_v_con") {

if (editorName == "smarteditor2") changeCode = (nameN[n].innerHTML.replace(/\<p\>/gi, "").replace(/\<\/p\>/gi, "<br>") + "<br>").replace(/\<br\>\<br\>/gi, "<br>");

else if (editorName == "cheditor5") changeCode = nameN[n].innerHTML.replace(/<(\/p|p)([^>]*)>/gi, "") + "<br>";

else if (editorName == "none") changeCode = nameN[n].innerHTML.replace(/\<br\>\<br\>/gi, "*br*").replace(/\<br\>/gi, "").replace(/\*br\*/gi, "<br>") + "<br>";

}

else changeCode = nameN[n].innerHTML.replace(/\<br\>\<br\>/gi, "*br*").replace(/\<br\>/gi, "").replace(/\*br\*/gi, "<br>") + "<br>"; 

nameN[n].innerHTML = "<pre><code>" + changeCode + "<img class=copyButton src=" + copyImage + " onclick=codeCopy(parentElement)></code></pre>";

}

}

hlGroup = ["bo_v_con"];

for (cmtPlus = 0; cmtPlus < cmtLimit; cmtPlus++) hlGroup.push(commentZone[cmtPlus].id);

for (hl in hlGroup) hlMode(hlGroup[hl]);

hljs.initHighlighting();

document.write("<textarea id=copyText style=display:none></textarea>");

document.write("<audio id=copySound src=" + copyMp3 + " ></audio>");

codeZone = document.getElementsByTagName("code");

for (cz = 0; cz < codeZone.length; cz++) {

codeZone[cz].style.fontSize = "1rem";

codeZone[cz].style.fontFamily = "times";

codeZone[cz].style.padding = "20px";

codeZone[cz].style.borderRadius = "15px";

codeZone[cz].style.backgroundColor = "#000000";

}

</script>

[/code]


http://www.mediaplayer.kr/main/data/file/mp3/988289629_651EeF2U_63abb472924f1838a34097f3757b8cb5042d8f5b.mp3


[code]

<wittazzurri>코드블럭의 연속넣기도 가능합니다</wittazzurri>

[/code]

댓글목록

profile_image

비타주리님의 댓글

비타주리 작성일

------
사용법 : https://sir.kr/g5_plugin/9655
------
[code]<wittazzurri>댓글에서도 코드블럭의 연속넣기가 가능합니다</wittazzurri>[/code]
https://youtu.be/EIzXAMjaJ98
[code]<link rel=stylesheet href=//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/a11y-dark.min.css>
<script src=//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js></script>
<style>
pre { position:relative; -ms-overflow-style:none; }
pre::-webkit-scrollbar { display:none; }
.copyButton { position:absolute; cursor:pointer; top:10px; right:10px; }
</style>
<script>
copyImage = "http://www.mediaplayer.kr/main/wittazzurri/code/copy_hand.png";
copyMp3 = "http://www.mediaplayer.kr/main/wittazzurri/code/copy_sound.mp3";
//document.write("<div class=cmt_contents style=display:none></div>");
//commentZone = document.getElementsByClassName("cmt_contents");
//cmtLimit = commentZone.length;
//for (cmt = 0; cmt < cmtLimit; cmt++) commentZone[cmt].id = "cmt_num_" + (Number(cmt) + 1);
editorName = "<?php echo $board['bo_use_dhtml_editor'] ? $config['cf_editor'] : "none"; ?>";
function codeCopy() {
copyText.style.display = "block";
copyText.value = arguments[0].innerText.trim();
copyText.select();
document.execCommand("copy");
copyText.style.display = "none";
copySound.play();
alert("COPY CODE!!!");
}
function hlMode() {
this[arguments[0]].innerHTML = this[arguments[0]].innerHTML.replace(/\[code\]/gi, "<div name=code_" + arguments[0] + ">").replace(/\[\/code\]/gi, "</div>");
nameN = document.getElementsByName("code_" + arguments[0]);
for (n = 0; n < nameN.length; n++) {
if (arguments[0] == "bo_v_con") {
if (editorName == "smarteditor2") changeCode = (nameN[n].innerHTML.replace(/\<p\>/gi, "").replace(/\<\/p\>/gi, "<br>") + "<br>").replace(/\<br\>\<br\>/gi, "<br>");
else if (editorName == "cheditor5") changeCode = nameN[n].innerHTML.replace(/<(\/p|p)([^>]*)>/gi, "") + "<br>";
else if (editorName == "none") changeCode = nameN[n].innerHTML.replace(/\<br\>\<br\>/gi, "*br*").replace(/\<br\>/gi, "").replace(/\*br\*/gi, "<br>") + "<br>";
}
else changeCode = nameN[n].innerHTML.replace(/\<br\>\<br\>/gi, "*br*").replace(/\<br\>/gi, "").replace(/\*br\*/gi, "<br>") + "<br>";
nameN[n].innerHTML = "<pre><code>" + changeCode + "<img class=copyButton src=" + copyImage + " onclick=codeCopy(parentElement)></code></pre>";
}
}
hlGroup = ["bo_v_con"];
for (cmtPlus = 0; cmtPlus < cmtLimit; cmtPlus++) hlGroup.push(commentZone[cmtPlus].id);
for (hl in hlGroup) hlMode(hlGroup[hl]);
hljs.initHighlighting();
document.write("<textarea id=copyText style=display:none></textarea>");
document.write("<audio id=copySound src=" + copyMp3 + " ></audio>");
codeZone = document.getElementsByTagName("code");
for (cz = 0; cz < codeZone.length; cz++) {
codeZone[cz].style.fontSize = "1rem";
codeZone[cz].style.fontFamily = "times";
codeZone[cz].style.padding = "20px";
codeZone[cz].style.borderRadius = "15px";
codeZone[cz].style.backgroundColor = "#000000";
}
</script>[/code]

profile_image

비타주리님의 댓글

비타주리 작성일

[code]
<body oncontextmenu='return false' onselectstart='return false' ondragstart='return false'>
[/code]

회원로그인

회원가입

사이트 정보

회사명 : 회사명 / 대표 : 대표자명
주소 : OO도 OO시 OO구 OO동 123-45
사업자 등록번호 : 123-45-67890
전화 : 02-123-4567 팩스 : 02-123-4568
통신판매업신고번호 : 제 OO구 - 123호
개인정보관리책임자 : 정보책임자명

공지사항

  • 게시물이 없습니다.

접속자집계

오늘
228
어제
179
최대
1,376
전체
152,762
Copyright © 소유하신 도메인. All rights reserved.