mirror of
https://github.com/soulaklabs/bitoduc.fr.git
synced 2025-12-08 17:13:23 +00:00
Ajout de désamorcer (sanitize), et mise en sûreté du js.
This commit is contained in:
@@ -4,6 +4,8 @@
|
|||||||
* Droits d'auteur 2013-2015 Quentin Sabah <quentin.sabah@gmail.com>
|
* Droits d'auteur 2013-2015 Quentin Sabah <quentin.sabah@gmail.com>
|
||||||
* Droits d'auteur 2015 Christophe-Marie Duquesne <chmd@chmd.fr>
|
* Droits d'auteur 2015 Christophe-Marie Duquesne <chmd@chmd.fr>
|
||||||
* Droits d'auteur 2015 Valentin Lorentz <progval+github@progval.net>
|
* Droits d'auteur 2015 Valentin Lorentz <progval+github@progval.net>
|
||||||
|
*
|
||||||
|
* Attention, ce fichier est désuet depuis la migration vers les pages de GitHub.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@@ -23,21 +25,22 @@ function mettreÀJourLienInversion() {
|
|||||||
var langueDestination = réciproque[langue];
|
var langueDestination = réciproque[langue];
|
||||||
$( "#lienInversion" )
|
$( "#lienInversion" )
|
||||||
.html(
|
.html(
|
||||||
'<span class="mot-' + langueSource + '">'
|
'<span class="mot-' + désamorcerLeHtml(langueSource) + '">'
|
||||||
+ langueSource.majusculer()
|
+ désamorcerLeHtml(langueSource.majusculer())
|
||||||
+ '</span>'
|
+ '</span>'
|
||||||
+ ' → '
|
+ ' → '
|
||||||
+ '<span class="mot-' + langueDestination + '">'
|
+ '<span class="mot-' + désamorcerLeHtml(langueDestination) + '">'
|
||||||
+ langueDestination.majusculer()
|
+ désamorcerLeHtml(langueDestination.majusculer())
|
||||||
+ '</span>'
|
+ '</span>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function htmlifier(mot, langue){
|
function htmlifier(mot, langue){
|
||||||
var res = '<span class="mot-' + langue + '">' + mot[langue] + '</span>';
|
var res = '<span class="mot-' + désamorcerLeHtml(langue) + '">';
|
||||||
|
res += désamorcerLeHtml(mot[langue]) + '</span>';
|
||||||
if (langue == "français") {
|
if (langue == "français") {
|
||||||
if ("genre" in mot){
|
if ("genre" in mot){
|
||||||
var genre = 'N' + mot["genre"].enMajuscules();
|
var genre = désamorcerLeHtml('N' + mot["genre"].enMajuscules());
|
||||||
res += ' <span class="genre">' + genre + '</span>';
|
res += ' <span class="genre">' + genre + '</span>';
|
||||||
}
|
}
|
||||||
if ("classe" in mot){
|
if ("classe" in mot){
|
||||||
@@ -112,6 +115,15 @@ function construireListe(traductions) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function désamorcerLeHtml(suspect) {
|
||||||
|
return suspect
|
||||||
|
.remplacer(/&/g, "&")
|
||||||
|
.remplacer(/</g, "<")
|
||||||
|
.remplacer(/>/g, ">")
|
||||||
|
.remplacer(/'/g, "'")
|
||||||
|
.remplacer(/"/g, """);
|
||||||
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$.récupérerJSON("liste_de_traductions.json", function(traductions) {
|
$.récupérerJSON("liste_de_traductions.json", function(traductions) {
|
||||||
construireListe(traductions);
|
construireListe(traductions);
|
||||||
|
|||||||
@@ -182,7 +182,8 @@
|
|||||||
{"anglais": "Rollback", "français": "Rétropédalage", "genre": "m", "classe": "groupe nominal"},
|
{"anglais": "Rollback", "français": "Rétropédalage", "genre": "m", "classe": "groupe nominal"},
|
||||||
{"anglais": "Rolling release", "français": "Publication continue", "genre": "f", "classe": "groupe nominal"},
|
{"anglais": "Rolling release", "français": "Publication continue", "genre": "f", "classe": "groupe nominal"},
|
||||||
{"anglais": "ROM (Read-Only Memory)", "français": "Mémoire morte", "genre": "f", "classe": "groupe nominal"},
|
{"anglais": "ROM (Read-Only Memory)", "français": "Mémoire morte", "genre": "f", "classe": "groupe nominal"},
|
||||||
{"anglais": "RTFM (Read The Fucking Manual)", "français": "LPDM (Lis le Putain De Manuel)", "classe": "proposition"},
|
{"anglais": "RTFM (Read The Fucking Manual)", "français": "LPDM (Lis le Putain De Manuel)", "classe": "proposition"},
|
||||||
|
{"anglais": "Sanitize", "français": "Désamorcer", "classe": "verbe"},
|
||||||
{"anglais": "Scale", "français": "Passe à l’échelle", "classe": "groupe verbal"},
|
{"anglais": "Scale", "français": "Passe à l’échelle", "classe": "groupe verbal"},
|
||||||
{"anglais": "Scaling", "français": "Passage à l’échelle", "genre": "m", "classe": "groupe nominal"},
|
{"anglais": "Scaling", "français": "Passage à l’échelle", "genre": "m", "classe": "groupe nominal"},
|
||||||
{"anglais": "Selfie", "français": "Egoportrait", "genre": "m", "classe": "groupe nominal"},
|
{"anglais": "Selfie", "français": "Egoportrait", "genre": "m", "classe": "groupe nominal"},
|
||||||
|
|||||||
Reference in New Issue
Block a user