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
1 parent
9db0599
commit 65564d9
Showing
9 changed files
with
94 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 @@ | ||
node_modules |
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,2 @@ | ||
{ | ||
} |
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,10 @@ | ||
{ | ||
"globals": { | ||
"Fetch": false, | ||
"StorageGetKey": false, | ||
"mturkDate": false, | ||
|
||
"HTML": false, | ||
"ENCODE": false | ||
} | ||
} |
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,9 @@ | ||
// eslint-disable-next-line no-unused-vars | ||
function Fetch(input, init, timeout) { | ||
return Promise.race([ | ||
fetch(input, init), | ||
new Promise((resolve, reject) => | ||
setTimeout(() => reject(new Error(`Fetch timeout.`)), timeout) | ||
) | ||
]); | ||
} |
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,15 @@ | ||
// eslint-disable-next-line no-unused-vars | ||
function MturkDate(offset = 0) { | ||
const date = new Date(Date.now() - offset); | ||
|
||
const toPST = date.toLocaleString(`en-US`, { | ||
timeZone: `America/Los_Angeles` | ||
}); | ||
|
||
const isPST = new Date(toPST); | ||
const yyyy = isPST.getFullYear(); | ||
const mm = `0${isPST.getMonth()}`.slice(-2); | ||
const dd = `0${isPST.getDate()}`.slice(-2); | ||
|
||
return `${yyyy}${mm}${dd}`; | ||
} |
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,19 @@ | ||
function StorageGet(keys) { | ||
return new Promise(resolve => chrome.storage.local.get(keys, resolve)); | ||
} | ||
|
||
async function StorageGetKey(key) { | ||
const storage = await StorageGet(key); | ||
return storage[key]; | ||
} | ||
|
||
// eslint-disable-next-line no-unused-vars | ||
function Enabled(name) { | ||
return new Promise(async resolve => { | ||
const options = await StorageGetKey(`options`); | ||
|
||
if (options[name]) resolve(); | ||
else | ||
window.console.warn(`"${name}" did not resolve because it is disabled.`); | ||
}); | ||
} |
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,14 @@ | ||
{ | ||
"globals": { | ||
"StorageGetKey": false, | ||
|
||
"HTML": false, | ||
|
||
"ReactDOM": false, | ||
"ReactProps": false, | ||
|
||
"Enabled": false, | ||
|
||
"mturkDate": false | ||
} | ||
} |
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 @@ | ||
chrome.runtime.sendMessage({ loggedIn: true }); |
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 @@ | ||
{ | ||
"name": "mturk-suite", | ||
"version": "1.0.0", | ||
"devDependencies": { | ||
"eslint": "^4.9.0", | ||
"eslint-config-airbnb": "^16.1.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-jsx-a11y": "^6.0.2", | ||
"eslint-plugin-react": "^7.4.0" | ||
}, | ||
"eslintConfig": { | ||
"extends": ["airbnb-base", "prettier"], | ||
"env": { | ||
"browser": true, | ||
"webextensions": true | ||
}, | ||
"rules": { | ||
"camelcase": 0, | ||
"linebreak-style": 0 | ||
} | ||
} | ||
} |