Commit da998a7dcf5a0a769236399b08b0e9699c261230

Authored by Geoffrey PREUD'HOMME
1 parent 059805e5

Nettoyage JS

Showing 3 changed files with 40 additions and 177 deletions   Show diff stats
js/base64.js deleted
@@ -1,135 +0,0 @@ @@ -1,135 +0,0 @@
1 -var Base64 = {  
2 -  
3 - // private property  
4 - _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",  
5 -  
6 - // public method for encoding  
7 - encode : function (input) {  
8 - var output = "";  
9 - var chr1, chr2, chr3, enc1, enc2, enc3, enc4;  
10 - var i = 0;  
11 -  
12 - input = Base64._utf8_encode(input);  
13 -  
14 - while (i < input.length) {  
15 -  
16 - chr1 = input.charCodeAt(i++);  
17 - chr2 = input.charCodeAt(i++);  
18 - chr3 = input.charCodeAt(i++);  
19 -  
20 - enc1 = chr1 >> 2;  
21 - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);  
22 - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);  
23 - enc4 = chr3 & 63;  
24 -  
25 - if (isNaN(chr2)) {  
26 - enc3 = enc4 = 64;  
27 - } else if (isNaN(chr3)) {  
28 - enc4 = 64;  
29 - }  
30 -  
31 - output = output +  
32 - this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +  
33 - this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);  
34 -  
35 - }  
36 -  
37 - return output;  
38 - },  
39 -  
40 - // public method for decoding  
41 - decode : function (input) {  
42 - var output = "";  
43 - var chr1, chr2, chr3;  
44 - var enc1, enc2, enc3, enc4;  
45 - var i = 0;  
46 -  
47 - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");  
48 -  
49 - while (i < input.length) {  
50 -  
51 - enc1 = this._keyStr.indexOf(input.charAt(i++));  
52 - enc2 = this._keyStr.indexOf(input.charAt(i++));  
53 - enc3 = this._keyStr.indexOf(input.charAt(i++));  
54 - enc4 = this._keyStr.indexOf(input.charAt(i++));  
55 -  
56 - chr1 = (enc1 << 2) | (enc2 >> 4);  
57 - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);  
58 - chr3 = ((enc3 & 3) << 6) | enc4;  
59 -  
60 - output = output + String.fromCharCode(chr1);  
61 -  
62 - if (enc3 != 64) {  
63 - output = output + String.fromCharCode(chr2);  
64 - }  
65 - if (enc4 != 64) {  
66 - output = output + String.fromCharCode(chr3);  
67 - }  
68 -  
69 - }  
70 -  
71 - output = Base64._utf8_decode(output);  
72 -  
73 - return output;  
74 -  
75 - },  
76 -  
77 - // private method for UTF-8 encoding  
78 - _utf8_encode : function (string) {  
79 - string = string.replace(/\r\n/g,"\n");  
80 - var utftext = "";  
81 -  
82 - for (var n = 0; n < string.length; n++) {  
83 -  
84 - var c = string.charCodeAt(n);  
85 -  
86 - if (c < 128) {  
87 - utftext += String.fromCharCode(c);  
88 - }  
89 - else if((c > 127) && (c < 2048)) {  
90 - utftext += String.fromCharCode((c >> 6) | 192);  
91 - utftext += String.fromCharCode((c & 63) | 128);  
92 - }  
93 - else {  
94 - utftext += String.fromCharCode((c >> 12) | 224);  
95 - utftext += String.fromCharCode(((c >> 6) & 63) | 128);  
96 - utftext += String.fromCharCode((c & 63) | 128);  
97 - }  
98 -  
99 - }  
100 -  
101 - return utftext;  
102 - },  
103 -  
104 - // private method for UTF-8 decoding  
105 - _utf8_decode : function (utftext) {  
106 - var string = "";  
107 - var i = 0;  
108 - var c = c1 = c2 = 0;  
109 -  
110 - while ( i < utftext.length ) {  
111 -  
112 - c = utftext.charCodeAt(i);  
113 -  
114 - if (c < 128) {  
115 - string += String.fromCharCode(c);  
116 - i++;  
117 - }  
118 - else if((c > 191) && (c < 224)) {  
119 - c2 = utftext.charCodeAt(i+1);  
120 - string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));  
121 - i += 2;  
122 - }  
123 - else {  
124 - c2 = utftext.charCodeAt(i+1);  
125 - c3 = utftext.charCodeAt(i+2);  
126 - string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));  
127 - i += 3;  
128 - }  
129 -  
130 - }  
131 -  
132 - return string;  
133 - }  
134 -  
135 -}  
1 $(document).ready(function() { 1 $(document).ready(function() {
2 -// enhance tel-links (from http://stackoverflow.com/a/18921965/2766106)  
3 -$("a[href^='tel:']").each(function () {  
4 - var target = "call-" + this.href.replace(/[^a-z0-9]*/gi, "");  
5 - var link = this; 2 + // enhance tel-links (from http://stackoverflow.com/a/18921965/2766106)
  3 + $("a[href^='tel:']").each(function() {
  4 + var target = "call-" + this.href.replace(/[^a-z0-9]*/gi, "");
  5 + var link = this;
6 6
7 - // load in iframe to supress potential errors when protocol is not available  
8 - $("body").append("<iframe name=\"" + target + "\" style=\"display: none\"></iframe>");  
9 - link.target = target; 7 + // load in iframe to supress potential errors when protocol is not available
  8 + $("body").append("<iframe name=\"" + target + "\" style=\"display: none\"></iframe>");
  9 + link.target = target;
10 10
11 - // replace tel with callto on desktop browsers for skype fallback  
12 - if (!navigator.userAgent.match(/(mobile)/gi)) {  
13 - link.href = link.href.replace(/^tel:/, "callto:");  
14 - }  
15 -}); 11 + // replace tel with callto on desktop browsers for skype fallback
  12 + if (!navigator.userAgent.match(/(mobile)/gi)) {
  13 + link.href = link.href.replace(/^tel:/, "callto:");
  14 + }
  15 + });
16 16
17 - // Carte  
18 - var mapCanvas = document.getElementById('map-canvas');  
19 - mapCanvas.innerHTML = '';  
20 - var polytechPos = new google.maps.LatLng(50.6074998, 3.1373338);  
21 - var mapOptions = {  
22 - center: polytechPos,  
23 - zoom: 16,  
24 - mapTypeId: google.maps.MapTypeId.ROADMAP  
25 - };  
26 - var map = new google.maps.Map(mapCanvas, mapOptions);  
27 - var marker = new google.maps.Marker({  
28 - place: {  
29 - location: polytechPos,  
30 - query: "Polytech Lille"  
31 - },  
32 - attribution: {  
33 - source: "Coupe de Robotique des Écoles Primaires",  
34 - webUrl: window.location.host  
35 - },  
36 - map: map,  
37 - title: "Polytech Lille"  
38 - });  
39 - var infowindow = new google.maps.InfoWindow({  
40 - content: "<strong>Polytech Lille</strong><br/>Lieux des évènements de la Coupe de Robotique des Écoles Primaires"  
41 - });  
42 - marker.addListener('click', function () {  
43 - infowindow.open(map, this);  
44 - }); 17 + // Carte
  18 + var mapCanvas = document.getElementById('map-canvas');
  19 + mapCanvas.innerHTML = '';
  20 + var polytechPos = new google.maps.LatLng(50.6074998, 3.1373338);
  21 + var mapOptions = {
  22 + center: polytechPos,
  23 + zoom: 16,
  24 + mapTypeId: google.maps.MapTypeId.ROADMAP
  25 + };
  26 + var map = new google.maps.Map(mapCanvas, mapOptions);
  27 + var marker = new google.maps.Marker({
  28 + place: {
  29 + location: polytechPos,
  30 + query: "Polytech Lille"
  31 + },
  32 + attribution: {
  33 + source: "Coupe de Robotique des Écoles Primaires",
  34 + webUrl: window.location.host
  35 + },
  36 + map: map,
  37 + title: "Polytech Lille"
  38 + });
  39 + var infowindow = new google.maps.InfoWindow({
  40 + content: "<strong>Polytech Lille</strong><br/>Lieux des évènements de la Coupe de Robotique des Écoles Primaires"
  41 + });
  42 + marker.addListener('click', function() {
  43 + infowindow.open(map, this);
  44 + });
45 }); 45 });
js/whirlpool.min.js deleted
@@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
1 -/* Whirlpool Hashing Function v3.0 ~ Sean Catchpole - Copyright 2009 Public Domain */  
2 -(function(){var D,h=10,u=[],w=[],q,p,B,v,A,f,e,b,a,G,F,s="\u1823\uc6E8\u87B8\u014F\u36A6\ud2F5\u796F\u9152\u60Bc\u9B8E\uA30c\u7B35\u1dE0\ud7c2\u2E4B\uFE57\u1577\u37E5\u9FF0\u4AdA\u58c9\u290A\uB1A0\u6B85\uBd5d\u10F4\ucB3E\u0567\uE427\u418B\uA77d\u95d8\uFBEE\u7c66\udd17\u479E\ucA2d\uBF07\uAd5A\u8333\u6302\uAA71\uc819\u49d9\uF2E3\u5B88\u9A26\u32B0\uE90F\ud580\uBEcd\u3448\uFF7A\u905F\u2068\u1AAE\uB454\u9322\u64F1\u7312\u4008\uc3Ec\udBA1\u8d3d\u9700\ucF2B\u7682\ud61B\uB5AF\u6A50\u45F3\u30EF\u3F55\uA2EA\u65BA\u2Fc0\udE1c\uFd4d\u9275\u068A\uB2E6\u0E1F\u62d4\uA896\uF9c5\u2559\u8472\u394c\u5E78\u388c\ud1A5\uE261\uB321\u9c1E\u43c7\uFc04\u5199\u6d0d\uFAdF\u7E24\u3BAB\ucE11\u8F4E\uB7EB\u3c81\u94F7\uB913\u2cd3\uE76E\uc403\u5644\u7FA9\u2ABB\uc153\udc0B\u9d6c\u3174\uF646\uAc89\u14E1\u163A\u6909\u70B6\ud0Ed\ucc42\u98A4\u285c\uF886";for(q=8;q-->0;){u[q]=[]}for(p=0;p<256;p++){B=s.charCodeAt(p/2);f=((p&1)==0)?B>>>8:B&255;e=f<<1;if(e>=256){e^=285}b=e<<1;if(b>=256){b^=285}a=b^f;G=b<<1;if(G>=256){G^=285}F=G^f;u[0][p]=[0,0];u[0][p][0]=(f<<24)|(f<<16)|(b<<8)|(f);u[0][p][1]=(G<<24)|(a<<16)|(e<<8)|(F);for(var q=1;q<8;q++){u[q][p]=[0,0];u[q][p][0]=(u[q-1][p][0]>>>8)|((u[q-1][p][1]<<24));u[q][p][1]=(u[q-1][p][1]>>>8)|((u[q-1][p][0]<<24))}}w[0]=[0,0];for(v=1;v<=h;v++){A=8*(v-1);w[v]=[0,0];w[v][0]=(u[0][A][0]&4278190080)^(u[1][A+1][0]&16711680)^(u[2][A+2][0]&65280)^(u[3][A+3][0]&255);w[v][1]=(u[4][A+4][1]&4278190080)^(u[5][A+5][1]&16711680)^(u[6][A+6][1]&65280)^(u[7][A+7][1]&255)}var z=[],y=[],n=0,j=0,d=[],o=[],m=[],l=[],g=[];var E=function(){var C,c,I,H,x;for(C=0,c=0;C<8;C++,c+=8){l[C]=[0,0];l[C][0]=((y[c]&255)<<24)^((y[c+1]&255)<<16)^((y[c+2]&255)<<8)^((y[c+3]&255));l[C][1]=((y[c+4]&255)<<24)^((y[c+5]&255)<<16)^((y[c+6]&255)<<8)^((y[c+7]&255))}for(C=0;C<8;C++){g[C]=[0,0];o[C]=[0,0];g[C][0]=l[C][0]^(o[C][0]=d[C][0]);g[C][1]=l[C][1]^(o[C][1]=d[C][1])}for(I=1;I<=h;I++){for(C=0;C<8;C++){m[C]=[0,0];for(x=0,H=56,c=0;x<8;x++,H-=8,c=H<32?1:0){m[C][0]^=u[x][(o[(C-x)&7][c]>>>(H%32))&255][0];m[C][1]^=u[x][(o[(C-x)&7][c]>>>(H%32))&255][1]}}for(C=0;C<8;C++){o[C][0]=m[C][0];o[C][1]=m[C][1]}o[0][0]^=w[I][0];o[0][1]^=w[I][1];for(C=0;C<8;C++){m[C][0]=o[C][0];m[C][1]=o[C][1];for(x=0,H=56,c=0;x<8;x++,H-=8,c=H<32?1:0){m[C][0]^=u[x][(g[(C-x)&7][c]>>>(H%32))&255][0];m[C][1]^=u[x][(g[(C-x)&7][c]>>>(H%32))&255][1]}}for(C=0;C<8;C++){g[C][0]=m[C][0];g[C][1]=m[C][1]}}for(C=0;C<8;C++){d[C][0]^=g[C][0]^l[C][0];d[C][1]^=g[C][1]^l[C][1]}};D=Whirlpool=function(c){return D.init().add(c).finalize()};D.version="3.0";D.init=function(){for(var c=32;c-->0;){z[c]=0}n=j=0;y=[0];for(c=8;c-->0;){d[c]=[0,0]}return D};var k=function(r){var c,x,t=r.toString();r=[];for(c=0;c<t.length;c++){x=t.charCodeAt(c);if(x>=256){r.push(x>>>8&255)}r.push(x&255)}return r};D.add=function(c,K){if(!c){return D}if(!K){c=k(c);K=c.length*8}var r=0,t=(8-(K&7))&7,C=n&7,x,H,J,I=K;for(x=31,J=0;x>=0;x--){J+=(z[x]&255)+(I%256);z[x]=J&255;J>>>=8;I=Math.floor(I/256)}while(K>8){H=((c[r]<<t)&255)|((c[r+1]&255)>>>(8-t));if(H<0||H>=256){return"Whirlpool requires a byte array"}y[j++]|=H>>>C;n+=8-C;if(n==512){E();n=j=0;y=[]}y[j]=((H<<(8-C))&255);n+=C;K-=8;r++}if(K>0){H=(c[r]<<t)&255;y[j]|=H>>>C}else{H=0}if(C+K<8){n+=K}else{j++;n+=8-C;K-=8-C;if(n==512){E();n=j=0;y=[]}y[j]=((H<<(8-C))&255);n+=K}return D};D.finalize=function(){var r,c,t,H="",C=[],x="0123456789ABCDEF".split("");y[j]|=128>>>(n&7);j++;if(j>32){while(j<64){y[j++]=0}E();j=0;y=[]}while(j<32){y[j++]=0}y.push.apply(y,z);E();for(r=0,c=0;r<8;r++,c+=8){t=d[r][0];C[c]=t>>>24&255;C[c+1]=t>>>16&255;C[c+2]=t>>>8&255;C[c+3]=t&255;t=d[r][1];C[c+4]=t>>>24&255;C[c+5]=t>>>16&255;C[c+6]=t>>>8&255;C[c+7]=t&255}for(r=0;r<C.length;r++){H+=x[C[r]>>>4];H+=x[C[r]&15]}return H}})();