Skip to content

Commit

Permalink
BNF only : accès à pressreader (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremieGiffard authored Jan 27, 2025
1 parent c47a808 commit b12416b
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
16 changes: 16 additions & 0 deletions ophirofox/content_scripts/pressreader.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.ophirofox-europresse {
visibility: visible !important;
position: fixed;
text-align: center;
width: 100%;
top: 0px;
left: 0px;
z-index: 50;
}
.ophirofox-europresse > a {
color: #fff !important;
padding: 1px 20px;
font-weight: 600;
background-color: #2bc48c;
border-radius: 25px;
}
26 changes: 26 additions & 0 deletions ophirofox/content_scripts/pressreader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
async function createLink(AUTH_URL) {
const div = document.createElement("div");
div.className = "ophirofox-europresse"
const a = document.createElement("a");
a.textContent = "Cliquez pour lire avec BNF"
var newUrl = new URL(window.location);//current page
newUrl.host = AUTH_URL //change only the domain name
a.href = newUrl;

div.appendChild(a);
return div;
}

/**
* @description website navigation without window reload.
*/
async function onLoad() {
const config = await configurationsSpecifiques(['BNF'])
if(!config) return;
//too much js dom updates everywere to choose a more specific DOM.element.
const element = document.querySelector('body');
if (!element) return;
element.insertAdjacentElement('beforeend', await createLink(config.AUTH_URL_PRESSREADER));
}

onLoad().catch(console.error)
15 changes: 14 additions & 1 deletion ophirofox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,18 @@
"css": [
"content_scripts/arret-sur-images.css"
]
},
{
"matches": [
"https://www.pressreader.com/*"
],
"js": [
"content_scripts/config.js",
"content_scripts/pressreader.js"
],
"css": [
"content_scripts/pressreader.css"
]
}
],
"browser_specific_settings": {
Expand Down Expand Up @@ -698,7 +710,8 @@
{
"name": "BNF",
"AUTH_URL": "https://bnf.idm.oclc.org/login?url=https://nouveau.europresse.com/access/ip/default.aspx?un=D000067U_1",
"AUTH_URL_ARRETSURIMAGES" : "www-arretsurimages-net.bnf.idm.oclc.org"
"AUTH_URL_ARRETSURIMAGES" : "www-arretsurimages-net.bnf.idm.oclc.org",
"AUTH_URL_PRESSREADER" : "www-pressreader-com.bnf.idm.oclc.org"
},
{
"name": "Bibliothèque Publique d'Information (BPI)",
Expand Down

0 comments on commit b12416b

Please sign in to comment.