-
Notifications
You must be signed in to change notification settings - Fork 1
/
ophirofox.user.js
3249 lines (2839 loc) · 130 KB
/
ophirofox.user.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
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// ==UserScript==
// @version 2.4.26474.25843
// @author Write
// @name OphirofoxScript
// @grant GM.getValue
// @grant GM.setValue
// @grant GM.deleteValue
// @include https://nouveau.europresse.com/*
// @include https://nouveau-europresse-com.essec.idm.oclc.org/*
// @include https://nouveau-europresse-com.ezproxy.univ-catholille.fr/*
// @include https://nouveau-europresse-com.ezproxy.upf.pf/*
// @include https://nouveau-eureka-cc.res.banq.qc.ca/*
// @include https://nouveau-europresse-com.budistant.univ-nantes.fr/*
// @include https://nouveau-europresse-com.proxy.rubens.ens.fr/*
// @include https://nouveau-europresse-com.rp1.ensam.eu/*
// @include https://nouveau-europresse-com.ezproxy.universite-paris-saclay.fr/*
// @include https://nouveau-europresse-com.ezpaarse.univ-paris1.fr/*
// @include https://nouveau-europresse-com.accesdistant.bu.univ-paris8.fr/*
// @include https://nouveau-europresse-com.docelec.insa-lyon.fr/*
// @include https://nouveau-europresse-com.rproxy.insa-rennes.fr/*
// @include https://nouveau-europresse-com.bnf.idm.oclc.org/*
// @include https://nouveau-europresse-com.docelec.univ-lyon1.fr/*
// @include https://nouveau-europresse-com.ezpum.scdi-montpellier.fr/*
// @include https://nouveau-europresse-com.ezpupv.scdi-montpellier.fr/*
// @include https://nouveau-europresse-com.sid2nomade-2.grenet.fr/*
// @include https://nouveau-europresse-com.ezproxy.u-bordeaux-montaigne.fr/*
// @include https://nouveau-europresse-com.docelec.u-bordeaux.fr/*
// @include https://nouveau-europresse-com.proxy.sciencespobordeaux.fr/*
// @include https://nouveau-europresse-com.proxy.unice.fr/*
// @include https://nouveau-europresse-com.acces.bibliotheque-diderot.fr/*
// @include https://nouveau-europresse-com.scd-proxy.uha.fr/*
// @include https://nouveau-europresse-com.ezproxy.ensta-bretagne.fr/*
// @include https://nouveau-europresse-com.ezproxy.u-paris.fr/*
// @include https://nouveau-europresse-com.faraway.parisnanterre.fr/*
// @include https://nouveau-europresse-com.scd1.univ-fcomte.fr/*
// @include https://nouveau-europresse-com.rproxy.univ-pau.fr/*
// @include https://nouveau-europresse-com.ezproxy.univ-artois.fr/*
// @include https://nouveau-europresse-com.doc-elec.univ-lemans.fr/*
// @include https://nouveau-europresse-com.lama.univ-amu.fr/*
// @include https://nouveau-europresse-com.portail.psl.eu/*
// @include https://nouveau-europresse-com.passerelle.univ-rennes1.fr/*
// @include https://nouveau-europresse-com.ressources-electroniques.univ-lille.fr/*
// @include https://nouveau-europresse-com.acces-distant.sciencespo.fr/*
// @include https://nouveau-europresse-com.ressources.univ-poitiers.fr/*
// @include https://nouveau-europresse-com.bibelec.univ-lyon2.fr/*
// @include https://nouveau-europresse-com.gorgone.univ-toulouse.fr/*
// @include https://nouveau-europresse-com.ezscd.univ-lyon3.fr/*
// @include https://nouveau-europresse-com.ezproxy.u-pec.fr/*
// @include https://nouveau-europresse-com.univ-smb.idm.oclc.org/*
// @include https://nouveau-europresse-com.ezproxy.univ-paris13.fr/*
// @include https://nouveau-europresse-com.ezproxy.campus-condorcet.fr/*
// @include https://nouveau-europresse-com.mediaproxy.imtbs-tsp.eu/*
// @include https://nouveau-europresse-com.buadistant.univ-angers.fr/*
// @include https://nouveau-europresse-com.accesdistant.sorbonne-universite.fr/*
// @include https://nouveau-europresse-com.docelec-u-paris2.idm.oclc.org/*
// @include https://nouveau-europresse-com.esc-clermont.idm.oclc.org/*
// @include https://nouveau-europresse-com.acces-distant.bnu.fr/*
// @include https://nouveau-europresse-com.bu-services.univ-antilles.fr/*
// @include https://nouveau-europresse-com.proxybib-pp.cnam.fr/*
// @include https://nouveau-europresse-com.srvext.uco.fr/*
// @include https://nouveau-europresse-com.urca.idm.oclc.org/*
// @include https://nouveau-europresse-com.merlin.u-picardie.fr/*
// @include https://nouveau-europresse-com.ezproxy.univ-littoral.fr/*
// @include https://nouveau-europresse-com.bases-doc.univ-lorraine.fr/*
// @include https://nouveau-europresse-com.ezproxy.utbm.fr/*
// @include https://nouveau-europresse-com.distant.bu.univ-rennes2.fr/*
// @include https://nouveau-europresse-com.ezproxy.hec.fr/*
// @include https://nouveau-europresse-com.proxy-bu1.u-bourgogne.fr/*
// @include https://nouveau-europresse-com.ezproxy.normandie-univ.fr/*
// @include https://nouveau-europresse-com.bibdocs.u-cergy.fr/*
// @include https://nouveau-europresse-com.ezproxy.univ-tln.fr/*
// @include https://nouveau-europresse-com.ezproxy.univ-paris3.fr/*
// @include https://nouveau-europresse-com.proxy.scd.univ-tours.fr/*
// @include https://nouveau-europresse-com.federation.unimes.fr/*
// @include https://nouveau-europresse-com.ezp.lib.cam.ac.uk/*
// @include https://nouveau-europresse-com.extranet.enpc.fr/*
// @include https://nouveau-europresse-com.scd-proxy.univ-brest.fr/*
// @include https://nouveau-europresse-com-s.docadis.univ-tlse3.fr/*
// @include https://nouveau-europresse-com.ezproxy.univ-orleans.fr/*
// @include https://europresse.ezproxy.univ-ubs.fr/*
// @include https://nouveau.europresse.com.elgebar.univ-reunion.fr/*
// @include https://nouveau-europresse-com.ezproxy.uca.fr/*
// @include https://nouveau-europresse-com.ressources.sciencespo-lyon.fr/*
// @include https://nouveau-europresse-com.proxy.univ-nc.nc/*
// @include https://nouveau-europresse-com.buproxy2.univ-avignon.fr/*
// @include https://nouveau-europresse-com.proxy.utt.fr/*
// @include https://nouveau-europresse-com.proxy.bnl.lu/*
// @include https://nouveau-europresse-com.revproxy.escpeurope.eu/*
// @include https://nouveau-europresse-com.univ-eiffel.idm.oclc.org/*
// @include https://nouveau-europresse-com.ezproxy.unilim.fr/*
// @include https://nouveau-europresse-com.ezproxy.uphf.fr/*
// @include https://nouveau-europresse-com.rennes-sb.idm.oclc.org/*
// @include https://nouveau-europresse-com.hub.tbs-education.fr/*
// @include https://nouveau-europresse-com.ezproxy.univ-perp.fr/*
// @include https://nouveau-europresse-com.ezproxy.vetagro-sup.fr/*
// @include https://nouveau-europresse-com.ezproxy.utc.fr/*
// @include https://nouveau-europresse-com.ezproxy.ulb.ac.be/*
// @include https://nouveau-europresse-com.gutenberg.univ-lr.fr/*
// @include https://nouveau-europresse-com.bpi.idm.oclc.org/*
// @include https://www.lemonde.fr/*
// @include https://www.liberation.fr/*
// @include https://next.liberation.fr/*
// @include https://www.lefigaro.fr/*
// @include https://leparticulier.lefigaro.fr/*
// @include https://www.monde-diplomatique.fr/*
// @include https://www.courrierdesmaires.fr/*
// @include https://www.la-croix.com/*
// @include https://www.telerama.fr/kiosque/telerama
// @include https://www.courrierinternational.com/*
// @include https://www.lamontagne.fr/*
// @include https://www.humanite.fr/*
// @include https://www.lepoint.fr/*
// @include https://www.lesoir.be/*
// @include https://www.lesechos.fr/*
// @include https://www.letemps.ch/*
// @include https://www.lalibre.be/*
// @include https://www.lavoixdunord.fr/*
// @include https://www.ouest-france.fr/*
// @include https://www.sudouest.fr/*
// @include https://www.laprovence.com/*
// @include https://www.ladepeche.fr/*
// @include https://www.leparisien.fr/*
// @include https://www.lexpress.fr/*
// @include https://www.nouvelobs.com/*
// @include https://www.estrepublicain.fr/*
// @include https://www.latribune.fr/*
// @include https://www.lopinion.fr/*
// @include https://www.nicematin.com/*
// @include https://www.corsematin.com/*
// @include https://www.lorientlejour.com/*
// @include https://www.lavenir.net/*
// @include https://www.dhnet.be/*
// @include https://www.sudinfo.be/*
// @include https://www.letelegramme.fr/*
// @include https://www.lsa-conso.fr/*
// @include https://www.leprogres.fr/*
// @include https://www.levif.be/*
// @include https://trends.levif.be/*
// @include https://www.knack.be/*
// @include https://www.demorgen.be/*
// @include https://www.standaard.be/*
// @include https://www.ft.com/*
// @include https://www.gva.be/*
// @include https://www.nieuwsblad.be/*
// @include https://www.hln.be/*
// @include https://www.challenges.fr/*
//
// @run-at document-start
//
// ==/UserScript==
(function() {
'use strict';
/* ----------------
* CONFIG
* ----------------
* */
// Changer la variable par le nom de votre université. Voir la liste ci-dessous dans ophirofox_config_list.
const universityName = "Bibliotheque nationale et universitaire de Strasbourg"
/* ----------------
* HELPERS
* ----------------
* */
const current = window.location.href;
const hostname = window.location.hostname;
function match(str, rule) {
var escapeRegex = (str) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(str);
}
function pasteStyle(str) {
var node = document.createElement('style');
node.type = 'text/css';
node.appendChild(document.createTextNode(str.replace(/;/g, ' !important;')));
if (document.head !== null) {
document.head.appendChild(node);
} else {
document.documentElement.appendChild(node);
}
}
const onElemAvailable = async selector => {
while (document.querySelector(selector) === null) {
await new Promise(resolve => requestAnimationFrame(resolve));
}
return document.querySelector(selector);
};
/* ----------------
* CODE
* ----------------
* */
const ophirofox_config_list = [{
"name": "Pas d'intermédiaire",
"AUTH_URL": "https://nouveau.europresse.com/Login"
}, {
"name": "Aix-Marseille Université",
"AUTH_URL": "https://lama.univ-amu.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U031032T_1"
}, {
"name": "Bibliotheque nationale du Luxembourg",
"AUTH_URL": "http://proxy.bnl.lu/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U030612T_1"
}, {
"name": "Bibliothèque et Archives nationales du Québec (BAnQ)",
"AUTH_URL": "http://res.banq.qc.ca/login?url=https://nouveau.eureka.cc/access/ip/default.aspx?un=bnat1"
}, {
"name": "Bibliotheque nationale et universitaire de Strasbourg",
"AUTH_URL": "http://acces-distant.bnu.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=bnus"
}, {
"name": "Bibliotheque municipale de Lyon",
"AUTH_URL": "https://connect.bm-lyon.fr/get/login?&access_list=LVAw&url=aHR0cHM6Ly9ub3V2ZWF1LmV1cm9wcmVzc2UuY29tL2FjY2Vzcy9odHRwcmVmL2RlZmF1bHQuYXNweD91bj1CTUxZT05BVV8x"
}, {
"name": "BNF",
"AUTH_URL": "https://bnf.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=D000067U_1"
}, {
"name": "Bibliothèque Publique d'Information (BPI)",
"AUTH_URL": "https://bpi.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=pompi"
}, {
"name": "Centrale Lyon",
"AUTH_URL": "https://ec-lyon.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=LYONT_7"
}, {
"name": "CY Cergy Paris Université",
"AUTH_URL": "https://bibdocs.u-cergy.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U031547T_1"
}, {
"name": "École Centrale de Lyon (ECL)",
"AUTH_URL": "https://ec-lyon.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=LYONT_7"
}, {
"name": "École normale supérieure de Lyon (ENS Lyon)",
"AUTH_URL": "https://acces.bibliotheque-diderot.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=ENSLYONT_1"
}, {
"name": "École normale supérieure de Paris (ENS ULM)",
"AUTH_URL": "https://proxy.rubens.ens.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=PSLT_1"
}, {
"name": "Conservatoire national des arts et métiers",
"AUTH_URL": "https://proxybib-pp.cnam.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=CNAM"
}, {
"name": "ENSAM",
"AUTH_URL": "https://rp1.ensam.eu/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=AML"
}, {
"name": "ENSTA Bretagne",
"AUTH_URL": "https://nouveau.europresse.com/access/ip/default.aspx?un=ENSTAT_1"
}, {
"name": "ENSTA Paris",
"AUTH_URL": "https://nouveau.europresse.com/access/ip/default.aspx?un=U033137T_9"
}, {
"name": "ENSAE Paris/ENSAI",
"AUTH_URL": "https://nouveau.europresse.com/access/ip/default.aspx?un=U033137T_1"
}, {
"name": "ESC Clermont Business School",
"AUTH_URL": "https://esc-clermont.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=ESCT_1"
}, {
"name": "ESCP Business School",
"AUTH_URL": "https://login.revproxy.escpeurope.eu/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=escpT_1"
}, {
"name": "ESSEC",
"AUTH_URL": "https://essec.idm.oclc.org/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=ESSECT_1"
}, {
"name": "Humathèque Campus Condorcet",
"AUTH_URL": "https://ezproxy.campus-condorcet.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=EPCS"
}, {
"name": "HEC Paris",
"AUTH_URL": "http://login.ezproxy.hec.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=josasT_1"
}, {
"name": "INSA Lyon",
"AUTH_URL": "https://docelec.insa-lyon.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=INSAT_3"
}, {
"name": "École des Ponts ParisTech",
"AUTH_URL": "https://extranet.enpc.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=umiv"
}, {
"name": "INSA Rennes",
"AUTH_URL": "http://rproxy.insa-rennes.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=INSAT_1"
}, {
"name": "La Rochelle Université",
"AUTH_URL": "https://gutenberg.univ-lr.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=ROCHELLET_1"
}, {
"name": "Le Mans Université",
"AUTH_URL": "https://login.doc-elec.univ-lemans.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U031524T_1"
}, {
"name": "Lycée Albert de Mun à Nogent-sur-Marne",
"AUTH_URL": "https://nouveau.europresse.com/Login/Esidoc?sso_id=0940880W"
}, {
"name": "Lycée Clemenceau à Nantes",
"AUTH_URL": "https://nouveau.europresse.com/Login/Esidoc?sso_id=0440021J"
}, {
"name": "Lycée International de l'Est Parisien",
"AUTH_URL": "https://nouveau.europresse.com/Login/Esidoc?sso_id=0932638M"
}, {
"name": "Lycée la Martinière Diderot",
"AUTH_URL": "https://idp-auth.gar.education.fr/domaineGar?idENT=QzAw&idEtab=MDY5MDAzN1I=&idRessource=ark%3A%2F57800%2Feuropresse-cision"
}, {
"name": "Médiathèque de Télécom SudParis & Institut Mines-Télécom Business School",
"AUTH_URL": "http://mediaproxy.imtbs-tsp.eu/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U033137T_8"
}, {
"name": "Rennes School of Business",
"AUTH_URL": "https://rennes-sb.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=RENNES2T_2"
}, {
"name": "SciencesPo Lyon",
"AUTH_URL": "http://ressources.sciencespo-lyon.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=LYONT_5"
}, {
"name": "Sciences Po Paris",
"AUTH_URL": "https://acces-distant.sciencespo.fr/fork?https://nouveau.europresse.com/access/ip/default.aspx?un=politique2T_1"
}, {
"name": "Télécom Paris",
"AUTH_URL": "https://nouveau.europresse.com/access/ip/default.aspx?un=U033137T_1"
}, {
"name": "Université Catholique de Lille",
"AUTH_URL": "https://login.ezproxy.univ-catholille.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=Vauban2T_1"
}, {
"name": "Université Claude Bernard Lyon 1",
"AUTH_URL": "http://docelec.univ-lyon1.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U033081T_1"
}, {
"name": "Université d'Angers",
"AUTH_URL": "https://buadistant.univ-angers.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=BUANGERST_1"
}, {
"name": "Université des Antilles",
"AUTH_URL": "http://bu-services.univ-antilles.fr:5000/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=ANTILLEST_1"
}, {
"name": "Université d'Artois",
"AUTH_URL": "http://ezproxy.univ-artois.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=littoralT_1"
}, {
"name": "Université d'Avignon",
"AUTH_URL": "https://buproxy2.univ-avignon.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=AvignonT_1"
}, {
"name": "Université de Bordeaux",
"AUTH_URL": "https://docelec.u-bordeaux.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=UNIVBORDEAUXT_1"
}, {
"name": "Université Bordeaux Montaigne",
"AUTH_URL": "https://ezproxy.u-bordeaux-montaigne.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=UNIVMONTAIGNET_1"
}, {
"name": "Sciences Po Bordeaux",
"AUTH_URL": "http://proxy.sciencespobordeaux.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=SCIENCESPOT_1"
}, {
"name": "Université de Bourgogne",
"AUTH_URL": "http://proxy-scd.u-bourgogne.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U032591T_1"
}, {
"name": "Université de Bretagne Occidentale",
"AUTH_URL": "http://scd-proxy.univ-brest.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=OCCIDENTALET_1"
}, {
"name": "Université Bretagne Sud",
"AUTH_URL": "http://ezproxy.univ-ubs.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=BRETAGNESUDT_1"
}, {
"name": "Université Catholique de l'Ouest",
"AUTH_URL": "https://srvext.uco.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=UCOT_1"
}, {
"name": "Université de Caen Normandie",
"AUTH_URL": "http://ezproxy.normandie-univ.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U031221T_3"
}, {
"name": "Université Clermont Auvergne",
"AUTH_URL": "https://ezproxy.uca.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=FERRANDU_1"
}, {
"name": "Université Côte d'Azur",
"AUTH_URL": "http://proxy.unice.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U032557T_1"
}, {
"name": "Université d'Évry Val d'Essonne",
"AUTH_URL": "https://ezproxy.universite-paris-saclay.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=U031535T_8"
}, {
"name": "Université de Franche-Comté",
"AUTH_URL": "http://scd1.univ-fcomte.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=FCOMTET_1"
}, {
"name": "Université Grenoble-Alpes",
"AUTH_URL": "https://sid2nomade-2.grenet.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=grenobleT_1"
}, {
"name": "Université Gustave Eiffel",
"AUTH_URL": "https://univ-eiffel.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=D000030T_5"
}, {
"name": "Université Le Havre Normandie",
"AUTH_URL": "http://ezproxy.normandie-univ.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U031221T_6"
}, {
"name": "Université de Haute-Alsace",
"AUTH_URL": "https://scd-proxy.uha.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=ALSACET_1"
}, {
"name": "Université Jean Monnet Saint-Étienne",
"AUTH_URL": "https://nouveau.europresse.com/access/ip/default.aspx?un=MONNETT_1"
}, {
"name": "Université Jean Moulin Lyon 3",
"AUTH_URL": "http://ezscd.univ-lyon3.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=MOULINT_1"
}, {
"name": "Université de la Nouvelle-Calédonie",
"AUTH_URL": "https://proxy.univ-nc.nc/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=CaledonieT_1"
}, {
"name": "Université de La Réunion",
"AUTH_URL": "https://elgebar.univ-reunion.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=BUREUNIONT_1"
}, {
"name": "Université de Liège",
"AUTH_URL": "https://nouveau.europresse.com/access/ip/default.aspx?un=U031558T_1"
}, {
"name": "Université Libre de Bruxelles",
"AUTH_URL": "http://nouveau.europresse.com.ezproxy.ulb.ac.be/access/ip/default.aspx?un=LIBRET_1"
}, {
"name": "Université de Lille",
"AUTH_URL": "https://ressources-electroniques.univ-lille.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=TourcoingT_1"
}, {
"name": "Université de Limoges",
"AUTH_URL": "https://ezproxy.unilim.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U031697T_1"
}, {
"name": "Université du Littoral Côte d'Opale (UCLO)",
"AUTH_URL": "http://ezproxy.univ-littoral.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=dunkerqueT_1"
}, {
"name": "Université de Lorraine",
"AUTH_URL": "https://login.bases-doc.univ-lorraine.fr/login?qurl=http://nouveau.europresse.com/access/ip/default.aspx?un=NANCY2"
}, {
"name": "Université Lumière Lyon 2",
"AUTH_URL": "http://bibelec.univ-lyon2.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=LYONT_3"
}, {
"name": "Université de Montpellier",
"AUTH_URL": "https://login.ezpum.scdi-montpellier.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=MontpellierT_1"
}, {
"name": "Université de Nantes",
"AUTH_URL": "https://budistant.univ-nantes.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=NANTEST_1"
}, {
"name": "Université de Nîmes",
"AUTH_URL": "https://federation.unimes.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=NimesT_1"
}, {
"name": "Université d'Orléans",
"AUTH_URL": "https://ezproxy.univ-orleans.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=OrleansT_1"
}, {
"name": "Université Paris 1 Panthéon-Sorbonne",
"AUTH_URL": "https://ezpaarse.univ-paris1.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=SORBONNET_1"
}, {
"name": "Université Paris 2 Panthéon Assas",
"AUTH_URL": "https://docelec-u-paris2.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=ASSAST_1"
}, {
"name": "Université Paris 8",
"AUTH_URL": "https://accesdistant.bu.univ-paris8.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=paris8"
}, {
"name": "Université Paris Cité",
"AUTH_URL": "https://ezproxy.u-paris.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=UNIVPARIS"
}, {
"name": "Université Paris-Est Créteil",
"AUTH_URL": "https://ezproxy.u-pec.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=D000030T_4"
}, {
"name": "Université Paris Nanterre",
"AUTH_URL": "http://faraway.parisnanterre.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=Paris10T_1"
}, {
"name": "Université Paris-Saclay",
"AUTH_URL": "https://ezproxy.universite-paris-saclay.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=U031535T_9"
}, {
"name": "Université Paul Sabatier, Toulouse III",
"AUTH_URL": "https://docadis.univ-tlse3.fr/https/nouveau.europresse.com/access/ip/default.aspx?un=CAPITOLET_6"
}, {
"name": "Université Paul-Valéry Montpellier 3",
"AUTH_URL": "https://login.ezpupv.scdi-montpellier.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=MontpellierT_1"
}, {
"name": "Université de Perpignan",
"AUTH_URL": "https://ezproxy.univ-perp.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=U031536T_1"
}, {
"name": "Université de Picardie Jules Verne",
"AUTH_URL": "https://merlin.u-picardie.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=BUPICARDIET_2"
}, {
"name": "Université PSL",
"AUTH_URL": "https://portail.psl.eu/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=PSLT_1"
}, {
"name": "Université de Pau et des Pays de l'Adour",
"AUTH_URL": "https://rproxy.univ-pau.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=uppaT_2"
}, {
"name": "Université de Poitiers",
"AUTH_URL": "http://ressources.univ-poitiers.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U032521T_1"
}, {
"name": "Université de la Polynésie Française",
"AUTH_URL": "http://nouveau.europresse.com.ezproxy.upf.pf/access/ip/default.aspx?un=tahitiT_1"
}, {
"name": "Université Polytechnique Hauts-de-France",
"AUTH_URL": "http://ezproxy.uphf.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=valenciennesT_1"
}, {
"name": "Université de Reims Champagne-Ardenne",
"AUTH_URL": "https://urca.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=ArdenneT_1"
}, {
"name": "Université de Rennes",
"AUTH_URL": "https://passerelle.univ-rennes1.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=RENNES1AT_1"
}, {
"name": "Université Rennes 2",
"AUTH_URL": "https://distant.bu.univ-rennes2.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=RENNES22T_1"
}, {
"name": "Université de Rouen Normandie",
"AUTH_URL": "http://ezproxy.normandie-univ.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U031221T_4"
}, {
"name": "Université Sorbonne Nouvelle Paris 3",
"AUTH_URL": "http://ezproxy.univ-paris3.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=pantheonT_1"
}, {
"name": "Université Sorbonne Université",
"AUTH_URL": "https://accesdistant.sorbonne-universite.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=UPMCT_1"
}, {
"name": "Université Sorbonne Paris Nord - Paris 13",
"AUTH_URL": "https://login.ezproxy.univ-paris13.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=paris13"
}, {
"name": "Université Savoie Mont Blanc",
"AUTH_URL": "https://univ-smb.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=savoieT_1"
}, {
"name": "Université de Technologie de Belfort-Montbéliard",
"AUTH_URL": "https://ezproxy.utbm.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=UTBMT_2"
}, {
"name": "Université de Technologie de Compiègne",
"AUTH_URL": "https://ezproxy.utc.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=BUCOMPIEGNET_2"
}, {
"name": "Université de Technologie de Troyes",
"AUTH_URL": "http://proxy.utt.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=BUTROYEST_2"
}, {
"name": "Université de Toulouse",
"AUTH_URL": "https://gorgone.univ-toulouse.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=CAPITOLET_2"
}, {
"name": "Université de Toulon",
"AUTH_URL": "http://ezproxy.univ-tln.fr:2048/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=ToulonT_1"
}, {
"name": "Université de Tours",
"AUTH_URL": "https://proxy.scd.univ-tours.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=butours"
}, {
"name": "Université de Versailles St-Quentin-en-Yvelines",
"AUTH_URL": "https://ezproxy.universite-paris-saclay.fr/login?url=http://nouveau.europresse.com/access/ip/default.aspx?un=U031535T_1"
}, {
"name": "University of Cambridge",
"AUTH_URL": "https://ezp.lib.cam.ac.uk/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U031883T_1"
}, {
"name": "TBS Education",
"AUTH_URL": "http://hub.tbs-education.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=CAPITOLET_11ip"
}, {
"name": "Toulouse Métropole - MaBM",
"AUTH_URL": "https://mabm.toulouse-metropole.fr/Portal/ASSARedirect.ashx?url=https://nouveau.europresse.com/access/httpref/default.aspx?un=bmtoulouseAU_1"
}, {
"name": "Métropole de Grenoble - Numothèque",
"AUTH_URL": "https://numotheque.grenoblealpesmetropole.fr/plateforme-redirect/BIB?url=https%3A%2F%2Fnouveau.europresse.com%2Faccess%2Fhttpref%2Fdefault.aspx?un=GRENOBLEU_2"
}, {
"name": "VetAgro Sup",
"AUTH_URL": "https://ezproxy.vetagro-sup.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=U032869T_1"
}];
function getOphirofoxConfigByName(search_name) {
return ophirofox_config_list.find(({
name
}) => search_name === name);
}
const DEFAULT_SETTINGS = {
partner_name: "Pas d'intermédiaire",
};
let current_settings = DEFAULT_SETTINGS;
async function getOphirofoxConfig() {
const url = new URL(window.location);
try {
const partner_name = universityName;
const name_match = getOphirofoxConfigByName(partner_name);
if (name_match) return name_match;
} catch (err) {
console.warn(
`No ophirofox domain found, using the default ${fallback.name}: ${err}`
);
}
const fallback = ophirofox_config_list[0];
return fallback;
}
const ophirofox_config = getOphirofoxConfig();
async function setKeywords(keywords, publishedTime) {
await GM.setValue("ophirofox_keywords", keywords);
await GM.setValue("ophirofox_published_time", publishedTime);
}
/**
* Crée un lien vers Europresse avec les keywords donnés
* @param {string} keywords
* @returns {Promise<HTMLAnchorElement>}
*/
async function ophirofoxEuropresseLink(keywords, {
publishedTime
} = {}) {
// Keywords is the article name
keywords = keywords ? keywords.trim() : document.querySelector("h1").textContent;
// Trying to determine published time with meta tags (Open Graph values)
publishedTime = publishedTime || document.querySelector("meta[property='article:published_time'], meta[property='og:article:published_time'], meta[property='date:published_time']")
?.getAttribute("content") || '';
// Creating HTML anchor element
const a = document.createElement("a");
a.textContent = "Lire sur Europresse";
a.className = "ophirofox-europresse";
a.onmousedown = setKeywords(keywords, publishedTime);
a.onclick = async function(evt) {
evt.preventDefault();
await Promise.resolve([ophirofox_config, setKeywords(keywords, publishedTime)])
const obj = await ophirofox_config;
window.location = obj.AUTH_URL;
}
ophirofox_config.then(({
AUTH_URL
}) => {
a.href = AUTH_URL
});
return a;
}
if (
"https://nouveau-europresse-com.essec.idm.oclc.org/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.univ-catholille.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.upf.pf/*".includes(hostname) ||
"https://nouveau-eureka-cc.res.banq.qc.ca/*".includes(hostname) ||
"https://nouveau-europresse-com.budistant.univ-nantes.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.proxy.rubens.ens.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.rp1.ensam.eu/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.universite-paris-saclay.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezpaarse.univ-paris1.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.accesdistant.bu.univ-paris8.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.docelec.insa-lyon.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.rproxy.insa-rennes.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.bnf.idm.oclc.org/*".includes(hostname) ||
"https://nouveau-europresse-com.docelec.univ-lyon1.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezpum.scdi-montpellier.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezpupv.scdi-montpellier.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.sid2nomade-2.grenet.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.u-bordeaux-montaigne.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.docelec.u-bordeaux.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.proxy.sciencespobordeaux.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.proxy.unice.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.acces.bibliotheque-diderot.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.scd-proxy.uha.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.ensta-bretagne.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.u-paris.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.faraway.parisnanterre.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.scd1.univ-fcomte.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.rproxy.univ-pau.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.univ-artois.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.doc-elec.univ-lemans.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.lama.univ-amu.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.portail.psl.eu/*".includes(hostname) ||
"https://nouveau-europresse-com.passerelle.univ-rennes1.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ressources-electroniques.univ-lille.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.acces-distant.sciencespo.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ressources.univ-poitiers.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.bibelec.univ-lyon2.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.gorgone.univ-toulouse.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezscd.univ-lyon3.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.u-pec.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.univ-smb.idm.oclc.org/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.univ-paris13.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.campus-condorcet.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.mediaproxy.imtbs-tsp.eu/*".includes(hostname) ||
"https://nouveau-europresse-com.buadistant.univ-angers.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.accesdistant.sorbonne-universite.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.docelec-u-paris2.idm.oclc.org/*".includes(hostname) ||
"https://nouveau-europresse-com.esc-clermont.idm.oclc.org/*".includes(hostname) ||
"https://nouveau-europresse-com.acces-distant.bnu.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.bu-services.univ-antilles.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.proxybib-pp.cnam.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.srvext.uco.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.urca.idm.oclc.org/*".includes(hostname) ||
"https://nouveau-europresse-com.merlin.u-picardie.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.univ-littoral.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.bases-doc.univ-lorraine.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.utbm.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.distant.bu.univ-rennes2.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.hec.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.proxy-bu1.u-bourgogne.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.normandie-univ.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.bibdocs.u-cergy.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.univ-tln.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.univ-paris3.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.proxy.scd.univ-tours.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.federation.unimes.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezp.lib.cam.ac.uk/*".includes(hostname) ||
"https://nouveau-europresse-com.extranet.enpc.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.scd-proxy.univ-brest.fr/*".includes(hostname) ||
"https://nouveau-europresse-com-s.docadis.univ-tlse3.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.univ-orleans.fr/*".includes(hostname) ||
"https://europresse.ezproxy.univ-ubs.fr/*".includes(hostname) ||
"https://nouveau.europresse.com.elgebar.univ-reunion.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.uca.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ressources.sciencespo-lyon.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.proxy.univ-nc.nc/*".includes(hostname) ||
"https://nouveau-europresse-com.buproxy2.univ-avignon.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.proxy.utt.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.proxy.bnl.lu/*".includes(hostname) ||
"https://nouveau-europresse-com.revproxy.escpeurope.eu/*".includes(hostname) ||
"https://nouveau-europresse-com.univ-eiffel.idm.oclc.org/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.unilim.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.uphf.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.rennes-sb.idm.oclc.org/*".includes(hostname) ||
"https://nouveau-europresse-com.hub.tbs-education.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.univ-perp.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.vetagro-sup.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.utc.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.ezproxy.ulb.ac.be/*".includes(hostname) ||
"https://nouveau-europresse-com.gutenberg.univ-lr.fr/*".includes(hostname) ||
"https://nouveau-europresse-com.bpi.idm.oclc.org/*".includes(hostname)) {
function removeMarkElements() {
// Remove all the <mark> elements, but keep their contents
Array.from(document.querySelectorAll("article mark")).forEach(mark => {
const repl = document.createElement("span");
repl.className = "mark";
Array.from(mark.childNodes).forEach(repl.appendChild.bind(repl));
mark.parentNode.replaceChild(repl, mark);
});
}
// Remove <mark> elements each time the page is updated
/*
let nextOp = null;
new MutationObserver(() => {
if (nextOp) clearTimeout(nextOp);
nextOp = setTimeout(removeMarkElements, 500);
}).observe(document.body, { subtree: true, childList: true });
*/
async function consumeReadRequest() {
const keywords = await GM.getValue("ophirofox_keywords");
const published_time = await GM.getValue("ophirofox_published_time");
const readRequest = {
keywords,
published_time
};
await GM.deleteValue("ophirofox_keywords");
await GM.deleteValue("ophirofox_published_time");
return readRequest;
}
async function onLoad() {
ophirofoxRealoadOnExpired();
const path = window.location.pathname;
if (!(
path.startsWith("/Search/Reading") ||
path.startsWith("/Search/Advanced") ||
path.startsWith("/Search/AdvancedMobile") ||
path.startsWith("/Search/Express") ||
path.startsWith("/Search/Simple") ||
path.startsWith("/Search/Result")
)) return;
const readRequest = await consumeReadRequest();
const search_terms = readRequest.keywords;
const published_time = readRequest.published_time;
if (!search_terms) return;
const stopwords = new Set(['d', 'l', 'et', 'sans', 'or']);
const keywords = search_terms
.replace(/œ/g, 'oe')
.split(/[^\p{L}]+/u)
.filter(w => !stopwords.has(w))
.join(' ');
const keyword_field_id = path.startsWith("/Search/Result") ? "NativeQuery" : "Keywords";
onElemAvailable('#' + keyword_field_id).then((selector) => {
const keyword_field = selector;
keyword_field.value = 'TIT_HEAD=' + keywords;
keyword_field.form.submit();
});
onElemAvailable('#DateFilter_DateRange').then((selector) => {
const date_filter = selector;
if (date_filter) {
if (!published_time) { // Full expand the time range
date_filter.value = 9;
} else {
const publishedDate = new Date(published_time);
publishedDate.setUTCHours(0, 0, 0, 0); // Europresse saves the exact UTC date, but "depuis X jours" is based on midnight
const currentDate = new Date();
const timeDifference = currentDate.getTime() - publishedDate.getTime();
// Rounds up for tolerance to be sure to not filtering badly
const daysDifference = Math.ceil(timeDifference / (1000 * 60 * 60 * 24));
let filterValue = 9;
switch (true) {
case (daysDifference <= 1):
filterValue = 2; // Depuis hier
break;
case (daysDifference <= 3):
filterValue = 11; // Depuis 3 jours
break;
case (daysDifference <= 7):
filterValue = 3; // Depuis 7 jours
break;
case (daysDifference <= 30):
filterValue = 4; // Depuis 30 jours
break;
case (daysDifference <= 90):
filterValue = 5; // Depuis 3 mois
break;
case (daysDifference <= 180):
filterValue = 6; // Depuis 6 mois
break;
case (daysDifference <= 365):
filterValue = 7; // Depuis 1 an
break;
case (daysDifference <= 730):
filterValue = 8; // Depuis 2 ans
break;
default:
filterValue = 9; // Dans toutes les archives
break;
}
date_filter.value = filterValue;
}
}
});
}
function ophirofoxRealoadOnExpired() {
const params = new URLSearchParams(window.location.search)
if (params.get("ErrorCode") == "4000112") {
// session expirée
window.history.back();
}
}
onLoad().catch(console.error);
pasteStyle(`
mark,
span.mark {
animation-duration: 3s;
animation-name: background-fadeout;
animation-fill-mode: forwards;
background-color: transparent;
}
@keyframes background-fadeout {
from {
background-color: #fbf592;
}
to {
background-color: transparent;
}
}
`);
}
if ("https://www.lemonde.fr/*".includes(hostname)) {
window.addEventListener("load", function(event) {
function extractKeywords() {
return extractKeywordsFromTitle() || extractKeywordsFromUrl(window.location);
}
function extractKeywordsFromTitle() {
const titleElem = document.querySelector("h1.article__title");
return titleElem && titleElem.textContent;
}
function extractKeywordsFromUrl(url) {
const source_url = new URL(url);
const lemonde_match = source_url.pathname.match(/([^/.]+)(_\d*_\d*\.html)?$/);
if (!lemonde_match) throw new Error("Could not find keywords in lemonde url");
return lemonde_match[1];
}
async function createLink() {
const a = await ophirofoxEuropresseLink(extractKeywords());
a.classList.add("btn", "btn--premium");
return a;
}
async function onLoad() {
const statusElem = document.querySelector(".article__status");
if (statusElem) {
statusElem.appendChild(await createLink());
}
const paywallElem = document.querySelector(".paywall-04__cta");
if (paywallElem) {
const link = await createLink();
link.className = "lmd-btn lmd-btn--l lmd-btn--premium paywall-04__cta";
paywallElem.parentNode.insertBefore(link, paywallElem);
}
}
onLoad().catch(console.error);
});
pasteStyle(`
.ophirofox-europresse {
color: black;
margin-left: 7px;
}
#js-message-register{
display: none;
}
`);
}
if ("https://www.liberation.fr/*".includes(hostname)) {
window.addEventListener("load", function(event) {
function extractKeywords() {
return document
.querySelector("meta[property='og:title']")
.getAttribute("content");
}
/**
* Crée un lien vers Europresse avec les keywords donnés
* @param {string} publishedTime - article publication date (2024-01-01)
* @returns {Promise<HTMLAnchorElement>}
*/
async function createLink(publishedTime) {
const a = await ophirofoxEuropresseLink(extractKeywords(), {
publishedTime: publishedTime
});
return a;
}
function findPremiumBanner() {
const anchor = document.querySelector('div.TypologyArticle__BlockPremium-sc-1vro4tp-2');
if (!anchor) {
return;
}
return anchor;
}
async function onLoad(premiumBanner) {
if (premiumBanner) {
/*
The UI is reactive (and DOM rewritten), so we need to wait for some nodes to be rewritten to the DOM
before we can add our link. It seems that the React components are added to the DOM in a particular order.
With heavy loading, the MutationObserver execution is too late, and only catch .dossier-feed class.
After caching, we can rely on the .article-body-paywall added node.
Weird choices for a nearly-static content-driven website with SEO concerns.
*/
const observer = new MutationObserver(async mutationsList => {
for (let mutation of mutationsList) {
if (mutation.addedNodes.length > 0) {
const addedNode = mutation.addedNodes[0];
if (addedNode.classList.contains('dossier-feed') ||
addedNode.classList.contains('article-body-paywall')
) {
observer.disconnect();
// Not sure if premiumBanner is (and will be) still valid after DOM rewrite
if (!document.querySelector('div.TypologyArticle__BlockPremium-sc-1vro4tp-2 + a.ophirofox-europresse')) {
// See #239, Libération replaces date:published_time with the date of edit, which means that a search limited by the time of publication may be too restrictive
// We need to specify the date to use for the generic ophirofoxEuropresseLink function
// Might need refactor if other medias have the same problem, more properties for fail-safe
let publishedDate = document.querySelector("meta[property='article:published_time'], meta[property='og:article:published_time'], meta[property='date:published_time']")
?.getAttribute("content") || '';
let firstPublishedDate = /\"first_publish_date\":\"(\d{4}-\d{2}-\d{2}[A-Z]+\d{2}:\d{2}:\d{2}.[0-9+-:]+Z)/.exec(document.getElementById('fusion-metadata').textContent)[1] // 2024-08-27T18:18:55.663Z => UTC
let firstPublishedDateInstance = new Date(firstPublishedDate);
// date:published_time is used by default and when firstPublishedDate is not older
if (publishedDate && !publishedDate.trim()) {
// If the first published date is valid and older
if (!isNaN(firstPublishedDateInstance) && (firstPublishedDateInstance < new Date(publishedDate)))
publishedDate = firstPublishedDate;
} else {
// If we are here, Libération did big shit or just changed their Open Grahs properties
if (!isNaN(firstPublishedDateInstance)) {
publishedDate = firstPublishedDate;
}
}
findPremiumBanner().after(await createLink(publishedDate));
console.log('Ophirofox injected after React DOM rewrite');
break;
}
}
}
}
});
observer.observe(document.querySelector('#fusion-app'), {
childList: true,
subtree: true
});
}
}
// Edge-cases, it costs nothing to try to add it *à l'anciene*
createLink().then(link => {
const premiumBanner = findPremiumBanner();
if (premiumBanner) {
premiumBanner.after(link);
console.log('Ophirofox injected');
}
onLoad(premiumBanner);
});
});
pasteStyle(`
.ophirofox-europresse {
display: inline-block;
font-size: 0.875rem;
line-height: 1.125rem;
margin-bottom: 1rem;
margin-left: 0px;
padding: 5px 10px;
background-color: #eeb54e;
color: #000;
border-radius: 2px;
text-decoration: none;
}
.ophirofox-europresse:hover {