ajout couv, correction bugs
This commit is contained in:
@@ -5,6 +5,9 @@ let baliseWords = [
|
||||
'free',
|
||||
'temps',
|
||||
'moment',
|
||||
'pilote',
|
||||
'free_left',
|
||||
'citation',
|
||||
'latour',
|
||||
'latour_nohead',
|
||||
'lampe',
|
||||
@@ -29,7 +32,7 @@ let baliseWords = [
|
||||
`doublepage_bigleft`
|
||||
];
|
||||
|
||||
var bodyContent = $('#body').html();
|
||||
var bodyContent = $('#body').html();
|
||||
|
||||
bodyContent = bodyContent.replace(/\[([^\/\]]+)\]/g, function(match, word) {
|
||||
if (baliseWords.includes(word)) {
|
||||
@@ -71,7 +74,7 @@ for(let encart of encarts) {
|
||||
let headerEl = document.createElement('div');
|
||||
headerEl.setAttribute('class', 'encart-header')
|
||||
let iconImg = document.createElement('img');
|
||||
if (encart.classList.contains('latour') || encart.classList.contains('latour')) {
|
||||
if (encart.classList.contains('latour') || encart.classList.contains('latour_nohead')) {
|
||||
iconImg.setAttribute('src', '/user/themes/carnet-atterrissage/assets/map.png');
|
||||
} else if (encart.classList.contains('lampe') || encart.classList.contains('lampe_nohead')) {
|
||||
iconImg.setAttribute('src', '/user/themes/carnet-atterrissage/assets/lampe.png');
|
||||
@@ -100,26 +103,45 @@ for(let encart of encarts) {
|
||||
}
|
||||
|
||||
for(let i = 0; i < contentToParse.length; i++) {
|
||||
if (contentToParse[i].childNodes.length == 1) {
|
||||
contentToParse[i].innerHTML = '<p>' + contentToParse[i].innerHTML + '</p>';
|
||||
if (contentToParse[i].childNodes.length == 1) {
|
||||
contentToParse[i].innerHTML = '<p>' + contentToParse[i].innerHTML + '</p>';
|
||||
} else {
|
||||
contentToParse[i].innerHTML = "<p>" + contentToParse[i].innerHTML.replace("<p>", "");
|
||||
}
|
||||
|
||||
// micro-typo
|
||||
for(j = 0; j < contentToParse[i].childNodes.length; j++) {
|
||||
let contentHTML = contentToParse[i].childNodes[j].innerHTML;
|
||||
if (contentHTML != undefined) {
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' :', ' :');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' ?', ' ?');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' !', ' !');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('« ', '« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »', ' »');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('“', '« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('”', ' »');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' min', ' min');
|
||||
}
|
||||
}
|
||||
|
||||
// data align last split
|
||||
if (contentToParse[i].innerHTML.includes('<br>')) {
|
||||
if (contentToParse[i].childElementCount > 0) {
|
||||
for (let j = 0; j < contentToParse[i].childElementCount; j++) {
|
||||
let parts = contentToParse[i].children[j].innerHTML.split('<br>');
|
||||
let newParts = parts.map(function(part) {
|
||||
return '<p>' + part + '</p>';
|
||||
});
|
||||
contentToParse[i].children[j].innerHTML = newParts.join('');
|
||||
}
|
||||
} else {
|
||||
contentToParse[i].innerHTML = "<p>" + contentToParse[i].innerHTML.replace("<p>", "");
|
||||
}
|
||||
|
||||
// micro-typo
|
||||
for(j = 0; j < contentToParse[i].childNodes.length; j++) {
|
||||
let contentHTML = contentToParse[i].childNodes[j].innerHTML;
|
||||
if (contentHTML != undefined) {
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' :', ' :');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' ?', ' ?');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' !', ' !');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('« ', '« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' »', ' »');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('“', '« ');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll('”', ' »');
|
||||
contentToParse[i].childNodes[j].innerHTML = contentToParse[i].childNodes[j].innerHTML.replaceAll(' min', ' min');
|
||||
}
|
||||
let parts = contentToParse[i].innerHTML.split('<br>');
|
||||
let newParts = parts.map(function(part) {
|
||||
return '<p>' + part + '</p>';
|
||||
});
|
||||
contentToParse[i].innerHTML = newParts.join('');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PAGES TITRES
|
||||
@@ -136,4 +158,4 @@ let dessinsPreH3 = document.querySelectorAll('h3 + p img');
|
||||
for (let dessin of dessinsPreH3) {
|
||||
dessin.style.width = '0px';
|
||||
dessin.style.height = '0px';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user