1/** 2 * Light UX deterrent: block common view-source / DevTools shortcuts. 3 * Not a security boundary â determined users can still inspect. 4 */ 5(function () { 6 'use strict'; 7 8 function isMod(e) { 9 return e.ctrlKey || e.metaKey; 10 } 11 12 function blockViewSource(e) { 13 var key = e.key; 14 if (!key) { 15 return false; 16 } 17 18 // Ctrl/Cmd + U 19 if (isMod(e) && (key === 'u' || key === 'U')) { 20 return true; 21 } 22 23 // F12 24 if (key === 'F12') { 25 return true; 26 } 27 28 // Ctrl+Shift+I/J/C or Cmd+Option+I/J/C 29 var upper = key.toUpperCase(); 30 if (['I', 'J', 'C'].indexOf(upper) !== -1) { 31 if (e.ctrlKey && e.shiftKey) { 32 return true; 33 } 34 if (e.metaKey && e.altKey) { 35 return true; 36 } 37 } 38 39 return false; 40 } 41 42 function stop(e) { 43 e.preventDefault(); 44 e.stopImmediatePropagation(); 45 return false; 46 } 47 48 document.addEventListener( 49 'contextmenu', 50 function (e) { 51 stop(e); 52 }, 53 true 54 ); 55 56 document.addEventListener( 57 'keydown', 58 function (e) { 59 if (blockViewSource(e)) { 60 stop(e); 61 } 62 }, 63 true 64 ); 65 66 document.addEventListener( 67 'keyup', 68 function (e) { 69 if (isMod(e) && (e.key === 'u' || e.key === 'U')) { 70 stop(e); 71 } 72 }, 73 true 74 ); 75})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.