var versionPdf = 2;
var urlSite="https://chinginfo.fr";
var local = false;
function chap_affExo() {
console.log("chap_affExo");
/*
ev.preventDefault();
ev.stopPropagation();
//=== Enonce ou correction
var e;
if(ev.currentTarget.getAttribute('affEnonce')==null){
e=0;
}
else{
e=1;
}
//=== Affiche le div
var num = ev.currentTarget.getAttribute("numexo");
*/
//Affiche l'exercice
var elt = document.getElementById('chap_exo');
elt.style.display = 'block';
//blur le body
document.querySelector("#aff").style.filter = "blur(2px)";
document.querySelector("#navigation").style.filter = "blur(2px)";
//document.querySelector("#navPlus").style.filter="blur(2px)";
//Lance l'animation
elt.style.animation = "2s linear 0s correcExo_anim_in"
elt.style.left = "50%"
}
function chap_affCorrec(ev) {
console.log("chap_affCorrec");
ev.preventDefault();
ev.stopPropagation();
//=== Enonce ou correction
var e;
if (ev.currentTarget.getAttribute('affEnonce') == null) {
e = 0;
}
else {
e = 1;
}
//=== Numero de l'exercice
var num = ev.currentTarget.getAttribute("numexo");
//=== Ouverture du pdf
pdfCorrec = new mpdfInfo("chap_exoAff", true)
//mpdf.col=sd_getCol;
pdfCorrec.col = 1;
pdfCorrec.zoomStrict = true;
pdfCorrec.mpdf_url = urlSite + '/chap_exoAff.php?n=' + num + '&e=' + e
pdfCorrec.mpdf_downloadUrl_withoutError = function (){
//=== Affiche le div
var elt = document.getElementById('chap_exo');
elt.style.display = 'block';
//blur le body
document.querySelector("#aff").style.filter = "blur(2px)";
document.querySelector("#navigation").style.filter = "blur(2px)";
//document.querySelector("#navPlus").style.filter="blur(2px)";
//Lance l'animation
elt.style.animation = "2s linear 0s correcExo_anim_in"
elt.style.left = "50%"
}
pdfCorrec.mpdf_downloadUrl_error = function (msg){
console.log("======================= "+msg)
if(msg=="Erreur:identification-prof"){
//==== Charge la page
var xhr = new myHttp(urlSite+'/profCode/authentification','get',[]);
xhr.myResponse = () =>{
//===== Chargement de la page
var elt = document.querySelector('#aff')
elt.innerHTML = xhr.responseText;
//==== Active le bouton submit
document.querySelector('#profCode-submit').addEventListener('click',chap_profCode_submit)
//==== Load image captcha
captcha_load('captcha-div');
}
xhr.send();
}
}
pdfCorrec.mpdf_start();
}
function chap_exoFerme() {
console.log("chap_correcFerme");
/*
if(mpdfPrinc == null) return;
mpdfPrinc.scrollOff = false;
*/
//blur le body
document.querySelector("#aff").style.filter = "none";
document.querySelector("#navigation").style.filter = "none";
//Ferme la fenetre d'exercice
var elt = document.getElementById('chap_exo');
elt.style.animation = "1s linear 0s correcExo_anim_out"
elt.style.left = "-150%"
}
function chap_clickUrl(ev) {
var url = ev.currentTarget.getAttribute('url');
console.log("chap_affCorrec", url);
var elt = document.createElement('a');
elt.setAttribute('href', url);
elt.setAttribute('target', '_blank');
elt.style.display = "none";
document.body.appendChild(elt);
elt.click();
document.body.removeChild(elt);
}
function chap_profCode_submit(){
console.log("chap_affConnexionProf_submit")
//==== Récupère l'email
var courriel = document.querySelector('#profCode-value').value;
var regex = /^[a-zA-Z0-9._%+-]+@(ac-[a-zA-Z0-9.-]+\.fr|aefe\.fr)$/;
if((courriel!="castanet@chingmath.fr") && (!regex.test(courriel))){
diagMessage('Veuillez saisir votre adresse académiqueee.'+courriel)
return;
}
//==== Récupère la captcha
var captcha = document.querySelector('#captcha-input').value;
if(! /^[a-zA-Z]+$/.test(captcha)){
diagMessage('Erreur dans la saisie du Captcha');
return;
}
//==== Cache la fenetre
chap_exoFerme()
//==== Envoi le mail
//==== Ouvre la connexion
var myhttp = new myHttp(urlSite+'/profCode/mail','post',[['m',courriel],['c',captcha]]);
myhttp.catchError = () => {
diagMessage(myhttp.responseText);
captcha_reload('captcha-div');
}
myhttp.myResponse = () => {
diagMessage("Un courriel vient de vous être envoyé avec les instructions")
captcha_reload('captcha-div');
}
myhttp.send();
}
function exo_aff(ev){
ev.preventDefault();
var elt = ev.currentTarget;
num=elt.getAttribute('num');
// ==== Affichage du block
document.querySelector('#affExo').style.display="block"
// ==== Chargement du pdf
pdfExo.affichePdf('e'+num);
}var dob_cookie = false;
var pdfChap = null;
var pdfExo;
var pdfCorrec;
var classeNum = 0;
var chapNum = 0;
var exoNum = 0;
var correcNum = 0;
console.log("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
var pdfDownload = null;
window.exoSacAdos = []
var gb_versionPdf = 2;
function loadMyPdf(){
console.log("loadMyPdf")
//Rejout le style de Aff
var elt = document.querySelector("#aff");
elt.style.width="auto"
elt.style.borderWidth="2px"
//Demarre les deux pdf
pdfChap = new mpdfInfo("aff",true);
pdfChap.zoomStrict=true;
pdfChap.col=1;
pdfChap.mpdf_col = 1;
pdfChap.mpdf_traitSeparation = true;
pdfCorrec = new mpdfInfo("chap_exoAff",true);
pdfCorrec.zoomStrict = true;
pdfExo = new mpdfInfo("affExo",true);
pdfSacados = new mpdfInfo("aff",true);
}
function loadInit() {
console.log('loadInit');
navBouton();
//Fermeture du div pour affichage exo/correc
var elt = document.querySelector('#affExo');
if (elt != null) {
elt.addEventListener('click', function (ev) { ev.currentTarget.style.display = "none"; });
}
//==== Ouvre une classe
if(classeNum != 0){
classeAff(classeNum);
}
//==== Ouvre un chapitre
if (chapNum != 0) {
console.log('Ouvre un chapitre : '+chapNum+' '+chapUrl)
chapitreAff(chapNum,chapUrl);
}
//==== Ouvre la correction
if(correcNum!=0){
console.log("YUUUUUUUUUUUUUUUUUUUUUU correctyion");
var obj = new Object();
obj.preventDefault = function(){};
obj.stopPropagation = function(){};
var div = document.createElement("div1");
div.setAttribute("numcorrec",correcNum);
div.setAttribute("affEnonce",1);
obj.currentTarget = div;
chap_affCorrec(obj);//"resultat/compilation/chap" + chapNum + ".pdf")
}
//==== Ouvre un exercice
if(exoNum!=0){
console.log("YUUUUUUUUUUUUUUUUUUUUUU exercuce");
/*
var obj = new Object();
obj.preventDefault = function(){};
obj.stopPropagation = function(){};
var div = document.createElement("div1");
div.setAttribute("numcorrec",exoNum);
div.setAttribute("affEnonce",1);
obj.currentTarget = div;
*/
chap_affExo();//"resultat/compilation/chap" + chapNum + ".pdf")
}
//==== Bouton download
var elt = document.querySelector("#downloadPdf");
if(elt!=null){
elt.addEventListener('click',download_pdf)
elt.querySelector(':nth-child(1)').src = image_pdf
elt.querySelector(':nth-child(2)').src = image_direction1
}
//==== Double-clic pour fermer le dialogue
var elt = document.querySelector('#chap_exo')
if(elt != undefined){
elt.addEventListener('dblclick',chap_exoFerme);
}
}
var g_diagTimeout=null;
function diagMessage(x){
var elt = document.getElementById('diagMessage');
if(x.substring(0,7)=="Erreur:"){
x = x.substring(7);
elt.style.backgroundColor="lightcoral";
}
else{
elt.style.backgroundColor="mediumturquoise";
}
elt.innerHTML=x;
elt.style.display="block";
g_diagTimeout = setTimeout(diagMessage_out,3000);
}
function diagMessage_out(){
if(g_diagTimeout!=null){
document.getElementById('diagMessage').style.display="none";
g_diagTimeout = null;
}
}
function download_pdf(e){
console.log("download_pdf")
//=== Recherche le numéro du chapitre
var numChap = document.querySelector('#downloadPdf').getAttribute('chap');
//=== Téléchargement du fichier
var elt = document.createElement('a');
elt.setAttribute('href',urlSite+'/chap_downloadPdf.php?c='+numChap)
elt.setAttribute('download',null)
document.body.appendChild(elt)
elt.click()
//document.body.removeChild(elt)
/*
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4){
if (xhr.status === 200) {
if(xhr.responseText.substring(0,7)=="Erreur:"){
diagMessage(xhr.responseText);
return;
}
var elt = document.createElement('a');
}
}
}
xhr.open('POST', urlSite+'/download_pdf.php', false);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send("d="+pdfDownload);
*/
}
window.addEventListener('load', loadInit);
zoomListe = [400,500,600,700,800,900,1000,1100,1200,1300,1400,1500]
zoomNum = 4
function affZoomChange(delta){
console.log("affZoomChange");
if(pdfChap==null){
return;
}
zoomNum += delta;
if(zoomNum<0){
zoomNum = 0;
}
if(zoomNum>=zoomListe.length){
zoomNum = zoomListe.length-1;
}
document.querySelector("#supAff").style.maxWidth=zoomListe[zoomNum]+"px"
//=== Redimensionne
pdfChap.mpdf_annotationsPositionAll()
}
/*================ SCript jx de ChingAtome =================*/
window.jx = function (url, cible, arg = {}) {
//Construction de l'history
console.log("jx " + url + " " + cible + " " + arg);
if ((url.indexOf('.php') == -1) && (cible == "sousAff") && (arg["noHistory"] == undefined)) {
urlHistory = url.replace('/cl/', '/classe/');
urlHistory = urlHistory.replace('/ch/', '/chapitre/');
urlHistory = urlHistory.replace('/info/', '/informatique/');
urlHistory = urlHistory.replace('/apropos/', '/a_propos/');
urlHistory = urlHistory.replace('/sacados/', '/sac-a-dos/');
urlHistory = urlHistory.replace('/divers/', '/divers-info/');
urlHistory = urlHistory.replace('/exo/', '/');
urlHistory = urlHistory.replace('/rsrc', '/ressource');
urlHistory = urlHistory.replace('/espaceProf/', '/espace/');
if (urlHistory.indexOf("vos-feuilles?af=") != -1) {
y = urlHistory.split("?af");
urlHistory = y[0]
}
history.pushState(url, null, urlHistory);
//history.replaceState(null,null,urlHistory);
}
//Affichage spécial "#sousAff"
if (cible == 'sousAff') {
//document.getElementById("navPlus").innerHTML="";
//document.getElementById("navPlus").style.height="initial";
document.getElementById('aff').scrollTo(0, 0);
}
//xmlhttprequest
var xhr_object = null;
if (window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if (window.ActiveXObject) // Internet Explorer
xhr_object = new ActiveXObject('Microsoft.XMLHTTP');
else { // XMLHttpRequest non supporté par le navigateur
alert('Votre navigateur ne supporte pas les objets XMLHTTPRequest...');
return;
}
xhr_object.onreadystatechange = function () {
if ((cible == null)
|| (typeof document.getElementById(cible) == undefined))
return;
//if((xhr_object.readyState == 4) && (xhr_object.status===200)){
if ((xhr_object.readyState == 4) && (xhr_object.status !== 2)) {
//document.title=this.url
if (cible == 'ssssssssousAff') {
clearInterval(boucleChargement);
window.scrollTo(0, 0);
//Desactive vielle feuille style
a = document.styleSheets
for (i = 2; i < a.length; i++) {
a[i].disabled = true;
}
}
setInnerHTML(document.getElementById(cible), xhr_object.responseText)
//document.getElementById(cible).innerHTML=xhr_object.responseText
//=== Arg option
if (arg["scrollTo"] != undefined) {
document.getElementById('sousAff').scroll(0, arg["scrollTo"]);
}
}
}
//Invocation de l'ajax
xhr_object.url = url;
//console.log("xxxxxxxx "+url)
//url="https://chinginfo.fr/dossier/weblinux/index.php";
xhr_object.open('GET', url, true);
//xhr_object.setRequestHeader('Content-Type', 'text/xml; charset=UTF-8');
xhr_object.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
xhr_object.send();
}
function insertScript($script, callback) {
var s = document.createElement('script')
s.type = 'text/javascript'
if ($script.src) {
s.onload = callback
s.onerror = callback
s.src = $script.src
} else {
s.textContent = $script.innerText
}
// re-insert the script tag so it executes.
document.head.appendChild(s)
// clean-up
$script.parentNode.removeChild($script)
// run the callback immediately for inline scripts
if (!$script.src) {
callback()
}
}
function runScripts($container) {
// get scripts tags from a node
var $scripts = $container.querySelectorAll('script')
var runList = []
var typeAttr
[].forEach.call($scripts, function ($script) {
typeAttr = $script.getAttribute('type')
// only run script tags without the type attribute
// or with a javascript mime attribute value
if (!typeAttr || runScriptTypes.indexOf(typeAttr) !== -1) {
runList.push(function (callback) {
insertScript($script, callback)
})
}
})
// insert the script tags sequentially
// to preserve execution order
if (runList.length != 0) {
seq(runList, scriptsDone)
}
}
// trigger DOMContentLoaded
function scriptsDone() {
var DOMContentLoadedEvent = document.createEvent('Event')
DOMContentLoadedEvent.initEvent('DOMContentLoaded', true, true)
document.dispatchEvent(DOMContentLoadedEvent)
}
// runs an array of async functions in sequential order
function seq(arr, callback, index) {
// first call, without an index
if (typeof index === 'undefined') {
index = 0
}
arr[index](function () {
index++
if (index === arr.length) {
callback()
} else {
seq(arr, callback, index)
}
})
}
var runScriptTypes = [
'application/javascript',
'application/ecmascript',
'application/x-ecmascript',
'application/x-javascript',
'text/ecmascript',
'text/javascript',
'text/javascript1.0',
'text/javascript1.1',
'text/javascript1.2',
'text/javascript1.3',
'text/javascript1.4',
'text/javascript1.5',
'text/jscript',
'text/livescript',
'text/x-ecmascript',
'text/x-javascript'
]
// setInnerHTML Sécurisé
function setInnerHTML(divContent, HTML) {
divContent.innerHTML = HTML;
runScripts(divContent)
}var sac_a_dos = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGIAAABiCAMAAACce/Y8AAAJJmlDQ1BpY2MAAEiJlZVnUJNZF8fv8zzphUASQodQQ5EqJYCUEFoo0quoQOidUEVsiLgCK4qINEWQRQEXXJUia0UUC4uCAhZ0gywCyrpxFVFBWXDfGZ33HT+8/5l7z2/+c+bec8/5cAEgiINlwct7YlK6wNvJjhkYFMwE3yiMn5bC8fR0A9/VuxEArcR7ut/P+a4IEZFp/OW4uLxy+SmCdACg7GXWzEpPWeGjy0wPj//CZ1dYsFzgMt9Y4eh/eexLzr8s+pLj681dfhUKABwp+hsO/4b/c++KVDiC9NioyGymT3JUelaYIJKZttIJHpfL9BQkR8UmRH5T8P+V/B2lR2anr0RucsomQWx0TDrzfw41MjA0BF9n8cbrS48hRv9/z2dFX73kegDYcwAg+7564ZUAdO4CQPrRV09tua+UfAA67vAzBJn/eqiVDQ0IgALoQAYoAlWgCXSBETADlsAWOAAX4AF8QRDYAPggBiQCAcgCuWAHKABFYB84CKpALWgATaAVnAad4Dy4Aq6D2+AuGAaPgRBMgpdABN6BBQiCsBAZokEykBKkDulARhAbsoYcIDfIGwqCQqFoKAnKgHKhnVARVApVQXVQE/QLdA66At2EBqGH0Dg0A/0NfYQRmATTYQVYA9aH2TAHdoV94fVwNJwK58D58F64Aq6HT8Id8BX4NjwMC+GX8BwCECLCQJQRXYSNcBEPJBiJQgTIVqQQKUfqkVakG+lD7iFCZBb5gMKgaCgmShdliXJG+aH4qFTUVlQxqgp1AtWB6kXdQ42jRKjPaDJaHq2DtkDz0IHoaHQWugBdjm5Et6OvoYfRk+h3GAyGgWFhzDDOmCBMHGYzphhzGNOGuYwZxExg5rBYrAxWB2uF9cCGYdOxBdhK7EnsJewQdhL7Hk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MgysvNsUTI5VPhSQ4bAvYFKry74UwIs48dYS4uHt2IIhFibgQ5gYwakciNwGKEAAk+ZQorAsy0bcLzwjM0RF14zZyJciJ+Fz6ibrhcoEafNSvgNgpBiov9iM5O/OUfwhHP2toQevuqYt7j2KmFdRQTyA2f7ybCvNJkFlKIgyoA/xTY3cM+n+vVK9JODTczajYEPMHijeh+/foNdbKsou5QmGsSUhGw+xwY4PP4IyNDfzGutFJTgu7w/LU5hejkhcAf/y0VHlVioojlPjUEUYkXs15vNPY9t93uF9SAkchkIfeLUuY5ah193LB7N/LuXYS6prfX53bfJL+vVieKUlJYT4OZy/cl+ti6rg55/56zAhke7u7q8j544A99UpI0zNH/xIlK+pKAPhHcsAF/7WONTM/I32/fXvF/R50klfL5DxmbN1OdUYkHwMX27B8+oNSVwtfJyXyvq44csVLFOZ4abbeplMXj7n3zpo0+I9BoUqO9DoMNIZO8upo+BDHhA+GB2+3z+QaGhp7fusWYaSTJyWm8ryanKskeoY8eNyoUIbfEYNyIUoRe4cKRtbemhjjzMptM/wS5KzRisTRudEpNVYC9/7/GurrdAWczSmWSSBSbK3upRhP85BrcPC0uppqsVqtwqdPTxTKZNCXu/6//AN45mfYdiBitAAAAAElFTkSuQmCC";
var image_direction1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYEAYAAAAhBex3AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRP///////wlY99wAAAAJcEhZcwAABdwAAAXcAIHgnTkAAAAHdElNRQflBBYEDxSQ5O58AAADA3pUWHRSYXcgcHJvZmlsZSB0eXBlIHhtcAAASInNVluS2yAQ/OcUOQJihhnpOLKAv1TlM8dPN8i27NV6d5NUJVZZL2B6uukBhZ/ff4Rv+E0ic5BNms8ebTKxi2XXFC1ZNrfFqpTktV0ul5Yc7xdTvskuWYtELR5V0He2Jejsq2NgFl+1ZjVcEVAEg5JLk0oowKg1AqTis00eUzFD4M0V4O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Y/OUW5OXkoYCAV7z0gnnT3HmegosKSkenjB5Y2HvEZIah0drKUrwL+rzzoFiwyzlN/pshZ6rHlv4Fe/buoVnikJaWhpzJ2Vix8gWeSAt5eFBYveZ9LF60GB9t+Ai19bUC0PSn+D3X/Prq0hR/ys/UIcPoDXvt6BG1hDm1Aw8+vFiON9i5aye4EPz+VGz79zfIGJ+BTm6ibH8ZCqcWgCaC4TaQNibN/M1113tiomNKU1L6AcjJ9ilMrrsZZfECSHTIzvJO0pRoIlicqqnBxk/+iRtm3YB3V7+HhoYGHDtxHMW/+hW6qMq1dXWYkDUBGz7egMtLLkNmZhZef+N1c+ZvZ3pGJo0oHTVq1LT+Vox+DqzE9wuz/+OP4L9OSkoq+kmGxA8o66OWLl36OM32CzIT+TFgZxMuNQh9ijh17r0zTmorixWjQYY3L1q06DH2Wf3ZtZxGRrANRt9Tyf/+66lhZL46gmySDf8HHHHZbUYJSdkAAAAASUVORK5CYII="
function navBouton() {
//Active les boutons de classedivCon
var liste = document.querySelectorAll('#navigation > div');
for (var i = 0; i < liste.length; i++) {
console.log(liste[i].parentNode.getAttribute('cl'))
console.log(liste[i].parentNode)
if (liste[i].getAttribute('cl') == null) continue;
liste[i].addEventListener('click', classeClick);
}
//Active les boutons de chapitre
var liste = document.querySelectorAll("#navigation > div > :nth-child(2) > div");
for (var i = 0; i < liste.length; i++) {
liste[i].addEventListener('click', chapitreClick);
}
//Affiche le sac à dos :
var elt = document.querySelector('#navigation > :nth-child(16)');
if (elt != null) {
console.log("kk")
elt.firstChild.src = sac_a_dos
elt.addEventListener('click', sacAdos_aff)
}
}
function classeClick(ev) {
var cl = ev.currentTarget.getAttribute('cl');
console.log('classeClick ' + cl);
classeAff(cl)
}
function classeAff(cl) {
// Formate la page
document.querySelector('#aff').style = ""
displayPdfTools(false)
lienAccueil(true);
//Recupere le contenu de la classe
var content;
if ((chapitre[cl] == undefined) || (chapitre[cl].length == 0)) {
content = 'Aucun chapitre pour le moment';
}
else {
var chap = chapitre[cl];
//==== Titre
content = '
' + chap[0][1] + '
'
//====
content += '';
for (var i = 1; i < chap.length; i++) {
if (chap[0][2] == 'projet') {
url = content += '- ' + chap[i][1] + '
';
}
else {
url = content += '- ' + chap[i][1] + '
';
}
}
content += '
';
history.replaceState(null, null, urlSite + "/classe/" + chap[0][2]);
}
//Ecriture du corps
document.querySelector('#aff').innerHTML = content;
activeClasse();
// Changement url
}
function activeClasse() {
console.log("activeClasse A FAIRE")
var liste = document.querySelectorAll('#navChap > li')
for (var i = 0; i < liste.length; i++) {
liste[i].addEventListener('click', chapitreClick)
}
}
function chapitreClick(ev) {
var url = ev.currentTarget.getAttribute('url')
var num = ev.currentTarget.getAttribute('num')
console.log('chapitreClick ',url);
if (url == null) {
console.log('chapitreClick /dossier - ',url);
//=== Ouverture du dossier
var elt = document.createElement('a');
elt.setAttribute('href','https://' + ev.currentTarget.getAttribute('dossier') + '.chinginfo.'+(local?'local':'fr'));
elt.target='chinginfo'
elt.style.display = "none";
document.body.appendChild(elt)
elt.click()
//document.body.removeChild(elt)
}
else {
console.log('chapitreClick / chapitre - ',url);
chapitreAff(num, url);
}
}
function chapitreAff(chapNum, url) {
console.log("chapitreAff " + chapNum + " " + url)
//====== Formatage de la page
document.querySelector('#aff').style.borderWidth = "2px"
displayPdfTools(true);
lienAccueil(false);
//===== Ajout le lien download
document.querySelector('#downloadPdf').setAttribute('chap',chapNum);
//===== Ajoute dans l'historique
//var url = urlSite + '/chap/' + url;
history.pushState(null, null, urlSite + '/chapitre/' + url);
//==== Initialise le pdf
if (true || pdfChap == null) {
loadMyPdf();
}
//Ouvre le chap
//pdfChap.mpdf_url = urlSite + '/resultat/cache/chap' + chapNum + '-0.b64';
pdfChap.mpdf_url = urlSite + '/chap_compil.php?chap=' + chapNum;
pdfChap.scrollY = 0;
pdfChap.counterdown = "chap";
pdfDownload = '/resultat/cache/chap' + chapNum + '.pdf';
pdfChap.mpdf_start();
}
function displayPdfTools(bol) {
var liste = ['downloadPdf ', 'zoomPdf'];
for (var i = 0; i < liste.length; i++) {
var elt = document.querySelector('#' + liste[i]);
if (bol) {
elt.style.display = "block"
}
else {
elt.style.display = "none"
}
}
}
function lienAccueil(bol) {
console.log("lienAccueil " + bol)
var elt = document.querySelector('#lienAccueil');
if (bol) {
elt.style.display = "block"
}
else {
elt.style.display = "none"
}
}
function affPresentation() {
document.querySelector('#aff').innerHTML = `ChingInfo.fr
Le site ChingInfo rassemble le travail de 8 ans d'enseignement en ISN, ICN, NSI et d'ateliers informatiques.
N'hésitez pas à proposer des améliorations à ces exercices via l'adresse castanet@chingmath.fr
Quelques projets liés à l'enseignement de l'informatique:
- Les images pour la SNT :
- Les réseaux pour la SNT :
- Les adresses IP pour la SNT :
- Un émulateur Linux pour la NSI :
- Utiliser un ESP32 en classe NSI :
- Des jeux et du Python :
- Quelques projets à utiliser en NSI :
`;
}var sacAdos_liste=[]
function chap_sacAdosAdd(ev){
console.log("chap_sacAdosAdd "+sacAdos_liste.length+" "+sacAdos_liste)
var elt = ev.currentTarget;
var num = elt.getAttribute('num');
//Ajoute ou enlève l'exercice du sac à dos
if((pos=sacAdos_liste.indexOf(num))!==-1){
console.log("aaaaaaaaa "+pos)
sacAdos_liste.splice(pos,1)
}
else{
sacAdos_liste.push(num)
}
//Affiche le cadre rouge
if(sac_isExoSelect(num)){
elt.style.backgroundColor="red";
}
else{
elt.style.backgroundColor="transparent";
}
//Actualise le compteur
sac_actualiseCompteur()
}
function sac_isExoSelect(num){
console.log("sac_isExoSelect "+num);
if(sacAdos_liste.indexOf(num)!=-1){
return true;
}
else{
return false;
}
}
function sac_actualiseCompteur(){
console.log("sac_actualise");
//Mise à jour du numéro d'exercice
var compteur = document.querySelector("#navigation > :nth-child(16) > :nth-child(2)");
if((num=sacAdos_liste.length) == 0){
compteur.innerHTML='';
compteur.style.display="none"
}
else{
compteur.innerHTML=num;
compteur.style.display="block"
}
console.log(compteur+" "+num);
}
function sacAdos_aff(){
console.log("sacAdos_aff "+sacAdos_liste.length)
//Envoi la compilation
var xhr = new XMLHttpRequest();
xhr.open('POST', urlSite+'/compil_sacAdos.php');
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.responseType='blob'
xhr.onreadystatechange = function() {
if (this.readyState == 4){
if (xhr.status === 200) {
var blob = xhr.response;
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = 'fichier.pdf';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
}
}
xhr.send("l="+sacAdos_liste.join(","));
//Ferme les autres fenêtres
//nav_fermeChap()
document.querySelector("#affExo").style.display="none"
}
if (typeof myHttp !== "function") {
window.myHttp = class extends XMLHttpRequest {
constructor(url, method, values) {
console.log("myHttp constructor")
super();
this.url = url;
this.method = method;
this.values = values;
if (/^(post|post-json|post-formData|post-array|post-blob)$/.exec(this.method)){
super.open('POST', this.url, true);
}
else if ((this.method == "get") || (this.method == "get-array")) {
super.open('GET', this.url, true);
}
if (this.method == "post-json") {
super.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
}
else if( (this.method == "post-array") || (this.method == "get-array") ){
super.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
super.responseType = "arraybuffer";
}
else if (this.method == "post-formData") {
}
else if(this.method == "post-blob"){
super.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
super.responseType = 'blob';
}
else {
super.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
}
super.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
if (this.isError()) {
this.catchError();
return;
}
this.myResponse();
}
}
}
send() {
console.log("http - send",this.values)
if (this.values == null) {
super.send();
}
else if ((this.method == "post-json") || (this.method == "post-formData") ) {
super.send(this.values);
}
else {
var liste = [];
for (var i = 0; i < this.values.length; i++) {
liste.push(this.values[i][0] + "=" + String(this.values[i][1]).replaceAll('&',''));
}
super.send(liste.join("&"));
}
}
isError() {
if ((this.method != "post-array") && (this.method != "get-array") && (this.method != "post-blob") && (this.responseText.substring(0, 7) == "Erreur:")) {
return true;
}
return false;
}
catchError() {
console.log("myHttp - catchError")
if (this.responseText == "Erreur:session") {
document.location = urlSite + "/?auth=1";
return;
}
else {
this.catchErrorDefault();
}
}
catchErrorDefault() {
console.log("myHttp - catchErrorDefault")
diagMessage(this.responseText.replace(':', ' : '), 2000);
//=== Evite les logins faut
var reg = new RegExp(/(Le mot de passe .* est incorrect|Le login .* existe pas)/);
var reg = new RegExp(/(Le mot de passe .*est\s*incorrect|Le login .*existe\s*pas)/);
if (reg.exec(this.responseText)) {
return;
}
//=== Envoi
var form = new FormData();
form.append('e', null);
form.append('m', "Erreur xhr\n
" + this.responseText + "\n
\n
");
var xhr = new myHttp(urlSite+'/mail-contact.php', 'post-formData', form);
xhr.send();
}
myResponse() {
console.log("Response default");
}
}
}
if (typeof myPdf !== "function") {
window.myPdf = class {
constructor(idContain, isMobile) {
console.log("___ mypdf constructor class:myPdf " + idContain + " " + isMobile);
this.mpdf_dateInit = Date.now()
//=== Entregistre valeur
this.mpdf_idContain = idContain
this.mpdf_isMobile = isMobile;
//==== Existence du div
this.mpdf_objContain = document.getElementById(idContain)
if (this.mpdf_objContain == null) return;
//===== Variable
if (isMobile) {
this.mpdf_col = 1;
}
else {
this.mpdf_col = 2;
}
if (urlSite == '') {
this.pdfJsScript = [[chromeExtension + 'javascript/pdf.js', false], [chromeExtension + '/javascript/pdf.worker.js', false]];
}
else {
console.log("XXXXXXXXX", dob_cookie)
if (dob_cookie) {
//==== Vieille version
this.pdfJsScript = [[urlSite + '/fichier/pdfjs-old-' + gb_versionPdf + '/pdf.js', false], [urlSite + '/fichier/pdfjs-old-' + gb_versionPdf + '/pdf.worker.js', false]];
}
else {
//==== Modern Version
this.pdfJsScript = [[urlSite + '/fichier/pdfjs-' + gb_versionPdf + '/pdf.mjs', false], [urlSite + '/fichier/pdfjs-' + gb_versionPdf + '/pdf.worker.mjs', false]];
}
}
this.extension = false;
this.mpdf_data = null;
this.mpdf_navPlus = null;
this.mpdf_url = null;
this.mpdf_pdfDoc = null;
this.mpdf_scrollDelta = 0;
this.mpdf_scrollY = null;
this.mpdf_scrollYmin = 0;
this.mpdf_scrollYmax = 0;
this.mpdf_scrollYContinous = 0;
this.mpdf_liftDiv = null;
this.mpdf_onlyOne = false;
this.mpdf_annotationDisplay = true;
this.mpdf_traitSeparation = false;
this.myPdfLift = true;
this.mpdf_maxContain = 3;
this.mpdf_glissiere = false;
this.mpdf_glissiereInverse = false;
this.mpdf_bGlissiereDown = false;
this.mpdf_bScrollBody = false;
this.mpdf_bLiftScroll = false;
this.mpdf_liftScroll = null;
this.mpdf_boutonScrollActive = false;
this.mpdf_scrollOff = false;
this.mpdf_bMouseScroll = false;
this.mpdf_loaded = false;
this.mpdf_chargeClone = false;
this.mpdf_pdfPageCurrent = 0;
this.mpdf_pageLoaded = [];
this.mpdf_renderWait = false;
this.mpdf_heightTotalPdf = 0;
this.mpdf_widthOnePagePdf = 0;
this.mpdf_liftScrollCoeff = 0
this.mpdf_renderAll = false
this.mpdf_navFirefox = false;
this.mpdf_zoomStrict = false;
this.mpdf_zoomStrictSuper = false;
this.mpdf_idResize = null;
this.mpdf_navPlusHeight = 0;
this.mpdf_vignette = false;
this.mpdf_callBackAfterCharge = null;
this.mpdf_titre = "";
this.mpdf_enonceDate = null;
this.mpdf_correctionDate = null;
this.mpdf_exoPublie = null;
this.mpdf_timezone = null;
this.mpdf_bMoveY = false; //garde en mémoire si un déplacement a été fait
this.mpdf_touchMoveY = null;
this.mpdf_mouseMoveY = null;
this.mpdf_continueMoveY = [0, 0, 0, 0];
this.mpdf_lastWheel = 0;
this.mpdf_loadTask;
this.mpdf_counterdown = ""
this.mpdf_signalezErreur_active = true;
this.mpdf_dataAux = null;
this.mpdf_divContain = [];
this.mpdf_divPage = [[], [], []];
this.mpdf_canvasPage = [[], [], []];
this.mpdf_glissiereXStart = null
this.mpdf_glissiereWidth = null
this.mpdf_url = null;
}
mpdf_mySelector(x) {
//console.log('balba #' + this.idContain + ' ' + this.mpdf_objContain + ' ' + x);
return this.mpdf_objContain.querySelector(x);
}
mpdf_mySelectorAll(x) {
return this.mpdf_objContain.querySelectorAll(x);
}
mpdf_start(){
if (this.mpdf_url == null) {
console.log('Erreur:Erreur pas d url');
return;
}
this.mpdf_pageLoaded = []
//=== Prepare l'interface utilisateur
this.mpdf_prepareContaint();
//=== Charge les données
this.mpdf_downloadUrl();
this.mpdf_downloadScript(0);
this.mpdf_downloadScript(1);
}
mpdf_prepareContaint() {
console.log("myPdf.preparePdf ");
//===== Charge une URL
console.log("myPdf.preparePdf Lecture url/pdf pour ChingMath");
console.log("myPdf.preparePdf preparePdf 2")
//=====
this.mpdf_timeDebut = Date.now();
console.log("myPdf.preparePdf aaaaaaaa ", this.mpdf_objContain);
//===== Efface le div
var range = document.createRange();
range.selectNodeContents(this.mpdf_objContain);
range.deleteContents();
//this.mpdf_objContain.innerHTML="";
//===== Vérifie l'existence des contains
this.mpdf_maxContain = (this.mpdf_chargeClone ? 3 : 1);
for (var i = 0; i < this.mpdf_maxContain; i++) {
//div Contain
var idContain = 'pdfContain' + i;
if (this.mpdf_mySelector('#' + idContain) == null) {
this.mpdf_divContain[i] = document.createElement("div");
this.mpdf_divContain[i].id = idContain;
this.mpdf_divContain[i].style.position = "relative"
this.mpdf_divContain[i].style.alignSelf = "start"
this.mpdf_divContain[i].style.hheight = "100%"
this.mpdf_divContain[i].style.lineHeight = "0px"
}
else {
this.mpdf_divContain[i] = this.mpdf_mySelector('#' + idContain);
}
//Place à prendre
if (i < this.mpdf_col) {
this.mpdf_divContain[i].style.display = "block";
this.mpdf_divContain[i].style.flex = "1";
}
else {
//contain.style.display="none";
this.mpdf_divContain[i].style.flex = "0";
}
}
//=====Ajoute la barre de séparation
var barre = [];
for (var i = 0; i < 2; i++) {
barre[i] = document.createElement("div");
//barre.style.position = "absolute";
barre[i].style.width = "1px";
barre[i].style.height = "100%";
barre[i].style.left = ((i + 1) * 100 / this.mpdf_col) + "%";
barre[i].style.backgroundColor = "black";
barre[i].style.zIndex = "10";
barre[i].id = "barreVertical" + i;
}
//====== Ajoute tout le monde
this.mpdf_objContain.appendChild(this.mpdf_divContain[0]);
if (this.mpdf_maxContain > 1) {
this.mpdf_objContain.appendChild(barre[0]);
this.mpdf_objContain.appendChild(this.mpdf_divContain[1]);
}
if (this.mpdf_maxContain > 2) {
this.mpdf_objContain.appendChild(barre[1]);
this.mpdf_objContain.appendChild(this.mpdf_divContain[2]);
}
//=== Ajoute la barre du scroll
if ((this.myPdfLift) && (this.mpdf_mySelector('#myPdfLiftDiv') == null)) {
console.log("myPdf.preparePdf add myPdfLift")
//console.log("aaaaaaaa " + this.isMobile)
this.mpdf_liftDiv = document.createElement("div");
this.mpdf_liftDiv.id = "myPdfLiftDiv";
this.mpdf_objContain.appendChild(this.mpdf_liftDiv);
this.mpdf_liftDiv.addEventListener('mousedown', (ev) => { ev.preventDefault(); ev.stopPropagation(); })
this.mpdf_liftScroll = document.createElement("span");
this.mpdf_liftScroll.id = "myPdfLiftSpan";
this.mpdf_liftScroll.style.top = "0px";
this.mpdf_liftScroll.style.cursor = "pointer";
this.mpdf_liftDiv.appendChild(this.mpdf_liftScroll);
this.mpdf_liftScroll.addEventListener("mousedown", (ev) => { console.log("aaaaaaaaaa"); this.mpdf_scrollLiftDown(ev) });
}
//===== Formatage du div
if (!this.mpdf_vignette) {
//this.mpdf_objContain.style.position="relative";
//this.mpdf_objContain.style.flex="1";
this.mpdf_objContain.style.display = "flex";
}
this.mpdf_objContain.style.position = "relative";
this.mpdf_objContain.style.overflowY = "hidden";
//this.mpdf_objContain.style.overflow = "hidden hidden";
this.mpdf_objContain.style.margin = "0px auto";
//==== Ajout de la glissiere
if (this.mpdf_glissiere) {
console.log("ajoute glissiere");
var elt = document.createElement('span');
elt.className = "s60 s_aq";
elt.style.width = "12px";
elt.style.height = "120px";
elt.id = "glissiere";
elt.alt = " pdf";
if (this.mpdf_glissiereInverse) {
elt.style.transform = "rotate(180deg) translate(-10px, 50%)"
}
this.mpdf_objContain.appendChild(elt);
//this.mpdf_objContain.insertBefore(elt,this.mpdf_objContain.firstChild);
this.mpdf_glissiereImg = elt;
//console.log("aaaaaaaaaaa "+this.glissiereImg)
elt.addEventListener('mousedown', this.mpdf_glissiereDown.bind(this));
document.body.addEventListener('mouseup', this.mpdf_glissiereUp.bind(this));
document.body.addEventListener('mousemove', this.mpdf_glissiereMove.bind(this));
}
//===== Ajoute les évènement du div
console.log("Ajoute les évènements")
//lié à la souris
this.mpdf_scrollMouseDownBind = this.mpdf_scrollMouseDown.bind(this);
this.mpdf_objContain.addEventListener("mousedown", this.mpdf_scrollMouseDownBind, { passive: false });
this.mpdf_scrollMouseUpBind = this.mpdf_scrollMouseUp.bind(this);
document.addEventListener("mouseup", this.mpdf_scrollMouseUpBind, { passive: false });
this.mpdf_scrollMouseMoveBind = this.mpdf_scrollMouseMove.bind(this);
document.addEventListener("mousemove", this.mpdf_scrollMouseMoveBind, { passive: false });
this.mpdf_scrollWheelBind = this.mpdf_scrollWheel.bind(this);
this.mpdf_objContain.addEventListener("wheel", this.mpdf_scrollWheelBind, { passive: false });
//lié au toucher
this.mpdf_scrollTouchStartBind = this.mpdf_scrollTouchStart.bind(this);
this.mpdf_objContain.addEventListener("touchstart", this.mpdf_scrollTouchStartBind, { passive: false });
this.mpdf_scrollTouchMoveBind = this.mpdf_scrollTouchMove.bind(this);
this.mpdf_objContain.addEventListener("touchmove", this.mpdf_scrollTouchMoveBind, { passive: false });
this.mpdf_scrollTouchEndBind = this.mpdf_scrollTouchEnd.bind(this);
this.mpdf_objContain.addEventListener("touchend", this.mpdf_scrollTouchEndBind, { passive: false });
//lié à la fenêtre
this.mpdf_resizeWindowBind = this.mpdf_resizeWindow.bind(this);
window.addEventListener("resize", this.mpdf_resizeWindowBind, { passive: false });
//lié aux touches
this.mpdf_scrollKeyBind = this.mpdf_scrollKey.bind(this)
document.addEventListener('keydown', this.mpdf_scrollKeyBind, false, { passive: false });
if (this.glissiere) {
console.log("mpdf_addEvent glissiere " + this.idContain)
this.mpdf_glissiereDownBind = this.mpdf_glissiereDown.bind(this);
this.mpdf_mySelector('#glissiere').addEventListener('mousedown', this.mpdf_glissiereDownBind)
this.mpdf_glissiereUpBind = this.mpdf_glissiereUp.bind(this);
document.body.addEventListener('mouseup', this.mpdf_glissiereUpBind)
this.mpdf_glissiereMoveBind = this.mpdf_glissiereMove.bind(this);
document.body.addEventListener('mousemove', this.mpdf_glissiereMoveBind)
}
console.log("mpdf_addEvent fin")
/*
//=== Vide tous les holders
for (var i = 0; i < this.mpdf_maxContain; i++) {
var myNode = this.mpdf_divContain[i];
if (myNode == null) continue;
var range = document.createRange();
range.selectNodeContents(myNode);
range.deleteContents();
}
//=== Chargement du nouveau PDF
if (this.mpdf_scrollY === null) {
this.mpdf_scrollY = 0;
}
*/
}
mpdf_isExist() {
//console.log("mpdf_isExist: " + this.idContain + " " + this.mpdf_objContain + " " + this.mpdf_objContain.parentNode)
//return (this.mpdf_objContain.parentNode == null ? false : true);
//var bool = this.divContain && this.divContain[0] && (this.divContain[0].offsetHeight!=0);
return this.mpdf_divContain && this.mpdf_divContain[0] && this.mpdf_divContain[0].parentNode && (this.mpdf_divContain[0].parentNode.offsetHeight != 0);
}
mpdf_updateExist() {
if (this.mpdf_isExist()) {
return;
}
//console.log("mpdf_updateExist", this.mpdf_divContain, this.mpdf_divContain[0], this.mpdf_divContain[0].parentNode, (this.mpdf_divContain[0].parentNode.offsetHeight != 0));
this.mpdf_removeListener();
console.log("__myPdf mpdf_updateExist fin");
//console.log("mpdf_updateExist "+window.mpdfA)
//delete window.mpdfA;
//==== Supprime le div de la correction de chap
if (this.mpdf_idContain == "chap_correcExoAff") {
var elt = document.querySelector('#chap_correcExo');
if (elt != null) {
document.body.removeChild(elt);
}
}
}
mpdf_removeListener() {
console.log("mpdf_removeListener")
//lié à la souris
this.mpdf_objContain.removeEventListener("mousedown", this.mpdf_scrollMouseDownBind, { passive: false });
document.removeEventListener("mouseup", this.mpdf_scrollMouseUpBind, { passive: false });
document.removeEventListener("mousemove", this.mpdf_scrollMouseMoveBind, { passive: false });
this.mpdf_objContain.removeEventListener("wheel", this.mpdf_scrollWheelBind, { passive: false });
//lié au toucher
this.mpdf_objContain.removeEventListener("touchstart", this.mpdf_scrollTouchStartBind, { passive: false });
this.mpdf_objContain.removeEventListener("touchmove", this.mpdf_scrollTouchMoveBind, { passive: false });
this.mpdf_objContain.removeEventListener("touchend", this.mpdf_scrollTouchEndBind, { passive: false });
//lié à la fenêtre
window.removeEventListener("resize", this.mpdf_resizeWindowBind, { passive: false });
//lié aux touches
document.removeEventListener('keydown', this.mpdf_scrollKeyBind, false, { passive: false });
if (true || this.glissiere) {
console.log("mmmmmmmmmmmmmm2 " + this.mpdf_idContain)
var elt = this.mpdf_mySelector('#glissiere');
if (elt != null) {
elt.removeEventListener('mousedown', this.mpdf_glissiereDownBind)
}
document.body.removeEventListener('mouseup', this.mpdf_glissiereUpBind)
document.body.removeEventListener('mousemove', this.mpdf_glissiereMoveBind)
}
}
/*========= ============ =========== =============== ============== */
async mpdf_downloadScript(num) {
this.mpdf_loaded = false;
if (((typeof pdfjsLib === "undefined") || (pdfjsLib == null)) && (this.pdfJsScript[num][1] == false)) {
let elt = document.createElement("script");
elt.setAttribute("src", this.pdfJsScript[num][0]);
if (dob_cookie == "1") {
elt.setAttribute("type", "text/javascript");
}
else {
elt.setAttribute("type", "module");
}
elt.setAttribute("async", "true");
document.body.appendChild(elt);
// success event
elt.addEventListener("load", () => {
console.log("==========File loaded")
this.mpdf_startPdf();
});
// error event
elt.addEventListener("error", (ev) => {
console.log("Error on loading file", ev);
});
//===== Vide la tache
this.pdfJsScript[num][1] = true;
return false;
}
return true;
}
async mpdf_downloadUrl() {
console.log("============ myPdf.mpdf_downloadPdf " + this.mpdf_url + " " + this.mpdf_col + " " + this.mpdf_maxContain);
//=== charge le pdf
var xhr;
if (true || (postArray.length == 0)) {
xhr = new myHttp(this.mpdf_url, 'get-array');
}
else {
xhr = new myHttp(this.mpdf_url, 'post-array', postArray);
}
xhr.catchError = function (xhr_local) {
console.log(" ??????????????? ")
console.log(xhr_local)
}.bind(this, xhr)
xhr.myResponse = function (xhr) {
console.log("mpdf_xhr_myResponseA", xhr.getResponseHeader("Content-Type"), xhr);
if (xhr.getResponseHeader("Content-Type").indexOf('text/') == 0) {
var msg;
if(xhr.responseType=="arraybuffer"){
msg = new TextDecoder().decode(xhr.response);
}
else{
//== a mon avis, cela ne sert à rien ... tous les retours de myPdf sont de type arraybuffer
msg = xhr.responseText;
}
this.mpdf_downloadUrl_error(msg);
return;
}
else {
this.mpdf_downloadUrl_withoutError();
}
var tab = new Uint8Array(xhr.response)
//========= Gestion du découpage des données pdf + aux ?
//var enc = new TextEncoder();console.log(enc.encode('|||'));
var dataMark = xhr.getResponseHeader('Data-Mark');
if (dataMark == null) {
console.log("mpdf_downloadUrl - sans data");
this.mpdf_data = tab;
this.mpdf_dataAux = null;
}
else {
console.log("mpdf_downloadUrl - avec data");
//console.log(xhr.response)
var index = parseInt(dataMark);
this.mpdf_data = tab.subarray(0, index);
this.mpdf_dataAux = new TextDecoder().decode(tab.subarray(index + 3));
}
//==== Récpuère les données
this.mpdf_startPdf()
console.log("============= fin mypdf_download", this.mpdf_data)
}.bind(this,xhr);
xhr.send();
}
mpdf_startPdf() {
console.log("======== mpdf_startPdf 1")
if ((typeof pdfjsLib === "undefined") || (pdfjsLib == null) || (this.mpdf_data == null)) {
return;
}
if (this.mpdf_loaded) {
return;
}
this.mpdf_loaded = true;
console.log("======== mpdf_startPdf 2")
pdfjsLib.GlobalWorkerOptions.workerSrc = this.pdfJsScript[1][0];
this.mpdf_loadTask = pdfjsLib.getDocument({ data: this.mpdf_data, disableFontFace: false, disableRange: true, disableStream: true, disableAutoFetch: true });
console.log("aaaaaaaaaa pdfJsScript ", this.mpdf_loadTask)
this.mpdf_loadTask.promise.then((pdfDoc, reject) => {
console.log("bbbbbbbbbb", pdfDoc)
this.mpdf_pdfDocLoad(pdfDoc);
})//.catch(this.errorPdf);
}
//====== Gestion de l'erreur
mpdf_preparePdf_checkError(tab) {
return ((new TextDecoder('utf-8')).decode(tab.slice(0, 7)) == 'Erreur:');
}
//========
mpdf_downloadUrl_error(reponse) {
//diagMessage((new TextDecoder('utf-8')).decode(reponse));
diagMessage(reponse);
}
mpdf_downloadUrl_withoutError() {
}
/*======== ================== ============== ============== */
mpdf_scrollMove(mvt, coef) {
//this.mpdf_updateExist.bind(this)()
if (this.mpdf_bLiftScroll) {
console.log("bLiftScroll move")
}
else {
if (mvt != 0) {
//console.log("scrollinfo "+mvt+" "+this.scrollDelta+" "+this.heightPdf);
//Continuite defilement : pas pour wheel
this.mpdf_continueMoveY.push(mvt * coef);
this.mpdf_continueMoveY = this.mpdf_continueMoveY.slice(-4);
this.mpdf_changeScroll(-mvt);
}
}
}
mpdf_scrollMouseDown(ev) {
//this.mpdf_updateExist.bind(this)();
console.log("mpdf_scrollMouseDown 1");
this.mpdf_bMoveY = false;
this.mpdf_bMouseScroll = true;
this.mpdf_mouseMoveY = ev.clientY;
this.mpdf_continueMoveY = [0, 0, 0, 0];
this.mpdf_scrollYContinous = 0;
}
mpdf_scrollMouseOut(ev) {
//this.mpdf_updateExist.bind(this)()
console.log("mpdf_scrollMouseOut 2 ");
this.mpdf_bMouseScroll = false;
this.mpdf_bLiftScroll = false;
}
mpdf_scrollMouseUp(ev) {
//this.mpdf_updateExist.bind(this)()
console.log("mpdf_scrollMouseUp 3");
this.mpdf_bMouseScroll = false;
this.mpdf_bLiftScroll = false
this.mpdf_scrollContinue(1);
}
mpdf_scrollMouseMove(ev) {
//console.log("mpdf_scrollMouseMove",this)
if (!this.mpdf_isExist()) {
return;
}
if (this.mpdf_bLiftScroll) {
//console.log("mpdf_scrollMouseMove / lift")
// liftScrollCoeff
//this.mpdf_scrollY = -ev.clientY / 771 * this.mpdf_scrollYmin;
this.mpdf_scrollY = (ev.clientY - this.mpdf_liftScrollDecY) / this.mpdf_liftScrollCoeff;
//console.log("ooooooooooo 34 " + this.scrollY);
//console.log("ooooooooooopppppppppppppp "+this.mpdf_liftScrollCoeff);
this.mpdf_updateScroll()
}
else {
//console.log("mpdf_scrollMouseMove / Other "+this.mpdf_bMouseScroll)
if (this.mpdf_bMouseScroll) {
this.mpdf_bMoveY = true;
var mvt = 0;
mvt = this.mpdf_mouseMoveY - ev.clientY;
this.mpdf_mouseMoveY = ev.clientY;
console.log("ooooooooooo 33" + mvt);
// Scroll
this.mpdf_scrollMove(mvt, 1);
}
}
}
mpdf_scrollWheel(ev) {
ev.stopPropagation();
ev.preventDefault();
//this.mpdf_updateExist.bind(this)()
//this.actualiseAffichage()
console.log("wheel ............" + ev.deltaY + " " + ev.detail);
var mvt;
if (ev.deltaY < 0)
mvt = -100;
else
mvt = 100;
mvt = Math.max(-1, Math.min(1, ev.deltaY)) * 25
if (this.mpdf_lastWheel + 40 < Date.now()) {
//console.log("zzzz")
if (this.mpdf_lastWheel + 400 > Date.now()) {
mvt = mvt * 4
}
this.mpdf_lastWheel = Date.now()
}
else {
mvt = 0
}
this.mpdf_changeScroll(-mvt);
}
mpdf_scrollTouchStart(ev) {
//this.mpdf_updateExist.bind(this)()
//ev.preventDefault();
//ev.stopPropagation();
this.mpdf_bMoveY = false;
//console.log("scrollTouchStart 4");
this.mpdf_touchMoveY = ev.touches[0].clientY;
this.mpdf_continueMoveY = [0, 0, 0, 0];
this.mpdf_scrollYContinous = 0;
//this.touchMoveY = null
}
mpdf_scrollTouchMove(ev) {
//this.mpdf_updateExist.bind(this)()
this.mpdf_bMoveY = true;
ev.preventDefault();
ev.stopPropagation();
var newValY = ev.touches[0].clientY;
var mvt = this.mpdf_touchMoveY - newValY;
this.mpdf_touchMoveY = newValY;
this.mpdf_scrollMove(mvt, 6);
}
mpdf_scrollTouchEnd(ev) {
//this.mpdf_updateExist.bind(this)()
//console.log("scrollTouchEnd 6");
this.mpdf_scrollMouseUp(ev)
}
mpdf_scrollLiftDown(ev) {
//this.mpdf_updateExist.bind(this)()
console.log("scrollLiftDown");
this.mpdf_bLiftScroll = true;
this.mpdf_liftScrollDecY = parseInt(document.querySelector('#myPdfLiftSpan').getBoundingClientRect().top);
ev.preventDefault();
ev.stopPropagation();
}
mpdf_scrollKey(ev) {
//this.mpdf_updateExist.bind(this)()
//console.log("xxxxxxxxH " + mpdf_ontain)
if (this.mpdf_scrollOff) return;
//console.log('scrollKey ' + ev.keyCode + ' ' + this.heightContaint + ' ' + this.mpdf_objContain + ' ' + this.mpdf_objContain.parentNode);
switch (ev.keyCode) {
case 33:
this.mpdf_changeScroll(this.mpdf_heightOneCol);
break;
case 34:
this.mpdf_changeScroll(-this.mpdf_heightOneCol);
break;
case 38:
this.mpdf_changeScroll(40);
break;
case 40:
this.mpdf_changeScroll(-40);
break;
}
}
/*======== ================== ============== ============== */
mpdf_resizeWindow() {
//this.mpdf_updateExist.bind(this)()
console.log("___ myPdf.resizeWindow");
if (this.mpdf_idResize != null) {
clearTimeout(this.mpdf_idResize);
}
this.mpdf_miseAjourParametre();
this.mpdf_idResize = setTimeout((e) => { this.mpdf_updateScroll(); this.mpdf_annotationsPositionAll(); }, 500);
}
mpdf_miseAjourParametre() {
console.log("mpdf_miseAjourParametre() mpdf_pdfPageCurrent:" + this.mpdf_pdfPageCurrent)
this.mpdf_heightOneCol = parseInt(this.mpdf_objContain.offsetHeight)
this.mpdf_heightContaintTotal = parseInt(this.mpdf_divContain[0].offsetHeight);
this.mpdf_heightTotalPdf = this.mpdf_heightContaintTotal / (this.mpdf_pdfPageCurrent + 1) * this.mpdf_nbrPages;
this.mpdf_widthOnePagePdf = parseInt(this.mpdf_divContain[0].offsetWidth);
console.log("eee dddddddddddddd " + this.mpdf_heightTotalPdf)
//====
//==== Scroll
//Definition de certaines constantes pour le scroll
console.log("eea_a1 : " + this.mpdf_heightOneCol + " " + this.mpdf_col + " " + this.mpdf_heightContaintTotal)
if (this.mpdf_heightOneCol * this.mpdf_col > this.mpdf_heightContaintTotal) {
if (this.mpdf_zoomStrict) {
// mpdf_zoomStrict : true
console.log("eee_a2 zoomStrict heightContaint:" + this.mpdf_heightOneCol + " heightPdf:" + this.mpdf_heightContaintTotal);
//Ne permet pas au pdf de déborder
console.log("eee_a2 pdf plus petite que la page " + this.mpdf_heightOneCol + " " + this.mpdf_heightContaintTotal + " " + this.mpdf_col);
this.mpdf_scrollYmin = 0
this.mpdf_scrollYmax = this.mpdf_heightContaintTotal//this.mpdf_heightOneCol * this.mpdf_col - this.mpdf_heightContaintTotal;
if (this.mpdf_zoomStrictSuper) {
this.mpdf_scrollYmin = 0;
}
}
else {
// mpdf_zoomStrict : false
console.log("eee_a3 ????????")
this.mpdf_scrollYmin = -this.mpdf_heightOneCol / this.mpdf_heightContaintTotal * this.mpdf_col + 20 / this.mpdf_heightContaintTotal;
this.mpdf_scrollYmax = 1 - 20 / this.mpdf_heightContaintTotal;
this.mpdf_scrollYmax = this.mpdf_heightOneCol * this.mpdf_col - this.mpdf_heightContaintTotal;
}
}
else {
console.log("eee_a4 : Pdf plus grand que page " + this.mpdf_pdfPageCurrent)
//this.mpdf_scrollYmin = this.mpdf_col * this.mpdf_heightOneCol - this.mpdf_heightTotalPdf;
this.mpdf_scrollYmin = this.mpdf_col * this.mpdf_heightOneCol - this.mpdf_heightContaintTotal
console.log("eee a4 bis " + this.mpdf_heightTotalPdf + " " + this.mpdf_heightContaintTotal + " " + this.mpdf_scrollYmin)
this.mpdf_scrollYmax = 0;
console.log("pdf plus grand que la page " + this.mpdf_heightOneCol + " " + this.mpdf_heightContaintTotal + " " + this.mpdf_col + " " + this.mpdf_scrollYmin + " " + this.mpdf_scrollYmax);
}
//==== Replace le lift
if (this.mpdf_scrollYmin == 0) {
this.mpdf_liftScrollCoeff = 0;
}
else {
this.mpdf_liftScrollCoeff = this.mpdf_heightOneCol / this.mpdf_scrollYmin;
this.mpdf_liftScrollCoeff = (this.mpdf_heightOneCol - 25) / this.mpdf_scrollYmin;
}
this.mpdf_updateScroll();
console.log("eee a8 " + this.mpdf_heightOneCol + " " + this.mpdf_heightContaintTotal + " " + this.mpdf_scrollYmin + " " + this.mpdf_scrollYmax + " " + this.mpdf_col + " " + this.mpdf_liftScrollCoeff)
}
/*======== ================== ============== ============== xxxxxxx */
mpdf_updateScroll() {
if (this.mpdf_rendering) {
console.log("mpdf_updateScroll STOP")
return;
}
//console.log("mpdf_updateScroll "+this.scrollY)
//Verifie si le scroll est bloque
if (false && this.mpdf_scrollOff) {
console.log("mpdf_updateScroll scrollOff")
return;
}
console.log("mpdf_updateScroll eeee " + this.mpdf_objContain + " " + this.mpdf_scrollY + " " + this.mpdf_scrollYmin + " " + this.mpdf_scrollYmax)
//Gère le scroll min et max
if (this.mpdf_scrollY <= this.mpdf_scrollYmin) {
this.mpdf_scrollY = this.mpdf_scrollYmin
console.log("mpdf_updateScroll eee A")
}
else if (this.mpdf_scrollY > this.mpdf_scrollYmax) {
this.mpdf_scrollY = this.mpdf_scrollYmax;
console.log("mpdf_updateScroll eee B")
}
//Gère l'affichage d'un bout de page manquant
this.mpdf_pageLoad_fillHeigth();
//==== Gère si le pdf est plus petit que
if (this.mpdf_zoomStrict && (this.mpdf_heightContaintTotal < this.mpdf_heightOneCol * this.mpdf_col)) {
this.mpdf_scrollY = 0
}
//======= Décalage des colonnes
this.mpdf_divContain[0].style.top = this.mpdf_scrollY + "px";
//console.log("ee a1 " + this.mpdf_divContain[0].id + " mpdf_scrollY:" + this.mpdf_scrollY)
if (this.mpdf_col > 1) {
this.mpdf_divContain[1].style.top = (this.mpdf_scrollY - this.mpdf_heightOneCol) + "px";
//console.log("eeee bbbb "+this.scrollY+" "+this.heightContaint+" "+this.this.divContain[1].style.top)
}
if (this.mpdf_col > 2) {
this.mpdf_divContain[2].style.top = (this.mpdf_scrollY - 2 * this.mpdf_heightOneCol) + "px";
}
//======== Bouton de navigation ???
if (this.mpdf_navPlus != null) {
if (this.mpdf_scrollY == 0) {
if (parseInt(this.mpdf_navPlus.style.height) == 0) {
requestAnimationFrame(() => {
this.mpdf_navPlus.style.height = '0px';
this.mpdf_navPlus.style.transition = '';
requestAnimationFrame(() => {
this.mpdf_navPlus.style.height = this.mpdf_navPlusHeight + 'px';
this.mpdf_navPlus.style.transition = 'height 0.3s ease-out';
});
});
}
}
else {
if (parseInt(this.mpdf_navPlus.style.height) != 0) {
requestAnimationFrame(() => {
this.mpdf_navPlus.style.height = this.mpdf_navPlusHeight + 'px';
this.mpdf_navPlus.style.transition = '';
requestAnimationFrame(() => {
this.mpdf_navPlus.style.transition = 'height 0.3s ease-out';
});
});
}
}
}
//========= Gère le défilement continue
if (Math.abs(this.mpdf_scrollYContinous) > 1) {
//console.log("scrollYContinous "+this.scrollYContinous);
this.mpdf_scrollYContinous = 0.9 * this.mpdf_scrollYContinous;
setTimeout(() => { this.mpdf_changeScroll(this.mpdf_scrollYContinous) }, 10);
}
//============= Actualise la position de l'ascenseur / lift
if (this.myPdfLift) {
//console.log("ffffffff "+ ((this.heightPdf - this.scrollY) / this.heightPdf));
this.mpdf_liftScroll.style.top = (this.mpdf_scrollY * this.mpdf_liftScrollCoeff) + "px";
}
//==========Action différentiée pour le changement de scroll
this.mpdf_callbackScroll();
}
mpdf_callbackScroll() {
}
mpdf_changeScrollPage(ev) {
//console.log("___ myPdf.mpdf_changeScrollPage B " + this.mpdf_objContain)
if (this.mpdf_scrollOff) return;
//console.log("mpdf_changeScrollPage");
var exoNum = ev.target.getAttribute("exercice");
this.mpdf_scrollY = posExo[exoNum];
this.mpdf_updateScroll();
}
mpdf_changeScroll(scrollAdd) {
//console.log("mpdf_changeScroll A " + this.idContain + " " + scrollAdd + " " + this.scrollDelta)
if (this.mpdf_scrollOff) return;
//console.log("mpdf_changeScroll B");
if (this.mpdf_divContain[0] == null) return;
//console.log("mpdf_changeScroll C");
this.mpdf_scrollY = this.mpdf_scrollY - scrollAdd * 2 * this.mpdf_scrollDelta;
this.mpdf_scrollY += scrollAdd;
//console.log("mpdf_changeScroll " + scrollAdd + " " + this.scrollY);
this.mpdf_updateScroll();
}
mpdf_scrollContinue(coef) {
//console.log("mpdf_scrollContinue D " + this.mpdf_objContain)
if (this.mpdf_scrollOff) return;
//Scroll continue
var mean = (this.mpdf_continueMoveY[0] + this.mpdf_continueMoveY[1] + this.mpdf_continueMoveY[2] + this.mpdf_continueMoveY[3]) / 4;
this.mpdf_continueMoveY = [0, 0, 0, 0];
//console.log("eeeeeeeeeeeeeeee "+mean);
if (Math.abs(mean) > 200) {
console.log("mpdf_scrollcontinue : " + this.mpdf_continueMoveY + " " + mean);
this.mpdf_scrollYContinous = -coef * mean;
this.mpdf_changeScroll(0);
}
else if (Math.abs(mean) > 100) {
console.log("mpdf_scrollcontinue : " + this.mpdf_continueMoveY + " " + mean);
this.mpdf_scrollYContinous = -coef * mean / 2;
this.mpdf_changeScroll(0);
}
else if (Math.abs(mean) > 50) {
console.log("mpdf_scrollcontinue : " + this.mpdf_continueMoveY + " " + mean);
this.mpdf_scrollYContinous = -coef * mean / 4;
this.mpdf_changeScroll(0);
}
}
//=======================
mpdf_annotationsSearch(pdfPage, numPage, viewport, scale) {
console.log("____ myPdf.annotationsSearch " + pdfPage + " " + numPage + " " + viewport + " " + scale)
if (!this.mpdf_annotationDisplay) {
return;
}
var result;
pdfPage.getAnnotations().then((annotations) => {
//console.log("getAnnotations " + annotations.length,annotations)
var view = pdfPage.view;
this.mpdf_divPage[0][numPage].setAttribute("viewWidth", pdfPage.view[2]);
//console.log("a"+pdfPage.pageIndex,annotations)
for (var i = 0; i < annotations.length; i++) {
console.log("annotations aaaa",annotations[i]);
//==== recherche du type d'annotation
var url = null;
var content = null;
if (annotations[i]['url'] != null) {
url = annotations[i]['url'];
}
else if (annotations[i]['unsafeUrl'] != null) {
url = annotations[i]['unsafeUrl'];
}
//===
var contentAnn = null;
if ((annotations[i]["contentsObj"]) && (annotations[i]["contentsObj"]['str'])) {
contentAnn = annotations[i]["contentsObj"]['str'];
}
//===== Creation de l'élément
var result = this.mpdf_annotationsCreateElement(i, url, contentAnn);
if (result[0] == null) {
// Ce n'est pas un élément, on continue la boucle
continue;
}
var elt = result[0];
var clickNode = result[1];
elt.setAttribute("target", "chingmath");
elt.setAttribute("annId", this.mpdf_divPage[0][numPage].id);
elt.style.position = "absolute";
//====== Calcul de la dimension de l'annotation
var marge = elt.getAttribute('marge')
if (marge == null) {
marge = 0;
}
else {
marge = parseInt(marge);
}
var decY = elt.getAttribute('decY');
if (decY == null) {
decY = 0;
}
else {
decY = parseInt(decY);
}
var r = annotations[i].rect;
var top = view[3] - r[1] - r[3] + r[1] - marge;
var left = r[0] - marge;
var width = r[2] - r[0] + 2 * marge;
var height = r[3] - r[1] + 2 * marge;
elt.setAttribute("annWidth", width);
elt.setAttribute("annHeight", height);
elt.setAttribute("annLeft", left);
elt.setAttribute("annTop", top + decY);
elt.setAttribute("annPdfWidth", view[2]);
if (false) {
console.log('pdfPage.getAnnotations', i, r, view)
//===== Dessine un rectangle sur l'annotation
var scale = this.mpdf_divPage[0][numPage].clientWidth / (view[2] - 0.17);
var dd = document.createElement('span');
dd.style.position = 'absolute';
dd.style.top = parseInt(top * scale) + "px";
dd.style.left = parseInt(left * scale) + "px";
dd.style.width = parseInt(width * scale) + "px";
dd.style.height = parseInt(height * scale) + "px";
dd.style.backgroundColor = "red"
dd.id = "aaaaaaaaaaa" + scale
this.mpdf_divPage[0][numPage].appendChild(dd);
}
/*
var rect = pdfjsLib.Util.normalizeRect([
r[0],
view[3] - r[1] + view[1],
r[2],
view[3] - r[3] + view[1]]);
*/
//Nouveau
/*
elt.setAttribute("annWidth", r[2] - r[0]);
elt.setAttribute("annHeight", r[3] - r[1]);
elt.setAttribute("annLeft", r[0]);
elt.setAttribute("annTop", view[3] - r[1]);
elt.setAttribute("annPdfWidth", view[2]);
elt.setAttribute("annWidth", rect[2] - rect[0]);
elt.setAttribute("annHeight", rect[3] - rect[1]);
elt.setAttribute("annLeft", r[0]);
elt.setAttribute("annTop", 1 * r[3] - 2);
elt.setAttribute("annPdfWidth", view[2]);
*/
//Copie dans les colonnes
//console.log("zzzzzzzzzzzzz eeeeeeeeeeeeee ");
if (this.mpdf_chargeClone) {
for (var k = 1; k < 3; k++) {
//console.log("zzzzzzzzzzzzz eeeeeeeeeeeeee "+k);
var eltClone = elt.cloneNode(false)
if (clickNode != null) {
//console.log("aaaaaaaa ",clickNode)
eltClone.addEventListener('click', clickNode);
}
this.mpdf_divPage[k][pdfPage._pageIndex].appendChild(eltClone);
}
}
this.mpdf_divPage[0][numPage].appendChild(elt);
}
this.mpdf_annotationsPosition(pdfPage._pageIndex);
});
}
mpdf_annotationsCreateElement(url, content) {
console.log("mpdf_annotationsCreateElement");
return [null, null];
}
mpdf_annotationsPositionAll() {
console.log("____ myPdf.annotationsPositionAll");
for (var i = 0; i < this.mpdf_nbrPages; i++) {
this.mpdf_annotationsPosition(i);
}
}
mpdf_annotationsPosition(numPage) {
console.log("____ myPdf.mpdf_annotationsPosition");
if (numPage == null) return
console.log("mpdf_annotationsPosition " + numPage);
//scale=div.clientWidth/pdfPage.view[2];
//Repositionne chaque annotation
var idPage = "div" + numPage;
for (var j = 0; j < this.mpdf_maxContain; j++) {
var liste = this.mpdf_divContain[j].querySelectorAll("#" + idPage + " .mypdf_ann");
var divVal = {};
//console.log("kkkkkkkkkkkkkkaaaaa " + liste.length);
var scale = null
for (var i = 0; i < liste.length; i++) {
//var divPage = liste[i].getAttribute("annId");
//console.log(divVal)
var myClick = liste[i].getAttribute('myclick');
if ((myClick == 'affExoCorrec') || (myClick == 'sacAdos') || (myClick == 'sd_affCorrec')) {
var zoom = 1.4;
}
else {
var zoom = 1;
}
if (scale == null) {
scale = parseFloat(this.mpdf_divPage[0][i].clientWidth) / (parseFloat(liste[i].getAttribute('annPdfWidth')) - 0.17);
console.log("ssssssssscale", scale)
}
zoom = 1;
var w = parseFloat(liste[i].getAttribute("annWidth")) * scale;
var h = parseFloat(liste[i].getAttribute("annHeight")) * scale;
var top = parseFloat(liste[i].getAttribute("annTop")) * scale;
var left = parseFloat(liste[i].getAttribute("annLeft")) * scale;
liste[i].style.width = parseInt(w) + "px";
liste[i].style.height = parseInt(h) + "px";
liste[i].style.top = parseInt(top) + "px";
liste[i].style.left = parseInt(left) + "px";
var radius = liste[i].getAttribute('radius');
if((radius==null) || (radius!=0)){
liste[i].style.borderRadius = parseInt(w / 5) + "px"
}
//console.log("Taille mypdf_ann : "+liste[i].getAttribute("annWidth")+" "+liste[i].style.height);
/*
liste[i].style.left = (liste[i].getAttribute("annLeft") * scale - w * ((zoom - 1) / 2)) + "px";
liste[i].style.top = (divVal[idPage + "ClientHeight"] - liste[i].getAttribute("annTop") * scale - h * ((zoom - 1) / 2)) + "px";
liste[i].style.top = (liste[i].getAttribute("annTop") * scale - h) + "px";
*/
//Nouveau
var w = liste[i].getAttribute("annWidth") * scale;
//liste[i].style.top = liste[i].getAttribute('annTop') * divVal[idDiv + "Scale"] - h - h * ((zoom - 1) / 2);
}
}
}
mpdf_annotationsPositionffff(numPage) {
var liste = document.querySelectorAll(".mypdf_ann");
console.log("mpdf_annotationsPosition - case", liste, liste.length)
var divVal = {};
for (var i = 0; i < liste.length; i++) {
console.log("mpdf_annotationsPosition - case - " + i)
var idDiv = liste[i].getAttribute("annId");
if (divVal[idDiv + "ViewWidth"] == undefined) {
divVal[idDiv + "ViewWidth"] = document.getElementById(idDiv).getAttribute("viewWidth");
divVal[idDiv + "ClientWidth"] = document.getElementById(idDiv).clientWidth;
divVal[idDiv + "ClientHeight"] = document.getElementById(idDiv).clientHeight;
divVal[idDiv + "Scale"] = divVal[idDiv + "ClientWidth"] / divVal[idDiv + "ViewWidth"];
}
var scale = divVal[idDiv + "Scale"];
liste[i].style.width = (liste[i].getAttribute("annWidth") * scale) + "px";
liste[i].style.height = (liste[i].getAttribute("annHeight") * scale) + "px";
liste[i].style.left = (liste[i].getAttribute("annLeft") * scale) + "px";
liste[i].style.top = (divVal[idDiv + "ClientHeight"] - liste[i].getAttribute("annTop") * scale) + "px";
}
}
mpdf_scrollPdfLatex(page, scroll) {
console.log("mpdf_scrollPdfLatex")
//=== Récupère la position de la page et le scale
var eltPage = document.querySelector('#' + this.mpdf_idContain + ' #div' + page);
console.log("yes " + '#' + this.mpdf_idContain + ' #div' + page)
var widthCanvas = parseFloat(eltPage.firstChild.getAttribute('width'));
var widthDiv = parseFloat(eltPage.clientWidth);
var divPosY = parseInt(eltPage.offsetTop);
var scale = eltPage.firstChild.getAttribute('scale');
//=== Rétablit le scroll
console.log('yyyyyy', [scroll, scale, widthDiv, widthCanvas, page, divPosY]);
var val = scroll * scale * 0.9953 * (widthDiv / widthCanvas) + divPosY;
this.mpdf_scrollY = -val;
console.log("rrrrrrrr", sd_mpdfA.mpdf_scrollY)
this.mpdf_updateScroll();
}
mpdf_pdfDocLoad(pdfDoc) {
this.mpdf_pdfDoc = pdfDoc;
this.mpdf_nbrPages = this.mpdf_pdfDoc.numPages;
console.log("___ myPdf.pdfDocLoad nbrPages:" + this.mpdf_nbrPages + " getMetada:" + this.mpdf_pdfDoc.getMetadata());
// Lit la première page
this.mpdf_pdfLoadPage();
}
mpdf_pdfLoadPage() {
console.log("mpdf_pdfLoadPage", this.mpdf_pdfPageCurrent)
return new Promise((resolveLoad, rejectLoad) => {
var numPage = this.mpdf_pdfPageCurrent;
//== Vérifie que la page demandée existe
if ((numPage >= this.mpdf_nbrPages) || (numPage < 0)) {
console.log("mpdf_pdfLoadPage : page d'autre page à charger")
resolveLoad();
return
}
//==== Chargement containPdf0
for (var i = 0; i < this.mpdf_maxContain; i++) {
this.mpdf_divPage[i][numPage] = document.createElement('div');
this.mpdf_divPage[i][numPage].id = 'div' + numPage;
this.mpdf_divPage[i][numPage].style.position = "relative";
//div.style.width="50%"
this.mpdf_divContain[i].appendChild(this.mpdf_divPage[i][numPage]);
}
//===== Creation du canvas
//console.log("yes mpdf_pdfLoadPage : add eltCanvas " + " " + this.mpdf_objContain.parentNode + " " + this.mpdf_url);
//Crée le conteneur
this.mpdf_canvasPage[0][numPage] = document.createElement('canvas');
this.mpdf_canvasPage[0][numPage].id = 'canvas-' + numPage;
this.mpdf_canvasPage[0][numPage].style.width = "100%";
this.mpdf_divPage[0][numPage].appendChild(this.mpdf_canvasPage[0][numPage]);
//Ajoute trait entre page
console.log("trait separation " + this.mpdf_traitSeparation)
if (this.mpdf_traitSeparation) {
var trait = document.createElement('div');
trait.className = "myPdfSeparation";
this.mpdf_divContain[0].appendChild(trait);
}
//=== Charge la page demandée
this.mpdf_pdfDoc.getPage(numPage + 1).then((resolve, reject) => {
this.mpdf_renderPage(resolve, resolveLoad);
console.log("aaaaaaa 2", resolve, resolveLoad)
});
});
}
mpdf_pdfLoadAllPage(page, scroll) {
console.log("mpdf_pdfLoadAllPage")
if (this.mpdf_pdfPageCurrent + 1 < this.mpdf_nbrPages) {
this.mpdf_pdfPageCurrent++;
this.mpdf_pdfLoadPage().then(() => { this.mpdf_pdfLoadAllPage(page, scroll) }).catch(() => {
console.log("non")
})
}
else {
if (page != null) {
console.log("yes yes " + page + " " + scroll)
this.mpdf_scrollPdfLatex(page, scroll);
}
}
}
mpdf_pageLoad_fillHeigth() {
console.log("mpdf_pageLoad_fillHeigth 1 / ", this.mpdf_heightOneCol, this.mpdf_heightContaintTotal, this.mpdf_heightTotalPdf, this.mpdf_widthOnePagePdf, this.mpdf_pdfPageCurrent);
var a = -this.mpdf_heightContaintTotal + this.mpdf_heightOneCol * this.mpdf_col;
var b = this.mpdf_scrollY;
console.log("mpdf_pageLoad_fillHeigth 2 / ", a, b, this.mpdf_heightContaintTotal);
//if ((!this.mpdf_onlyOne) && (a >= b) && (-a > -this.mpdf_heightContaintTotal) && (this.mpdf_pdfPageCurrent < this.mpdf_nbrPages)) {
if ((!this.mpdf_onlyOne) && (a >= b) && (this.mpdf_pdfPageCurrent < this.mpdf_nbrPages)) {
this.mpdf_pdfPageCurrent++;
console.log("mpdf_pageLoad_fillHeigth 3 / " + this.mpdf_pdfPageCurrent)
this.mpdf_pdfLoadPage();
}
}
mpdf_renderPage(page, resolveLoad) {
var numPage = page._pageIndex;
console.log("_____ mpdf.renderPage numPage:", numPage, resolveLoad);
if (!this.mpdf_isExist()) {
this.mpdf_updateExist();
return;
}
this.mpdf_rendering = true
//==== Charge le pdf dans le premier canevas
console.log("myPdf.renderPage")
//var scale=canvas.width/viewport.width*0.9;
if (true) {
var viewport = page.getViewport({ scale: 1 });
var scale = document.body.clientWidth / viewport.width * 1.5; //Prend body car div pas chargé pour 1er page/pdf
if (scale < 1.8) scale = 1.8;
if (scale > 2.5) scale = 2.5;
}
else {
scale = 1.6;
}
var canvas = this.mpdf_canvasPage[0][numPage];
canvas.setAttribute('scale', scale);
var viewport = page.getViewport({ scale: scale });
var ctx = canvas.getContext('2d');
canvas.width = viewport.width;
canvas.height = viewport.height;
console.log("mpdf.renderPage : load of renderTask")
var renderContext = { canvasContext: ctx, viewport: viewport, enableWebGl: true };
var renderContext = { canvasContext: ctx, viewport: viewport };
var renderTask = page.render(renderContext);
console.log("iiiiiiiiii", renderTask, resolveLoad)
renderTask.promise.then((resolve, rejectLoad) => {
var numPage = page._pageIndex;
console.log("mpdf.renderPage RenderTask 1 " + numPage + " : " + (Date.now() - this.mpdf_timeDebut) + "s " + this.mpdf_objContain.offsetHeight, resolveLoad);
if (!this.mpdf_isExist()) {
this.mpdf_updateExist();
return;
}
//Fin de chargement de la page
console.log("mpdf.renderPage RenderTask 2", this.mpdf_canvasPage)
var canvasOld = this.mpdf_canvasPage[0][numPage];
if (this.mpdf_divPage[0][numPage] == null) return;
//Copie dans le cas de l'affichage multi-colonne
if (this.mpdf_chargeClone) {
//console.log("mmmmmmmddddddddd "+page._pageIndex+" "+canvasOld+" "+div);
for (var i = 1; i < 3; i++) {
//console.log(i)
var clone = this.mpdf_divPage[0][numPage].cloneNode(true);
var can = clone.firstChild;
//console.log(can)
can.getContext('2d').drawImage(canvasOld, 0, 0);
this.mpdf_divPage[i][numPage].appendChild(clone);
}
}
//Extra parametre
console.log("ffffffffffffffffff", page._pageIndex, this.mpdf_callBackAfterCharge)
if ((page._pageIndex == 0) && (this.mpdf_callBackAfterCharge != null)) {
this.mpdf_callBackAfterCharge();
}
//==== Continue le chargement des pages
console.log("mpdf.renderPage RenderTask 3 fin", numPage, resolveLoad)
this.mpdf_rendering = false;
//==== Fin du chargement -- chrgement des parametres et chargement de la nouvelle page
console.log("numPage: ", numPage);
console.log("Durée de chargement du pdf (myPdf) " + (Date.now() - this.mpdf_dateInit))
this.mpdf_miseAjourParametre();
//== Affiche les annotations / liens
this.mpdf_annotationsSearch(page, numPage, viewport, scale);
//====
if (this.mpdf_callBackAfterRender != null) {
this.mpdf_callBackAfterRender(numPage);
//this.mpdf_updateScroll();
}
resolveLoad();
});
}
mpdf_callBackAfterRender(numPage) {
//Actualise le nombre de page à charger
//this.mpdf_pdfLoadNewPage();
}
mpdf_actualiseAffichage() {
console.log("____ myPdf.actualiseAffichage " + this.mpdf_col + " " + (this.mpdf_bActualisePdf ? "oui" : "non"));
for (var i = 0; i < this.mpdf_maxContain; i++) {
if (i < this.mpdf_col) {
this.mpdf_mySelector('#pdfContain' + i).style.flex = "1";
}
else {
this.mpdf_mySelector('#pdfContain' + i).style.flex = "0";
}
/*
document.getElementById("pdfContain"+i).style.width=(100/this.col)+"%";
document.getElementById("pdfContain"+i).style.left=(i*100/this.col)+"%";
*/
}
//Gestion des barres de séparation des colonnes
var barreVertical0 = this.mpdf_mySelector('#barreVertical0').style;
var barreVertical1 = this.mpdf_mySelector('#barreVertical1').style;
switch (this.mpdf_col) {
case 1:
barreVertical0.left = "120%";
barreVertical1.left = "120%";
break;
case 2:
barreVertical0.left = "50%";
barreVertical1.left = "120%";
break;
case 3:
barreVertical0.left = "33.3333%";
barreVertical1.left = "66.6666%";
break;
}
/*
//Render des pdf
for(j=0;j