Commit 350c3bc5 authored by Dorian's avatar Dorian
Browse files

credit porfolio js

parent 37a11bb2
......@@ -53,5 +53,42 @@ function replace(selector, toreplace, replacewith){
e_list[i].innerHTML = e_list[i].innerHTML.replace(regex, replacewith);
}
}
// peut etre utiliser par exemple comme ceci:
// -----------
// EXEMPLE:
// replace(".headline", "partie d'un titre", "<span>partie d'un titre</span>");
// -----------
function credit_portfolio(){
// met uniquement lae photographe en crédit de page d'ouverture
// et uniquement lae auteur.trice en crédit de fin de texte
// seulement credit photo au début
let header = document.querySelector(".header-byline"),
header_lines = header.innerHTML.split("<br>"),
header_search = "photo",
new_header = "photographe not found";
for (var i = 0; i < header_lines.length; i++) {
header_lines[i] = header_lines[i].split(":");
if(header_lines[i][0].toLowerCase().includes(header_search)){
new_header = header_lines[i][1];
}
}
header.innerHTML = new_header;
// seulement credit texte a la fin
let footer = document.querySelector(".footer-byline"),
footer_lines = footer.innerHTML.split("<br>"),
footer_search = "texte",
new_footer = "auteur.trice not found";
for (var i = 0; i < footer_lines.length; i++) {
footer_lines[i] = footer_lines[i].split(":");
if(footer_lines[i][0].toLowerCase().includes(footer_search)){
new_footer = footer_lines[i][1];
}
}
footer.innerHTML = new_footer;
}
......@@ -5,6 +5,8 @@
<meta charset="utf-8">
<title>portfolio</title>
<script src="../../vendors/modernizr-custom.js"></script>
<script src="../../js/toolkit.js"></script>
<link rel="stylesheet" href="../../vendors/reset.css">
<link rel="stylesheet" href="../../vendors/normalize-opentype.css">
<link rel="stylesheet" href="styles.less" type="text/less">
......
document.addEventListener("OnStoryReady", function(){
// breack title after second word
// add_br_at(1);
// met uniquement lae photographe en crédit de page d'ouverture
// et uniquement lae auteur.trice en crédit de fin de texte
credit_portfolio();
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment