Skip to content

Commit

Permalink
décode les caractères
Browse files Browse the repository at this point in the history
  • Loading branch information
azi-acceis committed Feb 1, 2024
1 parent 5146169 commit 6756bef
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@
<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<script>
function htmlDecode(str) {
var doc = new DOMParser().parseFromString(str, "text/html");
return doc.documentElement.textContent;
}
function entropie() {
/* Calcul de l'entropie */
var jeu_de_char = '';
var longueur = parseInt($('#longueur').val());
$('button').not('.is-outlined').each(function () {
jeu_de_char += $(this).data('charset');
jeu_de_char += htmlDecode($(this).data('charset'));
console.log(htmlDecode($(this).data('charset')).length);
});
// Supprime les valeurs dupliquées
jeu_de_char = [...new Set(jeu_de_char)].join("");
Expand Down Expand Up @@ -92,7 +97,7 @@ <h4 class="title is-4">Unitaires</h4>
</button>
</p>
<p class="control">
<button class="jeu-de-char button is-primary is-outlined" value="8" data-charset="\#$%&@^`~"
<button class="jeu-de-char button is-primary is-outlined" value="8" data-charset="#$%&@^`~"
data-tooltip="8 symboles # $ % & @ ^ ` ~ (caractères spéciaux n°1)">
# $ % & @ ^ ` ~
</button>
Expand All @@ -104,7 +109,7 @@ <h4 class="title is-4">Unitaires</h4>
</button>
</p>
<p class="control">
<button class="jeu-de-char button is-primary is-outlined" value="2" data-charset="%22'"
<button class="jeu-de-char button is-primary is-outlined" value="2" data-charset="&quot;'"
data-tooltip="2 symboles &quot; ' (caractères spéciaux n°3)">
" '
</button>
Expand All @@ -116,7 +121,7 @@ <h4 class="title is-4">Unitaires</h4>
</button>
</p>
<p class="control">
<button class="jeu-de-char button is-primary is-outlined" value="7" data-charset="%3C%3E*+!?="
<button class="jeu-de-char button is-primary is-outlined" value="7" data-charset="&lt;&gt;*+!?="
data-tooltip="7 symboles &lt; &gt; * + ! ? = (caractères spéciaux n°5)">
&lt; &gt; * + ! ? =
</button>
Expand Down Expand Up @@ -162,14 +167,14 @@ <h4 class="title is-4">Composés</h4>
</p>
<p class="control">
<button class="jeu-de-char button is-primary is-outlined" value="32"
data-charset="#$%&@^`~.,:;%22'%5C/|_-%3C%3E*+!?={[()]}"
data-charset="#$%&@^`~.,:;&quot;'\/|_-&lt;&gt;*+!?={[()]}"
data-tooltip="32 symboles # $ % & @ ^ ` ~ . , : ; &quot; ' \ / | _ - &lt; &gt; * + ! ? = { [ ( ) ] } (caractères spéciaux)">
caractères spéciaux
</button>
</p>
<p class="control">
<button class="jeu-de-char button is-primary is-outlined" value="38"
data-charset="#$%&@^`~.,:;%22'%5C/|_-%3C%3E*+!?={[()]}°£€¤µ§"
data-charset="#$%&@^`~.,:;&quot;'\/|_-&lt;&gt;*+!?={[()]}°£€¤µ§"
data-tooltip="38 symboles # $ % & @ ^ ` ~ . , : ; &quot; ' \ / | _ - &lt; &gt; * + ! ? = { [ ( ) ] } ° £ € ¤ µ § (caractères spéciaux étendus)">
caractères spéciaux étendus
</button>
Expand Down

0 comments on commit 6756bef

Please sign in to comment.