-
Notifications
You must be signed in to change notification settings - Fork 0
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
a594d8b
commit f9c7d58
Showing
6 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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,27 @@ | ||
{ | ||
"manifest_version": 2, | ||
|
||
"name": "Dyslexia Color Filter", | ||
"description": "Adds a coloured filtered to webpages to aid dislexics.", | ||
"version": "1.0", | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"<all_urls>" | ||
], | ||
"js": [ | ||
"overlay.js" | ||
], | ||
"run_at": "document_end" | ||
} | ||
], | ||
"permissions": [ | ||
"<all_urls>", | ||
"storage" | ||
], | ||
|
||
"browser_action": { | ||
"default_icon": "icon.png", | ||
"default_popup": "popup.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,34 @@ | ||
|
||
// Use of this source code is governed by a GNU-style license that can be | ||
// found in the LICENSE file. | ||
|
||
var overlay = document.createElement("div"); | ||
chrome.storage.sync.get('color', function(data){ | ||
var color = 'lime'; | ||
if ('color' in data) { | ||
color = data.color; | ||
} | ||
var style_string = 'height: 100%;' + | ||
'width: 100%;' + | ||
'background-color:' + color + ';' + | ||
'z-index: 2000000000;' + | ||
'position: fixed;' + | ||
'left: 0;' + | ||
'top: 0;' + | ||
'opacity:0.2;' + | ||
'pointer-events: none;'; | ||
overlay.setAttribute('style', style_string); | ||
}); | ||
|
||
overlay.setAttribute("id", "dyslexia_filter_overlay"); | ||
document.body.appendChild(overlay); | ||
|
||
chrome.storage.onChanged.addListener( function(changes, namespace) { | ||
for (key in changes) { | ||
var storageChange = changes[key]; | ||
if (key === 'color') { | ||
var overlay = document.getElementById('dyslexia_filter_overlay'); | ||
overlay.style.background = storageChange.newValue; | ||
} | ||
} | ||
}); |
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,63 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Dyslexia Filter</title> | ||
<style> | ||
@font-face { | ||
font-family: 'Open Sans'; | ||
font-style: normal; | ||
font-weight: 400; | ||
src: url('../fonts/Open Sans.woff') format('woff'); | ||
} | ||
|
||
body { | ||
min-width: 330px; | ||
overflow-x: hidden; | ||
font-family: 'Open Sans'; | ||
} | ||
|
||
.button { | ||
height: 40px; | ||
width: 60px; | ||
border: 1px solid black; | ||
background-color: transparent; | ||
float: left; | ||
margin: 10px; | ||
} | ||
|
||
.button:hover { | ||
cursor: pointer; | ||
} | ||
|
||
.button_inner { | ||
height: 36px; | ||
width: 56px; | ||
margin: 2px; | ||
} | ||
|
||
#blank_button { | ||
width: 72px; | ||
height: 1px; | ||
border-bottom: | ||
1px solid red; | ||
-webkit-transform: translateY(18px) translateX(-6px) rotate(34deg); | ||
} | ||
</style> | ||
<script src="popup.js"></script> | ||
</head> | ||
<body> | ||
<p style="clear:both">Presets:</p> | ||
<div data-color="transparent" class="button"> | ||
<div id="blank_button"></div> | ||
</div> | ||
<div data-color="lime" class="button"> | ||
<div class="button_inner" style="background-color:lime;"></div> | ||
</div> | ||
<div data-color="blue" class="button"> | ||
<div class="button_inner" style="background-color:blue;"></div> | ||
</div> | ||
<div data-color="purple" class="button"> | ||
<div class="button_inner" style="background-color:purple;"></div> | ||
</div> | ||
</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,18 @@ | ||
|
||
// Use of this source code is governed by a GNU-style license that can be | ||
// found in the LICENSE file. | ||
|
||
function addButtonListener() { | ||
var color = this.getAttribute('data-color'); | ||
chrome.storage.sync.set({'color': color}, function() { | ||
// Notify that we saved. | ||
console.log('Color updated to: ' + color); | ||
}); | ||
} | ||
|
||
document.addEventListener('DOMContentLoaded', function() { | ||
var buttons = document.getElementsByClassName('button'); | ||
for (var i = 0; i < buttons.length; i++) { | ||
buttons[i].addEventListener('click', addButtonListener); | ||
} | ||
}); |