Skip to content

Commit

Permalink
Version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiuionescu committed Aug 4, 2019
1 parent 7caa14d commit 58b2af1
Show file tree
Hide file tree
Showing 15 changed files with 3,327 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"env": { "es6": true },
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
},
"rules": {
"semi": ["error", "always"],
"quotes": ["error"]
}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
tests/js
.DS_Store
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# chrome-extension
# chrome-extension

Chrome extention for leveraging text predictions based on machine learning models trained via typelike.me
1 change: 1 addition & 0 deletions dist/css/dropdown.min.css

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

5 changes: 5 additions & 0 deletions dist/js/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
chrome.runtime.onInstalled.addListener(function() {
chrome.storage.local.set({active: 1}, function() {
console.log('Now Active');
});
});
1,013 changes: 1,013 additions & 0 deletions dist/js/content.js

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions dist/js/options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
function refresh() {
chrome.storage.local.get(['active', 'attachInput', 'attachTextarea', 'key'], function (result) {
document.getElementById('active').checked = result.active;
document.getElementById('attach-to-input').checked = result.attachInput;
document.getElementById('attach-to-textarea').checked = result.attachTextarea;
document.getElementById('key').value = result.key;
});
}
refresh();

document.getElementById('active').addEventListener('change', function(){
chrome.storage.local.set({active: document.getElementById('active').checked}, function() {
refresh();
});
});
document.getElementById('attach-to-input').addEventListener('change', function(){
chrome.storage.local.set({attachInput: document.getElementById('attach-to-input').checked}, function() {
refresh();
});
});
document.getElementById('attach-to-textarea').addEventListener('change', function(){
chrome.storage.local.set({attachTextarea: document.getElementById('attach-to-textarea').checked}, function() {
refresh();
});
});
document.getElementById('key').addEventListener('blur', function(){
chrome.storage.local.set({key: document.getElementById('key').value}, function() {
refresh();
});
});
50 changes: 50 additions & 0 deletions dist/options.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous"
/>
</head>
<body>
<div id="buttonDiv"></div>
<div>
<form>
<div class="form-check">
<input
type="checkbox"
id="active"
name="active"
class="form-check-input"
/>
<label for="active" class="form-check-label">Active</label>
</div>
<div class="form-check">
<input
type="checkbox"
id="attach-to-input"
name="attach-to-input"
class="form-check-input"
/>
<label for="attach-to-input" class="form-check-label">Attach to input elements</label>
</div>
<div class="form-check">
<input
type="checkbox"
id="attach-to-textarea"
name="attach-to-textarea"
class="form-check-input"
/>
<label for="attach-to-textarea" class="form-check-label">Attach to textarea elements</label>
</div>
<div class="form-group">
<label for="key">Model Key</label>
<input type="text" id="key" name="key" class="form-control" />
</div>
</form>
</div>
<script src="/dist/js/options.js"></script>
</body>
</html>
Binary file added favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "TypeLikeMe Typing Assistant",
"version": "0.1.0",
"description": "Chrome extention for leveraging text predictions based on machine learning models trained via typelike.me.",
"manifest_version": 2,
"permissions": ["storage", "activeTab"],
"background": {
"scripts": ["dist/js/background.js"],
"persistent": false
},
"options_page": "dist/options.html",
"page_action": {
"default_icon": {
"32": "favicon.png"
}
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["dist/js/content.js"],
"css": ["dist/css/dropdown.min.css"]
}
],
"icons": {
"32": "favicon.png"
}
}
Loading

0 comments on commit 58b2af1

Please sign in to comment.