Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript
JavaScript Forum programmation JavaScript. Lire : Cours JavaScript, FAQ JavaScript, Toutes les FAQ JavaScript et Sources JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 10/01/2012, 01h52   #1
Débutant
 
Inscription : mai 2005
Messages : 1 957
Détails du profil
Informations personnelles :
Localisation : Suisse

Informations forums :
Inscription : mai 2005
Messages : 1 957
Points : 615
Points : 615
Par défaut Comment comprendre ce code [ function(p,a,c,k,e,d){} ]

Bonjour à tous,

Je suis face un problème chinois,
Je dois comprendre un code et avant tou j'aimerais savoir comment le rendre lisible. Il doit etre compacté et y aurait il le moyen de le rendre "décompacter"?

Aussi, pourriez-vous me mettre sur la piste? Que fait-il en gros?

Code :
1
2
 
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('h(!j.21==1){7 $3=$}7 i={1c:0,11:"",6:{w:[],v:[],t:{H:0,G:0},x:[],C:[],U:j.U,1s:j.1r,13:j.13},1l:8(b){7 a=2o 2h();a.2m(a.2g()+27*24*1);1q.2c="22="+1X(b)+"; 26=/;2n="+a.2f()},1P:8(a,b){1Q(a){l"v":5.6.v.Y(b);r;l"w":5.6.w.Y(b);r;l"x":5.6.x.Y(b);r;l"C":5.6.C.Y(b);r;l"z":5.6.t.H=b;r;l"D":5.6.t.G=b;r}},2e:8(){h(1m(5.10!="1f")){5.10.2b("14").k("y","y");5.10.2a(8(){$3("q#X"+$3(5).B().B().k("K").S("V","")).W("E")});$3(".9 #1e").1G()}},1M:8(b,c){1Q(b){l"v":7 a=5.6.v.Q(c);h(a!=-1){5.6.v.R(a,1)}r;l"w":7 a=5.6.w.Q(c);h(a!=-1){5.6.w.R(a,1)}r;l"x":7 a=5.6.x.Q(c);h(a!=-1){5.6.x.R(a,1)}r;l"C":7 a=5.6.C.Q(c);h(a!=-1){5.6.C.R(a,1)}r;l"z":5.6.t.H=0;r;l"D":5.6.t.G=0;r}},29:8(){5.6={w:[],v:[],t:{H:0,G:0},x:[],C:[],U:j.U,1s:j.1r,13:j.13};$3(".9 :1b").k("y","");17(j.1i,j.1k);$3(".9 .1I").15("E");5.A()},1h:8(b){7 b=b||"2l";7 a=b.2k("2i");5.J=a[0];5.19=a[1];5.A()},2j:8(a){5.18=a||0;5.A()},1U:8(a){5.O=a;5.A(1g)},1B:8(){7 d=5.J?"&1R="+5.J:"";7 b=5.19?"&1W="+5.19:"";7 a=5.18?"&n="+5.18:"";7 c=5.O?"&p="+5.O:"";1O 1z+"/1y/1x/1V.23?"+d+b+a+c},A:8(c){5.O=c?5.O:1;7 b=5.1c?"20#1S":"u#1w";7 d=$3(b).1Z();7 a=$3(b).1Y();7 f=$3(b).1T()/2-25;7 e=$3(b).2d()/2-25;$3(b).1p("Z","2X");h($3(b+" #1d").I==0){$3(b).2W(\'<u K="1d" 1F="Z:1t;1u:0;1D:0;2U:.4;2O:\'+d+"12;1A:"+a+\'12;2R-2P:#2Q"></u><u 1F="Z:1t;1u:\'+e+"12;1D:"+f+\'12"><2L 1A="2M" 2S="\'+1z+\'/1y/1x/1d.2T"/></u>\')}h(5.11){5.11.2V()}5.11=$3.2N(5.1B(),{6:2J.2p(5.6)},8(g){$3("u#1w").2w(g);$3(b).1p("Z","")});5.1c=1}};$3(1q).2K(8(){h($3(".9 :y").I>0){i.10=$3(".9 :y");$3(".9 :1b").k("y","");$3(".9 #1e").2x()}$3(".9 :1b").T("14",8(){7 a=["v","C","w","x"];2v(7 b=0;b<a.I;b++){h($3(5).2u("2q"+a[b])){h($3(5).k("y")){i.1P(a[b],$3(5).m());$3("q#X"+$3(5).B().B().k("K").S("V","")).W("E")}F{i.1M(a[b],$3(5).m());h(i.6[a[b]].I==0||$3(5).B().B().2r(":y").I==0){$3("q#X"+$3(5).B().B().k("K").S("V","")).15("E")}}}}$3(".9 #1e").1G();i.A()});$3(".9 .1I").T("14",8(){7 b=$3(5).k("K").S("X","");7 a=$3(".9 #V"+b);a.1J(":1N")?$3(".9 q#1v"+b).k("L","1o"):$3(".9 q#1v"+b).k("L","2s");a.1L()});$3(".9 o#z, .9 o#D").T("2t",8(){17($3("o#z").m(),$3("o#D").m());1H(8(){h(1m(i.J)=="1f"){i.1h("1C")}F{i.A()}},2z)});h(j.2A){$3("u#2G 1E, u#2H 1E").T("14",8(){h($3("q#1n").k("L")=="1K"){$3("q#1n").k("L","1o")}F{$3("q#1n").k("L","1K")}$3("u.9").1L(2I,8(){h($(5).1J(":1N")){i.1l(0)}F{i.1l(1)}})})}$3("#s-P").s({2F:1g,P:1g,1a:j.1i,1j:j.1k,2E:1,2B:8(){h($3(".9 o#z").m()==$3(5).s("M","1a")&&$3(".9 o#D").m()==$3(5).s("M","1j")){$3(".9 q#16").15("E")}F{$3(".9 q#16").W("E")}h(1m(i.J)=="1f"){i.1h("1C")}F{i.A()}},2C:8(a,b){i.6.t.H=b.N[0];i.6.t.G=b.N[1];$3("o#z").m(b.N[0]);$3("o#D").m(b.N[1])}});17(j.1i,j.1k)});8 17(a,b){$3("#s-P").s("M","N",[a,b]).s("2D");$3("o#z").m(a);$3("o#D").m(b);i.6.t.H=a;i.6.t.G=b;h($3(".9 o#z").m()==$3("#s-P").s("M","1a")&&$3(".9 o#D").m()==$3("#s-P").s("M","1j")){$3(".9 q#16").15("E")}F{$3(".9 q#16").W("E")}}7 1H=(8(){7 a=0;1O 8(c,b){2y(a);a=28(c,b)}})();',62,184,'|||jq||this|data|var|function|LFoptions||||||||if|LFManager|LFsettings|attr|case|val||input||span|break|slider|price|div|attributes|features|tags|checked|price_low|sendRequest|parent|manufacturers|price_high|active|else|high|low|length|orderBy|id|class|option|values|page|range|indexOf|splice|replace|bind|convert|LFslide_|addClass|LFheader_|push|position|lastOptions|request|px|language|click|removeClass|LFheader_price|changeSliderValues|pageSize|orderWay|min|checkbox|sent|loadingMask|LFrestoreLast|undefined|true|sort|pricelow|max|pricehigh|saveState|typeof|StatFilter|expanded|css|document|category|idcategory|absolute|top|Stat|center_column|livefilter|modules|baseDir|height|getURI|price_asc|left|h4|style|fadeOut|delay|LFaccordeon|is|minimizedup|slideToggle|remove|hidden|return|add|switch|orderby|product_list|outerWidth|setPage|filter|orderway|escape|innerHeight|innerWidth|ul|compatibility|LFManagerState|php|||path|3600000|setTimeout|clear|each|trigger|cookie|outerHeight|restoreLast|toGMTString|getTime|Date|_|setPageSize|split|position_asc|setTime|expires|new|stringify|LF|find|minimized|keyup|hasClass|for|html|fadeIn|clearTimeout|1000|collapse|stop|slide|enable|step|animate|LFStyleFixed|LFStyleColumn|500|JSON|ready|img|50px|post|width|color|fff|background|src|gif|opacity|abort|append|relative'.split('|'),0,{}))
Merci pour vos lumières!!!
__________________
Il ne suffit pas de tout savoir. Vouloir et persévérer, c'est déjà presque tout!
pierrot10 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/01/2012, 08h52   #2
Rédacteur/Modérateur
 
