blinker / firefox.plugin / data / settings / settings.js @ 76dd22bd
History | View | Annotate | Download (15.434 KB)
1 |
/*
|
---|---|
2 |
* Copyright 2015 Thies Pfeiffer and Dimitri Heil and Kevin Taron
|
3 |
* Blinker is distributed under the terms of the GNU General Public License
|
4 |
*
|
5 |
* This file is part of Blinker.
|
6 |
*
|
7 |
* Blinker is free software: you can redistribute it and/or modify
|
8 |
* it under the terms of the GNU General Public License as published by
|
9 |
* the Free Software Foundation, either version 3 of the License, or
|
10 |
* (at your option) any later version.
|
11 |
*
|
12 |
* Blinker is distributed in the hope that it will be useful,
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
* GNU General Public License for more details.
|
16 |
*
|
17 |
* You should have received a copy of the GNU General Public License
|
18 |
* along with Blinker. If not, see <http://www.gnu.org/licenses/>.
|
19 |
*/
|
20 |
|
21 |
self.port.on('blickBrowserSettings', function(settings){ blickBrowserSettings = eval(settings); populatePanel(); }); |
22 |
self.port.on('loadSettings', loadSettings);
|
23 |
|
24 |
var blickBrowserSettings;
|
25 |
|
26 |
function loadSettings(){ |
27 |
console.log("getSettings");
|
28 |
self.port.emit("getAllSettings","null"); |
29 |
} |
30 |
|
31 |
function populatePanel(){ |
32 |
//loadSettings();
|
33 |
|
34 |
$("#main").empty(); |
35 |
console.log("populating panel....");
|
36 |
$("#main").append("<strong>EyeTracker is: "+blickBrowserSettings['eyeTracker']+"</strong><br />"); |
37 |
|
38 |
$("#main").append("<input type='checkbox' id='privacyMode'><label for='privacyMode'>Privacy Mode</label><br />"); |
39 |
if (blickBrowserSettings['privacyMode'] == true){ |
40 |
$("#privacyMode").prop('checked', true); |
41 |
} |
42 |
$("#privacyMode").click(function() { blickBrowserSettings['privacyMode'] = $('#privacyMode').is(':checked'); console.log("privacyMode: "+blickBrowserSettings['privacyMode']); writeSettings(); }); |
43 |
|
44 |
|
45 |
$("#main").append("<input type='checkbox' id='gazeEmulation'><label for='gazeEmulation'>GAZE Emulation</label><br />"); |
46 |
if (blickBrowserSettings['gazeEmulation'] == true){ |
47 |
$("#gazeEmulation").prop('checked', true); |
48 |
} |
49 |
$("#gazeEmulation").click(function() { blickBrowserSettings['gazeEmulation'] = $('#gazeEmulation').is(':checked'); console.log("gazeEmulation: "+blickBrowserSettings['gazeEmulation']); writeSettings(); }); |
50 |
|
51 |
|
52 |
$("#main").append("<input type='checkbox' id='gazeCrosshair'><label for='gazeCrosshair'>Show Cross</label><br />"); |
53 |
if (blickBrowserSettings['gazeCrosshair'] == true){ |
54 |
$("#gazeCrosshair").prop('checked', true); |
55 |
} |
56 |
$("#gazeCrosshair").click(function() { blickBrowserSettings['gazeCrosshair'] = $('#gazeCrosshair').is(':checked'); console.log("gazeCrosshair: "+blickBrowserSettings['gazeCrosshair']); writeSettings(); }); |
57 |
|
58 |
|
59 |
$("#main").append("<input type='checkbox' id='debugInformation'><label for='debugInformation'>Append status-info to mouse</label><br />"); |
60 |
if (blickBrowserSettings['debugInformation'] == true){ |
61 |
$("#debugInformation").prop('checked', true); |
62 |
} |
63 |
$("#debugInformation").click(function(){ blickBrowserSettings['debugInformation'] = $('#debugInformation').is(':checked'); console.log("debugInformation: "+blickBrowserSettings['debugInformation']); writeSettings(); }); |
64 |
|
65 |
$("#main").append("<hr>"); |
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
$("#main").append("<input type='checkbox' id='scrollAtBorders'><label for='scrollAtBorders'>Scroll at borders</label><br />"); |
76 |
if (blickBrowserSettings['scrollAtBorders'] == true){ |
77 |
$("#scrollAtBorders").prop('checked', true); |
78 |
} |
79 |
$("#scrollAtBorders").click(function(){ blickBrowserSettings['scrollAtBorders'] = $('#scrollAtBorders').is(':checked'); console.log("scrollAtBorders: "+blickBrowserSettings['scrollAtBorders']); writeSettings(); }); |
80 |
|
81 |
|
82 |
$("#main").append("Scrolling threshold <input type='number' id='scrollThreshold' value='"+blickBrowserSettings['scrollThreshold']+"'><br />"); |
83 |
$("#scrollThreshold").css("width","50px"); |
84 |
$("#scrollThreshold").change(function(){ blickBrowserSettings['scrollThreshold'] = parseInt($('#scrollThreshold').val()); console.log("scrollThreshold: "+blickBrowserSettings['scrollThreshold']); writeSettings(); }); |
85 |
|
86 |
$("#main").append("Scrolling speed <input type='number' id='scrollSpeed' value='"+blickBrowserSettings['scrollSpeed']+"'><br />"); |
87 |
$("#scrollSpeed").css("width","50px"); |
88 |
$("#scrollSpeed").change(function(){ blickBrowserSettings['scrollSpeed'] = parseInt($('#scrollSpeed').val()); console.log("scrollSpeed: "+blickBrowserSettings['scrollSpeed']); writeSettings(); }); |
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
$("#main").append("<hr>"); |
96 |
|
97 |
$("#main").append("<input type='checkbox' id='explicitMode'><label for='explicitMode'>Explicit Mode</label><br />"); |
98 |
if (blickBrowserSettings['explicitMode'] == true){ |
99 |
$("#explicitMode").prop('checked', true); |
100 |
} |
101 |
$("#explicitMode").click(function(){ blickBrowserSettings['explicitMode'] = $('#explicitMode').is(':checked'); console.log("explicitMode: "+blickBrowserSettings['explicitMode']); writeSettings(); }); |
102 |
|
103 |
|
104 |
|
105 |
$("#main").append("<input type='checkbox' id='autoReadingMode'><label for='autoReadingMode'>Automatic Reading Mode</label><br />"); |
106 |
if (blickBrowserSettings['autoReadingMode'] == true){ |
107 |
$("#autoReadingMode").prop('checked', true); |
108 |
} |
109 |
$("#autoReadingMode").click(function(){ blickBrowserSettings['autoReadingMode'] = $('#autoReadingMode').is(':checked'); console.log("autoReadingMode: "+blickBrowserSettings['autoReadingMode']); writeSettings(); }); |
110 |
|
111 |
$("#main").append("Fixation Duration <input type='number' id='autoReadingModeThreshold' value='"+blickBrowserSettings['autoReadingModeThreshold']+"'><br />"); |
112 |
$("#autoReadingModeThreshold").css("width","50px"); |
113 |
$("#autoReadingModeThreshold").change(function(){ blickBrowserSettings['autoReadingModeThreshold'] = parseInt($('#autoReadingModeThreshold').val()); console.log("autoReadingModeThreshold: "+blickBrowserSettings['autoReadingModeThreshold']); writeSettings(); }); |
114 |
|
115 |
$("#main").append("max. GazeMoving Radius <input type='number' id='autoReadingModeDistance' value='"+blickBrowserSettings['autoReadingModeDistance']+"'><br />"); |
116 |
$("#autoReadingModeDistance").css("width","50px"); |
117 |
$("#autoReadingModeDistance").change(function(){ blickBrowserSettings['autoReadingModeDistance'] = parseInt($('#autoReadingModeDistance').val()); console.log("autoReadingModeDistance: "+blickBrowserSettings['autoReadingModeDistance']); writeSettings(); }); |
118 |
|
119 |
|
120 |
|
121 |
$("#main").append("<hr>"); |
122 |
|
123 |
$("#main").append( 'Top Edge: <select id="topEdge"><option '+( (blickBrowserSettings.topEdge == "initiateGesture") ? "selected" : "")+' value="initiateGesture">Initiate gaze gesture</option><option '+( (blickBrowserSettings.topEdge == "toggleScrolling") ? "selected" : "")+' value="toggleScrolling">Toggle scrolling</option><option '+( (blickBrowserSettings.topEdge == "showControlBar") ? "selected" : "")+' value="showControlBar">Show control bar</option><option '+(blickBrowserSettings.topEdge == "clearDivs" ? "selected":"")+' value="clearDivs">Clear gaze elements</option><option '+(blickBrowserSettings.topEdge == "toggleReadingMode" ? "selected":"")+' value="toggleReadingMode">Toggle reading mode</option><option '+(blickBrowserSettings.topEdge == "none" ? "selected":"")+' value="none">None</option></select><br />'); |
124 |
$("#topEdge").change(function(){ blickBrowserSettings.topEdge = $('#topEdge').val(); console.log("topEdge: "+blickBrowserSettings.topEdge); writeSettings(); }); |
125 |
|
126 |
$("#main").append("Top Edge Tolerance <input type='number' id='topEdgeTolerance' value='"+blickBrowserSettings['topEdgeTolerance']+"'><br />"); |
127 |
$("#topEdgeTolerance").css("width","50px"); |
128 |
$("#topEdgeTolerance").change(function(){ blickBrowserSettings['topEdgeTolerance'] = parseInt($('#topEdgeTolerance').val()); console.log("topEdgeTolerance: "+blickBrowserSettings['topEdgeTolerance']); writeSettings(); }); |
129 |
|
130 |
$("#main").append("<hr>"); |
131 |
|
132 |
$("#main").append( 'Left Edge: <select id="leftEdge"><option '+( (blickBrowserSettings.leftEdge == "initiateGesture") ? "selected" : "")+' value="initiateGesture">Initiate gaze gesture</option><option '+( (blickBrowserSettings.leftEdge == "toggleScrolling") ? "selected" : "")+' value="toggleScrolling">Toggle scrolling</option><option '+( (blickBrowserSettings.leftEdge == "showControlBar") ? "selected" : "")+' value="showControlBar">Show control bar</option><option '+(blickBrowserSettings.leftEdge == "clearDivs" ? "selected":"")+' value="clearDivs">Clear gaze elements</option><option '+(blickBrowserSettings.leftEdge == "toggleReadingMode" ? "selected":"")+' value="toggleReadingMode">Toggle reading mode</option><option '+(blickBrowserSettings.leftEdge == "none" ? "selected":"")+' value="none">None</option></select><br />'); |
133 |
$("#leftEdge").change(function(){ blickBrowserSettings.leftEdge = $('#leftEdge').val(); console.log("leftEdge: "+blickBrowserSettings.leftEdge); writeSettings(); }); |
134 |
|
135 |
$("#main").append("Left Edge Tolerance <input type='number' id='leftEdgeTolerance' value='"+blickBrowserSettings['leftEdgeTolerance']+"'><br />"); |
136 |
$("#leftEdgeTolerance").css("width","50px"); |
137 |
$("#leftEdgeTolerance").change(function(){ blickBrowserSettings['leftEdgeTolerance'] = parseInt($('#leftEdgeTolerance').val()); console.log("leftEdgeTolerance: "+blickBrowserSettings['leftEdgeTolerance']); writeSettings(); }); |
138 |
|
139 |
$("#main").append("<hr>"); |
140 |
|
141 |
$("#main").append( 'Right Edge: <select id="rightEdge"><option '+( (blickBrowserSettings.rightEdge == "initiateGesture") ? "selected" : "")+' value="initiateGesture">Initiate gaze gesture</option><option '+( (blickBrowserSettings.rightEdge == "toggleScrolling") ? "selected" : "")+' value="toggleScrolling">Toggle scrolling</option><option '+( (blickBrowserSettings.rightEdge == "showControlBar") ? "selected" : "")+' value="showControlBar">Show control bar</option><option '+(blickBrowserSettings.rightEdge == "clearDivs" ? "selected":"")+' value="clearDivs">Clear gaze elements</option><option '+(blickBrowserSettings.rightEdge == "toggleReadingMode" ? "selected":"")+' value="toggleReadingMode">Toggle reading mode</option><option '+(blickBrowserSettings.rightEdge == "none" ? "selected":"")+' value="none">None</option></select><br />'); |
142 |
$("#rightEdge").change(function(){ blickBrowserSettings.rightEdge = $('#rightEdge').val(); console.log("rightEdge: "+blickBrowserSettings.rightEdge); writeSettings(); }); |
143 |
|
144 |
$("#main").append("Right Edge Tolerance <input type='number' id='rightEdgeTolerance' value='"+blickBrowserSettings['rightEdgeTolerance']+"'><br />"); |
145 |
$("#rightEdgeTolerance").css("width","50px"); |
146 |
$("#rightEdgeTolerance").change(function(){ blickBrowserSettings['rightEdgeTolerance'] = parseInt($('#rightEdgeTolerance').val()); console.log("rightEdgeTolerance: "+blickBrowserSettings['rightEdgeTolerance']); writeSettings(); }); |
147 |
|
148 |
$("#main").append("<hr>"); |
149 |
|
150 |
$("#main").append( 'Selection Mode: <select id="selectionMode"><option '+( (blickBrowserSettings.selectionMode == "isFixated") ? "selected" : "")+' value="isFixated">Fixation</option><option '+(blickBrowserSettings.selectionMode == "gazeEnter" ? "selected":"")+' value="gazeEnter">Gaze</option></select><br />'); |
151 |
$("#selectionMode").change(function(){ blickBrowserSettings.selectionMode = $('#selectionMode').val(); console.log("selectionMode: "+blickBrowserSettings.selectionMode); writeSettings(); }); |
152 |
|
153 |
|
154 |
$("#main").append("Gaze Confirmation Steps <input type='number' id='gazeConfirmationSteps' value='"+blickBrowserSettings['gazeConfirmationSteps']+"'><br />"); |
155 |
$("#gazeConfirmationSteps").css("width","50px"); |
156 |
$("#gazeConfirmationSteps").change(function(){ blickBrowserSettings['gazeConfirmationSteps'] = parseInt($('#gazeConfirmationSteps').val()); console.log("gazeConfirmationSteps: "+blickBrowserSettings['gazeConfirmationSteps']); writeSettings(); }); |
157 |
|
158 |
|
159 |
$("#main").append("Gaze Confirmation Size <input type='number' id='gazeConfirmationSize' value='"+blickBrowserSettings['gazeConfirmationSize']+"'><br />"); |
160 |
$("#gazeConfirmationSize").css("width","50px"); |
161 |
$("#gazeConfirmationSize").change(function(){ blickBrowserSettings['gazeConfirmationSize'] = parseInt($('#gazeConfirmationSize').val()); console.log("gazeConfirmationSize: "+blickBrowserSettings['gazeConfirmationSize']); writeSettings(); }); |
162 |
|
163 |
$("#main").append("<input type='checkbox' id='showLeftGazeLinkOption'><label for='showLeftGazeLinkOption'>Show left gaze link option Mode</label><br />"); |
164 |
if (blickBrowserSettings.showLeftGazeLinkOption === true){ |
165 |
$("#showLeftGazeLinkOption").prop('checked', true); |
166 |
} |
167 |
$("#showLeftGazeLinkOption").click(function(){ blickBrowserSettings['showLeftGazeLinkOption'] = $('#showLeftGazeLinkOption').is(':checked'); console.log("showLeftGazeLinkOption: "+blickBrowserSettings['showLeftGazeLinkOption']); writeSettings(); }); |
168 |
|
169 |
$("#main").append("Fixation Threshold <input type='number' id='fixationThreshold' value='"+blickBrowserSettings['fixationThreshold']+"'><br />"); |
170 |
$("#fixationThreshold").css("width","50px"); |
171 |
$("#fixationThreshold").change(function(){ blickBrowserSettings['fixationThreshold'] = parseInt($('#fixationThreshold').val()); console.log("fixationThreshold: "+blickBrowserSettings['fixationThreshold']); writeSettings(); }); |
172 |
|
173 |
|
174 |
$("#main").append("Saccade length <input type='number' id='saccadeLength' value='"+blickBrowserSettings['saccadeLength']+"'><br />"); |
175 |
$("#saccadeLength").css("width","50px"); |
176 |
$("#saccadeLength").change(function(){ blickBrowserSettings['saccadeLength'] = parseInt($('#saccadeLength').val()); console.log("saccadeLength: "+blickBrowserSettings['saccadeLength']); writeSettings(); }); |
177 |
|
178 |
saccadeLength |
179 |
$("#main").append("<hr>"); |
180 |
|
181 |
$("#main").append("Gaze Smoothing History <input type='number' id='gazeSmoothingHistory' value='"+blickBrowserSettings['gazeSmoothingHistory']+"'><br />"); |
182 |
$("#gazeSmoothingHistory").css("width","50px"); |
183 |
$("#gazeSmoothingHistory").change(function(){ blickBrowserSettings['gazeSmoothingHistory'] = parseInt($('#gazeSmoothingHistory').val()); console.log("gazeSmoothingHistory: "+blickBrowserSettings['gazeSmoothingHistory']); writeSettings(); }); |
184 |
|
185 |
|
186 |
$("#main").append("<button id='checkCalibration'>Check Calibration</button><br />"); |
187 |
$("#checkCalibration").click(toggleCheckCalibration); |
188 |
|
189 |
$("#main").append("Gaze Offset X <input type='number' id='gazeOffsetX' value='"+blickBrowserSettings['gazeOffsetX']+"'><br />"); |
190 |
$("#gazeOffsetX").css("width","50px"); |
191 |
$("#gazeOffsetX").change(function(){ blickBrowserSettings['gazeOffsetX'] = parseInt($('#gazeOffsetX').val()); console.log("gazeOffsetX: "+blickBrowserSettings['gazeOffsetX']); writeSettings(); }); |
192 |
|
193 |
$("#main").append("Gaze Offset Y <input type='number' id='gazeOffsetY' value='"+blickBrowserSettings['gazeOffsetY']+"'><br />"); |
194 |
$("#gazeOffsetY").css("width","50px"); |
195 |
$("#gazeOffsetY").change(function(){ blickBrowserSettings['gazeOffsetY'] = parseInt($('#gazeOffsetY').val()); console.log("gazeOffsetY: "+blickBrowserSettings['gazeOffsetY']); writeSettings(); }); |
196 |
|
197 |
if (blickBrowserSettings['eyeTracker'] == "eyetribe"){ |
198 |
$("#main").append("<button id='calibrate'>Calibrate</button><br />"); |
199 |
$("#calibrate").click(toggleCalibrate); |
200 |
} |
201 |
|
202 |
$("#main").append("<button id='tutorial'>Tutorial</button><br />"); |
203 |
$("#tutorial").click(openTutorial); |
204 |
|
205 |
$("#main").append("<button id='gazeElements'>HTML-Element Settings</button><br />"); |
206 |
$("#gazeElements").click(openHTMLSettings); |
207 |
|
208 |
blickBrowserSettings.showLeftGazeLinkOption |
209 |
|
210 |
|
211 |
} |
212 |
|
213 |
function writeSettings(){ |
214 |
self.port.emit('writeSettings',blickBrowserSettings);
|
215 |
} |
216 |
|
217 |
function toggleCheckCalibration(){ |
218 |
self.port.emit('toggleCheckCalibration','noop'); |
219 |
} |
220 |
|
221 |
function toggleCalibrate(){ |
222 |
self.port.emit('toggleCalibrate','noop'); |
223 |
} |
224 |
|
225 |
function openTutorial() { |
226 |
self.port.emit('openTutorial','noop'); |
227 |
} |
228 |
|
229 |
function openHTMLSettings() { |
230 |
self.port.emit('openHTMLSettings', 'noop'); |
231 |
} |