-
Notifications
You must be signed in to change notification settings - Fork 0
/
summary.js
258 lines (210 loc) · 6.38 KB
/
summary.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
/*
* @Author : Abdullah Ali, Tejas Bhalerao
* @Date : 2017-05-29 00:42:30
* @Description : This script is used to display the summary of the notification metrics subscribed by the user
* @Last Modified by : Tejas
* @Last Modified time: 2017-05-29 01:16:08
* @Contact : @xyleques, xyleques@me.com; tejasbhalerao01@gmail.com
* @version : 2
*/
//scr
var scrFlag;
var ctFlag;
var ptFlag;
var scrText = "Slip/Click";
scrText = scrText.bold();
scrText += " ratio is ";
var ctText = "Click Timing";
ctText = ctText.bold();
ctText += " is ";
var ptText = "Pause Timing";
ptText = ptText.bold();
ptText += " is ";
var counter = 0;
chrome.storage.sync.get(null, function(items) {
scrFlag = items.scrFlag;
ctFlag = items.ctFlag;
ptFlag = items.ptFlag;
if(!scrFlag && !ctFlag && !ptFlag) {
console.log("No subscribed notifications.");
}
else {
if(scrFlag) {
counter++;
var scrCardDiv = document.createElement("DIV");
scrCardDiv.className = "summary-card";
//counter
var scrCounterDiv = document.createElement("DIV");
scrCounterDiv.className = "counter";
scrCounterDiv.innerHTML = counter;
var scrSummaryDiv = document.createElement("DIV");
scrSummaryDiv.className = "summary";
//start creating the summary message string
var summary = scrText;
//relation
if(items.scrRel === "gt") {
summary += "greater than ";
} else if(items.scrRel === "et") {
summary += "equal to ";
} else {
summary += "less than ";
}
var scrRelValue = items.scrValue.toString().bold();
summary += scrRelValue + " using a ";
//viz type
if(items.scrViz === "scrBar") {
var scrVizValue = "Bar";
summary += scrVizValue.bold();
} else if(items.scrViz === "scrBarPlus") {
var scrVizValue = "Bar+";
summary += scrVizValue.bold();
} else if(items.scrViz === "scrDialog"){
var scrVizValue = "Dialog Box";
summary += scrVizValue.bold();
}
summary += " having ";
//position
summary += "position as ";
if(items.scrPos === "posTop") {
var scrPosValue = "Top";
summary += scrPosValue.bold();
} else {
var scrPosValue = "Bottom";
summary += scrPosValue.bold();
}
summary += ", ";
//color
var scrBarColorValue = items.scrBarColor.toString();
scrBarColorValue.fontcolor(scrBarColorValue);
summary += "color as " + scrBarColorValue.bold();
summary += " and ";
//thickness
summary += "thickness as ";
var scrThickValue = items.scrThick;
scrThickValue = scrThickValue.bold();
summary += scrThickValue + ".";
scrSummaryDiv.innerHTML = summary;
scrCardDiv.appendChild(scrCounterDiv);
scrCardDiv.appendChild(scrSummaryDiv);
document.getElementById("card-container").appendChild(scrCardDiv);
}
if(ctFlag) {
counter++;
var ctCardDiv = document.createElement("DIV");
ctCardDiv.className = "summary-card";
//counter
var ctCounterDiv = document.createElement("DIV");
ctCounterDiv.className = "counter";
ctCounterDiv.innerHTML = counter;
var ctSummaryDiv = document.createElement("DIV");
ctSummaryDiv.className = "summary";
//start creating the summary message string
var summary = ctText;
//relation
if(items.ctRel === "gt") {
summary += "greater than ";
} else if(items.ctRel === "et") {
summary += "equal to ";
} else {
summary += "less than ";
}
var ctRelValue = items.ctValue.toString().bold();
summary += ctRelValue + " using a ";
//viz type
if(items.ctViz === "ctBar") {
var ctVizValue = "Bar";
summary += ctVizValue.bold();
} else if(items.ctViz === "ctBarPlus") {
var ctVizValue = "Bar+";
summary += ctVizValue.bold();
} else if(items.ctViz === "ctDialog"){
var ctVizValue = "Dialog Box";
summary += ctVizValue.bold();
}
summary += " having ";
//position
summary += "position as ";
if(items.ctPos === "ctPosTop") {
var ctPosValue = "Top";
summary += ctPosValue.bold();
} else {
var ctPosValue = "Bottom";
summary += ctPosValue.bold();
}
summary += ", ";
//color
var ctBarColorValue = items.ctBarColor.toString();
ctBarColorValue.fontcolor(ctBarColorValue);
summary += "color as " + ctBarColorValue.bold();
summary += " and ";
//thickness
summary += "thickness as ";
var ctThickValue = items.ctThick;
ctThickValue = ctThickValue.bold();
summary += ctThickValue + ".";
ctSummaryDiv.innerHTML = summary;
ctCardDiv.appendChild(ctCounterDiv);
ctCardDiv.appendChild(ctSummaryDiv);
document.getElementById("card-container").appendChild(ctCardDiv);
}
if(ptFlag) {
counter++;
var ptCardDiv = document.createElement("DIV");
ptCardDiv.className = "summary-card";
//counter
var ptCounterDiv = document.createElement("DIV");
ptCounterDiv.className = "counter";
ptCounterDiv.innerHTML = counter;
var ptSummaryDiv = document.createElement("DIV");
ptSummaryDiv.className = "summary";
//start creating the summary message string
var summary = ptText;
//relation
if(items.ptRel === "gt") {
summary += "greater than ";
} else if(items.ptRel === "et") {
summary += "equal to ";
} else {
summary += "less than ";
}
var ptRelValue = items.ptValue.toString().bold();
summary += ptRelValue + " using a ";
//viz type
if(items.ptViz === "ptBar") {
var ptVizValue = "Bar";
summary += ptVizValue.bold();
} else if(items.ptViz === "ptBarPlus") {
var ptVizValue = "Bar+";
summary += ptVizValue.bold();
} else if(items.ptViz === "ptDialog"){
var ptVizValue = "Dialog Box";
summary += ptVizValue.bold();
}
summary += " having ";
//position
summary += "position as ";
if(items.ptPos === "ptPosTop") {
var ptPosValue = "Top";
summary += ptPosValue.bold();
} else {
var ptPosValue = "Bottom";
summary += ptPosValue.bold();
}
summary += ", ";
//color
var ptBarColorValue = items.ptBarColor.toString();
ptBarColorValue.fontcolor(ptBarColorValue);
summary += "color as " + ptBarColorValue.bold();
summary += " and ";
//thickness
summary += "thickness as ";
var ptThickValue = items.ptThick;
ptThickValue = ptThickValue.bold();
summary += ptThickValue + ".";
ptSummaryDiv.innerHTML = summary;
ptCardDiv.appendChild(ptCounterDiv);
ptCardDiv.appendChild(ptSummaryDiv);
document.getElementById("card-container").appendChild(ptCardDiv);
}
}
});