mirror of
https://github.com/soulaklabs/bitoduc.fr.git
synced 2025-12-09 17:35:35 +00:00
Merge pull request #49 from chmduquesne/gh-pages
Améliorations générales de lisibilité du code
This commit is contained in:
28
creuille.js
28
creuille.js
@@ -1,5 +1,4 @@
|
|||||||
function changeDeSens(traductions)
|
function changeDeSens(traductions) {
|
||||||
{
|
|
||||||
var langue = $( "#mots" ).attr("data-langue");
|
var langue = $( "#mots" ).attr("data-langue");
|
||||||
var autre = {'anglais': 'francais',
|
var autre = {'anglais': 'francais',
|
||||||
'francais': 'anglais'};
|
'francais': 'anglais'};
|
||||||
@@ -7,8 +6,8 @@ function changeDeSens(traductions)
|
|||||||
construitListe(traductions);
|
construitListe(traductions);
|
||||||
}
|
}
|
||||||
|
|
||||||
function metAJourLienChange(langue){
|
function metAJourLienChange(langue) {
|
||||||
var de = ' <span class="mot-anglais">Anglais</span> ';
|
var de = '<span class="mot-anglais">Anglais</span>';
|
||||||
var vers = '<span class="mot-francais">Français</span>';
|
var vers = '<span class="mot-francais">Français</span>';
|
||||||
var fleche = ' → ';
|
var fleche = ' → ';
|
||||||
if (langue == 'francais') {
|
if (langue == 'francais') {
|
||||||
@@ -19,7 +18,7 @@ function metAJourLienChange(langue){
|
|||||||
$( "#lienChange" ).html(de + fleche + vers);
|
$( "#lienChange" ).html(de + fleche + vers);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sansAccents(mot){
|
function sansAccents(mot) {
|
||||||
// Faute d'une bibliotheque unidecode, nous nous limitons aux lettres
|
// Faute d'une bibliotheque unidecode, nous nous limitons aux lettres
|
||||||
// accentuées du français.
|
// accentuées du français.
|
||||||
// https://fr.wikipedia.org/wiki/Diacritiques_utilisés_en_français
|
// https://fr.wikipedia.org/wiki/Diacritiques_utilisés_en_français
|
||||||
@@ -39,8 +38,7 @@ function sansAccents(mot){
|
|||||||
.replace("ü", "u");
|
.replace("ü", "u");
|
||||||
}
|
}
|
||||||
|
|
||||||
function construitListe(traductions)
|
function construitListe(traductions) {
|
||||||
{
|
|
||||||
var langue = $( "#mots" ).attr("data-langue");
|
var langue = $( "#mots" ).attr("data-langue");
|
||||||
|
|
||||||
metAJourLienChange(langue);
|
metAJourLienChange(langue);
|
||||||
@@ -55,27 +53,27 @@ function construitListe(traductions)
|
|||||||
$( "#mots" ).html("");
|
$( "#mots" ).html("");
|
||||||
$( "#index" ).html("");
|
$( "#index" ).html("");
|
||||||
|
|
||||||
var lettreAlphabet = '';
|
var lettre = '';
|
||||||
for (var i=0; i < traductions.length; i++) {
|
for (var i=0; i < traductions.length; i++) {
|
||||||
var mot = traductions[i];
|
var mot = traductions[i];
|
||||||
var l = sansAccents(mot[langue]).charAt(0).toUpperCase();
|
var l = sansAccents(mot[langue]).charAt(0).toUpperCase();
|
||||||
|
|
||||||
if (l != lettreAlphabet) {
|
if (l != lettre) {
|
||||||
lettreAlphabet = l;
|
lettre = l;
|
||||||
$( "#index" ).append(
|
$( "#index" ).append(
|
||||||
$("<a></a>")
|
$("<a></a>")
|
||||||
.attr("href", "#" + lettreAlphabet)
|
.attr("href", "#" + lettre)
|
||||||
.html(lettreAlphabet)
|
.html(lettre)
|
||||||
);
|
);
|
||||||
$( "#mots" ).append(
|
$( "#mots" ).append(
|
||||||
$("<div></div>")
|
$("<div></div>")
|
||||||
.attr("class", "groupe-lettre")
|
.attr("class", "groupe-lettre")
|
||||||
.append($("<a></a>").attr("name", lettreAlphabet))
|
.append($("<a></a>").attr("name", lettre))
|
||||||
.append($("<h3></h3>").html(lettreAlphabet))
|
.append($("<h3></h3>").html(lettre))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
var cle = '<span class="mot-anglais"> ' + mot.anglais + ' </span>';
|
var cle = '<span class="mot-anglais">' + mot.anglais + '</span>';
|
||||||
var val = '<span class="mot-francais">' + mot.francais + '</span>';
|
var val = '<span class="mot-francais">' + mot.francais + '</span>';
|
||||||
if (langue == "francais") {
|
if (langue == "francais") {
|
||||||
var tmp = cle;
|
var tmp = cle;
|
||||||
|
|||||||
@@ -43,10 +43,6 @@ h3
|
|||||||
.definition
|
.definition
|
||||||
{
|
{
|
||||||
padding: 1px 2px 1px 2px;
|
padding: 1px 2px 1px 2px;
|
||||||
}
|
|
||||||
|
|
||||||
.definition
|
|
||||||
{
|
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user