-
Notifications
You must be signed in to change notification settings - Fork 3
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
c8e2b4c
commit b19a83f
Showing
11 changed files
with
63 additions
and
8 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
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
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
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
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,11 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<textarea id="input" rows="6" cols="30"></textarea> | ||
<br> | ||
<button type="button" id="add">Add</button> | ||
<div id="error" style="color: red"></div> | ||
|
||
<script src="popup.js"></script> | ||
</body> | ||
</html> |
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,28 @@ | ||
// Same thing but synchronous because we love javascript so much. | ||
function quickAdd(text) { | ||
const endpoint = 'https://timkovi.ch/rip_quick_add_api'; | ||
|
||
let url = null; | ||
fetch(endpoint, { | ||
method: 'POST', | ||
headers: { | ||
'Accept': 'application/json', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({text}) | ||
}) | ||
.then(x => x.json()) | ||
.then(data => { | ||
const url = data.url; | ||
if (url) { | ||
chrome.tabs.create({url}); | ||
} else { | ||
document.getElementById('error').textContent = 'Could not parse time data from input'; | ||
} | ||
}); | ||
} | ||
|
||
document.getElementById('add').addEventListener('click', (e) => { | ||
const input = document.getElementById('input').value; | ||
quickAdd(input); | ||
}); |
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 |
---|---|---|
|
@@ -7,6 +7,6 @@ | |
}, | ||
"type": "module", | ||
"scripts": { | ||
"start": "node app.js" | ||
"start": "node server.js" | ||
} | ||
} |
File renamed without changes.