MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / lockCurrentWebsite

Function lockCurrentWebsite

scripts/auto_lockWebsite.js:237–361  ·  view source on GitHub ↗
(pass, matchedPattern)

Source from the content-addressed store, hash-verified

235}
236
237function lockCurrentWebsite(pass, matchedPattern) {
238 const id = "ufs_auto_lock_website_overlay";
239 const idStyle = id + "-style";
240
241 function lockAgain() {
242 let overlay = document.querySelector(`#${id}`);
243 let style = document.querySelector(`#${idStyle}`);
244 if (!overlay || !style) return;
245 overlay.style.top = "0";
246 style.disabled = false;
247 }
248
249 const exist = document.getElementById(id);
250 if (exist) {
251 lockAgain();
252 return;
253 }
254
255 const style = document.createElement("style");
256 style.id = idStyle;
257 style.textContent = /*css*/ `
258 * :not(#${id}, #${id} *) {
259 display: none !important;
260 }
261 `;
262 document.head.appendChild(style);
263
264 const overlay = document.createElement("div");
265 overlay.id = id;
266 overlay.innerHTML = /* html */ `
267 <h1>This websites has been Locked</h1>
268 <input id="password" type="password" placeholder="Enter password to unlock.." autocomplete="new-password" />
269 <div id="unlock-temporarly-container" title="Enable to unlock temporarly => will lock again if website reload">
270 <input id="unlock-temporarly" type="checkbox" />
271 <label for="unlock-temporarly" >Unlock temporarly</label>
272 </div>
273 <style>
274 #${id} {
275 position: fixed;
276 top: -100vh;
277 left: 0;
278 width: 100vw;
279 height: 100vh;
280 margin: 0;
281 padding: 0;
282 background-color: #112;
283 z-index: 2147483647;
284 opacity: 0;
285 transition: all 0.3s ease;
286 display: flex;
287 justify-content: center;
288 align-items: center;
289 flex-direction: column;
290 }
291 #${id} > h1 {
292 color: #ddd;
293 font-size: 30px;
294 text-align: center;

Callers 1

Calls 3

md5Function · 0.90
lockAgainFunction · 0.85
removeMethod · 0.45

Tested by

no test coverage detected