Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marcy Sutton
committed
Oct 15, 2019
0 parents
commit b309f1c
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# No Mouse Days | ||
|
||
Ever wanted a package that disables the mouse cursor one day a week so you can test keyboard accessibility as a team? No? Well here you go anyway. | ||
|
||
## How to use | ||
|
||
1. Install the package | ||
|
||
```sh | ||
npm install no-mouse-days | ||
``` | ||
|
||
2. Import the package into your project for all times | ||
|
||
```js | ||
import "no-mouse-days" | ||
``` | ||
|
||
3. Import and conditionally apply it in development, if you want | ||
|
||
```js | ||
if (process.env.NODE_ENV === 'development') { | ||
import("no-mouse-days") | ||
.then((data) => { | ||
// no-op | ||
}) | ||
} | ||
``` | ||
|
||
4. Or apply it one day of the week, e.g. on Mondays | ||
|
||
```js | ||
let date = new Date() | ||
let dayOfWeek = date.getDay() | ||
|
||
if (dayOfWeek === 1) { | ||
import("no-mouse-days") | ||
.then((data) => { | ||
// no-op | ||
}) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* Set the style */ | ||
var styles = '* { cursor: none !important; }'; | ||
|
||
/* Function to add style element */ | ||
function addStyle(styles) { | ||
/* Create style document */ | ||
var css = document.createElement('style'); | ||
css.type = 'text/css'; | ||
|
||
if (css.styleSheet) { | ||
css.styleSheet.cssText = styles; | ||
} else { | ||
css.appendChild(document.createTextNode(styles)); | ||
} | ||
|
||
/* Append style to the tag name */ | ||
document.getElementsByTagName("head")[0].appendChild(css); | ||
} | ||
|
||
/* Function call */ | ||
window.onload = function() { | ||
addStyle(styles) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "no-mouse-days", | ||
"version": "0.0.1", | ||
"description": "A package to disable the mouse cursor", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "Marcy Sutton <marcy@gatsbyjs.com> (https://www.marcysutton.com)", | ||
"license": "ISC" | ||
} |