main.js
48.7 KB
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
if( !window.YohoWap ){
var YohoWap = new Object();
}
YohoWap.Main = {
init: function(){
YohoWap.Main.isLogin(); //判断当前是否登陆状态
YohoWap.Main.backToTop(); //通用底部返回顶部
YohoWap.Main.homeTopSearch(); //首页头部search效果
YohoWap.Main.homeTopSlider(); //首页头部图片轮播效果
YohoWap.Main.productDetailSlider(); //deal详情页商品图片轮播
YohoWap.Main.closeDialog(); //关闭弹出半透明对话框
YohoWap.Main.orderAllMenu(); //全部订单头部下拉菜单
YohoWap.Main.orderSwichChange(); //确认订单页面有货币使用开关
YohoWap.Main.menuWidthChange(); //点击筛选有左侧菜单 宽度设定
YohoWap.Main.brandRightBar(); //品牌页右侧banner
},
//判断当前是否登陆状态
isLogin: function(){
newuserInfo('.newloginType');
var uid = getUid();
if(parseInt(uid) > 0){
getData(apiDomain,{'method':'open.message.messageCount','uid':uid},function(data){if(parseInt(data.count) > 0){$('#messgeNum').html(data.count).show();}return false;});
}
},
//通用底部返回顶部
backToTop: function(){
$('#backToTop').on('touch click',function(){console.log('000');
if( $(window).scrollTop() > 0 ){
window.scroll(0,0);
}
});
},
//首页头部search效果
homeTopSearch: function(){
if($('#m_header #search')){
//首次进入时,搜索框失去焦点
$('#m_header #search').blur();
//获取焦点时,加action
$('#m_header #search').focus(function(){
$('#m_header .logobox, #m_header .searchbox').addClass('action');
});
//点击取消时 失去焦点
$('.no_search').on('touch click',function(){
$('#m_header .logobox, #m_header .searchbox').removeClass('action');
$('#m_header #search').blur();
});
//清空搜索框
$('#m_header .clearText').on('touch click',function(){
$('#m_header #search').val('').focus();
});
}
},
//首页头部图片轮播效果
homeTopSlider:function(){
if( $('#slider') ){
//获取外层div的宽度 和 轮播图的个数
var w = '',len = '',
slider = $('#slider');
slider_son = $('#slider .swipe-wrap');
w = slider.width();
len = slider_son.find('div')?slider_son.find('div').length:'';
//当浏览器宽度变化时,重新获取外层div的宽度
$(window).resize(function(){
w = slider.width();
$('.swipe-wrap div, .swipe-wrap div img').css('width',w);
slider_son.css('width',w*len);
});
window.mySwipe = new Swipe(document.getElementById('slider'), {
startSlide: 0,
speed: 400,
auto: 3000,
continuous: true,
disableScroll: false,
stopPropagation: false,
callback: function(index, elem) {
$('.slider-nav span').removeClass('on').eq(index).addClass('on');
},
transitionEnd: function(index, elem) {}
});
}
},
//deal详情页商品图片轮播
productDetailSlider: function(){
if($('#productDetailSlider')){
//获取外层div的宽度 和 轮播图的个数
var w = '',len = '',
pdSlider =$('#productDetailSlider'),
pdSlider_son = $('#productDetailSlider .detail-wrap');
w = pdSlider.width();
len = pdSlider_son.find('div')?pdSlider_son.find('div').length:'';
$('.detail-wrap div, .detail-wrap div img').css('width',w);
pdSlider_son.css('width',w*len);
//当浏览器宽度变化时,重新获取外层div的宽度
$(window).resize(function(){
w = pdSlider.width();
$('.detail-wrap div, .detail-wrap div img').css('width',w);
pdSlider_son.css('width',w*len);
});
//滚动swipe
window.productDetailSlider = new Swipe(document.getElementById('productDetailSlider'), {
startSlide: 0,
speed: 400,
//auto: 3000,
continuous: false,
disableScroll: false,
stopPropagation: false,
scrollCLeft: $('#slider_left'),
scrollCRight: $('#slider_right'),
callback: function(index, elem) {
$('.detailSlide-nav span').removeClass('on').eq(index).addClass('on');
$('.detail-wrap span').removeClass('show').eq(index).addClass('show');
},
transitionEnd: function(index, elem) {}
});
}
},
//关闭弹出半透明对话框
closeDialog: function(){
$('.notice_dialog').on('touch click',function(event){
if(event.target.id == 'fav_dialog'){
$(this).fadeOut();
}
});
},
//全部订单头部下拉菜单
orderAllMenu: function(){
/*$('.icon-uni5D').showLayout({
showLayoutId : '.drop-down',
eventType : 'click'
});*/
$('#order_menu').on('touch click',function(){
if( $('.drop-down') ){
var dropdown = $('.drop-down');
if( dropdown.css('display') == 'none' ){
$('.drop-down').slideDown(300);
$(this).addClass('action');
}else{
$('.drop-down').slideUp(300);
$(this).removeClass('action');
}
}
});
$('.drop-down a').on('touch click',function(){
$('.drop-down').slideUp(300);
$(this).removeClass('action');
});
},
//确认订单页面有货币使用开关
orderSwichChange: function(){
if( $('#switch').length > 0 ){
$('#switch').on('touch click',function(e){
var sbtn = $('#switch span');
if((e.target.id == 'switch' || e.target.id == 'switch_p') ){
if(sbtn.hasClass('action')){
$('#switch span').removeClass('action');
selYohoCoin(0);
}else{$('#switch span').addClass('action');
selYohoCoin(1);
}
}
});
}
},
//点击筛选有左侧菜单 宽度设定
menuWidthChange: function(){
if( $('#changeWidth') && $('#changeWidth').find('div').hasClass('filterBox') ){
var w = $('.yohoBuyWrap').width();
$('#changeWidth').css('width',w*2);
$('#changeWidth').find('div').first().css('width',w);
$('#changeWidth .cover').css('width',w);
$(window).resize(function(){
w = $('.yohoBuyWrap').width();
$('#changeWidth').css('width',w*2);
$('#changeWidth').find('div').first().css('width',w);
$('#changeWidth .cover').css('width',w);
});
}
},
//品牌页右侧banner
brandRightBar: function(){
$(".brand-search span.icon-search").on("click",function(){
var keyword = $.trim($("#keyword").val());
if(keyword == ""){
alert("请输入品牌名称");
$('#keyword').focus();
return false;
}
$('#brand-search-from').submit();
});
if($('#right-bar')){
$(window).bind('scroll',function(){
var h = $(document).scrollTop();
if(h<43){
$('#right-bar').css('top', 43-h+'px');
}else{
$('#right-bar').css('top', '0px');
}
});
}
},
//登陆注册,当前input为焦点时,才显示清除的差
loginClearValue: function(){
var clearTimer;
if( $('.input-pan input') ){
$('.input-pan input').each(function(){
var _self = $(this);
_self.removeAttr('disabled');
_self.blur();
_self.val().length>0?_self.addClass('active'):_self.removeClass('active');
});
$('.input-pan input').on('keydown',function(){
var _self = $(this);
/*if(_self.attr('name') == 'verify_code') {
_self.val(_self.val().replace(/\D/g,''));
}*/
if(_self.attr('name') == 'img_verify_code' || _self.attr('name') == 'password') {
_self.val(_self.val().replace(/[\u4E00-\u9FA5]/g,''));
}
});
$('.input-pan input').on('keyup',function(){
var _self = $(this);
_self.val().length>0?_self.addClass('active'):_self.removeClass('active');
});
$('.input-pan input').focus(function(){
var _self = $(this);
$('a.clearText').hide();
clearTimeout(clearTimer);
_self.closest('.input-pan').find('a.clearText').show();
_self.val().length>0?_self.addClass('active'):_self.removeClass('active');
_self.on('input',function(){
_self.val().length>0?_self.addClass('active'):_self.removeClass('active');
})
}).blur(function(){
var _self = $(this);
clearTimer = setTimeout(function(){
_self.closest('.input-pan').find('a.clearText').hide();
},2000);
});
//点击清空文本框
$('.input-pan .clearText').on('touch click',function(){
var clearInput = $(this).closest('.input-pan').find('input');
clearInput.val('').focus();
clearInput.removeClass('active');
$('#errorContainer').slideUp();
});
}
}
};
$(function(){
//initial();
var k = true;
$('.headerMenuBtn').on('touch click', function(e){
var cover = $('.box .cover')[0];
if(cover){
var style = $('.box')[0].style;
cover.remove();
scoll(0);
}
if(k){
$('.yohoNavgator').show();
$('.yohoContainer').addClass('on');
k = false;
}else {
$('.yohoContainer').removeClass('on');
$('.yohoNavgator').hide();
k = true;
}
e.stopPropagation();
e.cancelable = false;
function scoll(width){
style.webkitTransitionDuration =
style.MozTransitionDuration =
style.msTransitionDuration =
style.OTransitionDuration =
style.transitionDuration = '400ms';
style.webkitTransform = 'translate(' + width + 'px,0)' + 'translateZ(0)';
style.msTransform =
style.MozTransform =
style.OTransform = 'translateX(' + width + 'px)';
}
});
$('.yohoContainer').on('touch click', function (){
$('.yohoContainer').removeClass('on');
$('.yohoNavgator').hide();
k = true;
});
$('.yohoNavgator').on('touch click', function(e){
e.stopPropagation();
e.cancelBubble = false;
});
$('.yohoTabNav a').on('touch click', function(){
var index = $('.yohoTabNav a').index($(this));
if($('.tabMenu').eq(index).hasClass('show')){
return false;
}else {
$('.tabMenu').eq(index).addClass('show').siblings().removeClass('show');
$('.yohoTabNav span').removeClass('show').eq(index).addClass('show');
}
});
$('.tabMenu li').on('touch click', function (){
var ODl = $(this).find('dl');
if(!ODl) return;
ODl.addClass('active');
});
$('.navItem dt').on('touch click', function(e){
$(this).parent().removeClass('active');
e.stopPropagation();
e.returnValue = false;
});
// 隐藏地址栏 & 处理事件的时候 ,防止滚动条出现
setTimeout(function(){ window.scrollTo(0, 1); }, 100);
// detail
window.detailSwipe = new Swipe(document.getElementById('detailSlider'), {
startSlide: 0,
speed: 400,
auto: 3000,
continuous: true,
disableScroll: false,
stopPropagation: false,
callback: function(index, elem) {
$('.detailSlide-nav span').removeClass('on').eq(index).addClass('on');
},
transitionEnd: function(index, elem) {}
});
window.getData = function(domain, options, onSuccess){
var defaults = {'page' : 1,'method' : '','v' : 1,'return_type' : 'jsonp','open_key' : '12345','tmp' : Math.random()};
if(typeof(domain) == undefined || domain == ''){console.log('请设置请求的api地址');return false;}
var params = $.extend(defaults, options);
params.page = params.page || 1;
if(params.method == ''){console.log('请设置请求的URL');return false;}
try{
$.getJSON(domain + '/?callback=?',params,function(_data){if(onSuccess != ''){eval(onSuccess(_data.data));return false;}});
}catch(e){
console.log(e.message);
}
};
window.cookie = function (name){
var cookieValue = null;if (document.cookie && document.cookie != '') {var cookies = document.cookie.split(';');for (var i = 0; i < cookies.length; i++) {var cookie = jQuery.trim(cookies[i]);if (cookie.substring(0, name.length + 1) == (name + '=')) {cookieValue = decodeURIComponent(cookie.substring(name.length + 1));break;}}}return cookieValue;
},
window.setcookie = function (name, value, options){
if(typeof value != 'undefined'){
options = options || {};if (value === null) {value = '';options.expires = -1;}var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {date = new Date();date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));} else {date = options.expires;}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
var path = options.path ? '; path=' + options.path : '';
var domain = options.domain ? '; domain=' + options.domain : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
}
},
window.getUid = function (){
var cookieName = '_UID';
var info = cookie(cookieName);
if(typeof info == 'undefined' || info == null){return 0;}
var user = info.split('::');
if(typeof user == 'undefined' || user.length < 4){return 0;}
return user[1];
},
window.getShoppingKey = function() {
var shoppingInfo = cookie('_g');
if(typeof shoppingInfo=='undefined' || shoppingInfo == null) {return '';}
var shoppingData = eval('(' + shoppingInfo + ')');
return shoppingData._k;
}
window.userInfo = function (boxId){
var noLoginHtml = '<a class="loginBtn" href="http://m.yohobuy.com/signin.html" target="_self">登录</a><a class="registerBtn" href="http://m.yohobuy.com/reg.html" target="_self">注册</a>', info = cookie('_UID'), boxObj = $(boxId);if(typeof info == 'undefined' || info == null){boxObj.html(noLoginHtml);return false;}
var user = info.split('::');if(typeof user == 'undefined' || user.length < 4){boxObj.html(noLoginHtml);return false;}
var userName = user[0] || ' ', name = '', _length = 0;
for(var t = 0; t < userName.length; t++){
var char = userName.substr(t,1);
if(/.*[\u4e00-\u9fa5]+.*$/.test(char)){_length += 2;}else{_length += 1;}
}
if(_length <= 10){name = userName;}else{_num = 0;for(var t = 0; t < userName.length; t++){if(_num < 10){var char = userName.substr(t,1);if(/.*[\u4e00-\u9fa5]+.*$/.test(char)){_num += 2;}else{_num += 1;}name += char;}}name += '...';}
var logouttUrl = '';
if(/http:\/\//.test(user[3])){
logouttUrl = user[3].replace('www.yohobuy.com', 'm.yohobuy.com');
}else{
logouttUrl = 'http://m.yohobuy.com/passport/signout/index?token=' + user[3];
}
var tmp = Math.random(), loginHtml = '<p>Hi, <a target="_self" href="http://m.yohobuy.com/home?tmp='+tmp+'" class="tdu">'+name+'</a> <a href="'+logouttUrl+'" class="loginOut" target="_self">退出</a></p>';
boxObj.html(loginHtml);
return false;
};
window.newuserInfo = function (boxId){
var url = document.location;
if(url.toString().indexOf('search') > 0 )
{
url = 'http://m.yohobuy.com';
}
var noLoginHtml = '<a target="_self" href="javascript:void(0)" id="backToTop" style="float:right;">Back to top <em class="icon-uni2C"></em></a><a target="_self" href="http://m.yohobuy.com/signin.html?refer=' + url +'">登录</a> | <a target="_self" href="http://m.yohobuy.com/reg.html?refer=' + url +'">注册</a>', info = cookie('_UID'), boxObj = $(boxId);if(typeof info == 'undefined' || info == null){boxObj.html(noLoginHtml);return false;}
var user = info.split('::');if(typeof user == 'undefined' || user.length < 4){boxObj.html(noLoginHtml);return false;}
var userName = user[0] || ' ', name = '', _length = 0;
for(var t = 0; t < userName.length; t++){
var char = userName.substr(t,1);
if(/.*[\u4e00-\u9fa5]+.*$/.test(char)){_length += 2;}else{_length += 1;}
}
if(_length <= 10){name = userName;}else{_num = 0;for(var t = 0; t < userName.length; t++){if(_num < 10){var char = userName.substr(t,1);if(/.*[\u4e00-\u9fa5]+.*$/.test(char)){_num += 2;}else{_num += 1;}name += char;}}name += '...';}
var logouttUrl = '';
if(/http:\/\//.test(user[3])){
logouttUrl = user[3].replace('www.yohobuy.com', 'm.yohobuy.com');
}else{
logouttUrl = 'http://m.yohobuy.com/passport/signout/index?token=' + user[3];
}
var tmp = Math.random(), loginHtml = '<a href="javascript:void(0)" id="backToTop" style="float:right;">Back to top <em class="icon-uni2C"></em></a>Hi, <a class="name" target="_self" href="http://m.yohobuy.com/home?tmp='+tmp+'">'+name+'</a> <a target="_self" href="'+logouttUrl+'">退出</a>';
boxObj.html(loginHtml);
return false;
};
window.favorite = function(apiDomain){
$('#favorite').on('touch click', function(){
if(parseInt(getUid()) == 0){
window.location.href = 'http://m.yohobuy.com/signin.html?refer=' + document.location;
return false;
}
var is_fav = $(this).attr('fav');
var product_id = $(this).attr('product');
var options = {
method : 'open.favorite.product',
product_id : product_id
};
if(is_fav == 1){
options.method = 'open.favorite.cancelproduct';
}
obj = this;
getData(apiDomain, options, function(data){
if(data.result == -1){
window.location.href = 'http://m.yohobuy.com/signin.html?refer=' + document.location;
return false;
}else if(data.result == 1 || data.result == -3){
var className = 'favorite';
var fav = 1;
if(is_fav == 1){
$(obj).removeClass('favorite').addClass('AddFavorite');
className = 'AddFavorite';
fav = 0;
$(obj).attr('fav',0);
}else{
$(obj).removeClass('AddFavorite').addClass('favorite');
$(obj).attr('fav',1);
}
return false;
}
});
if( $('.notice_dialog').length>0 && is_fav==0){
$('.notice_dialog').css('display','table');
}
});
};
window.showSize = function(sizeList){
if(typeof sizeList == undefined || sizeList.length < 1){
return false;
}
var html = '';
for(k in sizeList){
var size = sizeList[k];
var className = '';
if(parseInt(size['storage']) < 1){
className = 'none';
}
html += '<li class="'+className+'" storage="'+size['storage']+'" sku="'+size['product_sku']+'" size="'+size['size_id']+'" name="'+size['size_name']+'">'+size['size_name']+'</li>';
}
$('.addCartSizeList').html(html);
changeSize();
}
window.changeSize = function(){
$('.addCartSizeList li').each(function(){
$(this).on('touch click',function(){
var storage = parseInt($(this).attr('storage'));
if(storage < 1){
return false;
}
var sku = parseInt($(this).attr('sku'));
var size_id = parseInt($(this).attr('size'));
$('#size_id').val(size_id);
$('#product_sku').val(sku);
$('#storage').val(storage);
$('#num').val(1);
var obj = this;
//隐藏提示信息
$('#storageTopic').hide();
$('.errorAddCart').hide();
$('.addCartSizeList li').each(function(){$(this).removeClass('active');});
$(obj).addClass('active');
if(storage <= 3){
$('.storage-limit').show().children('em').html(storage);
}else{
$('.storage-limit').hide();
}
return false;
});
});
}
window.goods = function(sizeList){
if(typeof sizeList == undefined || sizeList.length < 1){
return false;
}
//对已经输出的尺码进行绑定事件
changeSize();
//对添加购物车按钮绑定事件
addCart();
//减数量
minus();
//加数量
plus();
//对颜色进行时间绑定
$('.addCartChooseColor li').each(function(){
$(this).on('touch click',function(){
var storage = parseInt($(this).attr('storage'));
var goods_id = parseInt($(this).attr('goods'));
var obj = this;
if(storage <= 0 || goods_id < 1 || typeof sizeList[goods_id] == undefined || sizeList[goods_id].lenght < 1){
return false;
}
$('#goods_id').val(goods_id);
$('#size_id').val(0);
$('#storage').val(0);
$('#num').val(1);
//隐藏提示信息
$('#storageTopic').hide();
$('.errorAddCart').hide();
$('.addCartChooseColor li').each(function(){$(this).removeClass('active');});
$(obj).addClass('active');
showSize(sizeList[goods_id]);
});
});
}
window.minus = function(){
$('#addCartMinus').on('touch click', function(){
var size_id = parseInt($('#size_id').val());
if(size_id == '' || size_id == 0){
$('.errorAddCart').show();
return false;
}else{
$('.errorAddCart').hide();
var storage = $('#storage').val();
if(storage <= 3){
$('.storage-limit').show().children('em').html(storage);
}
}
var num = parseInt($('#num').val());
//隐藏提示信息
$('#storageTopic').hide();
if(num == 1){
return false;
}
$('#num').val((num - 1));
});
}
window.plus = function(){
$('#addCartPlus').on('touch click',function(){
var size_id = parseInt($('#size_id').val());
if(size_id == '' || size_id == 0){
$('.errorAddCart').show();
return false;
}else{
$('.errorAddCart').hide();
}
var num = parseInt($('#num').val());
var _num = num + 1;
var storage = parseInt($('#storage').val());
$('#storageTopic').hide();
if(storage < _num){
$('.storage-limit').hide();
$('#storageTopic').show();
}else{
$('#num').val(_num);
}
return false;
});
}
window.addCart = function(){
$('#addCartButton').on('touch click',function(){
var product_id = parseInt($('#product_id').val());
var goods_id = parseInt($('#goods_id').val());
var size_id = parseInt($('#size_id').val());
var num = parseInt($('#num').val());
var storage = parseInt($('#storage').val());
var promotion_id = parseInt($('#promotion_id').val());
if(size_id < 1){
$('.errorAddCart').show();
return false;
}
if(num > storage){
$('#storageTopic').show();
return false;
}
//隐藏提示信息
$('#storageTopic').hide();
$('.errorAddCart').hide();
$.get('http://m.yohobuy.com/shopping/index/index',{product_id : product_id, goods_id : goods_id, size_id : size_id, num : num, promotion_id : promotion_id}, function(e){
if(e.code != 200){
alert('添加失败');
return false;
}
//window.location.href = e.data.to_url + '?refer=http://m.yohobuy.com/product/buy_'+product_id+'_'+goods_id+'.html';
window.location.href = e.data.to_url;
});
return false;
});
};
});
$.fn.showLayout = function(options) {
//mouse mouseover和mouseout
var defaults = {'showLayoutId':'','showTime':500,'eventType' : 'mouse','onEvent' : ''};
var params = $.extend(defaults, options);
return this.each(function() {
if(params.showLayoutId == ''){console.log('需要显示的层ID为空');return false;}
var time = params.showTime || 1000;
var eventType = params.eventType || 'mouse';
if(eventType == 'mouse'){
$(this).bind('mouseenter',function(){$(params.showLayoutId).fadeIn(params.showTime);if(params.onEvent != ''){eval(params.onEvent(false));}});
$(this).bind('mouseleave',function(){$(params.showLayoutId).fadeOut(params.showTime);if(params.onEvent != ''){eval(params.onEvent(true));}});
}else if(eventType == 'click'){
$(this).on('touch click', function(){
var isHidden = false;
if($(params.showLayoutId).is(':hidden') == false){$(params.showLayoutId).fadeOut(params.showTime);isHidden = true;}else{$(params.showLayoutId).fadeIn(params.showTime);isHidden = false;}
if(params.onEvent != ''){eval(params.onEvent(isHidden));}
});
}
});
};
$.fn.address = function(options){
var defaults = {
'province' : '#province', //省份容器的ID
'city' : '#city', //市的容器ID
'county' : '#county', //区的容器ID
'area' : '', //省市区列表
'parentBox' : '.addAddress', //地址界面的ID
'parentClickBtn' : '.YOHOBuyAddress', //点击按钮出现省的选择项
'codeId' : '#area_code',
'codeText' : '#areaCcode'
};
var params = $.extend(defaults, options);
if(params.area == '' || params.area.lenght < 1){
return false;
}
var showProvince = function(){
$(params.province).find('.chooseZone').empty();
for(k in params.area){
var info = params.area[k];
$(params.province).find('.chooseZone').append('<li><a href="javascript:void(0);" province="'+info['id']+'"><span class="fn-right"><em class="icon-uni3E"></em></span>'+info['caption']+'</a></li>');
}
$(params.parentBox).hide();
$(params.province).show();
$(params.province).find('li a').on('touch click',function(){
var _province = $(this).attr('province');
showCity(_province);
});
$(params.province).find('.listBack').on('touch click', function(){
$(params.province).hide();
$(params.parentBox).show();
});
};
var showCity = function(province){
if(typeof province == undefined || typeof params.area[province] == undefined || params.area[province]['sub'] == undefined || params.area[province]['sub'].length < 1)
{
return false;
}
$(params.city).find('.chooseZone').empty();
for(k in params.area[province]['sub']){
var info = params.area[province]['sub'][k];
$(params.city).find('.chooseZone').append('<li><a href="javascript:void(0);" province="'+province+'" city="'+info['id']+'"><span class="fn-right"><em class="icon-uni3E"></em></span>'+info['caption']+'</a></li>');
}
$(params.province).hide();
$(params.city).show();
$(params.city).find('li a').on('touch click', function(){
var _province = $(this).attr('province'), _city = $(this).attr('city');
showCounty(_province, _city);
});
$(params.city).find('.listBack').on('touch click', function(){
$(params.city).hide();
$(params.province).show();
});
};
var showCounty = function(province, city){
if(typeof province == undefined || typeof params.area[province] == undefined || params.area[province]['sub'] == undefined || params.area[province]['sub'].length < 1 || typeof city == undefined || typeof params.area[province]['sub'][city] == undefined || typeof params.area[province]['sub'][city]['sub'] == undefined || params.area[province]['sub'][city]['sub'].length < 1)
{
return false;
}
$(params.county).find('.chooseZone').empty();
var provinceName = params.area[province]['caption'];
var cityName = params.area[province]['sub'][city]['caption'];
for(k in params.area[province]['sub'][city]['sub']){
var info = params.area[province]['sub'][city]['sub'][k];
$(params.county).find('.chooseZone').append('<li><a href="javascript:void(0);" province="'+province+'" provinceName="'+provinceName+'" cityName="'+cityName+'" city="'+city+'" name="'+info['caption']+'" code="'+info['code']+'">'+info['caption']+'</a></li>');
}
$(params.city).hide();
$(params.county).show();
$(params.county).find('li a').on('touch click', function(){
var _province = $(this).attr('provinceName'), _city = $(this).attr('cityName'), _county = $(this).attr('name'), areaCode = $(this).attr('code');
$(params.codeId).val(areaCode);
$(params.codeText).val(_province + ' ' + _city + ' ' + _county);
$(params.county).hide();
$(params.parentBox).show();
});
$(params.county).find('.listBack').on('touch click', function(){
$(params.county).hide();
$(params.city).show();
});
};
return $(this).each(function(){
$(this).click(function(){
showProvince();
});
});
};
$.fn.filter = function(options){
var params = options;
delete params.q;
var brands = params['existsbrand'];
var brandNames = params['brandNames'];
var data = function(_type, callback){
params['filtertype'] = _type;
$.getJSON('http://list.m.yohobuy.com/filter/search?callback=?', params, function(_e){
$('.filterBox').hide();
if(_type == 'size'){
size(_e);
}else if(_type == 'color'){
color(_e);
} else if (_type == 'price') {
price(_e);
} else if (_type == 'brand') {
brand(_e);
} else if (_type == 'discount') {
discount(_e);
} else if (_type == 'day') {
day(_e);
} else if (_type == 'sort') {
sorts(_e);
} else if (_type == 'gender') {
gender(_e);
}
});
};
var gender = function (data) {
_boy = '';
_girl = '';
if (typeof data.param != 'undefined' && typeof data.param['gender'] != 'undefined' && data.param['gender'] == '1,3') {
_boy = 'icon-circle-c';
_girl = '';
} else if (typeof data.param != 'undefined' && typeof data.param['gender'] != 'undefined' && data.param['gender'] == '2,3'){
_boy = '';
_girl = 'icon-circle-c';
}
if (typeof params['gender'] != 'undefined' && params['gender'] == '1,3') {
_boy = 'icon-circle-c';
_girl = '';
} else if (typeof params['gender'] != 'undefined' && params['gender'] == '2,3') {
_boy = '';
_girl = 'icon-circle-c';
}
var html = '<li name="1,3" truevalue="BOYS"><label><span class="icon-radio-btn"><em class="icon-uni6F '+_boy+'"></em><input type="radio"/></span>BOYS</label></li><li name="2,3" truevalue="GIRLS"><label><span class="icon-radio-btn"><em class="icon-uni6F '+_girl+'"></em><input type="radio"/></span>GIRLS</label></li>';
$('.filterGender').empty();
$('.filterGender').append(html);
$('.filterGoodsLayer').hide();
$('.filterSex').show();
$('.filterGender').find('li').each(function () {
$(this).on('touch click', function () {
$('.filterGender').find('em').removeClass('icon-circle-c');
$(this).find('em').addClass('icon-circle-c');
params['gender'] = $(this).attr('name');
$('#gender').find('span').eq(1).html($(this).attr('truevalue'));
});
});
$('.filterSex').find('.listBack').on('touch click', function(){
$('.filterSex').hide();
$('.filterBox').hide();
$('.filterGoodsLayer').show();
});
};
var sorts = function (data) {
var html = '';
for (var k in data.groupSort) {
var info = data.groupSort[k];
var _style = '';
if (typeof data.param != 'undefined' && typeof data.param['msort'] != 'undefined' && data.param['msort'] == k) {
_style = 'icon-circle-c';
}
if (typeof params['msort'] != 'undefined' && params['msort'] == info['id']) {
_style = 'icon-circle-c';
}
html += '<li truesort="msort" truevalue="'+info['id']+'" name="'+info['sort_name']+'" class="filterCategoryT"><label><span class="icon-radio-btn"><em class="icon-uni6F '+ _style +'"></em><input type="radio"/></span>'+ info['sort_name'] +'</label></li>';
for (var i in info['sub']) {
var info2 = info['sub'][i];
var __style = '';
if (typeof data.param != 'undefined' && typeof data.param['misort'] != 'undefined' && data.param['misort'] == i) {
__style = 'icon-circle-c';
}
if (typeof params['misort'] != 'undefined' && params['misort'] == i) {
__style = 'icon-circle-c';
}
html += '<li truesort="misort" truevalue="'+i+'" name="'+info2['sort_name']+'"><label><span class="icon-radio-btn"><em class="icon-uni6F '+ __style +'"></em><input type="radio"/></span>' + info2['sort_name'] + '</label></li>';
}
}
$('.chosemsort').empty();
$('.chosemsort').append(html);
$('.filterGoodsLayer').hide();
$('.filterCategory').show();
$('.chosemsort').find('li').each(function (){
$(this).on('touch click', function () {
$(this).parent().find('em').removeClass('icon-circle-c');
$(this).find('em').addClass('icon-circle-c');
if ($(this).attr('truesort') == 'msort') {
delete params.misort;
params['msort'] = $(this).attr('truevalue');
} else {
delete params.msort;
params['misort'] = $(this).attr('truevalue');
}
$('#sort').find('span').eq(1).html($(this).attr('name'));
});
});
$('.filterCategory').find('.listBack').on('touch click', function(){
$('.filterCategory').hide();
$('.filterBox').hide();
$('.filterGoodsLayer').show();
});
};
var day = function (data) {
var html = '';
for (var k in data.day) {
var info = data.day[k];
var _style = '';
if (typeof data.param != 'undefined' && typeof data.param['day'] != 'undefined' && data.param['day'] == k) {
_style = 'icon-circle-c';
}
if (typeof params['day'] != 'undefined' && params['day'] == k) {
_style = 'icon-circle-c';
}
html += '<li trueday="'+k+'" name="'+ info +'"><label><span class="icon-radio-btn"><em class="icon-uni6F '+ _style +'"></em><input type="radio"/></span>' + info + '</lable></li>';
}
$('.choseday').empty();
$('.choseday').append(html);
$('.filterGoodsLayer').hide();
$('.filterDay').show();
$('.choseday').find('li').each(function () {
$(this).on('touch click', function () {
params['day'] = $(this).attr('trueday');
delete params.shelve_time;
$('.choseday').find('em').removeClass('icon-circle-c');
$(this).find('em').addClass('icon-circle-c');
$('#day').children('span').eq(1).html($(this).attr('name'));
});
});
$('.filterDay').find('.listBack').on('touch click', function(){
$('.filterDay').hide();
$('.filterBox').hide();
$('.filterGoodsLayer').show();
});
};
var discount = function (data) {
var html = '';
for (var k in data.discount) {
var info = data.discount[k];
var _style = '';
if (typeof data.param != 'undefined' && typeof data.param['discount'] != 'undefined' && data.param['discount'] == k) {
_style = 'icon-circle-c';
}
if (typeof params['p_d'] != 'undefined' && params['p_d'] == k) {
_style = 'icon-circle-c';
}
html += '<li truedis="'+ k +'" name="'+ info['name'] +'折"><label><span class="icon-radio-btn"><em class="icon-uni6F '+ _style +'"></em><input type="radio"/></span>'+ info['name'] +'折</label></li>';
}
$('.chosediscount').empty();
$('.chosediscount').append(html);
$('.filterGoodsLayer').hide('slow');
$('.filterDiscount').show('slow');
$('.chosediscount').find('li').each(function() {
$(this).on('touch click', function () {
params['p_d'] = $(this).attr('truedis');
$('.chosediscount').find('em').removeClass('icon-circle-c');
$(this).find('em').addClass('icon-circle-c');
$('#discount').children('span').eq(1).html($(this).attr('name'));
});
});
$('.filterDiscount').find('.listBack').on('touch click', function(){
$('.filterDiscount').hide();
$('.filterBox').hide();
$('.filterGoodsLayer').show();
});
};
var brand = function (data) {
var html = '';
for (var k in data.brand) {
var info = data.brand[k];
var _style = '';
html += '<h3 class="filterBrandT">' + k + '</h3><ul class="filterBrandList">'
for (var n in info) {
_style = '';
if (typeof info[n]['id'] != 'undefined' && typeof brands[info[n]['id']] != 'undefined' && brands[info[n]['id']] == info[n]['id']) {
_style = 'icon-correct-b';
}
if (typeof params['existsbrand'] != 'undefined' && typeof params['existsbrand'][info[n]['id']] != 'undefined'){
_style = 'icon-correct-b';
}
html += '<li brandid="'+info[n]['id']+'" name="'+info[n]['brand_name']+'"><label class="yCheckbox"><em class="'+_style+'"></em><input type="checkbox"/></label>'+info[n]['brand_name']+'</li>';
}
html += '</ul>';
}
$('#brandList').empty();
$('#brandList').html(html);
$('.filterGoodsLayer').hide();
$('.filterBrand').show();
$('.filterBrandList li').each(function() {
$(this).on('touch click', function () {
var brandId = $(this).attr('brandid');
var brandName = $(this).attr('name');
if (typeof brands[brandId] != 'undefined' && brands[brandId] == brandId) {
delete brands[brandId];
delete brandNames[brandId];
$(this).find('em').removeClass('icon-correct-b');
} else {
$(this).find('em').addClass('icon-correct-b');
brands[brandId] = brandId;
brandNames[brandId] = brandName;
}
var brandStr = '', i = 0, showBrandId = 0;
for (k in brands) {
if(i == 0){
showBrandId = k;
}
brandStr += k + ',';
i = i + 1;
};
if(brandStr == ''){
$('#brand').children('span').eq(1).html('全部');
}else{
if(i > 1){
$('#brand').children('span').eq(1).html(brandNames[showBrandId]+'等'+ i + '个');
}else{
$('#brand').children('span').eq(1).html(brandNames[showBrandId]);
}
}
params.brand= brandStr;
});
});
$('.filterBrandList em').each(function() {
$(this).on('touch click', function () {
var brandId = $(this).parent().parent().attr('brandid');
var brandName = $(this).parent().parent().attr('name');
if (typeof brands[brandId] != 'undefined' && brands[brandId] == brandId) {
delete brands[brandId];
delete brandNames[brandId];
$(this).removeClass('icon-correct-b');
} else {
$(this).addClass('icon-correct-b');
brands[brandId] = brandId;
brandNames[brandId] = brandName;
}
var brandStr = '', i = 0, showBrandId = 0;
for (k in brands) {
if(i == 0){
showBrandId = k;
}
brandStr += k + ',';
i = i + 1;
};
if(brandStr == ''){
$('#brand').children('span').eq(1).html('全部');
}else{
if(i > 1){
$('#brand').children('span').eq(1).html(brandNames[showBrandId]+'等'+ i + '个');
}else{
$('#brand').children('span').eq(1).html(brandNames[showBrandId]);
}
}
params.brand= brandStr;
});
});
$('.filterBrand').find('.clear').on('touch click', function(){
delete params['brand'];
delete params['existsbrand'];
delete params['brandNames'];
brands = {};
brandNames = {};
$('#brand').children('span').eq(1).html('全部');
$('.filterBrand').find('em').removeClass('icon-correct-b');
});
$('.filterBrand').find('.listBack').on('touch click', function(){
$('.filterBrand').hide();
$('.filterGoodsLayer').show();
});
$('.filterBrand').find('.yes').on('touch click', function(){
$('.filterBrand').hide();
$('.filterBox').hide();
$('.filterGoodsLayer').show();
});
};
var price = function (data) {
var html = '';
for (var k in data.priceRange) {
var info = data.priceRange[k];
var id = k.replace(',', '');
var _style = '';
if (typeof data.param != 'undefined' && typeof data.param['price'] != 'undefined' && data.param['price'] == k) {
_style = 'icon-circle-c';
}
if (typeof params['price'] != 'undefined' && params['price'] == k) {
_style = 'icon-circle-c';
}
html += '<li id="'+ id +'" name="'+ info +'" truename="'+k+'"><label><span class="icon-radio-btn"><em class="icon-uni6F '+_style+'"></em><input type="radio"/></span>' + info + '</label></li>';
}
$('.choseprice').empty();
$('.choseprice').append(html);
$('.filterGoodsLayer').hide();
$('.filterPrice').show();
$('.choseprice').find('li').each(function() {
$(this).on('touch click', function () {
var price_id = $(this).attr('id');
var trueprice = $(this).attr('truename');
var price_name = $(this).attr('name');
params['price'] = trueprice;
$('.choseprice').find('em').removeClass('icon-circle-c');
$(this).find('em').addClass('icon-circle-c');
$('#price').children('span').eq(1).html(price_name);
});
});
$('.filterPrice').find('.listBack').on('touch click', function(){
$('.filterPrice').hide();
$('.filterBox').hide();
$('.filterGoodsLayer').show();
});
};
var color = function(data){
var html = '';
for (k in data.color){
var info = data.color[k];
var _style = '';
if(info['color_value'] != ''){
_style = 'background:url('+info['color_value']+')';
}else{
_style = 'background-color:#' + info['color_code'] + ';';
}
if(info['color_code'] == 'FFFFFF' || info['color_code'] == 'FFF'){
_style += 'border: 1px solid #cccccc;';
}
var _class = '';
if (typeof params['color'] != 'undefined' && params['color'] == info['id']) {
_class = ' class="active" ';
}
html += '<li '+_class+' id="'+info['id']+'" name="'+info['color_name']+'" style="'+_style+'"></li>';
}
$('.chooseColor').empty();
$('.chooseColor').append(html);
$('.filterGoodsLayer').hide();
$('.filterColor').show();
$('.chooseColor').find('li').each(function(){
$(this).on('touch click',function(){
var color_id = $(this).attr('id');
var color_name = $(this).attr('name');
params['color'] = color_id;
$('.chooseColor').find('.active').removeClass('active');
$(this).addClass('active');
$('#color').children('span').eq(1).html(color_name);
});
});
$('.filterColor').find('.listBack').on('touch click', function(){
$('.filterColor').hide();
$('.filterBox').hide();
$('.filterGoodsLayer').show();
});
};
var size = function (data) {
var html = '';
for (k in data.size){
var info = data.size[k];
var _class = '';
if (typeof params['size'] != 'undefined' && params['size'] == info['id']) {
_class = ' class="active" ';
}
html += '<li '+_class+'><a href="javascript:void (0);" id="'+info['id']+'" name="'+info['size_name']+'">'+info['size_name']+'</a></li>';
}
$('.sizeList').empty();
$('.sizeList').append(html);
$('.filterGoodsLayer').hide();
//显示
$('.filterGoodsSize').show();
//绑定事件
$('.sizeList').find('a').each(function(){
$(this).on('touch click', function(){
var size_id = $(this).attr('id');
var size_name = $(this).attr('name');
params['size'] = size_id;
$('.sizeList').find('.active').removeClass('active');
$(this).parent().addClass('active');
$('#size').children('span').eq(1).html(size_name);
});
});
$('.filterGoodsSize').find('.listBack').on('touch click', function(){
$('.filterGoodsSize').hide();
$('.filterBox').hide();
$('.filterGoodsLayer').show();
});
};
return $(this).each(function(){
$(this).on('touch click', function(){
$('.listFilter').hide();
$('.goodsListBox').hide();
//显示
$('.filterGoodsLayer').show();
//绑定事件
$('.filterGoods').find('li').each(function(){
$(this).on('touch click', function(){
var flag = $(this).attr('id');
data(flag);
});
});
$('.filterGoodsLayer').find('.listBack').on('touch click', function(){
$('.filterGoodsLayer').hide();
$('.listFilter').show();
$('.goodsListBox').show();
});
$('#confirmBtn').on('touch click',function(){
var query = '';
for (var p in params) {
if (p == 'filtertype' || p == 'existsbrand' || p == 'brandNames') {
continue;
}
query += '&' + p + '=' + params[p];
}
console.log(window.location.host+window.location.pathname+'?'+query);
console.log(params);
location.href = 'http://'+window.location.host+window.location.pathname+'?'+query;
});
$('#clearAll').on('touch click', function () {
$('.filterSpan').each(function () {
$(this).html('全部');
});
delete params['brand'];
delete params['color'];
delete params['msort'];
delete params['misort'];
delete params['day'];
delete params['discount'];
delete params['price'];
delete params['size'];
brands = {};
brandNames = {};
});
});
});
};
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}('(6($){$.B.A=6(2){9 q={r:H,n:4,e:C,s:"<y />E...<y />",8:"",g:"3:D",t:6(){h 5},v:6(){h 4},u:6(){h 5}};9 2=$.G(q,2);9 m=4;9 b=5;9 f=0;7(2.u.d(a)===4){m=5}7(m===4){$(l).F(6(){7($(N).o()-$(l).o()<=$(l).P()+2.r){7((2.n==5||(2.n==4&&b!=4))){7(2.t.d(a)===4){f=0}b=4;f++;$(2.g).k("<3 c=\\"p\\">"+2.s+"</3>");7(Q 2.8==\'6\'){8=2.8.d(a)}z{8=2.8}7(8!==5){$("3#p").w();$(2.g).k("<3 c=\\"i\\">"+8+"</3>");$("3#i").S().I();$("3#i").O("c");9 j=J K();j[0]=f;2.v.d(a,j);7(2.e!==5||2.e!==0){$("L").k("<3 c=\\"x\\"></3>");$("3#x").M(2.e,1,6(){$(a).w();b=5})}z{b=5}}}}})}}})(R);',55,55,'||options|div|true|false|function|if|data|var|this|fired|id|apply|fireDelay|fireSequence|insertAfter|return|endless_scroll_data|args|after|window|firing|fireOnce|height|endless_scroll_loader|defaults|bottomPixels|loader|resetCounter|ceaseFire|callback|remove|endless_scroll_marker|br|else|endlessScroll|fn|150|last|Loading|scroll|extend|50|fadeIn|new|Array|body|fadeTo|document|removeAttr|scrollTop|typeof|jQuery|hide'.split('|'),0,{}));
/**
* 图片延迟加载
*/
(function(a,b){$window=a(b),a.fn.lazyload=function(c){function f(){var b=0;d.each(function(){var c=a(this);if(e.skip_invisible&&!c.is(":visible"))return;if(!a.abovethetop(this,e)&&!a.leftofbegin(this,e))if(!a.belowthefold(this,e)&&!a.rightoffold(this,e))c.trigger("appear");else if(++b>e.failure_limit)return!1})}var d=this,e={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null};return c&&(undefined!==c.failurelimit&&(c.failure_limit=c.failurelimit,delete c.failurelimit),undefined!==c.effectspeed&&(c.effect_speed=c.effectspeed,delete c.effectspeed),a.extend(e,c)),$container=e.container===undefined||e.container===b?$window:a(e.container),0===e.event.indexOf("scroll")&&$container.bind(e.event,function(a){return f()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,c.one("appear",function(){if(!this.loaded){if(e.appear){var f=d.length;e.appear.call(b,f,e)}a("<img />").bind("load",function(){c.hide().attr("src",c.data(e.data_attribute))[e.effect](e.effect_speed),b.loaded=!0;var f=a.grep(d,function(a){return!a.loaded});d=a(f);if(e.load){var g=d.length;e.load.call(b,g,e)}}).attr("src",c.data(e.data_attribute))}}),0!==e.event.indexOf("scroll")&&c.bind(e.event,function(a){b.loaded||c.trigger("appear")})}),$window.bind("resize",function(a){f()}),f(),this},a.belowthefold=function(c,d){var e;return d.container===undefined||d.container===b?e=$window.height()+$window.scrollTop():e=$container.offset().top+$container.height(),e<=a(c).offset().top-d.threshold},a.rightoffold=function(c,d){var e;return d.container===undefined||d.container===b?e=$window.width()+$window.scrollLeft():e=$container.offset().left+$container.width(),e<=a(c).offset().left-d.threshold},a.abovethetop=function(c,d){var e;return d.container===undefined||d.container===b?e=$window.scrollTop():e=$container.offset().top,e>=a(c).offset().top+d.threshold+a(c).height()},a.leftofbegin=function(c,d){var e;return d.container===undefined||d.container===b?e=$window.scrollLeft():e=$container.offset().left,e>=a(c).offset().left+d.threshold+a(c).width()},a.inviewport=function(b,c){return!a.rightofscreen(b,c)&&!a.leftofscreen(b,c)&&!a.belowthefold(b,c)&&!a.abovethetop(b,c)},a.extend(a.expr[":"],{"below-the-fold":function(c){return a.belowthefold(c,{threshold:0,container:b})},"above-the-top":function(c){return!a.belowthefold(c,{threshold:0,container:b})},"right-of-screen":function(c){return a.rightoffold(c,{threshold:0,container:b})},"left-of-screen":function(c){return!a.rightoffold(c,{threshold:0,container:b})},"in-viewport":function(c){return!a.inviewport(c,{threshold:0,container:b})},"above-the-fold":function(c){return!a.belowthefold(c,{threshold:0,container:b})},"right-of-fold":function(c){return a.rightoffold(c,{threshold:0,container:b})},"left-of-fold":function(c){return!a.rightoffold(c,{threshold:0,container:b})}})})(jQuery,window)
$(document).ready(function(){
//点击按新品事件
$('#filterList .new').click(function(){
$('#filterList .sortList').toggleClass('hidden');
});
//选择排序条件事件
$('#filterList .sortList p').click(function(){
var a = $('#filterList .new');
var aHtml = a.html();
var PHtml = $(this).html();
a.html(PHtml);
$(this).html(aHtml).parent().addClass('hidden');
});
YohoWap.Main.loginClearValue(); //登陆注册,当前input为焦点时,才显示清除的差
YohoWap.Main.init();
});