mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Adding no sleep
This commit is contained in:
parent
d6b6ff695d
commit
aad38c5b53
26 changed files with 1029 additions and 0 deletions
5
node_modules/.package-lock.json
generated
vendored
5
node_modules/.package-lock.json
generated
vendored
|
@ -820,6 +820,11 @@
|
||||||
"node-gyp-build-test": "build-test.js"
|
"node-gyp-build-test": "build-test.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nosleep.js": {
|
||||||
|
"version": "0.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.12.0.tgz",
|
||||||
|
"integrity": "sha512-9d1HbpKLh3sdWlhXMhU6MMH+wQzKkrgfRkYV0EBdvt99YJfj0ilCJrWRDYG2130Tm4GXbEoTCx5b34JSaP+HhA=="
|
||||||
|
},
|
||||||
"node_modules/pkcs7": {
|
"node_modules/pkcs7": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/pkcs7/-/pkcs7-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/pkcs7/-/pkcs7-1.0.4.tgz",
|
||||||
|
|
3
node_modules/nosleep.js/.babelrc
generated
vendored
Normal file
3
node_modules/nosleep.js/.babelrc
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"presets": [ "env" ]
|
||||||
|
}
|
9
node_modules/nosleep.js/.editorconfig
generated
vendored
Normal file
9
node_modules/nosleep.js/.editorconfig
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
charset = utf-8
|
1
node_modules/nosleep.js/.eslintrc.yml
generated
vendored
Normal file
1
node_modules/nosleep.js/.eslintrc.yml
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
extends: standard
|
125
node_modules/nosleep.js/.github/CONTRIBUTING.md
generated
vendored
Normal file
125
node_modules/nosleep.js/.github/CONTRIBUTING.md
generated
vendored
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
## Contributing in NoSleep.js
|
||||||
|
|
||||||
|
We'd always love contributions to further improve NoSleep.js!
|
||||||
|
|
||||||
|
Here are the guidelines we'd like you to follow:
|
||||||
|
|
||||||
|
* [Questions and Problems](#question)
|
||||||
|
* [Issues and Bugs](#issue)
|
||||||
|
* [Feature Requests](#feature)
|
||||||
|
* [Pull Request Submission Guidelines](#submit-pr)
|
||||||
|
* [Commit Message Conventions](#commit)
|
||||||
|
|
||||||
|
### <a name="question"></a> Got a Question or Problem?
|
||||||
|
|
||||||
|
Please submit support requests and questions to StackOverflow using the tag [[nosleep]](http://stackoverflow.com/tags/nosleep).
|
||||||
|
The issue tracker is for bug reports and feature discussions.
|
||||||
|
|
||||||
|
### <a name="issue"></a> Found an Issue or Bug?
|
||||||
|
|
||||||
|
Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.
|
||||||
|
|
||||||
|
We want to fix all the issues as soon as possible, but before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs, we ask that you to provide a minimal reproduction scenario (github repo or failing test case). Having a live, reproducible scenario gives us a wealth of important information without going back & forth to you with additional questions like:
|
||||||
|
|
||||||
|
- version of NoSleep.js used
|
||||||
|
- device manufacturer and device version information
|
||||||
|
- browser vendor and browser version information
|
||||||
|
- the use-case that fails
|
||||||
|
|
||||||
|
A minimal reproduce scenario allows us to quickly confirm a bug (or point out config problems) as well as confirm that we are fixing the right problem.
|
||||||
|
|
||||||
|
We will be insisting on a minimal reproduce scenario in order to save maintainers time and ultimately be able to fix more bugs. We understand that sometimes it might be hard to extract essentials bits of code from a larger code-base but we really need to isolate the problem before we can fix it.
|
||||||
|
|
||||||
|
Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that doesn't have enough info to be reproduced.
|
||||||
|
|
||||||
|
### <a name="feature"></a> Feature Requests?
|
||||||
|
|
||||||
|
You can *request* a new feature by creating an issue on Github.
|
||||||
|
|
||||||
|
If you would like to *implement* a new feature, please submit an issue with a proposal for your work `first`, to be sure that particular makes sense for the project.
|
||||||
|
|
||||||
|
### <a name="submit-pr"></a> Pull Request Submission Guidelines
|
||||||
|
|
||||||
|
Before you submit your Pull Request (PR) consider the following guidelines:
|
||||||
|
|
||||||
|
- Search Github for an open or closed PR that relates to your submission. You don't want to duplicate effort.
|
||||||
|
- Commit your changes using a descriptive commit message that follows our [commit message conventions](#commit). Adherence to these conventions is necessary because release notes are automatically generated from these messages.
|
||||||
|
- Fill out our `Pull Request Template`. Your pull request will not be considered if it is ignored.
|
||||||
|
- Please sign the `Contributor License Agreement (CLA)` when a pull request is opened. We cannot accept your pull request without this. Make sure you sign with the primary email address associated with your local / github account.
|
||||||
|
|
||||||
|
### <a name="commit"></a> NoSleep.js Commit Conventions
|
||||||
|
|
||||||
|
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
|
||||||
|
format that includes a **type**, a **scope** and a **subject**:
|
||||||
|
|
||||||
|
```
|
||||||
|
<type>(<scope>): <subject>
|
||||||
|
<BLANK LINE>
|
||||||
|
<body>
|
||||||
|
<BLANK LINE>
|
||||||
|
<footer>
|
||||||
|
```
|
||||||
|
|
||||||
|
The **header** is mandatory and the **scope** of the header is optional.
|
||||||
|
|
||||||
|
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
|
||||||
|
to read on GitHub as well as in various git tools.
|
||||||
|
|
||||||
|
The footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```
|
||||||
|
docs(readme): update install instructions
|
||||||
|
```
|
||||||
|
```
|
||||||
|
fix: refer to the `entrypoint` instead of the first `module`
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Revert
|
||||||
|
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
|
||||||
|
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
|
||||||
|
|
||||||
|
#### Type
|
||||||
|
Must be one of the following:
|
||||||
|
|
||||||
|
* **build**: Changes that affect the build system or external dependencies (example scopes: babel, npm)
|
||||||
|
* **chore**: Changes that fall outside of build / docs that do not effect source code (example scopes: package, defaults)
|
||||||
|
* **ci**: Changes to our CI configuration files and scripts (example scopes: circleci, travis)
|
||||||
|
* **docs**: Documentation only changes (example scopes: readme, changelog)
|
||||||
|
* **feat**: A new feature
|
||||||
|
* **fix**: A bug fix
|
||||||
|
* **perf**: A code change that improves performance
|
||||||
|
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||||
|
* **revert**: Used when reverting a committed change
|
||||||
|
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons)
|
||||||
|
* **test**: Addition of or updates to Jest tests
|
||||||
|
|
||||||
|
#### Scope
|
||||||
|
The scope is subjective & depends on the `type` see above. A good example would be a change to a particular class / module.
|
||||||
|
|
||||||
|
#### Subject
|
||||||
|
The subject contains a succinct description of the change:
|
||||||
|
|
||||||
|
* use the imperative, present tense: "change" not "changed" nor "changes"
|
||||||
|
* don't capitalize the first letter
|
||||||
|
* no dot (.) at the end
|
||||||
|
|
||||||
|
#### Body
|
||||||
|
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
|
||||||
|
The body should include the motivation for the change and contrast this with previous behavior.
|
||||||
|
|
||||||
|
#### Footer
|
||||||
|
The footer should contain any information about **Breaking Changes** and is also the place to
|
||||||
|
reference GitHub issues that this commit **Closes**.
|
||||||
|
|
||||||
|
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
|
||||||
|
|
||||||
|
Example
|
||||||
|
|
||||||
|
```
|
||||||
|
BREAKING CHANGE: Updates to `Chunk.mapModules`.
|
||||||
|
|
||||||
|
This release is not backwards compatible with `NoSleep 1.x` due to breaking changes in richtr/NoSleep.js#4764
|
||||||
|
Migration: see richtr/NoSleep.js#5225
|
||||||
|
|
||||||
|
```
|
16
node_modules/nosleep.js/.github/ISSUE_TEMPLATE.md
generated
vendored
Normal file
16
node_modules/nosleep.js/.github/ISSUE_TEMPLATE.md
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!--
|
||||||
|
👉🏽 Need support, advice, or help? Don't open an issue!
|
||||||
|
Head to StackOverflow https://stackoverflow.com.
|
||||||
|
|
||||||
|
Hey there!
|
||||||
|
|
||||||
|
You arrived at this template because you felt none of the other options
|
||||||
|
matched the kind of issue you'd like to report. Please use this opportunity to
|
||||||
|
tell us about your particular type of issue so we can try to accommodate
|
||||||
|
similar issues in the future.
|
||||||
|
|
||||||
|
PLEASE do note, if you're using this to report an issue already covered by the
|
||||||
|
existing template types, your issue may be closed as invalid. Our issue
|
||||||
|
templates contain fields that help us help you, and without that important
|
||||||
|
info, we might as well be ice-skating uphill, carrying a wooly mammoth.
|
||||||
|
-->
|
42
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/BUG.md
generated
vendored
Normal file
42
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/BUG.md
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
name: 🐛 Bug Report
|
||||||
|
about: Something went awry and you'd like to tell us about it.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Issues are so 🔥
|
||||||
|
|
||||||
|
If you remove or skip this template, you'll make the 🐼 sad and the mighty god
|
||||||
|
of Github will appear and pile-drive the close button from a great height
|
||||||
|
while making animal noises.
|
||||||
|
|
||||||
|
👉🏽 Need support, advice, or help? Don't open an issue!
|
||||||
|
Head to StackOverflow https://stackoverflow.com.
|
||||||
|
-->
|
||||||
|
|
||||||
|
* Device Name:
|
||||||
|
* Device Version:
|
||||||
|
* Browser Name:
|
||||||
|
* Browser Version:
|
||||||
|
* NoSleep.js Version:
|
||||||
|
|
||||||
|
### Expected Behavior
|
||||||
|
|
||||||
|
<!-- Remove this section if not reporting a bug or modification request. -->
|
||||||
|
|
||||||
|
### Actual Behavior
|
||||||
|
|
||||||
|
<!-- Remove this section if not reporting a bug or modification request. -->
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
```js
|
||||||
|
// reproducible code example, HEY YO remove this block if you don't need it
|
||||||
|
```
|
||||||
|
|
||||||
|
### How Do We Reproduce?
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Remove this section if not reporting a bug.
|
||||||
|
-->
|
30
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/DOCS.md
generated
vendored
Normal file
30
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/DOCS.md
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
name: 📚 Documentation
|
||||||
|
about: Are the docs lacking or missing something? Do they need some new 🔥 hotness? Tell us here.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Issues are so 🔥
|
||||||
|
|
||||||
|
If you remove or skip this template, you'll make the 🐼 sad and the mighty god
|
||||||
|
of Github will appear and pile-drive the close button from a great height
|
||||||
|
while making animal noises.
|
||||||
|
|
||||||
|
👉🏽 Need support, advice, or help? Don't open an issue!
|
||||||
|
Head to StackOverflow https://stackoverflow.com.
|
||||||
|
-->
|
||||||
|
|
||||||
|
Documentation Is:
|
||||||
|
|
||||||
|
<!-- Please place an x (no spaces!) in all [ ] that apply -->
|
||||||
|
|
||||||
|
- [ ] Missing
|
||||||
|
- [ ] Needed
|
||||||
|
- [ ] Confusing
|
||||||
|
- [ ] Not Sure?
|
||||||
|
|
||||||
|
### Please Explain in Detail...
|
||||||
|
|
||||||
|
|
||||||
|
### Your Proposal for Changes
|
28
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/FEATURE.md
generated
vendored
Normal file
28
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/FEATURE.md
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
name: ✨ Feature Request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Issues are so 🔥
|
||||||
|
|
||||||
|
If you remove or skip this template, you'll make the 🐼 sad and the mighty god
|
||||||
|
of Github will appear and pile-drive the close button from a great height
|
||||||
|
while making animal noises.
|
||||||
|
|
||||||
|
👉🏽 Need support, advice, or help? Don't open an issue!
|
||||||
|
Head to StackOverflow https://stackoverflow.com.
|
||||||
|
-->
|
||||||
|
|
||||||
|
* Device Name:
|
||||||
|
* Device Version:
|
||||||
|
* Browser Name:
|
||||||
|
* Browser Version:
|
||||||
|
* NoSleep.js Version:
|
||||||
|
|
||||||
|
### Feature Proposal
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Feature Use Case
|
32
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/MODIFICATION.md
generated
vendored
Normal file
32
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/MODIFICATION.md
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
name: 🔧 Modification Request
|
||||||
|
about: Would you like something work differently? Have an alternative approach? This is the template for you.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Issues are so 🔥
|
||||||
|
|
||||||
|
If you remove or skip this template, you'll make the 🐼 sad and the mighty god
|
||||||
|
of Github will appear and pile-drive the close button from a great height
|
||||||
|
while making animal noises.
|
||||||
|
|
||||||
|
👉🏽 Need support, advice, or help? Don't open an issue!
|
||||||
|
Head to StackOverflow https://stackoverflow.com.
|
||||||
|
-->
|
||||||
|
|
||||||
|
* Device Name:
|
||||||
|
* Device Version:
|
||||||
|
* Browser Name:
|
||||||
|
* Browser Version:
|
||||||
|
* NoSleep.js Version:
|
||||||
|
|
||||||
|
### Expected Behavior / Situation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Actual Behavior / Situation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Modification Proposal
|
8
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/SUPPORT.md
generated
vendored
Normal file
8
node_modules/nosleep.js/.github/ISSUE_TEMPLATE/SUPPORT.md
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
name: 🆘 Support, Help, and Advice
|
||||||
|
about: 👉🏽 Need support, help, or advice? Don't open an issue! Head to StackOverflow https://stackoverflow.com.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Hey there! If you need support, help, or advice then this is not the place to ask.
|
||||||
|
Please visit [StackOverflow](https://stackoverflow.com/questions/tagged/nosleep).
|
35
node_modules/nosleep.js/.github/PULL_REQUEST_TEMPLATE.md
generated
vendored
Normal file
35
node_modules/nosleep.js/.github/PULL_REQUEST_TEMPLATE.md
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<!--
|
||||||
|
HOLY CRAP a Pull Request. We ❤️ those!
|
||||||
|
|
||||||
|
If you remove or skip this template, you'll make the 🐼 sad and the mighty god
|
||||||
|
of Github will appear and pile-drive the close button from a great height
|
||||||
|
while making animal noises.
|
||||||
|
|
||||||
|
Please place an x (no spaces!) in all [ ] that apply
|
||||||
|
-->
|
||||||
|
|
||||||
|
This PR contains a:
|
||||||
|
|
||||||
|
- [ ] **bugfix**
|
||||||
|
- [ ] new **feature**
|
||||||
|
- [ ] **code refactor**
|
||||||
|
- [ ] **test update** <!-- if bug or feature is checked, this should be too -->
|
||||||
|
- [ ] **typo fix**
|
||||||
|
- [ ] **metadata update**
|
||||||
|
|
||||||
|
### Motivation / Use-Case
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please explain the motivation or use-case for your change.
|
||||||
|
What existing problem does the PR solve?
|
||||||
|
If this PR addresses an issue, please link to the issue.
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Breaking Changes
|
||||||
|
|
||||||
|
<!--
|
||||||
|
If this PR introduces a breaking change, please describe the impact and a
|
||||||
|
migration path for existing applications.
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Additional Info
|
1
node_modules/nosleep.js/.nvmrc
generated
vendored
Normal file
1
node_modules/nosleep.js/.nvmrc
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
14.3.0
|
22
node_modules/nosleep.js/LICENSE
generated
vendored
Normal file
22
node_modules/nosleep.js/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) Rich Tibbett
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
79
node_modules/nosleep.js/README.md
generated
vendored
Normal file
79
node_modules/nosleep.js/README.md
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
# NoSleep.js
|
||||||
|
|
||||||
|
Prevent display sleep and enable wake lock in all Android and iOS web browsers.
|
||||||
|
|
||||||
|
Check out the [live demo](https://richtr.github.io/NoSleep.js/example) in any Android or iOS web browser.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This library is available on [Bower](http://bower.io/) as **nosleep**.
|
||||||
|
|
||||||
|
`bower install nosleep`
|
||||||
|
|
||||||
|
This package is published to npm as **nosleep.js** and can be installed with:
|
||||||
|
|
||||||
|
`npm install nosleep.js`
|
||||||
|
|
||||||
|
Alternatively, you can manually add [NoSleep.js](https://github.com/richtr/NoSleep.js/blob/master/dist/NoSleep.js) to your project (or the [minified version](https://github.com/richtr/NoSleep.js/blob/master/dist/NoSleep.min.js)).
|
||||||
|
|
||||||
|
## Build from source
|
||||||
|
|
||||||
|
Install all development dependencies with:
|
||||||
|
|
||||||
|
`npm install`
|
||||||
|
|
||||||
|
To build this library run:
|
||||||
|
|
||||||
|
`npm run build`
|
||||||
|
|
||||||
|
A new build of [NoSleep.js](https://github.com/richtr/NoSleep.js/blob/master/dist/NoSleep.js) and [NoSleep.min.js](https://github.com/richtr/NoSleep.js/blob/master/dist/NoSleep.min.js) will now be available in the `/dist` directory.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Import ES6 module:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import NoSleep from 'nosleep.js';
|
||||||
|
```
|
||||||
|
|
||||||
|
Create a new NoSleep object and then enable or disable it when needed.
|
||||||
|
|
||||||
|
To create a new NoSleep object:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var noSleep = new NoSleep();
|
||||||
|
```
|
||||||
|
|
||||||
|
To enable wake lock:
|
||||||
|
|
||||||
|
**NOTE: This function call must be wrapped in a user input event handler e.g. a mouse or touch handler**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Enable wake lock.
|
||||||
|
// (must be wrapped in a user input event handler e.g. a mouse or touch handler)
|
||||||
|
document.addEventListener('click', function enableNoSleep() {
|
||||||
|
document.removeEventListener('click', enableNoSleep, false);
|
||||||
|
noSleep.enable();
|
||||||
|
}, false);
|
||||||
|
```
|
||||||
|
|
||||||
|
To disable wake lock:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Disable wake lock at some point in the future.
|
||||||
|
// (does not need to be wrapped in any user input event handler)
|
||||||
|
noSleep.disable();
|
||||||
|
```
|
||||||
|
|
||||||
|
See [example/index.html](https://github.com/richtr/NoSleep.js/blob/master/example/index.html) (and the [live demo](https://richtr.github.io/NoSleep.js/example)) for more information.
|
||||||
|
|
||||||
|
## Feedback
|
||||||
|
|
||||||
|
If you find any bugs or issues please report them on the [NoSleep.js Issue Tracker](https://github.com/richtr/NoSleep.js/issues).
|
||||||
|
|
||||||
|
If you would like to contribute to this project please consider [forking this repo](https://github.com/richtr/NoSleep.js/fork), making your changes and then creating a new [Pull Request](https://github.com/richtr/NoSleep.js/pulls) back to the main code repository.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT. Copyright (c) [Rich Tibbett](https://twitter.com/_richtr).
|
||||||
|
|
||||||
|
See the [LICENSE](https://github.com/richtr/NoSleep.js/blob/master/LICENSE) file.
|
20
node_modules/nosleep.js/bower.json
generated
vendored
Normal file
20
node_modules/nosleep.js/bower.json
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"name": "nosleep",
|
||||||
|
"title": "NoSleep.js",
|
||||||
|
"version": "0.12.0",
|
||||||
|
"description": "Prevent display sleep on all Android and iOS browsers",
|
||||||
|
"homepage": "https://github.com/richtr/NoSleep.js",
|
||||||
|
"authors": ["Rich Tibbett"],
|
||||||
|
"main": "src/index.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"ignore": [
|
||||||
|
"**/.*",
|
||||||
|
"**/*.md",
|
||||||
|
"**/*.html",
|
||||||
|
"/*.js",
|
||||||
|
"package.json",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components"
|
||||||
|
],
|
||||||
|
"keywords": ["nosleep", "wake lock", "wakelock", "screen", "display", "sleep"]
|
||||||
|
}
|
265
node_modules/nosleep.js/dist/NoSleep.js
generated
vendored
Normal file
265
node_modules/nosleep.js/dist/NoSleep.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/nosleep.js/dist/NoSleep.min.js
generated
vendored
Normal file
2
node_modules/nosleep.js/dist/NoSleep.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
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>
|
22
node_modules/nosleep.js/nosleep.d.ts
generated
vendored
Normal file
22
node_modules/nosleep.js/nosleep.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
declare namespace nosleep {
|
||||||
|
class NoSleep {
|
||||||
|
constructor();
|
||||||
|
|
||||||
|
get isEnabled(): boolean;
|
||||||
|
enable(): Promise<any>;
|
||||||
|
disable(): void;
|
||||||
|
_addSourceToVideo(
|
||||||
|
element: HTMLElement,
|
||||||
|
type: string,
|
||||||
|
dataURI: string
|
||||||
|
): void;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface Window {
|
||||||
|
NoSleep: typeof nosleep.NoSleep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default nosleep.NoSleep;
|
39
node_modules/nosleep.js/package.json
generated
vendored
Normal file
39
node_modules/nosleep.js/package.json
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"name": "nosleep.js",
|
||||||
|
"version": "0.12.0",
|
||||||
|
"author": "Rich Tibbett",
|
||||||
|
"license": "MIT",
|
||||||
|
"description": "Prevent display sleep and enable wake lock in any Android or iOS web browser",
|
||||||
|
"keywords": [
|
||||||
|
"nosleep",
|
||||||
|
"wake lock",
|
||||||
|
"wakelock",
|
||||||
|
"screen",
|
||||||
|
"display",
|
||||||
|
"sleep"
|
||||||
|
],
|
||||||
|
"main": "dist/NoSleep.min.js",
|
||||||
|
"module": "src/index.js",
|
||||||
|
"types": "nosleep.d.ts",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/richtr/NoSleep.js.git"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-core": "^6.26.3",
|
||||||
|
"babel-loader": "^7.1.5",
|
||||||
|
"babel-preset-env": "^1.7.0",
|
||||||
|
"prettier": "^2.0.5",
|
||||||
|
"terser-webpack-plugin": "^3.0.2",
|
||||||
|
"webpack": "^4.44.0",
|
||||||
|
"webpack-cli": "^3.3.11"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/richtr/NoSleep.js",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/richtr/NoSleep.js/issues"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint": "prettier --check src",
|
||||||
|
"build": "npm run lint && webpack"
|
||||||
|
}
|
||||||
|
}
|
143
node_modules/nosleep.js/src/index.js
generated
vendored
Normal file
143
node_modules/nosleep.js/src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
const { webm, mp4 } = require("./media.js");
|
||||||
|
|
||||||
|
// Detect iOS browsers < version 10
|
||||||
|
const oldIOS = () =>
|
||||||
|
typeof navigator !== "undefined" &&
|
||||||
|
parseFloat(
|
||||||
|
(
|
||||||
|
"" +
|
||||||
|
(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(
|
||||||
|
navigator.userAgent
|
||||||
|
) || [0, ""])[1]
|
||||||
|
)
|
||||||
|
.replace("undefined", "3_2")
|
||||||
|
.replace("_", ".")
|
||||||
|
.replace("_", "")
|
||||||
|
) < 10 &&
|
||||||
|
!window.MSStream;
|
||||||
|
|
||||||
|
// Detect native Wake Lock API support
|
||||||
|
const nativeWakeLock = () => "wakeLock" in navigator;
|
||||||
|
|
||||||
|
class NoSleep {
|
||||||
|
constructor() {
|
||||||
|
this.enabled = false;
|
||||||
|
if (nativeWakeLock()) {
|
||||||
|
this._wakeLock = null;
|
||||||
|
const handleVisibilityChange = () => {
|
||||||
|
if (this._wakeLock !== null && document.visibilityState === "visible") {
|
||||||
|
this.enable();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener("visibilitychange", handleVisibilityChange);
|
||||||
|
document.addEventListener("fullscreenchange", handleVisibilityChange);
|
||||||
|
} else if (oldIOS()) {
|
||||||
|
this.noSleepTimer = null;
|
||||||
|
} else {
|
||||||
|
// Set up no sleep video element
|
||||||
|
this.noSleepVideo = document.createElement("video");
|
||||||
|
|
||||||
|
this.noSleepVideo.setAttribute("title", "No Sleep");
|
||||||
|
this.noSleepVideo.setAttribute("playsinline", "");
|
||||||
|
|
||||||
|
this._addSourceToVideo(this.noSleepVideo, "webm", webm);
|
||||||
|
this._addSourceToVideo(this.noSleepVideo, "mp4", mp4);
|
||||||
|
|
||||||
|
this.noSleepVideo.addEventListener("loadedmetadata", () => {
|
||||||
|
if (this.noSleepVideo.duration <= 1) {
|
||||||
|
// webm source
|
||||||
|
this.noSleepVideo.setAttribute("loop", "");
|
||||||
|
} else {
|
||||||
|
// mp4 source
|
||||||
|
this.noSleepVideo.addEventListener("timeupdate", () => {
|
||||||
|
if (this.noSleepVideo.currentTime > 0.5) {
|
||||||
|
this.noSleepVideo.currentTime = Math.random();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_addSourceToVideo(element, type, dataURI) {
|
||||||
|
var source = document.createElement("source");
|
||||||
|
source.src = dataURI;
|
||||||
|
source.type = `video/${type}`;
|
||||||
|
element.appendChild(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
get isEnabled() {
|
||||||
|
return this.enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
enable() {
|
||||||
|
if (nativeWakeLock()) {
|
||||||
|
return navigator.wakeLock
|
||||||
|
.request("screen")
|
||||||
|
.then((wakeLock) => {
|
||||||
|
this._wakeLock = wakeLock;
|
||||||
|
this.enabled = true;
|
||||||
|
console.log("Wake Lock active.");
|
||||||
|
this._wakeLock.addEventListener("release", () => {
|
||||||
|
// ToDo: Potentially emit an event for the page to observe since
|
||||||
|
// Wake Lock releases happen when page visibility changes.
|
||||||
|
// (https://web.dev/wakelock/#wake-lock-lifecycle)
|
||||||
|
console.log("Wake Lock released.");
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.enabled = false;
|
||||||
|
console.error(`${err.name}, ${err.message}`);
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
} else if (oldIOS()) {
|
||||||
|
this.disable();
|
||||||
|
console.warn(`
|
||||||
|
NoSleep enabled for older iOS devices. This can interrupt
|
||||||
|
active or long-running network requests from completing successfully.
|
||||||
|
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
|
||||||
|
`);
|
||||||
|
this.noSleepTimer = window.setInterval(() => {
|
||||||
|
if (!document.hidden) {
|
||||||
|
window.location.href = window.location.href.split("#")[0];
|
||||||
|
window.setTimeout(window.stop, 0);
|
||||||
|
}
|
||||||
|
}, 15000);
|
||||||
|
this.enabled = true;
|
||||||
|
return Promise.resolve();
|
||||||
|
} else {
|
||||||
|
let playPromise = this.noSleepVideo.play();
|
||||||
|
return playPromise
|
||||||
|
.then((res) => {
|
||||||
|
this.enabled = true;
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.enabled = false;
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
disable() {
|
||||||
|
if (nativeWakeLock()) {
|
||||||
|
if (this._wakeLock) {
|
||||||
|
this._wakeLock.release();
|
||||||
|
}
|
||||||
|
this._wakeLock = null;
|
||||||
|
} else if (oldIOS()) {
|
||||||
|
if (this.noSleepTimer) {
|
||||||
|
console.warn(`
|
||||||
|
NoSleep now disabled for older iOS devices.
|
||||||
|
`);
|
||||||
|
window.clearInterval(this.noSleepTimer);
|
||||||
|
this.noSleepTimer = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.noSleepVideo.pause();
|
||||||
|
}
|
||||||
|
this.enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = NoSleep;
|
6
node_modules/nosleep.js/src/media.js
generated
vendored
Normal file
6
node_modules/nosleep.js/src/media.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
48
node_modules/nosleep.js/webpack.config.js
generated
vendored
Normal file
48
node_modules/nosleep.js/webpack.config.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
const webpack = require("webpack");
|
||||||
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
|
|
||||||
|
const { version, author, license } = require("./package.json");
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
mode: "production",
|
||||||
|
entry: {
|
||||||
|
NoSleep: `${__dirname}/src/index.js`,
|
||||||
|
"NoSleep.min": `${__dirname}/src/index.js`,
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: `${__dirname}/dist`,
|
||||||
|
filename: "[name].js",
|
||||||
|
library: "NoSleep",
|
||||||
|
libraryTarget: "umd",
|
||||||
|
globalObject: "this",
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
exclude: /(node_modules|bower_components)/,
|
||||||
|
use: {
|
||||||
|
loader: "babel-loader",
|
||||||
|
options: {
|
||||||
|
presets: ["env"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: true,
|
||||||
|
minimizer: [
|
||||||
|
new TerserPlugin({
|
||||||
|
test: /\.min\.js(\?.*)?$/i,
|
||||||
|
extractComments: false,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
new webpack.BannerPlugin({
|
||||||
|
banner: `[name].js v${version} - git.io/vfn01 - ${author} - ${license} license`,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
};
|
11
package-lock.json
generated
11
package-lock.json
generated
|
@ -23,6 +23,7 @@
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"keycode": "^2.2.1",
|
"keycode": "^2.2.1",
|
||||||
"moment-timezone": "^0.5.34",
|
"moment-timezone": "^0.5.34",
|
||||||
|
"nosleep.js": "^0.12.0",
|
||||||
"pouchdb": "^7.3.0",
|
"pouchdb": "^7.3.0",
|
||||||
"sweetalert": "^2.1.2",
|
"sweetalert": "^2.1.2",
|
||||||
"tinymce": "^6.1.2",
|
"tinymce": "^6.1.2",
|
||||||
|
@ -851,6 +852,11 @@
|
||||||
"node-gyp-build-test": "build-test.js"
|
"node-gyp-build-test": "build-test.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nosleep.js": {
|
||||||
|
"version": "0.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.12.0.tgz",
|
||||||
|
"integrity": "sha512-9d1HbpKLh3sdWlhXMhU6MMH+wQzKkrgfRkYV0EBdvt99YJfj0ilCJrWRDYG2130Tm4GXbEoTCx5b34JSaP+HhA=="
|
||||||
|
},
|
||||||
"node_modules/pkcs7": {
|
"node_modules/pkcs7": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/pkcs7/-/pkcs7-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/pkcs7/-/pkcs7-1.0.4.tgz",
|
||||||
|
@ -1857,6 +1863,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz",
|
||||||
"integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ=="
|
"integrity": "sha512-dSq1xmcPDKPZ2EED2S6zw/b9NKsqzXRE6dVr8TVQnI3FJOTteUMuqF3Qqs6LZg+mLGYJWqQzMbIjMtJqTv87nQ=="
|
||||||
},
|
},
|
||||||
|
"nosleep.js": {
|
||||||
|
"version": "0.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.12.0.tgz",
|
||||||
|
"integrity": "sha512-9d1HbpKLh3sdWlhXMhU6MMH+wQzKkrgfRkYV0EBdvt99YJfj0ilCJrWRDYG2130Tm4GXbEoTCx5b34JSaP+HhA=="
|
||||||
|
},
|
||||||
"pkcs7": {
|
"pkcs7": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/pkcs7/-/pkcs7-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/pkcs7/-/pkcs7-1.0.4.tgz",
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
"js-cookie": "^3.0.1",
|
"js-cookie": "^3.0.1",
|
||||||
"keycode": "^2.2.1",
|
"keycode": "^2.2.1",
|
||||||
"moment-timezone": "^0.5.34",
|
"moment-timezone": "^0.5.34",
|
||||||
|
"nosleep.js": "^0.12.0",
|
||||||
"pouchdb": "^7.3.0",
|
"pouchdb": "^7.3.0",
|
||||||
"sweetalert": "^2.1.2",
|
"sweetalert": "^2.1.2",
|
||||||
"tinymce": "^6.1.2",
|
"tinymce": "^6.1.2",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue