-
Notifications
You must be signed in to change notification settings - Fork 1
/
background.js
671 lines (600 loc) · 43 KB
/
background.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
/* POSSEDEX
VERSION 1 / MARS 2017
VERSION 2 / JANVIER 2018
REMERCIEMENT A L'EQUIPE LES DECODEURS DU MONDE
REMERCIEMENT AUX INSOUMIS QUI SE RECONNAITRONT
.y.
-dMm.
.mMMMd.
.dMMMMMd. .:+oyyso-
`hMMMMMMMd` -odNMMMMMMMNy` `..
sMMMm:dMMMddNMMMMmyoomMMMh `.-/+oydmmN:
:NMMN/ .mMMMMMNd+-` -NMMMyydmNNNMMMMMMMd.
hMMMy -mMMMN: sMMMMMMMMNNmhhNMMMo
-mMMM- -mMMMy` -NMMMy+/-.`` /NMMN.
/NMMM` -mMMMy` `hMMM+ sMMMh
-mMMMo` :mMMMs` sMMMd .NMMN/
+NMMNy` :NMMNs /MMMm` +MMMd.
:dMMMd: :NMMMo` `NMMN- `dMMMo
.yMMMN+ :NMMNo NMMN/ /NMMM.
`oNMMNy. /NMMN+ dMMMo yMMMh
:mMMMd- /NMMN+ yMMMs `NMMN/
`-://ohhhhy+////ymNMN/.-shhds:--+mmmd.
`/osoo+++++++++++oosshdsssoooooooooosss+/-`
`+so/:::::::::::::::/osss+:::::::::::://+os+-`
-ss/:----------------/ss+:--------------::+ss+-.```
.ss+:::::::--::::::::+sso::---------------::+osoooo-
`+sso+++///::::///+++oosso+//:::::::--------:::/+ss-
`/ss+/::::::::::::::::::+ssssoooooo+:------------/ss-
.os+:-------------------:oso-....os+-------------/ss-
`+so::----------:::::://+ss+` +so:------------/ss-
.+so+////////:::::////+++os+. -ss/------------/ss-
`-oso//:::::------------:os+ `/so/:----------/ss-
`oso:-----------------::oso `+so/:---------/ss-
:ss+:::::::::::::::://+oss/. ``/so+:--------/ss-
-+osoooooo++///::::::::/+so- -.`:oso/::-----/ss-
.-:::oso:-------------:os+` o+ `:oso+/::::/ss-
/so/:------------:os+` /Ms. `-+ysssoooss-
`+so+/:::::::::/+oso. +MMd- .hNmmh----`
`:+oooossssooooo+:` yMMMy` -MMMN/
`..:dmmm/...` :NMMM: sMMMm`
:MMMm. yMMMh .dMMMs
yMMMy ``.:+yMMMN: :NMMN:
`mMMM/ ``-+shmMMMMMMNNy sMMMm`
/NMMN-:ohmMMMMNNmdyo+/-- .mMMMo
sMMMMmMMMMNmyo/.` `.:/+ossodMMMN:
.mMMMMMNmy+.` `-+ymNMMMMMMMMMMMMd`
:MMMMNs:` ``./oymNMMMMNdhyssyhmMMMMo
yMMMNyoooyhdNNMMMMNMMMMo` `dMMMd`
-dNMMMMMMMMMNNNdy+:oMMMN: `:hMMMN:
`:+syyyyso/:.` yMMMm` `/dMMMMd:
.dMMMhomMMMNh/
-NMMMMMMNy-
+NMMMms.
sMmo`
`/`
*/
var browser = browser || chrome;
var _debug = 0; // 0=quiet, 1=verbose, 2=more verbose, 3= very very verbose, 4=even more. 5 very very verbose
if (_debug) {
console && console.info("DEBUG LEVEL", _debug);
}
/***** constants and variables *****/
let col_nom = 0;
let col_desc = 1;
let col_slug = 2;
let col_classement_possedex = 3;
let col_updated = 4;
let col_pub = 5;
let col_subventions = 6;
let col_sources = 7;
let col_proprietaire1 = 8;
let col_fortune1 = 9;
let col_marque1 = 10;
let col_influence1 = 11;
let col_proprietaire2 = 12;
let col_fortune2 = 13;
let col_marque2 = 14;
let col_influence2 = 15;
let col_proprietaire3 = 16;
let col_fortune3 = 17;
let col_marque3 = 18;
let col_influence3 = 19;
let messages = {
inconnu : "non classé",
capital : "Ce média dépend d'intérêts industriels, financiers, ou de groupe de presse.",
etat : "Ce média dépend d'un ou plusieurs états",
independant : "Ce média est indépendant vis à vis d'intérêts industriels, financiers, groupe de presse ou étatique.",
rien : "rien"
};
let icones = {
inconnu : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJN AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAA CXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4gEDDyoQwQ0NBgAACBlJREFUWMOtl1tsHOUVx38z sxevb3uz19ndrO34kkAM9sYmJCGhiEoJpVQxNKlAeQHRF0IfmgpRcZHoGyAeivpWBCoV7UPDA0lV 2hADIpAoIY3xZR+IL7G9ruPN2rve2bVnb/bOfH1wvPWytpOHHmmkmfPd/uf8z3fOGWl0dFSwhciy zKVLl7BarezduxfDMACQJAlJkhDif8vXv9+tmLYalCQJTdM4e/YT6uvr2bNnDyaTCSEEqVSKTCaN w+Ekn89jNpuxWq0oivL/AyDLMkNDQ4RCIWpqapmcnMBud9DXd56LF78BJF544SSRyCyalqatrY3d u3djsViKQO7kFWkrCgzD4O233yIcnkKSJGw2G9lsFl3XCQaDfP311xw92svDDz9MKrXI0tIS4+Oj 7Ny5i+bmHdjtdmpqarYEYdrq8KGhQQYHB3j++V/icDh4/fXXOHz4MG+88TsaG5s4derXXLp0EU3T mJiYYGEhTjQa5eWXf8vVq1cxDIOHHjqA3799UxDyZtzPzc3xxRdfkMvl6OoK8sQTP+Oee+7B5XLT 2NiEoih0dXURiUTwer28+uqrnDz5InV1dbhcLhYXU0Sjt/j888+5cePG5jT/UCGEIBQKoWkagUAA IQT5fJ66ujqOH/8FX375JaHQMABNTU3YbDaOHHmMAwceYnFxEafTiS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FWHRkYXRlOm1v ZGlmeQAyMDE4LTAxLTAzVDE2OjQwOjQ1KzAxOjAwr7D+yAAAAABJRU5ErkJggg==',
independant : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJN AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAA CXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4gEDDyoQwQ0NBgAACBlJREFUWMOtl1tsHOUVx38z sxevb3uz19ndrO34kkAM9sYmJCGhiEoJpVQxNKlAeQHRF0IfmgpRcZHoGyAeivpWBCoV7UPDA0lV 2hADIpAoIY3xZR+IL7G9ruPN2rve2bVnb/bOfH1wvPWytpOHHmmkmfPd/uf8z3fOGWl0dFSwhciy zKVLl7BarezduxfDMACQJAlJkhDif8vXv9+tmLYalCQJTdM4e/YT6uvr2bNnDyaTCSEEqVSKTCaN w+Ekn89jNpuxWq0oivL/AyDLMkNDQ4RCIWpqapmcnMBud9DXd56LF78BJF544SSRyCyalqatrY3d u3djsViKQO7kFWkrCgzD4O233yIcnkKSJGw2G9lsFl3XCQaDfP311xw92svDDz9MKrXI0tIS4+Oj 7Ny5i+bmHdjtdmpqarYEYdrq8KGhQQYHB3j++V/icDh4/fXXOHz4MG+88TsaG5s4derXXLp0EU3T mJiYYGEhTjQa5eWXf8vVq1cxDIOHHjqA3799UxDyZtzPzc3xxRdfkMvl6OoK8sQTP+Oee+7B5XLT 2NiEoih0dXURiUTwer28+uqrnDz5InV1dbhcLhYXU0Sjt/j888+5cePG5jT/UCGEIBQKoWkagUAA IQT5fJ66ujqOH/8FX375JaHQMABNTU3YbDaOHHmMAwceYnFxEafTiSwr5HI5ZFlG0zQuXvyGcDiM JElbA5AkiXA4zLffXmFwcIDu7h58Pj8fffRnUqkUR4/24nDYOX36NAAejweAWGwegJGREQKBRrLZ DLquF/dMp9Nc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VDE2OjQwOjQ1KzAxOjAwr7D+yAAAAABJRU5ErkJggg==',
rien : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJN AAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAA CXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH4gEDDyoQwQ0NBgAACBlJREFUWMOtl1tsHOUVx38z sxevb3uz19ndrO34kkAM9sYmJCGhiEoJpVQxNKlAeQHRF0IfmgpRcZHoGyAeivpWBCoV7UPDA0lV 2hADIpAoIY3xZR+IL7G9ruPN2rve2bVnb/bOfH1wvPWytpOHHmmkmfPd/uf8z3fOGWl0dFSwhciy zKVLl7BarezduxfDMACQJAlJkhDif8vXv9+tmLYalCQJTdM4e/YT6uvr2bNnDyaTCSEEqVSKTCaN w+Ekn89jNpuxWq0oivL/AyDLMkNDQ4RCIWpqapmcnMBud9DXd56LF78BJF544SSRyCyalqatrY3d u3djsViKQO7kFWkrCgzD4O233yIcnkKSJGw2G9lsFl3XCQaDfP311xw92svDDz9MKrXI0tIS4+Oj 7Ny5i+bmHdjtdmpqarYEYdrq8KGhQQYHB3j++V/icDh4/fXXOHz4MG+88TsaG5s4derXXLp0EU3T mJiYYGEhTjQa5eWXf8vVq1cxDIOHHjqA3799UxDyZtzPzc3xxRdfkMvl6OoK8sQTP+Oee+7B5XLT 2NiEoih0dXURiUTwer28+uqrnDz5InV1dbhcLhYXU0Sjt/j888+5cePG5jT/UCGEIBQKoWkagUAA IQT5fJ66ujqOH/8FX375JaHQMABNTU3YbDaOHHmMAwceYnFxEafTiSwr5HI5ZFlG0zQuXvyGcDiM JElbA5AkiXA4zLffXmFwcIDu7h58Pj8fffRnUqkUR4/24nDYOX36NAAejweAWGwegJGREQKBRrLZ DLquF/dMp9NcuXKZRCJRBkJef7imafT397O8vEwsFmN2dpYTJ04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5ErkJggg==',
};
let bandeau_msgs = {
inconnu : "Inconnu",
capital : "Liens capitalistiques",
etat : "Liens étatiques",
independant : "Indépendant financièrement",
rien : "rien"
};
let owner_msgs = {
inconnu : "Ce site n'est pas référencé dans notre base de données.",
capital : "Voici les liens capitalistiques avec les principaux actionnaires du média que vous consultez :",
etat : "Ce média est la propriété du ou des états suivants :",
independant : "Ce site n'a pas de lien capitalistique ou étatique à notre connaissance",
rien : "rien"
};
// vars to show in prefs
var colors = {
inconnu : "#00a86b", // c'est que de l'info :)
capital : "#00a86b", // c'est que de l'info :)
etat : "#00a86b", // c'est que de l'info :)
independant : "#00a86b", // c'est que de l'info :)
rien : "#00a86b" // c'est que de l'info :)
//"#A2A9AE", // gris
//"#D50303", // rouge
//"#F5A725", // jaune
//"#129AF0", // bleu
//"#468847", // vert
};
// let possedex_colors = [ "#A2A9AE", "#129AF0", "#D50303", "#F5A725", "#468847" ];
// let possedex_descs = [ "inclassable", "parodique", "pas fiable du tout", "peu fiable", "fiable" ];
var base_url = "http://possedex.info/database.json";
var CURRENT_VERSION = '0.0.3';
var always_refresh = false;
var urls = "";
var note = null;
var classement = null;
var notule = ""
var active_url = "";
var has_info = false;
var clean_url = "";
var owner_msg = '';
var proprietaires = '';
var fortunes = '';
var marques = '';
var influences = '';
var proprietaires = '';
var interets = '';
var conflits = '';
var subventions = '';
var publicite = '';
var sources = [];
var note = '';
var updated_human = '';
var color = '';
var possedex_color = '';
var possedex_desc = '';
var message = '';
var bandeau_msg = '';
var icone = '';
function onInstall() {
if (1 <= _debug)
console && console.log("Le Possedex est installé");
loadData();
var last_update = new Date();
browser.storage.local.set({
'infobulles': {
'inconnu' : false,
'capital' : true,
'etat' : true,
'independant' : true
},
'persistant' : false,
"installed" : CURRENT_VERSION,
'last_update': last_update.getTime()
});
browser.tabs.create({url: "install.html"});
}
browser.storage.local.get(['installed'], function(results){
var install = results.installed;
if (install != CURRENT_VERSION) {
onInstall();
}
});
function loadJSON(path, success, error)
{
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function()
{
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
if (success) {
if (4 <= _debug) {
console && console.info("raw json");
console && console.log(xhr.responseText);
}
success(JSON.parse(xhr.responseText));
}
} else {
if (error)
error(xhr);
}
}
};
xhr.open("GET", path, true);
xhr.send();
}
function loadData(){
if (1 <= _debug) {
console && console.info('start loadData()');
//console && console.info('NO DEBUG');
}
browser.storage.local.get('last_update', function(results){
var new_update = new Date();
if (2 <= _debug) {
console && console.log("found last update : ", results, "base url=", base_url+"?"+new_update.getTime());
}
loadJSON(base_url+"?"+new_update.getTime(),
function(data) {
if (2 <= _debug) {
console && console.info("storing urls...", data['urls']);
}
browser.storage.local.set({'urls': data['urls']}, function() {
});
if (2 <= _debug)
console && console.info("set sites to", data['sites']);
browser.storage.local.set({'sites': data['sites']}, function() {
});
if (3 <= _debug)
console && console.info("set last_update to", new_update.getTime());
browser.storage.local.set({'last_update': new_update.getTime()}, function() {
});
},
function(data) {
console && console.error("error on loadJSON with "+base_url);
console && console.info(data);
}
);
});
}
function removeAfterLastSlash(url){
if(url.lastIndexOf('/') !== -1) {
return url.substring(0, url.lastIndexOf('/'));
}
else {
return url;
}
}
function lastSlash(url){ // remove the last slash at the end of the string
if(url.lastIndexOf('/') == url.length-1) {
return url.substring(0, url.length-1);
}
else {
return url;
}
}
function url_cleaner(url){
return url
.replace("http://", "")
.replace('www.', "")
.replace("https://", "")
.replace("\n", "");
}
function youtubeChannel(url){
var elms = url.split('/');
if(elms.length > 2){
return elms[0] + '/' + elms[1] + "/" + elms[2];
}
else{
return url;
}
}
function debunkSite(url, tab_id, display){
if (3 <= _debug) {
console && console.group('STARRT debunk site '+url);
}
browser.storage.local.get(['urls', "sites", "already_visited", "infobulles", "persistant", "last_update"], function(results){
if (3 <= _debug) {
console && console.info("debunkSite : var results");
console && console.log(results);
}
if ("urls" in results) {
if (_debug > 4) {
console && console.log("urls is in results");
}
try {
urls = results.urls;
sites = results.sites;
has_info = urls.hasOwnProperty(url);
// si le site est trouvé direct
if (has_info == true) {
site_id = urls[url];
if (2 <= _debug) {
console && console.log('site FOUND ! ', site_id);
}
try {
site_url = url;
site_actif = sites[site_id][col_nom]; // nom du site
updated = new Date(sites[site_id][col_updated]); // last maj
classement = sites[site_id][col_classement_possedex]; // classement possedex
notule = sites[site_id][col_desc]; // description originale
slug = sites[site_id][col_slug]; // nom normalisé
owner_msg = owner_msgs[classement]; // message "ce media est la propriété ..."
var proprietaire1 = sites[site_id][col_proprietaire1]; // propriétaires
var fortunes1 = sites[site_id][col_fortune1 ]; // propriétaires
var marque1 = sites[site_id][col_marque1 ]; // propriétaires
var influence1 = sites[site_id][col_influence1 ]; // propriétaires
var proprietaire2 = sites[site_id][col_proprietaire2]; // propriétaires
var fortunes2 = sites[site_id][col_fortune2 ]; // propriétaires
var marque2 = sites[site_id][col_marque2 ]; // propriétaires
var influence2 = sites[site_id][col_influence2 ]; // propriétaires
var proprietaire3 = sites[site_id][col_proprietaire3]; // propriétaires
var fortunes3 = sites[site_id][col_fortune3 ]; // propriétaires
var marque3 = sites[site_id][col_marque3 ]; // propriétaires
var influence3 = sites[site_id][col_influence3 ]; // propriétaires
proprietaires = [proprietaire1, proprietaire2, proprietaire3];
fortunes = [fortunes1 , fortunes2 , fortunes3 ];
marques = [marque1 , marque2 , marque3 ];
influences = [influence1 , influence2 , influence3 ];
subventions = sites[site_id][col_subventions]; // Montant des subventions d'état
publicite = sites[site_id][col_pub]; // Pub ?
var raw_sources = sites[site_id][col_sources]; // Nos sources (urls séparés par virgule et/ou espace)
if (3 <= _debug) {
console && console.info("sources avant markdown", sources);
}
// Markdown style
var regex = new RegExp(/\[([^\]]*?)\]\(([^\)]*?)\)[, ]{0,2}/gm);
match = regex.exec(raw_sources);
sources = [];
while (match != null) {
title = match[1];
url = match[2];
sources.push({"url":url, "title":title});
match = regex.exec(raw_sources);
}
if (3 <= _debug) {
console && console.log("sources apres markdown", sources);
}
// URL toute seule
var regex = new RegExp(/^(http[s]?:\/\/([^/]+)\/[^" ,]+)[^"]{1,2}$/g);
match = regex.exec(raw_sources);
while (match != null) {
url = match[1];
title = match[2];
sources.push({"url":url, "title":title});
match = regex.exec(raw_sources);
}
if (3 <= _debug) {
console && console.log("sources apres urls simples", sources);
}
note = classement;
color = colors[classement];
message = messages[classement];
//possedex_color = possedex_colors[possedex_note];
//possedex_desc = possedex_descs[possedex_note];
updated_human = updated.toLocaleString('fr');
//.' à ' .updated.toLocaleTimeString('fr');
bandeau_msg = bandeau_msgs[classement];
icone = icones[classement];
if (2 <= _debug) {
console && console.group("tout s'est bien passé");
console && console.log('site_actif =',site_actif );
console && console.log('updated =',updated_human );
console && console.log('classement =',classement );
console && console.log('notule =',notule );
console && console.log('slug =',slug );
console && console.log('proprietaires =',proprietaires );
console && console.log('interets =',interets );
console && console.log('conflits =',conflits );
console && console.log('subventions =',subventions );
console && console.log('sources =',sources );
console && console.groupEnd();
}
} catch(e) {
if (1 <= _debug) {
console && console.error("ERREUR has_info");
console && console.error(e);
console && console.log(sites[site_id]);
}
}
//browser.browserAction.setIcon({
// path: "img/icones/icon-" + classement + ".png", // note
// tabId: t
//});
if(results.infobulles[classement] == true && display == true){ // note
browser.tabs.query({active: true, currentWindow: true}, function(tabs) {
// sendMessage to the content.js listener
browser.tabs.sendMessage(tabs[0].id, {
show_popup : true,
note : classement,
color : colors[classement],
message : messages[classement],
bandeau_msg : bandeau_msgs[classement],
icone : icones[classement],
persistant : results.persistant
}, function(response) { // note
});
});
}
}
else {
if (3 <= _debug) {
console && console.info("site non trouvé avec l'url suivante :", url);
console && console.log(url);
console && console.log("dans la base :");
console && console.log(urls);
}
//browser.browserAction.setIcon({
// path: "icone.png",
// tabId: t
//});
// Optional : add a badge text and badge bg with the icon
//browser.browserAction.setBadgeText({"text" : "Soumis :p"});
//browser.browserAction.setBadgeBackgroundColor({'color' : "#D50303"});
}
if (url.match(/youtube.com/)) {
if (null == classement)
classement = ''; // propriétaires
//browser.browserAction.setIcon({
// path: "img/icones/icon-" + (classement) + ".png", // note
// tabId: t
//});
if ("" == proprietaires)
proprietaires = "Youtube est une propriété de la Holding Alphabet (Google)"; // propriétaires
if ("" == interets)
interets = "Le groupe Alphabet(Google) a de nombreux intérêts internationnaux. Son business model est fortement basé sur la publicité et son quasi-monopole de la publicité. Google exerce de nombreuses pressions sur les états et l'Union Européenne."; // intérets
if ("" == conflits)
conflits = "Youtube peut être un outil de partage de connaissances. Les vidéastes et utilisateurs de la plateforme youtube ne sont pas forcément soumis à Google, mais… "; // exemple de conflits / complicité idéologique
if ("" == subventions)
subventions = ""; // Montant des subventions d'état
if ("" == sources)
sources = ""; // Nos sources (urls séparés par virgule et/ou espace)
}
} catch(e) {
console && console.error(e);
}
}
var today = new Date();
last_update = results.last_update;
if(always_refresh || (today.getTime() - last_update)/1000/60/60 >= 24) {
if (1 <= _debug) {
console && console.log("refresh every hour or refresh forced");
}
loadData();
} else {
if (2 <= _debug) {
human_date = new Date(last_update).toString();
console && console.log("(not refresh) use data found in cache (from "+human_date+")");
}
}
});
if (3 <= _debug) {
console && console.groupEnd();
}
}
function checkSite(do_display){
browser.tabs.query({currentWindow: true, active: true}, function(tabs){
if (!tabs.length) {
return;
}
var tab;
for (active_tab of tabs) {
tab = active_tab;
}
active_url = lastSlash(tab.url);
if (_debug > 5) {
console && console.warn("active url", active_url);
}
if(active_url.indexOf("chrome-extension://") == 0) {
return;
}
// YOUTUBE
if(active_url.indexOf("youtube.com/") > -1){
if(active_url.indexOf("channel") == -1){
browser.tabs.query({active: true, currentWindow: true}, function(tabs) {
browser.tabs.sendMessage(tabs[0].id, {text: 'report_back'}, function(response){
clean_url = response.farewell.replace('https://www.', "");
debunkSite(clean_url, tab.id, do_display);
});
});
}
else {
clean_url = youtubeChannel(url_cleaner(active_url));
debunkSite(clean_url, tab.id, do_display);
}
}
// SOCIAL NETWORKS HOMEPAGE
else if(active_url == 'https://www.facebook.com' || active_url == 'https://twitter.com' || active_url == 'https://www.youtube.com'){
clean_url = url_cleaner(active_url);
debunkSite(clean_url, tab.id, do_display);
}
// OTHER URLS
else {
matches = []
// @TODO: recursiv last slash
clean_url = url_cleaner(active_url);
find_url = urls[clean_url];
if (4 <= _debug) {
console && console.log("all urls", urls);
console && console.log("active_url", active_url);
console && console.log("clean_url", clean_url);
console && console.log("find_url urls[\""+clean_url+"\"]", urls[clean_url]);
}
// {{{ this might be removed (redundant with after the for()
if (find_url) {
matches.push(find_url);
if (4 <= _debug) {
console && console.warn("URL MATCHES !!!! (clean_url="+clean_url+")", find_url);
}
}
// }}} this might be removed (redundant with after the for()
if (4 <= _debug) {
console && console.group("for key in urls");
}
for (var key in urls) {
if (!urls.hasOwnProperty(key)) {
if (4 <= _debug) {
console && console.info("this url «key» has not ownProperty", key);
}
continue;
}
var index = active_url.indexOf(key);
if(index != -1) {
if (4 <= _debug) {
console && console.info("url FOUND !", key, index);
}
if((
active_url.indexOf('http://www.'+ key) == 0
|| active_url.indexOf('https://www.'+ key) == 0
|| active_url.indexOf('http://'+ key) == 0
|| active_url.indexOf('https://'+ key) == 0
)
&& index != 0
&& (active_url[index-1] == "/" || active_url[index-1] == ".")
&& key != "facebook.com"
&& key != "twitter.com") {
// current active_url contains the current url from
// the loop (key)
matches.push(key);
if (_debug > 4) {
console && console.warn("URL MATCHES !!!!");
}
}
}
}
if (4 <= _debug) {
console && console.groupEnd();
}
tampon = "";
for(var url_i=0;url_i<matches.length;url_i++){
if(matches[url_i].length > tampon.length){
tampon = matches[url_i];
if (4 <= _debug) {
console && console.log("tampon update to use longer url :", tampon);
}
}
}
clean_url = tampon; // this contains the longest url match
if (4 <= _debug) {
console && console.log("call debunkSite");
console && console.log("clean_url", clean_url);
console && console.log("tab id", tab.id);
console && console.log("do display", do_display);
}
debunkSite(clean_url, tab.id, do_display);
}
});
}
browser.tabs.onActivated.addListener(function (tabId, tab) {
if (4 <= _debug) {
console && console.log("listener onActivated");
}
checkSite(false);
});
browser.windows.getCurrent(function (tabId, tab) {
if (4 <= _debug) {
console && console.log("windows.getCurrent");
}
checkSite(false);
});
// This event happens everytime but seems required to update logo color
// onload
browser.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
//if (4 <= _debug) {
// console && console.log("onUpdated");
//}
checkSite(changeInfo.status && (changeInfo.status == "complete"));
});
browser.windows.onFocusChanged.addListener(function (tabId, tab) {
if (4 <= _debug) {
console && console.log("onFocusChanged");
}
checkSite(false);
});
browser.browserAction.onClicked.addListener(function (tabId, tab) {
if (4 <= _debug) {
console && console.log("onClicked");
}
checkSite(false);
});
browser.tabs.onCreated.addListener(function (tabId, tab) {
if (4 <= _debug) {
console && console.log("onCreated");
}
checkSite(true);
});