Skip to content

Commit

Permalink
version 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcy Sutton committed Oct 15, 2019
0 parents commit b309f1c
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
@@ -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
})
}
```
23 changes: 23 additions & 0 deletions index.js
@@ -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)
}
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions package.json
@@ -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"
}

0 comments on commit b309f1c

Please sign in to comment.