mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-05 02:39:46 +02:00
Adding no sleep
This commit is contained in:
parent
d6b6ff695d
commit
aad38c5b53
26 changed files with 1029 additions and 0 deletions
36
node_modules/nosleep.js/example/index.html
generated
vendored
Normal file
36
node_modules/nosleep.js/example/index.html
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>NoSleep.js - Simple Test Page</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
</head>
|
||||
<body>
|
||||
<h1>NoSleep Test Page</h1>
|
||||
<script src="../dist/NoSleep.min.js"></script>
|
||||
|
||||
<input type="button" id="toggle" value="Wake Lock is disabled" />
|
||||
|
||||
<script>
|
||||
var noSleep = new NoSleep();
|
||||
|
||||
var wakeLockEnabled = false;
|
||||
var toggleEl = document.querySelector("#toggle");
|
||||
toggleEl.addEventListener('click', function() {
|
||||
if (!wakeLockEnabled) {
|
||||
noSleep.enable(); // keep the screen on!
|
||||
wakeLockEnabled = true;
|
||||
toggleEl.value = "Wake Lock is enabled";
|
||||
document.body.style.backgroundColor = "green";
|
||||
} else {
|
||||
noSleep.disable(); // let the screen turn off.
|
||||
wakeLockEnabled = false;
|
||||
toggleEl.value = "Wake Lock is disabled";
|
||||
document.body.style.backgroundColor = "";
|
||||
}
|
||||
}, false);
|
||||
</script>
|
||||
|
||||
<!-- Github Ribbon -->
|
||||
<a href="https://github.com/richtr/NoSleep.js"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue