Skip to content

Instantly share code, notes, and snippets.

@gojun077
Forked from Kilian/annoying.js
Created September 11, 2012 07:50
Show Gist options
  • Save gojun077/3696750 to your computer and use it in GitHub Desktop.
Save gojun077/3696750 to your computer and use it in GitHub Desktop.
forked from Kilian's "How to be an asshole"
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/
* for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer
* instead of visitors
*
* Licensed under the MIT license. http://www.opensource.org/licenses/mit-license.php
*
*/
/* 다소 생략 됐음; 제가 보여드리고자하는 'DogBird' 자바 스크립트는 1)오른쪽 마우스 클릭 차단
2)텍스트 선택 차단 3)키보드 복사 (Ctrl+C) 차단 입니다.
*/
/* 오른쪽 마우스 클릭 차단 및 복사 방지
*/
a.noRightClick = function () {
document.oncontextmenu = function(){ return false; };
};
/* 텍스트 선택 차단
*/
a.noSelect = function () {
//텍스트 선택 차단 IE
document.onselectstart = function () {
if (event.srcElement.type != "text" && event.srcElement.type
!= "textarea" && event.srcElement.type != "password") {
return false;
} else {
return true;
}
};
//텍스트 선택 차단 파이어폭스
document.onmousedown=function(e){
var obj=e.target;
if (obj.tagName.toUpperCase() == "INPUT" || obj.tagName.toUpperCase()
== "TEXTAREA" || obj.tagName.toUpperCase() == "PASSWORD") {
return true;
} else {
return false;
}
};
};
/* 키보드 복사 차단
*/
a.noCopy = function () {
window.onkeydown = function(e) {
if ( e.ctrlKey ) {
return false;
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment