From 2c9cabdb06e7f878b62f56df265e047c2874aff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Rivi=C3=A8re?= Date: Sat, 18 Dec 2021 22:52:46 +0100 Subject: [PATCH] add archive.org --- tarteaucitron.services.js | 50 +++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/tarteaucitron.services.js b/tarteaucitron.services.js index 76e6ae5..4dbc7a5 100644 --- a/tarteaucitron.services.js +++ b/tarteaucitron.services.js @@ -5001,34 +5001,48 @@ tarteaucitron.services.mtcaptcha = { } }; -// Gallica -tarteaucitron.services.gallica = { - "key": "gallica", - "type": "other", - "name": "Gallica", - "uri": "https://gallica.bnf.fr/edit/und/conditions-dutilisation-des-contenus-de-gallica", +// Internet Archive / https://archive.org +tarteaucitron.services.archive = { + "key": "archive", + "type": "video", + "name": "Internet Archive", + "uri": "https://archive.org/about/terms.php", "needConsent": true, - "cookies": ['dtCookie', 'dtLatC', 'dtPC', 'dtSa', 'JSESSIONID', 'rxVisitor', 'rxvt', 'xtvrn'], + "cookies": ['abtest-identifier','donation-identifier','PHPSESSID','search-inside-XXX'], "js": function () { "use strict"; - tarteaucitron.fallback(['gallica_player'], function (x) { - var src = tarteaucitron.getElemAttr(x, "data-src"), - style = tarteaucitron.getElemAttr(x, "data-style"), - frame; - if (src === undefined) { + tarteaucitron.fallback(['archive_player'], function (x) { + var video_id = tarteaucitron.getElemAttr(x, "data-videoID"), + video_width = tarteaucitron.getElemAttr(x, "data-width"), + frame_width = 'width=', + video_height = tarteaucitron.getElemAttr(x, "data-height"), + frame_height = 'height=', + video_frame; + + if (video_id === undefined) { return ""; } - frame = ''; - return frame; + if (video_width !== undefined) { + frame_width += '"' + video_width + '" '; + } else { + frame_width += '"" '; + } + if (video_height !== undefined) { + frame_height += '"' + video_height + '" '; + } else { + frame_height += '"" '; + } + video_frame = ''; + return video_frame; }); }, "fallback": function () { "use strict"; - var id = 'gallica'; - tarteaucitron.fallback(['gallica_player'], function (elem) { - elem.style = elem.getAttribute('data-style'); + var id = 'archive'; + tarteaucitron.fallback(['archive_player'], function (elem) { + elem.style.width = elem.getAttribute('data-width') + 'px'; + elem.style.height = elem.getAttribute('data-height') + 'px'; return tarteaucitron.engage(id); }); } }; -