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 2015 Christophe-Marie Duquesne <chmd@chmd.fr>
|
||||
* 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';
|
||||
@@ -23,21 +25,22 @@ function mettreÀJourLienInversion() {
|
||||
var langueDestination = réciproque[langue];
|
||||
$( "#lienInversion" )
|
||||
.html(
|
||||
'<span class="mot-' + langueSource + '">'
|
||||
+ langueSource.majusculer()
|
||||
'<span class="mot-' + désamorcerLeHtml(langueSource) + '">'
|
||||
+ désamorcerLeHtml(langueSource.majusculer())
|
||||
+ '</span>'
|
||||
+ ' → '
|
||||
+ '<span class="mot-' + langueDestination + '">'
|
||||
+ langueDestination.majusculer()
|
||||
+ '<span class="mot-' + désamorcerLeHtml(langueDestination) + '">'
|
||||
+ désamorcerLeHtml(langueDestination.majusculer())
|
||||
+ '</span>'
|
||||
);
|
||||
}
|
||||
|
||||
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 ("genre" in mot){
|
||||
var genre = 'N' + mot["genre"].enMajuscules();
|
||||
var genre = désamorcerLeHtml('N' + mot["genre"].enMajuscules());
|
||||
res += ' <span class="genre">' + genre + '</span>';
|
||||
}
|
||||
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() {
|
||||
$.récupérerJSON("liste_de_traductions.json", function(traductions) {
|
||||
construireListe(traductions);
|
||||
|
||||
@@ -183,6 +183,7 @@
|
||||
{"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": "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": "Scaling", "français": "Passage à l’échelle", "genre": "m", "classe": "groupe nominal"},
|
||||
{"anglais": "Selfie", "français": "Egoportrait", "genre": "m", "classe": "groupe nominal"},
|
||||
|
||||
Reference in New Issue
Block a user