-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbpc.en.user.js
More file actions
5150 lines (4904 loc) · 208 KB
/
Copy pathbpc.en.user.js
File metadata and controls
5150 lines (4904 loc) · 208 KB
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==
// @name Bypass Paywalls Clean - en
// @version 4.2.5.1
// @description Bypass Paywalls of news sites
// @author magnolia1234
// @downloadURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.en.user.js
// @updateURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc.en.user.js
// @homepageURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @supportURL https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters
// @license MIT; https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=LICENSE
// @match *://*.com/*
// @match *://*.co.uk/*
// @match *://*.com.au/*
// @match *://*.co/*
// @match *://*.io/*
// @match *://*.net/*
// @match *://*.net.au/*
// @match *://*.org/*
// @match *://*.pub/*
// @match *://*.businessdesk.co.nz/*
// @match *://*.businesspost.ie/*
// @match *://*.businesstimes.com.sg/*
// @match *://*.capital.bg/*
// @match *://*.dnevnik.bg/*
// @match *://*.epoch.org.il/*
// @match *://*.europower.no/*
// @match *://*.fiskeribladet.no/*
// @match *://*.forbes.ua/*
// @match *://*.ftm.eu/*
// @match *://*.gitflic.ru/*
// @match *://*.haaretz.co.il/*
// @match *://*.iai.tv/*
// @match *://*.independent.ie/*
// @match *://*.indiatoday.in/*
// @match *://*.intrafish.no/*
// @match *://*.ipolitics.ca/*
// @match *://*.japantimes.co.jp/*
// @match *://*.livelaw.in/*
// @match *://*.nation.africa/*
// @match *://*.nautil.us/*
// @match *://*.niagarafallsreview.ca/*
// @match *://*.nv.ua/*
// @match *://*.nzherald.co.nz/*
// @match *://*.puck.news/*
// @match *://*.sloanreview.mit.edu/*
// @match *://*.stcatharinesstandard.ca/*
// @match *://*.theleaflet.in/*
// @match *://*.uxdesign.cc/*
// @match *://*.wellandtribune.ca/*
// @connect archive.fo
// @connect archive.is
// @connect archive.li
// @connect archive.md
// @connect archive.ph
// @connect archive.vn
// @connect djservices.io
// @exclude *://*.amazon-adsystem.com/*
// @exclude *://*.consentmanager.net/*
// @exclude *://*.centrefrance.com/*
// @exclude *://*.criteo.com/*
// @exclude *://*.dailymotion.com/*
// @exclude *://*.doubleclick.net/*
// @exclude *://*.dwcdn.net/*
// @exclude *://*.facebook.com/*
// @exclude *://*.google.com/*
// @exclude *://*.googleapis.com/*
// @exclude *://*.googletagmanager.com/*
// @exclude *://*.instagram.com/*
// @exclude *://*.klarna.com/*
// @exclude *://*.mediafire.com/*
// @exclude *://*.openx.net/*
// @exclude *://*.outbrain.com/*
// @exclude *://*.pinterest.com/*
// @exclude *://*.pubmatic.com/*
// @exclude *://*.rubiconproject.com/*
// @exclude *://*.seedtag.com/*
// @exclude *://*.smartadserver.com/*
// @exclude *://*.stripe.com/*
// @exclude *://*.taboola.com/*
// @exclude *://*.tinypass.com/*
// @exclude *://*.twitter.com/*
// @exclude *://*.ultimedia.com/*
// @exclude *://*.youtube.com/*
// @exclude *://*.abcmais.com/*
// @exclude *://*.bienpublic.com/*
// @exclude *://*.cambiocolombia.com/*
// @exclude *://*.clarin.com/*
// @exclude *://*.connaissancedesarts.com/*
// @exclude *://*.cronista.com/*
// @exclude *://*.diariocordoba.com/*
// @exclude *://*.diariovasco.com/*
// @exclude *://*.elconfidencial.com/*
// @exclude *://*.elcorreo.com/*
// @exclude *://*.elespanol.com/*
// @exclude *://*.elespectador.com/*
// @exclude *://*.elmercurio.com/*
// @exclude *://*.elpais.com/*
// @exclude *://elpais.com/*
// @exclude *://*.elperiodico.com/*
// @exclude *://*.elperiodicodearagon.com/*
// @exclude *://*.elperiodicoextremadura.com/*
// @exclude *://*.elperiodicomediterraneo.com/*
// @exclude *://*.eltiempo.com/*
// @exclude *://*.eltribuno.com/*
// @exclude *://*.eluniverso.com/*
// @exclude *://*.exame.com/*
// @exclude *://*.expansion.com/*
// @exclude *://*.faz.net/*
// @exclude *://*.globo.com/*
// @exclude *://*.handelsblatt.com/*
// @exclude *://*.ilsole24ore.com/*
// @exclude *://*.jeuneafrique.com/*
// @exclude *://*.journaldunet.com/*
// @exclude *://*.larioja.com/*
// @exclude *://*.lasegunda.com/*
// @exclude *://*.latercera.com/*
// @exclude *://*.lavenir.net/*
// @exclude *://*.ledauphine.com/*
// @exclude *://*.ledevoir.com/*
// @exclude *://*.lejsl.com/*
// @exclude *://*.lerevenu.com/*
// @exclude *://*.lesinrocks.com/*
// @exclude *://*.levante-emv.com/*
// @exclude *://*.loeildelaphotographie.com/*
// @exclude *://*.marca.com/*
// @exclude *://*.marianne.net/*
// @exclude *://*.parismatch.com/*
// @exclude *://*.parkiet.com/*
// @exclude *://*.politicaexterior.com/*
// @exclude *://*.pourleco.com/*
// @exclude *://*.projectcargojournal.com/*
// @exclude *://*.quotidiano.net/*
// @exclude *://*.railfreight.cn/*
// @exclude *://*.railfreight.com/*
// @exclude *://*.railtech.com/*
// @exclude *://*.reforme.net/*
// @exclude *://*.revistaoeste.com/*
// @exclude *://*.science-et-vie.com/*
// @exclude *://*.topagrar.com/*
// @exclude *://*.tt.com/*
// @exclude *://*.tuttosport.com/*
// @exclude *://*.valeursactuelles.com/*
// @exclude *://*.wochenblatt.com/*
// @grant GM.xmlHttpRequest
// @require https://gitflic.ru/project/magnolia1234/bypass-paywalls-clean-filters/blob/raw?file=userscript/bpc_func.js
// ==/UserScript==
(function() {
//'use strict';
if (window.top !== window.self && !matchDomain(['app.historytoday.com', 'appan.newscientist.com']))
return;
var usa_adv_local_domains = ['al.com', 'cleveland.com', 'lehighvalleylive.com', 'masslive.com', 'mlive.com', 'nj.com', 'oregonlive.com', 'pennlive.com', 'silive.com', 'syracuse.com'];
if (matchDomain(['adage.com', 'autonews.com', 'pionline.com'])) {
function crain_main() {
if (window.Fusion) {
window.Fusion.globalContent._id = 0;
window.Fusion.globalContent.content_restrictions = {};
}
}
window.setTimeout(function () {
insert_script(crain_main);
}, 100);
}
else if (matchDomain('nzherald.co.nz')) {
function nzherald_main() {
if (window.Fusion)
window.Fusion.globalContent.isPremium = false;
}
window.setTimeout(function () {
insert_script(nzherald_main);
}, 100);
}
else if (matchDomain(['thehindu.com', 'thehindubusinessline.com'])) {
function hindu_main() {
if (window) {
window.Adblock = false;
window.isNonSubcribed = false;
}
}
window.setTimeout(function () {
insert_script(hindu_main);
}, 100);
}
else if (matchDomain(usa_adv_local_domains)) {
function adv_main() {
if (window.adiData) {
window.adiData.entryTags = 0;
}
}
window.setTimeout(function () {
insert_script(adv_main);
}, 100);
}
window.setTimeout(function () {
var ca_torstar_domains = ['niagarafallsreview.ca', 'stcatharinesstandard.ca', 'thepeterboroughexaminer.com', 'therecord.com', 'thespec.com', 'thestar.com', 'wellandtribune.ca'];
var ke_nation_media_domains = ['businessdailyafrica.com', 'nation.africa'];
var medium_custom_domains = ['betterprogramming.pub', 'towardsdatascience.com'];
var no_dn_media_domains = ['dn.no', 'europower.no', 'fiskeribladet.no', 'hydrogeninsight.com', 'intrafish.com', 'intrafish.no', 'kystens.no', 'rechargenews.com', 'tradewindsnews.com', 'upstreamonline.com'];
var sg_sph_media_domains = ['businesstimes.com.sg', 'straitstimes.com'];
var uk_dmg_media_domains = ['dailymail.co.uk', 'mailonsunday.co.uk', 'thisismoney.co.uk'];
var uk_nat_world_domains = ['scotsman.com', 'yorkshirepost.co.uk'];
var usa_arizent_custom_domains = ['accountingtoday.com', 'benefitnews.com', 'bondbuyer.com', 'dig-in.com', 'financial-planning.com', 'nationalmortgagenews.com'];
var usa_conde_nast_domains = ['architecturaldigest.com', 'bonappetit.com', 'cntraveler.com', 'epicurious.com', 'gq.com' , 'newyorker.com', 'vanityfair.com', 'vogue.co.uk', 'vogue.com', 'wired.com'];
var usa_craincomm_domains = ['360dx.com', 'adage.com', 'autonews.com', 'chicagobusiness.com', 'crainscleveland.com', 'crainsdetroit.com', 'crainsgrandrapids.com', 'crainsnewyork.com', 'european-rubber-journal.com', 'genomeweb.com', 'modernhealthcare.com', 'pionline.com', 'plasticsnews.com', 'precisionmedicineonline.com', 'rubbernews.com', 'sustainableplastics.com', 'tirebusiness.com', 'utech-polyurethane.com'];
var usa_gannett_domains = ['azcentral.com', 'cincinnati.com', 'commercialappeal.com', 'courier-journal.com', 'democratandchronicle.com', 'desmoinesregister.com', 'detroitnews.com', 'dispatch.com', 'freep.com', 'indystar.com', 'jacksonville.com', 'jsonline.com', 'knoxnews.com', 'news-press.com', 'northjersey.com', 'oklahoman.com', 'palmbeachpost.com', 'tennessean.com'];
var usa_hearst_comm_domains = ['ctpost.com', 'expressnews.com', 'houstonchronicle.com', 'nhregister.com', 'sfchronicle.com', 'statesman.com', 'timesunion.com'];
var usa_lee_ent_domains = ['buffalonews.com', 'journalnow.com', 'journalstar.com', 'madison.com', 'nwitimes.com', 'omaha.com', 'richmond.com', 'stltoday.com', 'tucson.com', 'tulsaworld.com'];
var usa_mcc_domains = ['bnd.com', 'charlotteobserver.com', 'elnuevoherald.com', 'fresnobee.com', 'kansas.com', 'kansascity.com', 'kentucky.com', 'mcclatchydc.com', 'miamiherald.com', 'newsobserver.com', 'sacbee.com', 'star-telegram.com', 'thestate.com', 'tri-cityherald.com'];
var usa_mng_domains = ['bostonherald.com', 'denverpost.com', 'eastbaytimes.com', 'mercurynews.com', 'ocregister.com', 'pressenterprise.com', 'sandiegouniontribune.com', 'twincities.com'];
var usa_nymag_domains = ['curbed.com', 'grubstreet.com', 'nymag.com', 'thecut.com', 'vulture.com'];
var usa_outside_mag_domains = ["backpacker.com", "betamtb.com", "betternutrition.com", "cleaneatingmag.com", "climbing.com", "outsideonline.com", "oxygenmag.com", "skimag.com", "trailrunnermag.com", "triathlete.com", "vegetariantimes.com", "womensrunning.com", "yogajournal.com"];
var usa_penske_media_domains = ['billboard.com', 'rollingstone.com', 'sourcingjournal.com', 'sportico.com', 'variety.com', 'wwd.com'];
var usa_tribune_domains = ['baltimoresun.com', 'capitalgazette.com', 'chicagotribune.com', 'courant.com', 'dailypress.com', 'mcall.com', 'nydailynews.com', 'orlandosentinel.com', 'pilotonline.com', 'sun-sentinel.com'];
if (matchDomain('gitflic.ru')) {
if (window.location.pathname.startsWith('/project/magnolia1234/bpc_uploads') && document.head) {
let sheet = document.createElement('style');
let path_short = window.location.pathname.replace('/project/magnolia1234/bpc_uploads', '');
if (!path_short)
sheet.innerText = 'div[data-cell-type="commit"], div[data-cell-type="date"] {display: none !important;} div[data-cell-type="filename"] {flex: 0 0 100% !important;}';
else if (path_short.match(/^\/(blob|file)/))
sheet.innerText = 'div.project-files-tree, div.project-files-list {flex: 0 0 50% !important; max-width: 50% !important;}';
if (sheet.innerText)
document.head.appendChild(sheet);
}
}
if (matchDomain('medium.com') || matchDomain(medium_custom_domains) || document.querySelector('head > link[href*=".medium.com/"]')) {
let url = window.location.href;
let paywall = document.querySelector('article.meteredContent');
if (paywall) {
paywall.removeAttribute('class');
let header = paywall.querySelector('h1');
if (header)
header.before(externalLink(['freedium.cfd', 'freedium-mirror.cfd', 'readmedium.com', 'archive.today'], 'https://{domain}/{url}', url, 'BPC > Try for full article text:'));
}
window.setTimeout(function () {
let banner = pageContains('div > div > p', /author made this story available to/);
if (banner.length)
removeDOMElement(banner[0].parentNode.parentNode);
}, 1000);
}
else if (window.location.hostname.match(/\.(au|nz)$/) || matchDomain(['afr.com'])) {//australia & new zealand
if (matchDomain('afr.com')) {
let error = document.querySelector('div[data-testid="DefaultError"]');
if (error)
refreshCurrentTab();
let article_sel = '#endOfArticle:not(:empty)';
let article = document.querySelector(article_sel);
if (!article) {
article_sel = '#body-content';
article = document.querySelector(article_sel);
}
if (article) {
window.setTimeout(function () {
let pars = article.querySelectorAll('p:not([class]), p[class*="-defaultWrapper"], figure:not(:empty)');
let pagination = document.querySelector('div > span#pagination-top');
if ((pars.length && pars.length < 5) || pagination) {
if (pagination) {
removeDOMElement(pagination.parentNode);
} else {
let loading = pageContains(article_sel + ' div', 'Loading...');
removeDOMElement(...pars, ...loading);
}
let url = window.location.href.split(/[#\?]/)[0];
fetch(url)
.then(response => {
if (response.ok) {
response.text().then(html => {
if (html.includes('__REDUX_STATE__=')) {
try {
let json = JSON.parse(html.split('__REDUX_STATE__=')[1].split('};')[0].replace(/:undefined([,}])/g, ':0$1').replace(/new\sMap\(\[[^{]*\]\)/g, 0) + '}');
if (json) {
let placeholders;
function find_item(match, p1, offset, string) {
let placeholder_id = p1;
let result = '';
if (placeholder_id && placeholders[placeholder_id]) {
let item = placeholders[placeholder_id];
if (item.data) {
if (['linkArticle', 'linkExternal'].includes(item.type)) {
if (item.data.text) {
if (item.data.url)
result = '<a href="' + item.data.url + '"' + (item.data.newTab ? 'target="_blank"' : '') + '>' + item.data.text + '</a>';
else
result = item.data.text;
}
} else if (item.type === 'image') {
if (item.data.fileName) {
let credit = (item.data.credit && item.data.credit.trim()) || item.data.source;
result = '<figure><img src="https://static.ffx.io/images/w_960/' + item.data.fileName + '" style="width: 100%;"><figcaption>' + (item.data.caption ? item.data.caption : '') + (credit ? '<span style="font-weight: bold;"> ' + credit + '</span>' : '') + '</figcaption></figure>';
}
} else if (item.type === 'youtube') {
if (item.data.url) {
if (item.data.url.includes('watch?v='))
result = '<iframe src="' + item.data.url.replace('watch?v=', 'embed/') + '" style="width: 100%; height: 400px;"></iframe>';
else
result = '<a href="' + item.data.url + '" target="_blank">' + item.data.url + '</a>';
}
} else if (['instagram', 'twitter'].includes(item.type)) {
if (item.data.url)
result = '<a href="' + item.data.url + '" target="_blank">' + item.data.url + '</a>';
} else if (item.type === 'iframe') {
if (item.data.url)
result = '<iframe src="' + item.data.url + '" style="width: 100%; height: 400px; border: none;"></iframe>';
} else if (!['callout', 'quote', 'relatedStory', 'video'].includes(item.type)) {
console.log(item);
}
}
}
return result;
}
let json_text = json.page.content.asset.body;
if (json_text) {
placeholders = json.page.content.asset.bodyPlaceholders;
if (placeholders)
json_text = json_text.replace(/<x-placeholder id="(\w+)"><\/x-placeholder>/g, find_item);
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + json_text + '</div>', 'text/html');
let content_new = doc.querySelector('div');
let widget = document.querySelector('div[class$="-wrapper"] > div#WidgetContainer');
if (article_sel.startsWith('#endOfArticle')) {
article.parentNode.replaceChild(content_new, article);
if (widget)
content_new.firstChild.before(widget.parentNode);
window.setTimeout(function () {
content_new.id = 'endOfArticle';
}, 500);
} else
article.firstChild.before(content_new);
addStyle(article_sel + ' p {margin: 20px 0px;}');
} else {
let parser = new DOMParser();
let posts = json.page.content.asset.posts;
article.innerHTML = '';
for (let post of posts) {
let asset = post.asset;
if (asset && asset.body) {
let json_text = asset.body;
placeholders = asset.bodyPlaceholders;
if (placeholders)
json_text = json_text.replace(/<x-placeholder id="(\w+)"><\/x-placeholder>/g, find_item);
let doc = parser.parseFromString('<section>' + json_text + '</section>', 'text/html');
let par = doc.querySelector('section');
let header;
if (asset.headlines && asset.headlines.headline) {
header = document.createElement('h2');
header.innerText = asset.headlines.headline;
header.id = post.id;
}
let byline;
if (asset.byline) {
byline = document.createElement('p');
byline.innerText = asset.byline;
byline.style = 'margin-bottom: 24px;'
}
article.append(header, byline, par);
}
}
addStyle('section:not([class]) > p {margin: 24px 0px;}');
let key_posts = document.querySelectorAll('li > a[href*="?post="]');
for (let elem of key_posts)
elem.href = elem.href.replace('?post=', '#');
}
}
} catch (err) {
console.log(err);
}
}
});
}
}).catch(function (err) {
false;
});
}
}, 1000);
}
}
else if (matchDomain('businessdesk.co.nz')) {
let paywall = document.querySelector('div.paywall');
if (paywall) {
paywall.classList.remove('paywall');
let signup_box = document.querySelector('div.signup-box-container');
removeDOMElement(signup_box);
let url = window.location.href.split(/[#\?]/)[0];
fetch(url, {headers: {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"}})
.then(response => {
if (response.ok) {
response.text().then(html => {
let match = html.match(/:query="'([^"]+)'"/);
if (match) {
let parser = new DOMParser();
let src_text = breakText(parseHtmlEntities(match[1])).replace(/\n\n/g, '<br><br>').replace(/\.([^\s\d]|&)/g, ". $1");
let doc = parser.parseFromString('<div>' + src_text + '</div>', 'text/html');
let content_new = doc.querySelector('div');
paywall.innerHTML = '';
paywall.appendChild(content_new);
}
})
}
})
}
}
else if (matchDomain(['crikey.com.au', 'smartcompany.com.au', 'themandarin.com.au'])) {
let ads = 'div.wp-block-pm-ad-placeholder-block';
hideDOMStyle(ads);
}
else if (matchDomain('forbes.com.au')) {
setCookie('blaize_session', '', 'forbes.com.au', '/', 0);
getJsonUrl('div[class*="_gate"]', '', 'div.article-page__content-body');
let fade = document.querySelector('div[style*="background-image: linear-gradient"]');
removeDOMElement(fade);
}
else if (matchDomain('macrobusiness.com.au')) {
let paywall = pageContains('div > p', 'The full text of this article is available');
if (paywall[0]) {
let fade = document.querySelector('div.bg-gradient-to-t');
removeDOMElement(paywall[0].parentNode, fade);
let json_script = document.querySelector('script#__NUXT_DATA__');
if (json_script) {
try {
let json = JSON.parse(json_script.text);
let json_text = json.filter(x => typeof x === 'string' && x.match(/(<|\\u003C)p>/))[0];
if (json_text) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + json_text + '</div>', 'text/html');
let content_new = doc.querySelector('div');
let article = document.querySelector('div.content');
if (article) {
article.innerHTML = '';
article.appendChild(content_new);
}
} else
refreshCurrentTab();
} catch (err) {
console.log(err);
}
}
}
}
else if (matchDomain('nzherald.co.nz')) {
// use bpc adblocker filter
let premium_toaster = '#premium-toaster';
hideDOMStyle(premium_toaster);
}
else if (matchDomain('spectator.com.au')) {
getJsonUrl('section.paywall', '', 'div.article-body', {art_append: 1});
}
else if (matchDomain('thesaturdaypaper.com.au')) {
let hide_end = document.querySelector('div.hide-end');
if (hide_end)
refreshCurrentTab();
let paywall = document.querySelector('div.paywall-hard-always-show');
removeDOMElement(paywall);
}
else if (matchDomain(['brisbanetimes.com.au', 'smh.com.au', 'theage.com.au', 'watoday.com.au'])) {
if (!window.location.hostname.startsWith('amp.')) {
amp_redirect('head > meta[content^="FOR SUBSCRIBERS"], #paywall_prompt');
} else {
amp_unhide_subscr_section();
}
}
else {
// Australian Community Media newspapers
let au_comm_media_domains = ['bendigoadvertiser.com.au', 'bordermail.com.au', 'canberratimes.com.au', 'centralwesterndaily.com.au', 'dailyadvertiser.com.au', 'dailyliberal.com.au', 'examiner.com.au', 'illawarramercury.com.au', 'newcastleherald.com.au', 'northerndailyleader.com.au', 'standard.net.au', 'theadvocate.com.au', 'thecourier.com.au', 'westernadvocate.com.au'];
if (matchDomain(au_comm_media_domains) || document.querySelector('div#footer a[href^="https://acm.media/"]')) {
let mask = document.querySelector('div[class^="gradient-mask-"]');
if (mask) {
mask.removeAttribute('class');
let div_hidden = document.querySelectorAll('div.flex-col div.hidden');
for (let elem of div_hidden)
elem.classList.remove('hidden');
} else {
let subscribe_truncate = document.querySelector('.subscribe-truncate');
if (subscribe_truncate)
subscribe_truncate.classList.remove('subscribe-truncate');
let subscriber_hiders = document.querySelectorAll('.subscriber-hider');
for (let subscriber_hider of subscriber_hiders)
subscriber_hider.classList.remove('subscriber-hider');
}
let noscroll = document.querySelectorAll('html[style], body[style]');
for (let elem of noscroll)
elem.removeAttribute('style');
let story_generic_iframe = '.story-generic__iframe';
let blocker = 'div.blocker';
let overlays = 'div.transition-all, div[id^="headlessui-dialog"]';
let ads = '.ad-placeholder, .sticky, [id*="-container"], #hindsight-ads-iframe, div.vf3-conversations-list__promo, div#tbl-next-up, iframe[data-ad-id]';
hideDOMStyle(story_generic_iframe + ', ' + blocker + ', ' + overlays + ', ' + ads);
} else if (window.location.hostname.endsWith('.com.au')) {
// Australia News Corp
let au_news_corp_domains = ['adelaidenow.com.au', 'cairnspost.com.au', 'codesports.com.au', 'couriermail.com.au', 'dailytelegraph.com.au', 'geelongadvertiser.com.au', 'goldcoastbulletin.com.au', 'heraldsun.com.au', 'theaustralian.com.au', 'thechronicle.com.au', 'themercury.com.au', 'townsvillebulletin.com.au', 'weeklytimesnow.com.au'];
if (matchDomain(au_news_corp_domains) || matchDomain('ntnews.com.au')) {
let url = window.location.href;
if (window.location.pathname.startsWith('/subscribe/') && !url.includes('/digitalprinteditions')) {
let og_url = document.querySelector('head > meta[property="og:url"][content]');
if (og_url) {
let url_new = og_url.content;
if (matchDomain('ntnews.com.au')) {
let article = document.querySelector('div.dsf-article-preview');
if (article) {
article.before(googleSearchToolLink(url_new));
}
} else {
url_new += '?amp';
window.setTimeout(function () {
window.location.href = url_new;
}, 500);
}
}
} else if (window.location.search.match(/[&\?]amp/)) {
amp_unhide_subscr_section('[id^="ad-mrec-"]', false);
let figure_stretch = document.querySelectorAll('figure.stretch');
for (let elem of figure_stretch)
elem.classList.remove('stretch');
let comments = document.querySelector('#comments-load, .comments-module');
removeDOMElement(comments);
} else {
if (window.location.pathname.includes('/video/') && document.querySelector('div.vms-premium-video'))
header_nofix('div.video-hub');
let ads = '.header_ads-container, .ad-block';
hideDOMStyle(ads);
}
} else {
// Australian Seven West Media
if (matchDomain('thewest.com.au') || document.querySelector('head > link[href="https://images.thewest.com.au"]')) {
function thewest_main(node) {
let filter = /^window\.PAGE_DATA\s?=\s?/;
let json_script = getSourceJsonScript(filter);
if (json_script) {
let json_text = json_script.text.split(filter)[1];
json_text = json_text.replace(/:undefined([,}])/g, ':"undefined"$1');
try {
let json_article = JSON.parse(json_text);
let json_pub;
for (let key in json_article) {
let json_resolution = json_article[key].data.result.resolution;
if (json_resolution && json_resolution.publication) {
json_pub = json_resolution.publication;
break;
}
}
let json_content = [];
let url_loaded;
if (json_pub) {
json_content = json_pub.content.blocks;
url_loaded = json_pub._self;
} else
refreshCurrentTab();
//let json_video = json_pub.mainVideo;
let url = window.location.href;
if (!url_loaded || !url.includes(url_loaded.slice(-10)))
refreshCurrentTab();
let par_elem, par_sub1, par_sub2;
let par_dom = document.createElement('div');
let tweet_id = 1;
for (let par of json_content) {
par_elem = '';
if (par.kind === 'text') {
par_elem = document.createElement('p');
par_elem.innerText = par.text;
} else if (par.kind === 'subhead') {
par_elem = document.createElement('h2');
par_elem.innerText = par.text;
} else if (par.kind === 'pull-quote') {
par_elem = document.createElement('i');
par_elem.innerText = (par.attribution ? par.attribution + ': ' : '') + par.text;
} else if (par.kind === 'embed') {
if (par.reference.includes('https://omny.fm/') || par.reference.includes('https://docdro.id/')) {
par_elem = document.createElement('embed');
par_elem.src = par.reference;
par_elem.style = 'height:500px; width:100%';
par_elem.frameborder = '0';
} else {
par_elem = document.createElement('a');
par_elem.href = par.reference;
par_elem.innerText = par.reference.split('?')[0];
}
} else if (par.kind === 'unordered-list') {
if (par.items) {
par_elem = document.createElement('ul');
for (let item of par.items)
if (item.text) {
par_sub1 = document.createElement('li');
if (item.intentions[0] && item.intentions[0].href) {
par_sub2 = document.createElement('a');
par_sub2.href = item.intentions[0].href;
} else {
par_sub2 = document.createElement('span');
}
par_sub2.innerText = item.text;
par_sub1.appendChild(par_sub2);
par_elem.appendChild(par_sub1);
}
}
} else if (par.kind === 'inline') {
if (par.asset.kind === 'image' && par.asset.original && par.asset.original.reference) {
par_elem = makeFigure(par.asset.original.reference, par.asset.captionText, {style: 'width:100%'});
}
} else if (par.kind === 'inline-related') {
par_elem = document.createElement('p');
if (par.publications) {
for (let elem of par.publications) {
let par_link = document.createElement('a');
par_link.href = elem._self;
par_link.innerText = elem.heading;
par_elem.appendChild(par_link);
par_elem.appendChild(document.createElement('br'));
}
}
} else {
par_elem = document.createElement('p');
par_elem.innerText = par.text;
console.log(par.kind);
}
if (par_elem)
par_dom.appendChild(par_elem);
}
let content = document.querySelector('div[class*="StyledArticleContent"]');
if (content) {
content.innerHTML = '';
content.appendChild(par_dom);
} else {
par_dom.setAttribute('style', 'margin: 20px;');
node.before(par_dom);
}
} catch (err) {
console.log(err);
}
}
removeDOMElement(node);
}
let paywall_sel = 'div.paywall div[data-testid*="BreachScreen"], div[class*="StyledBreachWallContent"]';
let paywall = document.querySelector(paywall_sel);
if (paywall)
thewest_main(paywall);
waitDOMElement(paywall_sel, 'DIV', thewest_main, true);
let ads = 'div.headerAdvertisement, div.disabled-ad, div.ad-no-notice';
hideDOMStyle(ads);
} else if (document.querySelector('head > link[rel="dns-prefetch"][href="//static.ew.mmg.navigacloud.com"]')) { // McPherson Media Group
let paywall = document.querySelector('div#content-Load-message');
if (paywall) {
removeDOMElement(paywall);
let lockable = document.querySelectorAll('div[id^="lockable-"]');
for (let elem of lockable) {
elem.removeAttribute('style');
elem.removeAttribute('id');
}
let gradient = document.querySelector('div.gradienttext');
if (gradient)
gradient.removeAttribute('class');
}
}
}
}
}
} else if ((window.location.hostname.match(/\.(ie|uk)$/) && !matchDomain(['vogue.co.uk'])) || matchDomain(['apollo-magazine.com', 'autosport.com', 'decanter.com', 'fnlondon.com', 'ft.com', 'gbnews.com', 'granta.com', 'iai.tv', 'irishexaminer.com', 'motorsportmagazine.com', 'newstatesman.com', 'scotsman.com', 'tes.com', 'the-tls.com', 'thelawyer.com', 'thetimes.com', 'unherd.com'])) {//united kingdom/ireland
if (matchDomain('apollo-magazine.com')) {
setCookie('blaize_session', '', 'apollo-magazine.com', '/', 0);
let banner = document.querySelector('#subscribe-ribbon');
removeDOMElement(banner);
}
else if (matchDomain('autocar.co.uk')) {
let paywall = document.querySelector('div.ms-block, div.register-block');
if (paywall) {
removeDOMElement(paywall);
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = json.articleBody;
let article = document.querySelector('div.block-node');
if (json_text && article) {
article.innerHTML = '';
let article_new = document.createElement('p');
article_new.innerText = json_text;
let fade = document.querySelector('div.article-section > div[style*="max-height"]');
removeDOMElement(fade);
let url = window.location.href;
article.append(article_new, 'Text-only > for missing media/links: ', googleSearchToolLink(url));
}
}
}
}
let ads = 'div[class*="-ads-"]';
hideDOMStyle(ads);
}
else if (matchDomain('autosport.com')) {
header_nofix('div.ms-article-content > p', 'div.ms-piano_article-banner');
}
else if (matchDomain(['belfasttelegraph.co.uk', 'independent.ie'])) {
let paywall = document.querySelector('div[class*="_fadetowhite"]');
if (paywall) {
let content = document.querySelector('script[data-fragment-type="ArticleContent"]');
if (content) {
removeDOMElement(paywall);
let flip_pay = 'div#flip-pay';
hideDOMStyle(flip_pay, 5);
let intro = document.querySelector('div > div[data-auth-intro="article"]');
if (intro) {
let intro_par = intro.querySelector('p[class]');
let intro_par_class;
if (intro_par)
intro_par_class = intro_par.getAttribute('class');
let content_text = content.innerText;
if (content_text.includes('__PRELOADED_STATE_GRAPH')) {
content_text = content_text.replace(/window\["__PRELOADED_STATE_GRAPH__.+"\]\s=\s/, '');
try {
let json = JSON.parse(content_text);
if (Object.keys(json).length) {
let key = Object.keys(json)[0];
let pars = json[key].data.article.body;
let parser = new DOMParser();
for (let par of pars) {
for (let type in par) {
let item = par[type];
let elem = document.createElement('p');
elem.setAttribute('style', "margin: 10px;");
if (type === 'bullet_list') {
let ul = document.createElement('ul');
for (let sub_item of item) {
li.innerText = parseHtmlEntities(sub_item.replace(/<[^<]*>/g, ''));
li.innerText = sub_item;
ul.appendChild(li);
}
elem.appendChild(ul);
} else if (type === 'image') {
let url = item.url;
if (item.cropped && item.cropped.url)
url = item.cropped.url;
let figure = makeFigure(url, item.caption);
elem.appendChild(figure);
} else if (type === 'related') {
if (item.articles) {
let articles = item.articles;
for (let article of articles) {
let elem_link = document.createElement('a');
elem_link.href = article.webcmsRelativeUrl;
elem_link.innerText = article.title;
elem_link.style = 'text-decoration: underline;';
elem.append(elem_link, document.createElement('br'));
}
}
} else if (!['ad', 'quote', 'streamone'].includes(type)) {
let html = parser.parseFromString('<p class="' + intro_par_class + '">' + item + '</p>', 'text/html');
elem = html.querySelector('p');
elem.querySelectorAll('iframe[allow*="fullscreen"][allowfullscreen]').forEach(e => e.removeAttribute('allowfullscreen'));
if (!['p', 'subhead', 'legacy-ml'].includes(type)) {
console.log(type);
console.log(item);
}
}
window.setTimeout(function () {
if (elem)
intro.parentNode.appendChild(elem);
}, 500);
}
}
}
} catch (err) {
console.log(err);
}
}
}
}
}
let ads = 'div.ad';
hideDOMStyle(ads);
}
else if (matchDomain('businesspost.ie')) {
func_post = function () {
if (mobile) {
let lazy_images = document.querySelectorAll('div[style] > img[loading="lazy"][style]');
for (let elem of lazy_images) {
elem.style = 'width: 95%;';
elem.parentNode.removeAttribute('style');
}
}
}
let url = window.location.href;
getArchive(url, 'div#bp_piano_article_subscription_offer', '', 'div[itemprop="articleBody"]');
let ads = 'div[id^="Inline-MPU-article-"]';
hideDOMStyle(ads);
}
else if (matchDomain('decanter.com')) {
let paywall = document.querySelector('div[id^="react_subscriber_content_"]');
if (paywall) {
removeDOMElement(paywall);
let data = document.querySelector('div[data-dom-id^="react_subscriber_content_"][data-props]');
if (data) {
try {
let json = JSON.parse(data.getAttribute('data-props'));
if (json && json.content) {
let content = decode_utf8(atob(json.content));
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + content + '</div>', 'text/html');
let content_new = doc.querySelector('div');
data.before(content_new);
header_nofix('div.collection-wrapper', '', 'BPC > no fix for reviews');
let fade = 'div.piano-container-fade';
hideDOMStyle(fade);
}
} catch (err) {
console.log(err);
}
}
}
}
else if (matchDomain('fnlondon.com')) {
func_post = function () {
if (mobile) {
let lazy_images = document.querySelectorAll('picture > img[loading="lazy"][style]');
for (let elem of lazy_images) {
elem.style = 'width: 95%;';
elem.parentNode.removeAttribute('style');
}
}
}
let url = window.location.href;
getArchive(url, 'div[data-testid="articleSignInSubscribeWrapper"]', '', 'article');
let fade = 'div#cx-snippet';
hideDOMStyle(fade);
function fnlondon_main(node) {
window.setTimeout(function () {
let signin_links = node.querySelectorAll('a[href^="https://www.fnlondon.com/client/login?target="]');
for (let elem of signin_links) {
elem.href = '#';//elem.href.split('target=')[1].split('&')[0];
elem.innerText = 'Open';
elem.addEventListener('click', function () { window.location.reload(); });
}
}, 500);
}
waitDOMElement('div[id^="continuous_article_"]', 'DIV', fnlondon_main, true);
}
else if (matchDomain('ft.com')) {
func_post = function () {
let lazy_images = document.querySelectorAll('figure > picture > img[loading="lazy"][src^="data:image/gif"][new-cursrc]');
for (let elem of lazy_images) {
elem.removeAttribute('loading');
elem.style = 'width: 100%;';
let figure = elem.parentNode.parentNode;
if (figure.parentNode && figure.parentNode.nodeName === 'DIV')
figure.parentNode.removeAttribute('style');
elem.src = elem.getAttribute('new-cursrc');
}
if (mobile) {
let grids = document.querySelectorAll('div[style*="grid-template-areas"], article#site-content');
for (let elem of grids)
elem.style = 'margin: 10px;';
}
}
let url = window.location.href;
getArchive(url, 'div#barrier-page', '', 'div.n-layout__row--content', '', 'div[style*="article-body"]', 'body');
let banners = '.js-article-ribbon, div.o-ads, pg-slot';
hideDOMStyle(banners);
}
else if (matchDomain('gbnews.com')) {
let ads = 'div.ad--billboard, div.ad--placeholder, div.video-inbody';
hideDOMStyle(ads);
}
else if (matchDomain('granta.com')) {
getJsonUrl('div.article-sign-up-container', '', 'div.article-excerpt');
}
else if (matchDomain('iai.tv')) {
let paywall = document.querySelector('div.article-paywall-main');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div > div.iai-article--content-inner');
if (article) {
let content_new = document.querySelector('head > meta[name="twitter:description"][content]');
if (content_new) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + content_new.content + '</div>', 'text/html');
let article_new = doc.querySelector('div');
article.parentNode.replaceChild(article_new, article);
}
}
}
}
else if (matchDomain('irishexaminer.com')) {
setCookie('blaize_session', '', 'irishexaminer.com', '/', 0);
let premium = document.querySelector('head > meta[name="isPremium"][content="true"]');
let article = document.querySelector('article');
if (premium && article) {
removeDOMElement(premium);
function stripAppLinks(story) {
story.querySelectorAll('a.readmore-event[href$="?type=app"]').forEach(e => e.href = e.href.split('?')[0]);
}
let url = window.location.href;
let app = window.location.search.startsWith('?type=app');
if (!app) {
let paywall = document.querySelector('div#paywall-premium');
if (paywall) {
let body_hide = article.querySelector('style:not(:empty)');
removeDOMElement(paywall, body_hide);
let url_src = url.split(/[#\?]/)[0] + '?type=app';
let story = article.querySelector('story');
if (story) {
let podcast = article.querySelector('.bbw-embed');
if (!podcast) {
fetch(url_src)
.then(response => {
if (response.ok) {
response.text().then(html => {
if (html.includes('<story')) {
let parser = new DOMParser();
let doc = parser.parseFromString(html, 'text/html');
let story_new = doc.querySelector('story');
if (story_new) {
stripAppLinks(story_new);
story.parentNode.replaceChild(story_new, story);
}
}
});
}
});
} else
window.location.href = url_src;
} else
window.location.href = url_src;
}
} else {
let longread = document.querySelector('head > meta[name="isLongRead"][content="true"]');
if (longread) {
removeDOMElement(longread);
let row = article.querySelector('div.row');
if (row)
row.append(googleSearchToolLink(url.split('?')[0]));
} else {
let div = document.createElement('div');
div.style.margin = '20px';
let home = document.createElement('a');
home.innerText = window.location.hostname;
home.href = 'https://' + window.location.hostname;
div.append(home);
article.before(div);
let story = article.querySelector('story');
if (story)
stripAppLinks(story);
hideDOMStyle('.bbw-embed');
}
}
}
}
else if (matchDomain('literaryreview.co.uk')) {
getJsonUrl('p.subscribe-for-more', '', 'div#_articlereview');
}
else if (matchDomain('motorsportmagazine.com')) {
getJsonUrl('aside.paywall', '', 'div[data-behaviour="post-content"]');
let banner = document.querySelector('div[data-behaviour="react-paywall-threshold"]');
removeDOMElement(banner);
let ads = 'aside.ad-space';
hideDOMStyle(ads);
}
else if (matchDomain('newstatesman.com')) {
let ads = 'div.ad';
hideDOMStyle(ads);
}
else if (matchDomain('spectator.co.uk')) {
setCookie(['blaize_session', 'userArticleViews'], '', 'spectator.co.uk', '/', 0);
let paywall_sel = 'section.paywall, div.paywall-magazine';
let entry_content = document.querySelector('div.entry-content');
if (entry_content)
getJsonUrl(paywall_sel, '', 'div.entry-content', {art_append: 1});
else