마우스우클릭 방지 한방에 후킹
그누순정 55832 버전 이상입니다.
아래의 코드를 적은 후 그 php 파일을 이름은 아무거나 주고 extend 디렉토리로 업로드해 주세요.
관리자는 우클릭이 가능하고 나머지는 우클릭을 금지합니다.
[code]
<?php
if (!defined('_GNUBOARD_')) exit;
add_event('tail_sub', function() {
global $is_admin;
if (!$is_admin) echo "<script>document.oncontextmenu = document.onselectstart = document.ondragstart = () => { return false; }</script>";
});
[/code]
----------
개인적으로 https://sir.kr/g5_tip/22905 웹폰트와 함께 붙여서 아래처럼 사용하고 있습니다.
[code]
<?php
if (!defined('_GNUBOARD_')) exit;
add_event('tail_sub', function() {
echo "
<style>
@font-face { font-family:'NEXON Lv1 Gothic OTF'; src:url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@2.1/NEXON Lv1 Gothic OTF.woff') format('woff'); }
div, span, table, p, input, textarea, button, select, code, h1, h2, h3 { font-family:'NEXON Lv1 Gothic OTF' !important; }
</style>
";
global $is_admin;
if (!$is_admin) echo "<script>document.oncontextmenu = document.onselectstart = document.ondragstart = () => { return false; }</script>";
});
[/code]
----------
[ 추가사항 ]
생각해보니 글쓰는 사람이 write 모드에서 우클릭이 잠겨 있으면 좀 이상할 것 같네요.
그래서 글쓰기시에는 등급에 상관없이 우클릭을 개방한다는 조건까지 감안한다면 아래처럼요.
[code]
<?php
if (!defined('_GNUBOARD_')) exit;
add_event('tail_sub', function() {
global $is_admin;
$ok_mouse = $is_admin || basename($_SERVER['PHP_SELF']) === "write.php";
if (!$ok_mouse) echo "<script>document.oncontextmenu = document.onselectstart = document.ondragstart = () => { return false; }</script>";
});
[/code]
----------
[code]
<?php
if (!defined('_GNUBOARD_')) exit;
add_event('tail_sub', function() {
echo "
<style>
@font-face { font-family:'NEXON Lv1 Gothic OTF'; src:url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_20-04@2.1/NEXON Lv1 Gothic OTF.woff') format('woff'); }
div, span, table, p, input, textarea, button, select, code, h1, h2, h3 { font-family:'NEXON Lv1 Gothic OTF' !important; }
</style>
";
global $is_admin;
$ok_mouse = $is_admin || basename($_SERVER['PHP_SELF']) === "write.php";
if (!$ok_mouse) echo "<script>document.oncontextmenu = document.onselectstart = document.ondragstart = () => { return false; }</script>";
});
[/code]
----------
[ 스킨과의 연동 ] : https://sir.kr/g5_skin/60391
댓글 20개
감사합니다. ^^
@민트다이어리 감사합니다
감사 드립니다. 좋네요.
@오소피아 좋으시다니 감사합니다
정말 쏠쏠한 팁이네요. 고맙습니다 :)
@뒷집돌쇠 쏠쏠하다니 감사합니다
감사합니다
@너나잘해 어이구 감사합니다
이거 정말 필요했습니다
감사합니다
@미키손 필요했디니 다행입니다.
훅이 코어를 안 건드려서 편해요
감사 합니다.
@들레아빠 감사합니다 항상
감사합니당
@patrick영 감사합니다
추천 눌렀습니다. 감사합니다.
@하늘뚱 추천주심에 감사합니다.
감사합니다.
@써맨 감사합니다
한방에 .... 좋습니다.
유익한 자료! 꼼꼼한 배려까지 ㅎㅎ 감사합니다
@하늘아래구름
배려라고 하시니 감사합니다
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4406 | ||
| 2424 | 1년 전 | 1144 | ||
| 2423 | 1년 전 | 1163 | ||
| 2422 |
|
1년 전 | 1839 | |
| 2421 | 1년 전 | 1065 | ||
| 2420 |
|
1년 전 | 1845 | |
| 2419 | 1년 전 | 1155 | ||
| 2418 | 1년 전 | 1143 | ||
| 2417 | 1년 전 | 931 | ||
| 2416 | 1년 전 | 1226 | ||
| 2415 | 1년 전 | 1111 | ||
| 2414 | 1년 전 | 997 | ||
| 2413 | 1년 전 | 1400 | ||
| 2412 |
|
1년 전 | 2004 | |
| 2411 | 1년 전 | 995 | ||
| 2410 | 1년 전 | 1862 | ||
| 2409 | 1년 전 | 1695 | ||
| 2408 | 1년 전 | 1192 | ||
| 2407 | 1년 전 | 1161 | ||
| 2406 | 1년 전 | 835 | ||
| 2405 | 1년 전 | 2045 | ||
| 2404 |
와칸다포에버
|
1년 전 | 1049 | |
| 2403 | 1년 전 | 1126 | ||
| 2402 |
뽕엄능브라
|
1년 전 | 2057 | |
| 2401 | 1년 전 | 1162 | ||
| 2400 | 1년 전 | 1263 | ||
| 2399 | 1년 전 | 1849 | ||
| 2398 | 1년 전 | 1581 | ||
| 2397 | 1년 전 | 1895 | ||
| 2396 | 1년 전 | 1261 | ||
| 2395 | 1년 전 | 1081 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기