Quizz de la semaine Le questionnaire interactif ne s'affiche pas dans votre navigateur. Voici les articles sur lesquels il porte : Hermès : la France produit, l'Asie consommeEn Ukraine, faire rouler les trains, nerf de la guerre« Peaceful China » : Xi Jinping donne ses directives avant le congrès du PartiLa route du sel, l'impôt qui a dessiné la FranceDésarmer les milices ou la guerre civile : l'impossible choix de Bagdad '; h += ''; h += ''; h += '0 question sur ' + total + '' + 'Score : 0'; h += ''; for (var i = 0; i < total; i++) { var qq = QUIZZ.questions[i]; etat.push(null); h += ''; h += '' + (i + 1) + '' + '' + echapper(qq.q) + ''; h += ''; for (var j = 0; j < qq.options.length; j++) { h += '' + '' + lettre(j) + '' + '' + echapper(qq.options[j]) + '' + ''; } h += ''; h += ''; h += ''; } h += ''; h += ''; racine.innerHTML = h; racine.querySelector(".qc-jauge").setAttribute("aria-hidden", "true"); } function repondues() { var n = 0; for (var i = 0; i < etat.length; i++) { if (etat[i] !== null) { n++; } } return n; } function score() { var n = 0; for (var i = 0; i < etat.length; i++) { if (etat[i] !== null && etat[i] === QUIZZ.questions[i].bonne) { n++; } } return n; } function majCompteur() { var n = repondues(); var pct = total ? Math.round((n / total) * 100) : 0; racine.querySelector(".qc-jauge-barre").style.width = pct + "%"; racine.querySelector(".qc-compteur-txt").textContent = n + (n > 1 ?

" questions" : " question") + " sur " + total; racine.querySelector(".qc-compteur-score").textContent = "Score : " + score(); } function repondre(iq, io) { if (etat[iq] !== null) { return; } etat[iq] = io; var qq = QUIZZ.questions[iq]; var bloc = racine.querySelector('.qc-q[data-q="' + iq + '"]'); var boutons = bloc.querySelectorAll(".qc-opt"); var juste = (io === qq.bonne); for (var k = 0; k < boutons.length; k++) { var b = boutons[k]; var idx = parseInt(b.getAttribute("data-o"), 10); b.disabled = true; b.classList.add("qc-fige"); if (idx === qq.bonne) { b.classList.add("qc-juste"); } if (idx === io && !juste) { b.classList.add("qc-faux"); } } var corr = bloc.querySelector(".qc-corr"); var c = '' + (juste ? "Bonne réponse" : "Réponse : " + echapper(qq.options[qq.bonne])) + ''; if (qq.explication) { c += '' + echapper(qq.explication) + ' '; } if (qq.lien) { c += '' + (qq.article ? echapper(qq.article) : "Lire l'article") + ' →'; } corr.innerHTML = c; corr.hidden = false; bloc.classList.add("qc-q-faite"); majCompteur(); if (repondues() === total) { terminer(); } } function mention(pct) { for (var i = 0; i < QUIZZ.mentions.length; i++) { if (pct >= QUIZZ.mentions[i].min) { return QUIZZ.mentions[i]; } } return QUIZZ.mentions[QUIZZ.mentions.length - 1]; } function terminer() { var s = score(); var pct = total ? Math.round((s / total) * 100) : 0; var m = mention(pct); var h = ''; h += 'Résultat'; h += '' + s + '/' + total + ''; h += '' + echapper(m.titre) + ''; h += '' + echapper(m.texte) + ' '; h += ''; var rates = []; for (var i = 0; i < total; i++) { if (etat[i] !== QUIZZ.questions[i].bonne && QUIZZ.questions[i].lien) { rates.push(QUIZZ.questions[i]); } } if (rates.length) { h += 'À relire'; for (var r = 0; r < rates.length; r++) { h += '' + echapper(rates[r].article || "Lire l'article") + ''; } h += ''; } h += ''; h += 'Partager mon score'; h += 'Recommencer'; h += ''; if (QUIZZ.abonnement && QUIZZ.abonnement.afficher) { h += '' + echapper(QUIZZ.abonnement.texte) + ' ' + '' + echapper(QUIZZ.abonnement.libelle) + ' →'; } var final = racine.querySelector(".qc-final"); final.innerHTML = h; final.hidden = false; final.querySelector(".qc-partage").addEventListener("click", function () { var url = window.location.href.split("#")[0]; var txt = "J'ai obtenu " + s + "/" + total + " au quizz de la semaine de Conflits."; window.open( "https://twitter.com/intent/tweet?text=" + encodeURIComponent(txt) + "&url=" + encodeURIComponent(url), "_blank", "noopener,width=600,height=480" ); }); final.querySelector(".qc-refaire").addEventListener("click", function () { construire(); brancher(); majCompteur(); racine.scrollIntoView({ behavior: "smooth", block: "start" }); }); if (typeof final.scrollIntoView === "function") { final.scrollIntoView({ behavior: "smooth", block: "nearest" }); } } function brancher() { var opts = racine.querySelectorAll(".qc-opt"); for (var i = 0; i < opts.length; i++) { opts[i].addEventListener("click", function () { repondre(parseInt(this.getAttribute("data-q"), 10), parseInt(this.getAttribute("data-o"), 10)); }); } } construire(); brancher(); majCompteur(); })();