From a51a67a5674bd419f811b8e1a4ff527a498dfb9a Mon Sep 17 00:00:00 2001 From: Christophe-Marie Duquesne Date: Sun, 13 Dec 2015 13:17:31 +0100 Subject: [PATCH] Nettoyage du javascript MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Renommage de creuille.js en principal.js (plus soutenu et surtout plus bitoduc) - Utilisation de "'use strict';" - Code de gogol analytique mis dans un fichier dédié --- fr.js | 8 +++++--- gogol-analytique.js | 19 +++++++++++++++++++ index.html | 23 ++--------------------- creuille.js => principal.js | 10 ++++++++++ 4 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 gogol-analytique.js rename creuille.js => principal.js (94%) diff --git a/fr.js b/fr.js index 6ddf219..576032a 100644 --- a/fr.js +++ b/fr.js @@ -1,13 +1,15 @@ -Objet = Object +'use strict'; + +var Objet = Object Objet.creer = Objet.create -Chaine = String +var Chaine = String Chaine.prototype.enMinuscules = Chaine.prototype.toLowerCase Chaine.prototype.enMajuscules = Chaine.prototype.toUpperCase Chaine.prototype.remplacer = Chaine.prototype.replace Chaine.prototype.caractereA = Chaine.prototype.charAt -Tableau = Array +var Tableau = Array Tableau.prototype.tri = Tableau.prototype.sort Tableau.prototype.longueur = function () { return this.length; } Tableau.prototype.pousser = Tableau.prototype.push diff --git a/gogol-analytique.js b/gogol-analytique.js new file mode 100644 index 0000000..0da3a65 --- /dev/null +++ b/gogol-analytique.js @@ -0,0 +1,19 @@ +'use strict'; + +$(function() { + var _gaq = _gaq || []; + _gaq.pousser(['_setAccount', 'UA-42609030-1']); + _gaq.pousser(['_trackPageview']); + + (function() { + var ga = document.creerElement('script'); + ga.type = 'text/javascript'; + ga.async = true; + ga.src = + ('https:' == document.localisation.protocole ? + 'https://ssl' : 'http://www') + + '.google-analytics.com/ga.js'; + var s = document.recupererElementParNomDEtiquette('script')[0]; + s.parentNode.insertBefore(ga, s); + })(); +}); diff --git a/index.html b/index.html index 718e6c6..10244ab 100644 --- a/index.html +++ b/index.html @@ -8,29 +8,10 @@ - - - + + -

Bitoduc.fr : termes informatiques en français

diff --git a/creuille.js b/principal.js similarity index 94% rename from creuille.js rename to principal.js index 1bd403a..a3287a4 100644 --- a/creuille.js +++ b/principal.js @@ -1,3 +1,5 @@ +'use strict'; + var reciproque = {'anglais': 'francais', 'francais': 'anglais'}; var embelli = {'francais': 'Français', 'anglais': 'Anglais'}; @@ -123,3 +125,11 @@ function construitListe(traductions) { ); } } + +$(function() { + $.recupererJSON( "traductions.json", function( traductions ) { + construitListe(traductions); + $( "#lienChange" ).clic( function() {changeDeSens(traductions);} ); + }); +}); +