Avatar de SpaceFrog
 
Homme
Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Analyste Programmeur
Inscription : mars 2002
Messages : 30 075
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : Royaume-Uni

Informations professionnelles :
Activité : Développeur Web Php Mysql Html Javascript CSS Apache - Intégrateur - Analyste Programmeur
Secteur : Industrie

Informations forums :
Inscription : mars 2002
Messages : 30 075
Points : 45 207
Points : 45 207
fais une recherche sur google avec "javascript unpacker"

Mais pour commencer tu as ceci :

Code :
eval ( function(p,a,c,k,e,d){e=function(c){return( ...
eval attend une chaine string
c'est donc que la closure function(p,a,c,k,e,d) va retourner une chaine
pour la visualiser, il suffit de supprimer l'eval et d'envoyer ce que la fonction retourne dans un textarea par exemple:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
<script type="text/javascript">
function bar(){
return  function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('h(!j.21==1){7 $3=$}7 i={1c:0,11:"",6:{w:[],v:[],t:{H:0,G:0},x:[],C:[],U:j.U,1s:j.1r,13:j.13},1l:8(b){7 a=2o 2h();a.2m(a.2g()+27*24*1);1q.2c="22="+1X(b)+"; 26=/;2n="+a.2f()},1P:8(a,b){1Q(a){l"v":5.6.v.Y(b);r;l"w":5.6.w.Y(b);r;l"x":5.6.x.Y(b);r;l"C":5.6.C.Y(b);r;l"z":5.6.t.H=b;r;l"D":5.6.t.G=b;r}},2e:8(){h(1m(5.10!="1f")){5.10.2b("14").k("y","y");5.10.2a(8(){$3("q#X"+$3(5).B().B().k("K").S("V","")).W("E")});$3(".9 #1e").1G()}},1M:8(b,c){1Q(b){l"v":7 a=5.6.v.Q(c);h(a!=-1){5.6.v.R(a,1)}r;l"w":7 a=5.6.w.Q(c);h(a!=-1){5.6.w.R(a,1)}r;l"x":7 a=5.6.x.Q(c);h(a!=-1){5.6.x.R(a,1)}r;l"C":7 a=5.6.C.Q(c);h(a!=-1){5.6.C.R(a,1)}r;l"z":5.6.t.H=0;r;l"D":5.6.t.G=0;r}},29:8(){5.6={w:[],v:[],t:{H:0,G:0},x:[],C:[],U:j.U,1s:j.1r,13:j.13};$3(".9 :1b").k("y","");17(j.1i,j.1k);$3(".9 .1I").15("E");5.A()},1h:8(b){7 b=b||"2l";7 a=b.2k("2i");5.J=a[0];5.19=a[1];5.A()},2j:8(a){5.18=a||0;5.A()},1U:8(a){5.O=a;5.A(1g)},1B:8(){7 d=5.J?"&1R="+5.J:"";7 b=5.19?"&1W="+5.19:"";7 a=5.18?"&n="+5.18:"";7 c=5.O?"&p="+5.O:"";1O 1z+"/1y/1x/1V.23?"+d+b+a+c},A:8(c){5.O=c?5.O:1;7 b=5.1c?"20#1S":"u#1w";7 d=$3(b).1Z();7 a=$3(b).1Y();7 f=$3(b).1T()/2-25;7 e=$3(b).2d()/2-25;$3(b).1p("Z","2X");h($3(b+" #1d").I==0){$3(b).2W(\'<u K="1d" 1F="Z:1t;1u:0;1D:0;2U:.4;2O:\'+d+"12;1A:"+a+\'12;2R-2P:#2Q"></u><u 1F="Z:1t;1u:\'+e+"12;1D:"+f+\'12"><2L 1A="2M" 2S="\'+1z+\'/1y/1x/1d.2T"/></u>\')}h(5.11){5.11.2V()}5.11=$3.2N(5.1B(),{6:2J.2p(5.6)},8(g){$3("u#1w").2w(g);$3(b).1p("Z","")});5.1c=1}};$3(1q).2K(8(){h($3(".9 :y").I>0){i.10=$3(".9 :y");$3(".9 :1b").k("y","");$3(".9 #1e").2x()}$3(".9 :1b").T("14",8(){7 a=["v","C","w","x"];2v(7 b=0;b<a.I;b++){h($3(5).2u("2q"+a[b])){h($3(5).k("y")){i.1P(a[b],$3(5).m());$3("q#X"+$3(5).B().B().k("K").S("V","")).W("E")}F{i.1M(a[b],$3(5).m());h(i.6[a[b]].I==0||$3(5).B().B().2r(":y").I==0){$3("q#X"+$3(5).B().B().k("K").S("V","")).15("E")}}}}$3(".9 #1e").1G();i.A()});$3(".9 .1I").T("14",8(){7 b=$3(5).k("K").S("X","");7 a=$3(".9 #V"+b);a.1J(":1N")?$3(".9 q#1v"+b).k("L","1o"):$3(".9 q#1v"+b).k("L","2s");a.1L()});$3(".9 o#z, .9 o#D").T("2t",8(){17($3("o#z").m(),$3("o#D").m());1H(8(){h(1m(i.J)=="1f"){i.1h("1C")}F{i.A()}},2z)});h(j.2A){$3("u#2G 1E, u#2H 1E").T("14",8(){h($3("q#1n").k("L")=="1K"){$3("q#1n").k("L","1o")}F{$3("q#1n").k("L","1K")}$3("u.9").1L(2I,8(){h($(5).1J(":1N")){i.1l(0)}F{i.1l(1)}})})}$3("#s-P").s({2F:1g,P:1g,1a:j.1i,1j:j.1k,2E:1,2B:8(){h($3(".9 o#z").m()==$3(5).s("M","1a")&&$3(".9 o#D").m()==$3(5).s("M","1j")){$3(".9 q#16").15("E")}F{$3(".9 q#16").W("E")}h(1m(i.J)=="1f"){i.1h("1C")}F{i.A()}},2C:8(a,b){i.6.t.H=b.N[0];i.6.t.G=b.N[1];$3("o#z").m(b.N[0]);$3("o#D").m(b.N[1])}});17(j.1i,j.1k)});8 17(a,b){$3("#s-P").s("M","N",[a,b]).s("2D");$3("o#z").m(a);$3("o#D").m(b);i.6.t.H=a;i.6.t.G=b;h($3(".9 o#z").m()==$3("#s-P").s("M","1a")&&$3(".9 o#D").m()==$3("#s-P").s("M","1j")){$3(".9 q#16").15("E")}F{$3(".9 q#16").W("E")}}7 1H=(8(){7 a=0;1O 8(c,b){2y(a);a=28(c,b)}})();',62,184,'|||jq||this|data|var|function|LFoptions||||||||if|LFManager|LFsettings|attr|case|val||input||span|break|slider|price|div|attributes|features|tags|checked|price_low|sendRequest|parent|manufacturers|price_high|active|else|high|low|length|orderBy|id|class|option|values|page|range|indexOf|splice|replace|bind|convert|LFslide_|addClass|LFheader_|push|position|lastOptions|request|px|language|click|removeClass|LFheader_price|changeSliderValues|pageSize|orderWay|min|checkbox|sent|loadingMask|LFrestoreLast|undefined|true|sort|pricelow|max|pricehigh|saveState|typeof|StatFilter|expanded|css|document|category|idcategory|absolute|top|Stat|center_column|livefilter|modules|baseDir|height|getURI|price_asc|left|h4|style|fadeOut|delay|LFaccordeon|is|minimizedup|slideToggle|remove|hidden|return|add|switch|orderby|product_list|outerWidth|setPage|filter|orderway|escape|innerHeight|innerWidth|ul|compatibility|LFManagerState|php|||path|3600000|setTimeout|clear|each|trigger|cookie|outerHeight|restoreLast|toGMTString|getTime|Date|_|setPageSize|split|position_asc|setTime|expires|new|stringify|LF|find|minimized|keyup|hasClass|for|html|fadeIn|clearTimeout|1000|collapse|stop|slide|enable|step|animate|LFStyleFixed|LFStyleColumn|500|JSON|ready|img|50px|post|width|color|fff|background|src|gif|opacity|abort|append|relative'.split('|'),0,{})
}
function foo(){
document.getElementById('res').value=bar()
}
</script>
</head>
<body onload="foo()">
<textarea id="res" style="width:100%;height:100%"></textarea>
</body>
</html>
Après le code ayant été packed ... bonne chance pour t'y retrouver dans les variables !
__________________
Ma page Developpez
Président du CCMPTP (Comité Contre le Mot "Problème" dans les Titres de Posts)
Deux règles du succès: 1) Ne communiquez jamais à quelqu'un tout votre savoir...
Votre post est résolu ? Alors n'oubliez pas le Tag


réalisations :www.planet-languages.com|www.saftair.com| www.ouestisol.fr | www.sebemex.fr | www.extramiante.fr | www.sistac-alizay.fr | www.acoustishop.fr | www.litt.fr | www.ouestventil.fr
SpaceFrog est actuellement connecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/01/2012, 13h48   #3
Membre Expert
 
Avatar de Willpower
 
Homme Boris Dessy
sans emploi
Inscription : décembre 2010
Messages : 872
Détails du profil
Informations personnelles :
Nom : Homme Boris Dessy
Localisation : Belgique

Informations professionnelles :
Activité : sans emploi

Informations forums :
Inscription : décembre 2010
Messages : 872
Points : 1 381
Points : 1 381
Il a été pacté avec un des outils de pactage les plus connus, il est donc facile de le décompacter avec cet outil : http://jsbeautifier.org/

Ca te donne le résultat suivant :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
if (!LFsettings.compatibility == 1) {
    var $jq = $
}
var LFManager = {
    sent: 0,
    request: "",
    data: {
        features: [],
        attributes: [],
        price: {
            low: 0,
            high: 0
        },
        tags: [],
        manufacturers: [],
        convert: LFsettings.convert,
        idcategory: LFsettings.category,
        language: LFsettings.language
    },
    saveState: function (b) {
        var a = new Date();
        a.setTime(a.getTime() + 3600000 * 24 * 1);
        document.cookie = "LFManagerState=" + escape(b) + "; path=/;expires=" + a.toGMTString()
    },
    add: function (a, b) {
        switch (a) {
        case "attributes":
            this.data.attributes.push(b);
            break;
        case "features":
            this.data.features.push(b);
            break;
        case "tags":
            this.data.tags.push(b);
            break;
        case "manufacturers":
            this.data.manufacturers.push(b);
            break;
        case "price_low":
            this.data.price.low = b;
            break;
        case "price_high":
            this.data.price.high = b;
            break
        }
    },
    restoreLast: function () {
        if (typeof (this.lastOptions != "undefined")) {
            this.lastOptions.trigger("click").attr("checked", "checked");
            this.lastOptions.each(function () {
                $jq("span#LFheader_" + $jq(this).parent().parent().attr("id").replace("LFslide_", "")).addClass("active")
            });
            $jq(".LFoptions #LFrestoreLast").fadeOut()
        }
    },
    remove: function (b, c) {
        switch (b) {
        case "attributes":
            var a = this.data.attributes.indexOf(c);
            if (a != -1) {
                this.data.attributes.splice(a, 1)
            }
            break;
        case "features":
            var a = this.data.features.indexOf(c);
            if (a != -1) {
                this.data.features.splice(a, 1)
            }
            break;
        case "tags":
            var a = this.data.tags.indexOf(c);
            if (a != -1) {
                this.data.tags.splice(a, 1)
            }
            break;
        case "manufacturers":
            var a = this.data.manufacturers.indexOf(c);
            if (a != -1) {
                this.data.manufacturers.splice(a, 1)
            }
            break;
        case "price_low":
            this.data.price.low = 0;
            break;
        case "price_high":
            this.data.price.high = 0;
            break
        }
    },
    clear: function () {
        this.data = {
            features: [],
            attributes: [],
            price: {
                low: 0,
                high: 0
            },
            tags: [],
            manufacturers: [],
            convert: LFsettings.convert,
            idcategory: LFsettings.category,
            language: LFsettings.language
        };
        $jq(".LFoptions :checkbox").attr("checked", "");
        changeSliderValues(LFsettings.pricelow, LFsettings.pricehigh);
        $jq(".LFoptions .LFaccordeon").removeClass("active");
        this.sendRequest()
    },
    sort: function (b) {
        var b = b || "position_asc";
        var a = b.split("_");
        this.orderBy = a[0];
        this.orderWay = a[1];
        this.sendRequest()
    },
    setPageSize: function (a) {
        this.pageSize = a || 0;
        this.sendRequest()
    },
    setPage: function (a) {
        this.page = a;
        this.sendRequest(true)
    },
    getURI: function () {
        var d = this.orderBy ? "&orderby=" + this.orderBy : "";
        var b = this.orderWay ? "&orderway=" + this.orderWay : "";
        var a = this.pageSize ? "&n=" + this.pageSize : "";
        var c = this.page ? "&p=" + this.page : "";
        return baseDir + "/modules/livefilter/filter.php?" + d + b + a + c
    },
    sendRequest: function (c) {
        this.page = c ? this.page : 1;
        var b = this.sent ? "ul#product_list" : "div#center_column";
        var d = $jq(b).innerWidth();
        var a = $jq(b).innerHeight();
        var f = $jq(b).outerWidth() / 2 - 25;
        var e = $jq(b).outerHeight() / 2 - 25;
        $jq(b).css("position", "relative");
        if ($jq(b + " #loadingMask").length == 0) {
            $jq(b).append('<div id="loadingMask" style="position:absolute;top:0;left:0;opacity:.4;width:' + d + "px;height:" + a + 'px;background-color:#fff"></div><div style="position:absolute;top:' + e + "px;left:" + f + 'px"><img height="50px" src="' + baseDir + '/modules/livefilter/loadingMask.gif"/></div>')
        }
        if (this.request) {
            this.request.abort()
        }
        this.request = $jq.post(this.getURI(), {
            data: JSON.stringify(this.data)
        }, function (g) {
            $jq("div#center_column").html(g);
            $jq(b).css("position", "")
        });
        this.sent = 1
    }
};
$jq(document).ready(function () {
    if ($jq(".LFoptions :checked").length > 0) {
        LFManager.lastOptions = $jq(".LFoptions :checked");
        $jq(".LFoptions :checkbox").attr("checked", "");
        $jq(".LFoptions #LFrestoreLast").fadeIn()
    }
    $jq(".LFoptions :checkbox").bind("click", function () {
        var a = ["attributes", "manufacturers", "features", "tags"];
        for (var b = 0; b < a.length; b++) {
            if ($jq(this).hasClass("LF" + a[b])) {
                if ($jq(this).attr("checked")) {
                    LFManager.add(a[b], $jq(this).val());
                    $jq("span#LFheader_" + $jq(this).parent().parent().attr("id").replace("LFslide_", "")).addClass("active")
                } else {
                    LFManager.remove(a[b], $jq(this).val());
                    if (LFManager.data[a[b]].length == 0 || $jq(this).parent().parent().find(":checked").length == 0) {
                        $jq("span#LFheader_" + $jq(this).parent().parent().attr("id").replace("LFslide_", "")).removeClass("active")
                    }
                }
            }
        }
        $jq(".LFoptions #LFrestoreLast").fadeOut();
        LFManager.sendRequest()
    });
    $jq(".LFoptions .LFaccordeon").bind("click", function () {
        var b = $jq(this).attr("id").replace("LFheader_", "");
        var a = $jq(".LFoptions #LFslide_" + b);
        a.is(":hidden") ? $jq(".LFoptions span#Stat" + b).attr("class", "expanded") : $jq(".LFoptions span#Stat" + b).attr("class", "minimized");
        a.slideToggle()
    });
    $jq(".LFoptions input#price_low, .LFoptions input#price_high").bind("keyup", function () {
        changeSliderValues($jq("input#price_low").val(), $jq("input#price_high").val());
        delay(function () {
            if (typeof (LFManager.orderBy) == "undefined") {
                LFManager.sort("price_asc")
            } else {
                LFManager.sendRequest()
            }
        }, 1000)
    });
    if (LFsettings.collapse) {
        $jq("div#LFStyleFixed h4, div#LFStyleColumn h4").bind("click", function () {
            if ($jq("span#StatFilter").attr("class") == "minimizedup") {
                $jq("span#StatFilter").attr("class", "expanded")
            } else {
                $jq("span#StatFilter").attr("class", "minimizedup")
            }
            $jq("div.LFoptions").slideToggle(500, function () {
                if ($(this).is(":hidden")) {
                    LFManager.saveState(0)
                } else {
                    LFManager.saveState(1)
                }
            })
        })
    }
    $jq("#slider-range").slider({
        animate: true,
        range: true,
        min: LFsettings.pricelow,
        max: LFsettings.pricehigh,
        step: 1,
        stop: function () {
            if ($jq(".LFoptions input#price_low").val() == $jq(this).slider("option", "min") && $jq(".LFoptions input#price_high").val() == $jq(this).slider("option", "max")) {
                $jq(".LFoptions span#LFheader_price").removeClass("active")
            } else {
                $jq(".LFoptions span#LFheader_price").addClass("active")
            }
            if (typeof (LFManager.orderBy) == "undefined") {
                LFManager.sort("price_asc")
            } else {
                LFManager.sendRequest()
            }
        },
        slide: function (a, b) {
            LFManager.data.price.low = b.values[0];
            LFManager.data.price.high = b.values[1];
            $jq("input#price_low").val(b.values[0]);
            $jq("input#price_high").val(b.values[1])
        }
    });
    changeSliderValues(LFsettings.pricelow, LFsettings.pricehigh)
});
 
function changeSliderValues(a, b) {
    $jq("#slider-range").slider("option", "values", [a, b]).slider("enable");
    $jq("input#price_low").val(a);
    $jq("input#price_high").val(b);
    LFManager.data.price.low = a;
    LFManager.data.price.high = b;
    if ($jq(".LFoptions input#price_low").val() == $jq("#slider-range").slider("option", "min") && $jq(".LFoptions input#price_high").val() == $jq("#slider-range").slider("option", "max")) {
        $jq(".LFoptions span#LFheader_price").removeClass("active")
    } else {
        $jq(".LFoptions span#LFheader_price").addClass("active")
    }
}
var delay = (function () {
    var a = 0;
    return function (c, b) {
        clearTimeout(a);
        a = setTimeout(c, b)
    }
})();
Willpower est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/01/2012, 13h54   #4
Membre Expert
 
Avatar de Willpower
 
Homme Boris Dessy
sans emploi
Inscription : décembre 2010
Messages : 872
Détails du profil
Informations personnelles :
Nom : Homme Boris Dessy
Localisation : Belgique

Informations professionnelles :
Activité : sans emploi

Informations forums :
Inscription : décembre 2010
Messages : 872
Points : 1 381
Points : 1 381
Citation:
Envoyé par SpaceFrog Voir le message
Après le code ayant été packed ... bonne chance pour t'y retrouver dans les variables !
En fait les variables(noms de fonctions) ont bien gardé des noms lisibles car la plupart des packer (configurés par défaut) ne diminuent les noms de variables que s'ils ont une portée locale (si l'on pacte un code complet, il est donc intéressant de l'englober d'une fonction de closure pour que le compresseur sache que la portée de toutes les variables est locale) ce qui n'a apparemment pas été le cas ici.

EDIT: Enfin, sauf les 2-3 variables locales à chaque fonction (a,b,c) mais comme celles-ci sont bien codées et assez courtes avec peu de variables. Ca reste lisible même avec des noms d'une seule lettre.


Illustration de la closure dont je parle avec le même outil(ou l'un de ses clones) utilisé que pour le code proposé par l'auteur du sujet :

http://javascriptcompressor.com/

si l'on compresse (avec l'option "Shrink variables") ceci :

Code :
var aaaaaaaaaaaaaaaaaaaaaaaa = function(gggggggggggggg){};
nous obtenons ceci :

Code :
var aaaaaaaaaaaaaaaaaaaaaaaa=function(a){};

alors si on rajoute du code (une closure) le résultat de la compression sera plus court (36 au lieu de 43 caractère dans cet exemple) :

Code :
(function(){var aaaaaaaaaaaaaaaaaaaaaaaa = function(gggggggggggggg){};})();
la compression donne ceci :

Code :
(function(){var b=function(a){}})();
Willpower est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/01/2012, 16h52   #5
Débutant
 
Inscription : mai 2005
Messages : 1 957
Détails du profil
Informations personnelles :
Localisation : Suisse

Informations forums :
Inscription : mai 2005
Messages : 1 957
Points : 615
Points : 615
Ok, super!
je vous remercie pour vos éclaircissements. Je vais regardé ceci, ce soir, chez moi.

Toute bonne soirée à vous
__________________
Il ne suffit pas de tout savoir. Vouloir et persévérer, c'est déjà presque tout!
pierrot10 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 09h24.


 
 
 
 
Partenaires

Hébergement Web