Skip to content

Commit c894e03

Browse files
authored
ajout de mediapart à BNU (#364)
1 parent 27b1133 commit c894e03

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

ophirofox/content_scripts/mediapart.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/**
2-
* @description create link <a> to BNF mirror
2+
* @description create link <a> to a mirror
33
* @param {string} AUTH_URL_MEDIAPART
4+
* @param {string} name
45
*/
5-
async function createLink(AUTH_URL_MEDIAPART) {
6+
async function createLink(AUTH_URL_MEDIAPART, name) {
67
const span = document.createElement("span");
7-
span.textContent = "Lire avec BNF";
8+
span.textContent = "Lire avec " + name;
89

910
const a = document.createElement("a");
1011
a.href = new URL(window.location);
@@ -54,13 +55,13 @@ async function handleMediapart(config) {
5455
if (!reserve) return;
5556

5657
for (const balise of reserve) {
57-
balise.appendChild(await createLink(config.AUTH_URL_MEDIAPART));
58+
balise.appendChild(await createLink(config.AUTH_URL_MEDIAPART, config.name));
5859
}
5960
}
6061

6162
/**@description check for users with mediapart access. If yes, create link button */
6263
async function onLoad() {
63-
const config = await configurationsSpecifiques(["BNF"]);
64+
const config = await configurationsSpecifiques(["BNF" , "Bibliotheque nationale et universitaire de Strasbourg"]);
6465
if (!config) return;
6566
const currentPage = new URL(window.location);
6667
if (currentPage.host == config.AUTH_URL_MEDIAPART) {

ophirofox/manifest.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@
316316
{
317317
"matches": [
318318
"https://www.mediapart.fr/*",
319-
"https://www-mediapart-fr.bnf.idm.oclc.org/*"
319+
"https://www-mediapart-fr.bnf.idm.oclc.org/*",
320+
"https://www-mediapart-fr.acces-distant.bnu.fr/*"
320321
],
321322
"js": [
322323
"content_scripts/config.js",
@@ -851,7 +852,8 @@
851852
},
852853
{
853854
"name": "Bibliotheque nationale et universitaire de Strasbourg",
854-
"AUTH_URL": "https://acces-distant.bnu.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=bnus"
855+
"AUTH_URL": "https://acces-distant.bnu.fr/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=bnus",
856+
"AUTH_URL_MEDIAPART": "www-mediapart-fr.acces-distant.bnu.fr"
855857
},
856858
{
857859
"name": "Bibliotheque municipale de Lyon",

0 commit comments

Comments
 (0)