UNPKG

react-js-plugins

Version:

A powerful and efficient React utility library designed to enhance application performance by streamlining and simplifying the management of complex asynchronous operations.

41 lines (40 loc) 2.18 kB
import { _addEventListenerToElement } from "./chunk75342"; import { _isInArray } from "./chunk83453"; export function _truncateText(text, limit) { if (limit === void 0) { limit = 20; } if (!text) return ""; return text.length > limit ? text.slice(0, limit) + "…" : text; } export function _isTruncate(text, limit) { if (limit === void 0) { limit = 20; } return !!text && text.length > limit; } export function _toTitleCase(text) { if (!text) return ""; return text .toLowerCase() .split(' ') .map(function (word) { return word.charAt(0).toUpperCase() + word.slice(1); }) .join(' '); } export var _disableDevTools = function () { _addEventListenerToElement('contextmenu', 'click', function (e) { return e.preventDefault(); }); document.onkeydown = function (e) { if (e.key === "F12" || (e.ctrlKey && e.shiftKey && _isInArray(["I", "C", "J"], e.key.toUpperCase())) || (e.ctrlKey && _isInArray(["U", "S"], e.key.toUpperCase()))) { e.preventDefault(); return false; } }; var s = 160; setInterval(function () { if (window.outerWidth - window.innerWidth > s || window.outerHeight - window.innerHeight > s) { document.body.innerHTML = "<div style=\"\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background-color: skyblue;\n color: #fff;\n padding: 30px 40px;\n border-radius: 10px;\n box-shadow: 0 8px 20px rgba(0,0,0,0.3);\n text-align: center;\n font-family: Arial, sans-serif;\n z-index: 9999;\n max-width: 500px;\n line-height: 1.5;\n \">\n <h2 style=\"margin: 0 0 15px 0; font-size: 24px;\">\u26A0\uFE0F Access Denied</h2>\n <p style=\"margin: 0; font-size: 16px;\">\n Developer Tools are not permitted.<br>\n Please close the Developer Tools and refresh the page to continue.\n </p>\n </div>"; } }, 1000); };