Statistics
| Branch: | Revision:

blinker / firefox.plugin / data / settings.js @ e75d6b65

History | View | Annotate | Download (14.397 KB)

1 a03cd52e Thies Pfeiffer
/*
2
 * Copyright 2015 Thies Pfeiffer and Dimitri Heil
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
46
47
48
        $("#main").append("<input type='checkbox' id='gazeCrosshair'><label for='gazeCrosshair'>Show Cross</label><br />");
49
        if (blickBrowserSettings['gazeCrosshair'] == true){
50
                $("#gazeCrosshair").prop('checked', true);
51
        }        
52
        $("#gazeCrosshair").click(function() { blickBrowserSettings['gazeCrosshair'] = $('#gazeCrosshair').is(':checked'); console.log("gazeCrosshair: "+blickBrowserSettings['gazeCrosshair']); writeSettings(); });
53
54
55
        $("#main").append("<input type='checkbox' id='debugInformation'><label for='debugInformation'>Append status-info to mouse</label><br />");
56
        if (blickBrowserSettings['debugInformation'] == true){
57
                $("#debugInformation").prop('checked', true);
58
        }
59
        $("#debugInformation").click(function(){ blickBrowserSettings['debugInformation'] = $('#debugInformation').is(':checked'); console.log("debugInformation: "+blickBrowserSettings['debugInformation']); writeSettings(); });
60
61
        $("#main").append("<hr>");
62
63
64
65
66
67
68
69
70
71
        $("#main").append("<input type='checkbox' id='scrollAtBorders'><label for='scrollAtBorders'>Scroll at borders</label><br />");
72
        if (blickBrowserSettings['scrollAtBorders'] == true){
73
                $("#scrollAtBorders").prop('checked', true);
74
        }
75
        $("#scrollAtBorders").click(function(){ blickBrowserSettings['scrollAtBorders'] = $('#scrollAtBorders').is(':checked'); console.log("scrollAtBorders: "+blickBrowserSettings['scrollAtBorders']); writeSettings(); });
76
77
78
        $("#main").append("Scrolling threshold <input type='number' id='scrollThreshold' value='"+blickBrowserSettings['scrollThreshold']+"'><br />");
79
        $("#scrollThreshold").css("width","50px");
80
        $("#scrollThreshold").change(function(){ blickBrowserSettings['scrollThreshold'] = parseInt($('#scrollThreshold').val()); console.log("scrollThreshold: "+blickBrowserSettings['scrollThreshold']); writeSettings(); });        
81
82
        $("#main").append("Scrolling speed <input type='number' id='scrollSpeed' value='"+blickBrowserSettings['scrollSpeed']+"'><br />");
83
        $("#scrollSpeed").css("width","50px");
84
        $("#scrollSpeed").change(function(){ blickBrowserSettings['scrollSpeed'] = parseInt($('#scrollSpeed').val()); console.log("scrollSpeed: "+blickBrowserSettings['scrollSpeed']); writeSettings(); });
85
86
87
88
89
90
91
        $("#main").append("<hr>");
92
93
        $("#main").append("<input type='checkbox' id='explicitMode'><label for='explicitMode'>Explicit Mode</label><br />");
94
        if (blickBrowserSettings['explicitMode'] == true){
95
                $("#explicitMode").prop('checked', true);
96
        }
97
        $("#explicitMode").click(function(){ blickBrowserSettings['explicitMode'] = $('#explicitMode').is(':checked'); console.log("explicitMode: "+blickBrowserSettings['explicitMode']); writeSettings(); });
98
99
100
101
        $("#main").append("<input type='checkbox' id='autoReadingMode'><label for='autoReadingMode'>Automatic Reading Mode</label><br />");
102
        if (blickBrowserSettings['autoReadingMode'] == true){
103
                $("#autoReadingMode").prop('checked', true);
104
        }
105
        $("#autoReadingMode").click(function(){ blickBrowserSettings['autoReadingMode'] = $('#autoReadingMode').is(':checked'); console.log("autoReadingMode: "+blickBrowserSettings['autoReadingMode']); writeSettings(); });
106
107
        $("#main").append("Fixation Duration <input type='number' id='autoReadingModeThreshold' value='"+blickBrowserSettings['autoReadingModeThreshold']+"'><br />");
108
        $("#autoReadingModeThreshold").css("width","50px");
109
        $("#autoReadingModeThreshold").change(function(){ blickBrowserSettings['autoReadingModeThreshold'] = parseInt($('#autoReadingModeThreshold').val()); console.log("autoReadingModeThreshold: "+blickBrowserSettings['autoReadingModeThreshold']); writeSettings(); });
110
111
        $("#main").append("max. GazeMoving Radius <input type='number' id='autoReadingModeDistance' value='"+blickBrowserSettings['autoReadingModeDistance']+"'><br />");
112
        $("#autoReadingModeDistance").css("width","50px");
113
        $("#autoReadingModeDistance").change(function(){ blickBrowserSettings['autoReadingModeDistance'] = parseInt($('#autoReadingModeDistance').val()); console.log("autoReadingModeDistance: "+blickBrowserSettings['autoReadingModeDistance']); writeSettings(); });
114
115
116
117
        $("#main").append("<hr>");        
118
119
        $("#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 />');
120
        $("#topEdge").change(function(){ blickBrowserSettings.topEdge = $('#topEdge').val(); console.log("topEdge: "+blickBrowserSettings.topEdge); writeSettings(); });
121
122
        $("#main").append("Top Edge Tolerance <input type='number' id='topEdgeTolerance' value='"+blickBrowserSettings['topEdgeTolerance']+"'><br />");
123
        $("#topEdgeTolerance").css("width","50px");
124
        $("#topEdgeTolerance").change(function(){ blickBrowserSettings['topEdgeTolerance'] = parseInt($('#topEdgeTolerance').val()); console.log("topEdgeTolerance: "+blickBrowserSettings['topEdgeTolerance']); writeSettings(); });
125
126
        $("#main").append("<hr>");
127
128
        $("#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 />');
129
        $("#leftEdge").change(function(){ blickBrowserSettings.leftEdge = $('#leftEdge').val(); console.log("leftEdge: "+blickBrowserSettings.leftEdge); writeSettings(); });
130
131
        $("#main").append("Left Edge Tolerance <input type='number' id='leftEdgeTolerance' value='"+blickBrowserSettings['leftEdgeTolerance']+"'><br />");
132
        $("#leftEdgeTolerance").css("width","50px");
133
        $("#leftEdgeTolerance").change(function(){ blickBrowserSettings['leftEdgeTolerance'] = parseInt($('#leftEdgeTolerance').val()); console.log("leftEdgeTolerance: "+blickBrowserSettings['leftEdgeTolerance']); writeSettings(); });
134
135
        $("#main").append("<hr>");
136
137
        $("#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 />');
138
        $("#rightEdge").change(function(){ blickBrowserSettings.rightEdge = $('#rightEdge').val(); console.log("rightEdge: "+blickBrowserSettings.rightEdge); writeSettings(); });
139
140
        $("#main").append("Right Edge Tolerance <input type='number' id='rightEdgeTolerance' value='"+blickBrowserSettings['rightEdgeTolerance']+"'><br />");
141
        $("#rightEdgeTolerance").css("width","50px");
142
        $("#rightEdgeTolerance").change(function(){ blickBrowserSettings['rightEdgeTolerance'] = parseInt($('#rightEdgeTolerance').val()); console.log("rightEdgeTolerance: "+blickBrowserSettings['rightEdgeTolerance']); writeSettings(); });
143
144
        $("#main").append("<hr>");
145
146
        $("#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 />');
147
        $("#selectionMode").change(function(){ blickBrowserSettings.selectionMode = $('#selectionMode').val(); console.log("selectionMode: "+blickBrowserSettings.selectionMode); writeSettings(); });
148
149
150
        $("#main").append("Gaze Confirmation Steps <input type='number' id='gazeConfirmationSteps' value='"+blickBrowserSettings['gazeConfirmationSteps']+"'><br />");
151
        $("#gazeConfirmationSteps").css("width","50px");
152
        $("#gazeConfirmationSteps").change(function(){ blickBrowserSettings['gazeConfirmationSteps'] = parseInt($('#gazeConfirmationSteps').val()); console.log("gazeConfirmationSteps: "+blickBrowserSettings['gazeConfirmationSteps']); writeSettings(); });
153
154
155
        $("#main").append("Gaze Confirmation Size <input type='number' id='gazeConfirmationSize' value='"+blickBrowserSettings['gazeConfirmationSize']+"'><br />");
156
        $("#gazeConfirmationSize").css("width","50px");
157
        $("#gazeConfirmationSize").change(function(){ blickBrowserSettings['gazeConfirmationSize'] = parseInt($('#gazeConfirmationSize').val()); console.log("gazeConfirmationSize: "+blickBrowserSettings['gazeConfirmationSize']); writeSettings(); });
158
159
        $("#main").append("<input type='checkbox' id='showLeftGazeLinkOption'><label for='showLeftGazeLinkOption'>Show left gaze link option Mode</label><br />");
160
        if (blickBrowserSettings.showLeftGazeLinkOption === true){
161
                $("#showLeftGazeLinkOption").prop('checked', true);
162
        }
163
        $("#showLeftGazeLinkOption").click(function(){ blickBrowserSettings['showLeftGazeLinkOption'] = $('#showLeftGazeLinkOption').is(':checked'); console.log("showLeftGazeLinkOption: "+blickBrowserSettings['showLeftGazeLinkOption']); writeSettings(); });
164
165
        $("#main").append("Fixation Threshold <input type='number' id='fixationThreshold' value='"+blickBrowserSettings['fixationThreshold']+"'><br />");
166
        $("#fixationThreshold").css("width","50px");
167
        $("#fixationThreshold").change(function(){ blickBrowserSettings['fixationThreshold'] = parseInt($('#fixationThreshold').val()); console.log("fixationThreshold: "+blickBrowserSettings['fixationThreshold']); writeSettings(); });
168
169
170
        $("#main").append("Saccade length <input type='number' id='saccadeLength' value='"+blickBrowserSettings['saccadeLength']+"'><br />");
171
        $("#saccadeLength").css("width","50px");
172
        $("#saccadeLength").change(function(){ blickBrowserSettings['saccadeLength'] = parseInt($('#saccadeLength').val()); console.log("saccadeLength: "+blickBrowserSettings['saccadeLength']); writeSettings(); });
173
        
174
        saccadeLength
175
        $("#main").append("<hr>");
176
177
        $("#main").append("Gaze Smoothing History <input type='number' id='gazeSmoothingHistory' value='"+blickBrowserSettings['gazeSmoothingHistory']+"'><br />");
178
        $("#gazeSmoothingHistory").css("width","50px");
179
        $("#gazeSmoothingHistory").change(function(){ blickBrowserSettings['gazeSmoothingHistory'] = parseInt($('#gazeSmoothingHistory').val()); console.log("gazeSmoothingHistory: "+blickBrowserSettings['gazeSmoothingHistory']); writeSettings(); });
180
181
182
        $("#main").append("<button id='checkCalibration'>Check Calibration</button><br />");
183
        $("#checkCalibration").click(toggleCheckCalibration);
184
        
185
        $("#main").append("Gaze Offset X <input type='number' id='gazeOffsetX' value='"+blickBrowserSettings['gazeOffsetX']+"'><br />");
186
        $("#gazeOffsetX").css("width","50px");
187
        $("#gazeOffsetX").change(function(){ blickBrowserSettings['gazeOffsetX'] = parseInt($('#gazeOffsetX').val()); console.log("gazeOffsetX: "+blickBrowserSettings['gazeOffsetX']); writeSettings(); });
188
189
        $("#main").append("Gaze Offset Y <input type='number' id='gazeOffsetY' value='"+blickBrowserSettings['gazeOffsetY']+"'><br />");
190
        $("#gazeOffsetY").css("width","50px");
191
        $("#gazeOffsetY").change(function(){ blickBrowserSettings['gazeOffsetY'] = parseInt($('#gazeOffsetY').val()); console.log("gazeOffsetY: "+blickBrowserSettings['gazeOffsetY']); writeSettings(); });
192
193
        if (blickBrowserSettings['eyeTracker'] == "eyetribe"){
194
                $("#main").append("<button id='calibrate'>Calibrate</button><br />");
195
                $("#calibrate").click(toggleCalibrate);
196
        }
197
198
blickBrowserSettings.showLeftGazeLinkOption
199
200
201
}
202
203
function writeSettings(){
204
        self.port.emit('writeSettings',blickBrowserSettings);        
205
}
206
207
function toggleCheckCalibration(){
208
        self.port.emit('toggleCheckCalibration','noop');        
209
}
210
211
function toggleCalibrate(){
212
        self.port.emit('toggleCalibrate','noop');        
213
}