Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- INLINE CSS -->
- <style>
- /* fully disable selection & touch callouts everywhere except form controls */
- html, body, .quiz-content, .quiz-content * {
- -webkit-touch-callout: none !important; /* iOS long-press */
- -webkit-user-select: none !important; /* Chrome/Safari */
- -moz-user-select: none !important; /* Firefox */
- -ms-user-select: none !important; /* IE/Edge */
- user-select: none !important; /* standard */
- touch-action: manipulation !important; /* prevent double-tap select */
- }
- /* allow selection & interaction in form controls */
- input, textarea, select, button {
- -webkit-touch-callout: initial !important;
- -webkit-user-select: text !important;
- -moz-user-select: text !important;
- -ms-user-select: text !important;
- user-select: text !important;
- touch-action: auto !important;
- }
- /* remove any highlight color if it still flashes */
- ::selection {
- background: transparent !important;
- }
- </style>
- <!-- INLINE JS ANTI-CHEAT -->
- <script type="text/javascript">
- (function(){
- // mark page no-translate
- document.body.classList.add('notranslate');
- // show image if you have one (example)
- var img = document.getElementById('quiz-image');
- if(img) img.style.display = 'block';
- // common anti-cheat locks
- document.addEventListener('contextmenu', e => e.preventDefault(), false);
- document.addEventListener('dragstart', e => e.preventDefault(), false);
- document.addEventListener('copy', e => e.preventDefault(), false);
- document.addEventListener('paste', e => e.preventDefault(), false);
- document.addEventListener('keydown', function(e){
- var mod = e.ctrlKey || e.metaKey;
- if(mod && /[csfu]/i.test(e.key)) e.preventDefault();
- if(mod && e.shiftKey && /[ICJ]/.test(e.key)) e.preventDefault();
- if(e.keyCode === 123) e.preventDefault(); // F12
- }, false);
- // clear *any* selection immediately
- document.addEventListener('selectionchange', function(){
- var sel = document.getSelection();
- if(sel) sel.removeAllRanges();
- }, false);
- // block text-selection start on touch devices
- document.addEventListener('selectstart', function(e){
- e.preventDefault();
- }, false);
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement