|
@@ -6,11 +6,238 @@ |
|
@@ -6,11 +6,238 @@ |
6
|
var $ = require('yoho.jquery');
|
6
|
var $ = require('yoho.jquery');
|
7
|
var handlebars = require('yoho.handlebars');
|
7
|
var handlebars = require('yoho.handlebars');
|
8
|
var json2 = require('json2');
|
8
|
var json2 = require('json2');
|
9
|
-var noticeSuccess = false;
|
|
|
10
|
-var vipInfoCombine = null;
|
|
|
11
|
-var loginInfoCombine = null;
|
|
|
12
|
-var apiDomain = 'http://api.open.yohobuy.com';
|
|
|
13
|
-var cartTpl = '';
|
9
|
+var vipInfoCombine = null; //用户信息编译模板
|
|
|
10
|
+var loginInfoCombine = null; //登录信息编译模板
|
|
|
11
|
+var apiDomain = 'http://api.open.yohobuy.com'; //获取数据的地址
|
|
|
12
|
+var cartTpl = ''; //购物车模板
|
|
|
13
|
+/**
|
|
|
14
|
+ * 搜寻的时候过滤非法字符(+-/:等非法字符单独出现)
|
|
|
15
|
+ * @type {RegExp}
|
|
|
16
|
+ */
|
|
|
17
|
+var reg = /^[\^\!\+\-\(\)\:\[\]\\\{\}\~\*\?\|\&\;\/\s]{0,}$/g;
|
|
|
18
|
+var keyword = '';
|
|
|
19
|
+var link = '';
|
|
|
20
|
+var dataLayer = [];
|
|
|
21
|
+var requestFrame = null;
|
|
|
22
|
+var logoanimationstart = 0;
|
|
|
23
|
+var $logotrans = $('.icon-logo');
|
|
|
24
|
+var isen = true;
|
|
|
25
|
+var loopdurationtime = 500;
|
|
|
26
|
+var globaltimeout;
|
|
|
27
|
+var onetimeoout;
|
|
|
28
|
+/**
|
|
|
29
|
+ * banner和地址的映射
|
|
|
30
|
+ * @type {Object}
|
|
|
31
|
+ */
|
|
|
32
|
+var bannerMap = {
|
|
|
33
|
+ listboys: '4f78b0f418fc42314d8b6e791cfb7fa8',
|
|
|
34
|
+ listgirls: '00c1f025a51b6b597dc37925951ea27d',
|
|
|
35
|
+ listkids: 'b02df11184727701ade1b6de9737d08c',
|
|
|
36
|
+ listlifestyle: 'fd35c52dced0c880976ba858346d1fc5',
|
|
|
37
|
+ searchboys: '9fb8986ea700cc27a8057361c3924394',
|
|
|
38
|
+ searchgirls: 'e3e207a1443ca60c8037fe52a5560c18',
|
|
|
39
|
+ searchkids: '620fc77f479da8feaeb06f2324e5d0bb',
|
|
|
40
|
+ searchlifestyle: 'a3c93301c6ffaf3ed0f36a4a451be36d',
|
|
|
41
|
+ uniquebrandboys: '2ebb0810c0d1a67e5229149c9c3aba7d',
|
|
|
42
|
+ uniquebrandgirls: '99e23385f4ba4b65f406b7e2968ac821',
|
|
|
43
|
+ uniquebrandkids: 'a74ebc9b17840c91b9ea46568111fe6b',
|
|
|
44
|
+ uniquebrandlifestyle: '0e8c81ead53f56302baa4d0ad967f527',
|
|
|
45
|
+ brandsboys: '77b352db07129c76a9d532acad149f9f',
|
|
|
46
|
+ brandsgirls: 'bf047f16e52ebc38be5ce9c7623831e6',
|
|
|
47
|
+ brandskids: 'e3ae1ce9b5e13c6d271ef3eccb831652',
|
|
|
48
|
+ brandslifestyle: 'e4ac8029c30f65d7f1af030980d140fe',
|
|
|
49
|
+ newboys: '869d3c5f3b450fb52101d00a61ce87cb',
|
|
|
50
|
+ newgirls: 'd953b6dfdac02483d1dcce8d96055954',
|
|
|
51
|
+ newkids: '0874cb6d75df8e0e78f2d475e53ecc08',
|
|
|
52
|
+ newlifestyle: '43e8fc8e178115c262bbce2bd0012db7',
|
|
|
53
|
+ saleboys: 'c846e3165c994769b4201d8c32f3ae9b',
|
|
|
54
|
+ salegirls: '52b1d389edcbc62d65de71b80c4d6ad0',
|
|
|
55
|
+ salekids: 'ad8b1703c761ba00973868ab5199cc27',
|
|
|
56
|
+ salelifestyle: '7acc64905c70ac91846f43fb2cec4bbd',
|
|
|
57
|
+ homeboys: 'b0856a771ef1b59ab1234c74688fa42d',
|
|
|
58
|
+ homegirls: '2bd61fa12e4933211518f70fe5ce3c48',
|
|
|
59
|
+ homekids: '895c59e8c64b40399c9533509507320c',
|
|
|
60
|
+ homelifestyle: '2e037d4e25d2767352ca3e0a4627f7bd',
|
|
|
61
|
+ indexboys: '0c911d3000f52e8ca7cffb74f5864c29',
|
|
|
62
|
+ indexgirls: 'b645b8980c423ab30485e0a9d08c2ef7',
|
|
|
63
|
+ indexkids: '17f6d5d5d454d2c507bc5fcbc90f7756',
|
|
|
64
|
+ indexlifestyle: '735cd393e841762af8793c346abbbc36'
|
|
|
65
|
+};
|
|
|
66
|
+var cookieMap = {};
|
|
|
67
|
+
|
|
|
68
|
+function getSource(column, postition, event) {
|
|
|
69
|
+ try {
|
|
|
70
|
+ dataLayer.push({
|
|
|
71
|
+ louceng: column,
|
|
|
72
|
+ weizhi: postition,
|
|
|
73
|
+ event: event
|
|
|
74
|
+ });
|
|
|
75
|
+ } catch (e) {}
|
|
|
76
|
+}
|
|
|
77
|
+
|
|
|
78
|
+function submitSearch() {
|
|
|
79
|
+ var $keywordinput = $('#query_key').val();
|
|
|
80
|
+ var column = 'Search';
|
|
|
81
|
+ var postition = 'Head Search';
|
|
|
82
|
+ var event = 'Search';
|
|
|
83
|
+ var $formatkeyword,
|
|
|
84
|
+ $formatkeywordinput;
|
|
|
85
|
+
|
|
|
86
|
+ $formatkeyword = $.trim(keyword.toLowerCase());
|
|
|
87
|
+ $formatkeywordinput = $.trim($keywordinput.toLowerCase());
|
|
|
88
|
+ getSource(column, postition, event);
|
|
|
89
|
+ if (link !== '' && keyword !== '' && $formatkeyword === $formatkeywordinput) {
|
|
|
90
|
+ location.href = link.replace('\'', '');
|
|
|
91
|
+ } else {
|
|
|
92
|
+ if (reg.test($keywordinput)) {
|
|
|
93
|
+ location.href = 'http://search.yohobuy.com/error?query=' + $keywordinput + '&result=error';
|
|
|
94
|
+ } else {
|
|
|
95
|
+ $('#searchForm').submit();
|
|
|
96
|
+ return false;
|
|
|
97
|
+ }
|
|
|
98
|
+ }
|
|
|
99
|
+}
|
|
|
100
|
+/**
|
|
|
101
|
+ * 定义购物车扩展
|
|
|
102
|
+ */
|
|
|
103
|
+
|
|
|
104
|
+function actionGoodsCart() {
|
|
|
105
|
+ var defaults = {
|
|
|
106
|
+ cookie: '_g',
|
|
|
107
|
+ cartNum: ''
|
|
|
108
|
+ };
|
|
|
109
|
+ var params = '';
|
|
|
110
|
+ var cartInfo = '';
|
|
|
111
|
+ var queryNum = 0;
|
|
|
112
|
+ var listIndex = 0;
|
|
|
113
|
+ var tmpList = 0;
|
|
|
114
|
+ var totalNum = 0;
|
|
|
115
|
+ var text = '';
|
|
|
116
|
+
|
|
|
117
|
+ $.fn.miniCart = function(options) {
|
|
|
118
|
+ params = $.extend(defaults, options);
|
|
|
119
|
+ if (typeof window.cookie(params.cookie) === 'undefined') {
|
|
|
120
|
+ cartInfo = null;
|
|
|
121
|
+ } else {
|
|
|
122
|
+ cartInfo = json2.parse(window.cookie(params.cookie));
|
|
|
123
|
+ }
|
|
|
124
|
+ if (cartInfo != null) {
|
|
|
125
|
+ totalNum = parseInt(cartInfo._nac) + parseInt(cartInfo._ac);
|
|
|
126
|
+ if (totalNum === 0) {
|
|
|
127
|
+ $('#icart-num').attr('class', 'icart-num icart-none');
|
|
|
128
|
+ } else {
|
|
|
129
|
+ $('#icart-num').attr('class', 'icart-num');
|
|
|
130
|
+ }
|
|
|
131
|
+ $(params.cartNum).html(totalNum);
|
|
|
132
|
+ }
|
|
|
133
|
+ };
|
|
|
134
|
+ $.fn.search = function(searchDomain) {
|
|
|
135
|
+
|
|
|
136
|
+ function getKeywords(obj) {
|
|
|
137
|
+ var key = $.trim($(obj).val());
|
|
|
138
|
+
|
|
|
139
|
+ key = key.replace(new RegExp('\'', 'gm'), ''); //去掉特殊字符
|
|
|
140
|
+ if (key === '') {
|
|
|
141
|
+ $('.search-list').hide();
|
|
|
142
|
+ return false;
|
|
|
143
|
+ }
|
|
|
144
|
+ key = encodeURI(key);
|
|
|
145
|
+ $.get(searchDomain + '?callback=?&query=' + key, function(htmlData) {
|
|
|
146
|
+ $('.search-list').html(htmlData.data);
|
|
|
147
|
+ queryNum = $('.search-list').children('li').length;
|
|
|
148
|
+ listIndex = -1;
|
|
|
149
|
+ if (queryNum > 0) {
|
|
|
150
|
+ $('.search-list').show();
|
|
|
151
|
+ } else {
|
|
|
152
|
+ $('.search-list').hide();
|
|
|
153
|
+ }
|
|
|
154
|
+ $('.search-list').find('a').hover(function() {
|
|
|
155
|
+ $(this).css('background-color', '#eee');
|
|
|
156
|
+ }, function() {
|
|
|
157
|
+ $(this).css('background-color', '#fff');
|
|
|
158
|
+ });
|
|
|
159
|
+ }, 'jsonp');
|
|
|
160
|
+ }
|
|
|
161
|
+
|
|
|
162
|
+ function getText(obj) {
|
|
|
163
|
+ $('.search-list li:eq(' + tmpList + ')').children('a').css('background-color', '#fff');
|
|
|
164
|
+ $('.search-list li:eq(' + listIndex + ')').children('a').css('background-color', '#eee');
|
|
|
165
|
+ text = $('.search-list li:eq(' + listIndex + ')').children('a').attr('title');
|
|
|
166
|
+ $('#query_key').val(text);
|
|
|
167
|
+ }
|
|
|
168
|
+ return this.each(function() {
|
|
|
169
|
+ $(this).keyup(function(event) {
|
|
|
170
|
+ if (event.which === 38) {
|
|
|
171
|
+ if (queryNum === 0) {
|
|
|
172
|
+ return false;
|
|
|
173
|
+ }
|
|
|
174
|
+ if (listIndex === -1) {
|
|
|
175
|
+ listIndex = 0;
|
|
|
176
|
+ }
|
|
|
177
|
+ tmpList = listIndex;
|
|
|
178
|
+ listIndex = (listIndex - 1 + queryNum) % queryNum;
|
|
|
179
|
+ getText(this);
|
|
|
180
|
+ } else if (event.which === 40) {
|
|
|
181
|
+ if (queryNum === 0) {
|
|
|
182
|
+ return false;
|
|
|
183
|
+ }
|
|
|
184
|
+ tmpList = listIndex;
|
|
|
185
|
+ listIndex = (listIndex + 1) % queryNum;
|
|
|
186
|
+ getText(this);
|
|
|
187
|
+ } else if (event.which === 13) {
|
|
|
188
|
+ submitSearch();
|
|
|
189
|
+ } else {
|
|
|
190
|
+ getKeywords(this);
|
|
|
191
|
+ }
|
|
|
192
|
+ });
|
|
|
193
|
+ });
|
|
|
194
|
+ };
|
|
|
195
|
+ $.extend({
|
|
|
196
|
+ getData: function(domain, options, onSuccess) {
|
|
|
197
|
+ var defaults = {
|
|
|
198
|
+ page: 1,
|
|
|
199
|
+ method: '',
|
|
|
200
|
+ v: 1,
|
|
|
201
|
+ return_type: 'jsonp',
|
|
|
202
|
+ open_key: '12345',
|
|
|
203
|
+ tmp: Math.random()
|
|
|
204
|
+ };
|
|
|
205
|
+ var params = '';
|
|
|
206
|
+
|
|
|
207
|
+ if (typeof (domain) === undefined || domain === '') {
|
|
|
208
|
+ console.log('请设置请求的api地址');
|
|
|
209
|
+ return false;
|
|
|
210
|
+ }
|
|
|
211
|
+ params = $.extend(defaults, options);
|
|
|
212
|
+ params.page = params.page || 1;
|
|
|
213
|
+ if (params.method === '') {
|
|
|
214
|
+ console.log('请设置请求的URL');
|
|
|
215
|
+ return false;
|
|
|
216
|
+ }
|
|
|
217
|
+ try {
|
|
|
218
|
+ $.getJSON(domain + '/?callback=?', params, function(_data) {
|
|
|
219
|
+ if (onSuccess !== '') {
|
|
|
220
|
+ if (typeof onSuccess(_data.data) !== 'undefined') {
|
|
|
221
|
+ json2.parse(onSuccess(_data.data));
|
|
|
222
|
+ }
|
|
|
223
|
+ return false;
|
|
|
224
|
+ }
|
|
|
225
|
+ });
|
|
|
226
|
+ } catch (e) {
|
|
|
227
|
+ console.log(e.message);
|
|
|
228
|
+ }
|
|
|
229
|
+ },
|
|
|
230
|
+ getShoppingKey: function() {
|
|
|
231
|
+ var shoppingInfo = window.cookie('_g');
|
|
|
232
|
+ var shoppingData = json2.parse(shoppingInfo);
|
|
|
233
|
+
|
|
|
234
|
+ if (typeof shoppingInfo === 'undefined' || shoppingInfo === null) {
|
|
|
235
|
+ return '';
|
|
|
236
|
+ }
|
|
|
237
|
+ return shoppingData._k;
|
|
|
238
|
+ }
|
|
|
239
|
+ });
|
|
|
240
|
+}
|
14
|
/**
|
241
|
/**
|
15
|
* 判断为1的helper
|
242
|
* 判断为1的helper
|
16
|
* @param {[type]} v1 [description]
|
243
|
* @param {[type]} v1 [description]
|
|
@@ -56,8 +283,7 @@ handlebars.registerHelper('equalzero', function(v1, options) { |
|
@@ -56,8 +283,7 @@ handlebars.registerHelper('equalzero', function(v1, options) { |
56
|
return options.inverse(this);
|
283
|
return options.inverse(this);
|
57
|
}
|
284
|
}
|
58
|
});
|
285
|
});
|
59
|
-require('../plugin/yohocookie');
|
|
|
60
|
-require('../plugin/yohocart');
|
286
|
+
|
61
|
/**
|
287
|
/**
|
62
|
* 获取头部banner的回调函数
|
288
|
* 获取头部banner的回调函数
|
63
|
* @param {[type]} data [description]
|
289
|
* @param {[type]} data [description]
|
|
@@ -75,42 +301,9 @@ function JsonPCallBack(data) { |
|
@@ -75,42 +301,9 @@ function JsonPCallBack(data) { |
75
|
}
|
301
|
}
|
76
|
}
|
302
|
}
|
77
|
|
303
|
|
78
|
-/**
|
|
|
79
|
- * 获取头部服务器维护的回调
|
|
|
80
|
- * @param {[type]} data [description]
|
|
|
81
|
- */
|
|
|
82
|
-function NoticeCallBack(data) {
|
|
|
83
|
- if (+data.code === 200) {
|
|
|
84
|
- noticeSuccess = true;
|
|
|
85
|
- }
|
|
|
86
|
-}
|
|
|
87
|
window.JsonPCallBack = JsonPCallBack;
|
304
|
window.JsonPCallBack = JsonPCallBack;
|
88
|
|
305
|
|
89
|
-window.NoticeCallBack = NoticeCallBack;
|
|
|
90
|
-/**
|
|
|
91
|
- * 检测是否获得公告
|
|
|
92
|
- * @return {[type]} [description]
|
|
|
93
|
- */
|
|
|
94
|
-function checkNotice() {
|
|
|
95
|
- var noticeinner;
|
|
|
96
|
-
|
|
|
97
|
- if (!noticeSuccess) {
|
|
|
98
|
- noticeinner = '<div class="noticewrapper">' +
|
|
|
99
|
- '<div class="noticecontainer">' +
|
|
|
100
|
- '<h1 class="noticetitle">关于系统升级的公告</h1>' +
|
|
|
101
|
- '<div class="noticecontent">' +
|
|
|
102
|
- '<p class="tips">尊敬的顾客:</p>' +
|
|
|
103
|
- '<p class="detail">您好!为了向您提供更优质的服务,目前系统正在升级,请耐心等待。</p>' +
|
|
|
104
|
- '<p class="detail">' +
|
|
|
105
|
- '系统升级期间,部分地区用户体验会有暂时中断,如遇紧急事宜,欢迎垂询客服热线:400-889-9646 09:00-22:30(周一至周日)。稍后系统将恢复正常' +
|
|
|
106
|
- '</p>' +
|
|
|
107
|
- '<p class="detail">使用,欢迎您继续光顾YOHO!BUY有货!带来不便之处深表歉意,请您谅解!</p>' +
|
|
|
108
|
- '</div>' +
|
|
|
109
|
- '</div>' +
|
|
|
110
|
- '</div>';
|
|
|
111
|
- $('.header-topwrapper').append(noticeinner);
|
|
|
112
|
- }
|
|
|
113
|
-}
|
306
|
+
|
114
|
/**
|
307
|
/**
|
115
|
* 获得banner数据
|
308
|
* 获得banner数据
|
116
|
* @param {[string]} code [banner对应的编码]
|
309
|
* @param {[string]} code [banner对应的编码]
|
|
@@ -119,23 +312,11 @@ function checkNotice() { |
|
@@ -119,23 +312,11 @@ function checkNotice() { |
119
|
function getBannerData(code) {
|
312
|
function getBannerData(code) {
|
120
|
var script = document.createElement('script');
|
313
|
var script = document.createElement('script');
|
121
|
|
314
|
|
122
|
- script.src = 'http://new.yohobuy.com/resource/getbanner?content_code=' +
|
315
|
+ script.src = 'http://www.yohobuy.com/common/getbanner?content_code=' +
|
123
|
code + '&client_type=web&callback=JsonPCallBack';
|
316
|
code + '&client_type=web&callback=JsonPCallBack';
|
124
|
document.getElementsByTagName('head')[0].appendChild(script);
|
317
|
document.getElementsByTagName('head')[0].appendChild(script);
|
125
|
}
|
318
|
}
|
126
|
-/**
|
|
|
127
|
- * 获取公告的jsonp请求
|
|
|
128
|
- * @param {[type]} code [description]
|
|
|
129
|
- * @return {[type]} [description]
|
|
|
130
|
- */
|
|
|
131
|
-function getNoticeData(code) {
|
|
|
132
|
- var script = document.createElement('script');
|
|
|
133
|
|
319
|
|
134
|
- script.src = 'http://new.yohobuy.com/resource/getbanner?content_code=' +
|
|
|
135
|
- code + '&client_type=web&callback=NoticeCallBack';
|
|
|
136
|
- document.getElementsByTagName('head')[0].appendChild(script);
|
|
|
137
|
- window.setTimeout(checkNotice, 5000); //5s后检测是否成功
|
|
|
138
|
-}
|
|
|
139
|
/**
|
320
|
/**
|
140
|
* 显示和隐藏
|
321
|
* 显示和隐藏
|
141
|
* @param {[type]} sourceClass [description]
|
322
|
* @param {[type]} sourceClass [description]
|
|
@@ -221,7 +402,7 @@ function isSupportCss3Animation() { |
|
@@ -221,7 +402,7 @@ function isSupportCss3Animation() { |
221
|
* @param {Array} ) { var thisFunc, prefixList [description]
|
402
|
* @param {Array} ) { var thisFunc, prefixList [description]
|
222
|
* @return {[type]} [description]
|
403
|
* @return {[type]} [description]
|
223
|
*/
|
404
|
*/
|
224
|
-function requestFrameCloser() {
|
405
|
+function requestFrameAct() {
|
225
|
var prefixList = ['webkit', 'moz', 'ms'];
|
406
|
var prefixList = ['webkit', 'moz', 'ms'];
|
226
|
var func1 = prefixList[0] + 'RequestAnimationFrame';
|
407
|
var func1 = prefixList[0] + 'RequestAnimationFrame';
|
227
|
var func2 = prefixList[1] + 'RequestAnimationFrame';
|
408
|
var func2 = prefixList[1] + 'RequestAnimationFrame';
|
|
@@ -229,7 +410,7 @@ function requestFrameCloser() { |
|
@@ -229,7 +410,7 @@ function requestFrameCloser() { |
229
|
|
410
|
|
230
|
if (window[func1]) {
|
411
|
if (window[func1]) {
|
231
|
return function(callback) {
|
412
|
return function(callback) {
|
232
|
- window[func1](callback);
|
413
|
+ requestAnimationFrame(callback);
|
233
|
};
|
414
|
};
|
234
|
}
|
415
|
}
|
235
|
if (window[func2]) {
|
416
|
if (window[func2]) {
|
|
@@ -248,69 +429,61 @@ function requestFrameCloser() { |
|
@@ -248,69 +429,61 @@ function requestFrameCloser() { |
248
|
}
|
429
|
}
|
249
|
|
430
|
|
250
|
|
431
|
|
251
|
-window.requestFrame = requestFrameCloser();
|
|
|
252
|
-window.start = 0;
|
|
|
253
|
-window.$logotrans = $('.icon-logo');
|
|
|
254
|
-window.isen = true;
|
|
|
255
|
-
|
|
|
256
|
/**
|
432
|
/**
|
257
|
* css3动画
|
433
|
* css3动画
|
258
|
* @return {[type]} [description]
|
434
|
* @return {[type]} [description]
|
259
|
*/
|
435
|
*/
|
260
|
|
436
|
|
261
|
function tsAnimate() {
|
437
|
function tsAnimate() {
|
262
|
- window.start += 10;
|
|
|
263
|
- window.$logotrans.css({
|
|
|
264
|
- transform: 'rotateX(' + window.start + 'deg)',
|
|
|
265
|
- '-webkit-transform': 'rotateX(' + window.start + 'deg)',
|
|
|
266
|
- '-moz-transform': 'rotateX(' + window.start + 'deg)'
|
438
|
+ logoanimationstart += 10;
|
|
|
439
|
+ $logotrans.css({
|
|
|
440
|
+ transform: 'rotateX(' + logoanimationstart + 'deg)',
|
|
|
441
|
+ '-webkit-transform': 'rotateX(' + logoanimationstart + 'deg)',
|
|
|
442
|
+ '-moz-transform': 'rotateX(' + logoanimationstart + 'deg)'
|
267
|
});
|
443
|
});
|
268
|
- if (window.start / 90 % 2 === 1) {
|
|
|
269
|
- if (window.isen) {
|
|
|
270
|
- window.$logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo1.png)');
|
|
|
271
|
- window.isen = false;
|
444
|
+ if (logoanimationstart / 90 % 2 === 1) {
|
|
|
445
|
+ if (isen) {
|
|
|
446
|
+ $logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo1.png)');
|
|
|
447
|
+ isen = false;
|
272
|
} else {
|
448
|
} else {
|
273
|
- window.$logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo_e.png)');
|
|
|
274
|
- window.isen = true;
|
449
|
+ $logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo_e.png)');
|
|
|
450
|
+ isen = true;
|
275
|
}
|
451
|
}
|
276
|
}
|
452
|
}
|
277
|
- if (window.start / 90 % 2 === 0 && window.start % 360 !== 0) {
|
453
|
+ if (logoanimationstart / 90 % 2 === 0 && logoanimationstart % 360 !== 0) {
|
278
|
window.setTimeout(tsAnimate, 3000);
|
454
|
window.setTimeout(tsAnimate, 3000);
|
279
|
} else {
|
455
|
} else {
|
280
|
- if (window.start % 360 === 0) {
|
456
|
+ if (logoanimationstart % 360 === 0) {
|
281
|
window.setTimeout(tsAnimate, 1 * 60 * 1000);
|
457
|
window.setTimeout(tsAnimate, 1 * 60 * 1000);
|
282
|
} else {
|
458
|
} else {
|
283
|
- window.requestFrame(function() {
|
459
|
+ requestFrame(function() {
|
284
|
tsAnimate();
|
460
|
tsAnimate();
|
285
|
});
|
461
|
});
|
286
|
}
|
462
|
}
|
287
|
}
|
463
|
}
|
288
|
}
|
464
|
}
|
289
|
|
465
|
|
290
|
-window.loopdurationtime = 500;
|
|
|
291
|
-window.globaltimeout;
|
|
|
292
|
-window.onetimeoout;
|
|
|
293
|
/**
|
466
|
/**
|
294
|
* 淡出
|
467
|
* 淡出
|
295
|
* @return {[type]} [description]
|
468
|
* @return {[type]} [description]
|
296
|
*/
|
469
|
*/
|
297
|
function fadeAnimate() {
|
470
|
function fadeAnimate() {
|
298
|
- if (window.globaltimeout) {
|
|
|
299
|
- window.clearTimeout(window.globaltimeout);
|
471
|
+ if (globaltimeout) {
|
|
|
472
|
+ window.clearTimeout(globaltimeout);
|
300
|
}
|
473
|
}
|
301
|
- window.$logotrans.fadeOut(window.loopdurationtime, function() {
|
|
|
302
|
- window.isen = false;
|
|
|
303
|
-
|
|
|
304
|
- window.$logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo.png)');
|
|
|
305
|
- window.$logotrans.fadeIn(window.loopdurationtime, function() {
|
|
|
306
|
- window.onetimeoout = window.setTimeout(function() {
|
|
|
307
|
- window.$logotrans.fadeOut(window.loopdurationtime, function() {
|
|
|
308
|
- window.clearTimeout(window.onetimeoout);
|
|
|
309
|
- window.isen = true;
|
|
|
310
|
- window.$logotrans.css('background-image',
|
474
|
+ $logotrans.fadeOut(loopdurationtime, function() {
|
|
|
475
|
+ isen = false;
|
|
|
476
|
+
|
|
|
477
|
+ $logotrans.css('background-image', 'url(http://static.yohobuy.com/newheader/img/logo.png)');
|
|
|
478
|
+ $logotrans.fadeIn(loopdurationtime, function() {
|
|
|
479
|
+ onetimeoout = window.setTimeout(function() {
|
|
|
480
|
+ $logotrans.fadeOut(loopdurationtime, function() {
|
|
|
481
|
+ window.clearTimeout(onetimeoout);
|
|
|
482
|
+ isen = true;
|
|
|
483
|
+ $logotrans.css('background-image',
|
311
|
'url(http://static.yohobuy.com/newheader/img/logo_e.png)');
|
484
|
'url(http://static.yohobuy.com/newheader/img/logo_e.png)');
|
312
|
- window.$logotrans.fadeIn(window.loopdurationtime, function() {
|
|
|
313
|
- window.globaltimeout = window.setTimeout(fadeAnimate, 1 * 60 * 1000);
|
485
|
+ $logotrans.fadeIn(loopdurationtime, function() {
|
|
|
486
|
+ globaltimeout = window.setTimeout(fadeAnimate, 1 * 60 * 1000);
|
314
|
});
|
487
|
});
|
315
|
});
|
488
|
});
|
316
|
}, 3000);
|
489
|
}, 3000);
|
|
@@ -323,6 +496,7 @@ function fadeAnimate() { |
|
@@ -323,6 +496,7 @@ function fadeAnimate() { |
323
|
*/
|
496
|
*/
|
324
|
function actionTopLogoAnimate() {
|
497
|
function actionTopLogoAnimate() {
|
325
|
if (isSupportCss3Animation()) {
|
498
|
if (isSupportCss3Animation()) {
|
|
|
499
|
+ requestFrame = requestFrameAct();
|
326
|
window.setTimeout(tsAnimate, 3000);
|
500
|
window.setTimeout(tsAnimate, 3000);
|
327
|
} else {
|
501
|
} else {
|
328
|
window.setTimeout(fadeAnimate, 3000);
|
502
|
window.setTimeout(fadeAnimate, 3000);
|
|
@@ -355,134 +529,56 @@ function actionAddKeyWords() { |
|
@@ -355,134 +529,56 @@ function actionAddKeyWords() { |
355
|
});
|
529
|
});
|
356
|
}
|
530
|
}
|
357
|
}
|
531
|
}
|
358
|
-window.dataLayer = [];
|
|
|
359
|
-
|
|
|
360
|
-function getSource(column, postition, event) {
|
|
|
361
|
- try {
|
|
|
362
|
- window.dataLayer.push({
|
|
|
363
|
- louceng: column,
|
|
|
364
|
- weizhi: postition,
|
|
|
365
|
- event: event
|
|
|
366
|
- });
|
|
|
367
|
- } catch (e) {}
|
|
|
368
|
-}
|
|
|
369
|
-/**
|
|
|
370
|
- * 搜寻的时候过滤非法字符(+-/:等非法字符单独出现)
|
|
|
371
|
- * @type {RegExp}
|
|
|
372
|
- */
|
|
|
373
|
-window.reg = /^[\^\!\+\-\(\)\:\[\]\\\{\}\~\*\?\|\&\;\/\s]{0,}$/g;
|
|
|
374
|
-window.keyword = '';
|
|
|
375
|
-window.link = '';
|
|
|
376
|
-
|
|
|
377
|
-window.submitSearch = function() {
|
|
|
378
|
- var $keywordinput = $('#query_key').val();
|
|
|
379
|
- var column = 'Search';
|
|
|
380
|
- var postition = 'Head Search';
|
|
|
381
|
- var event = 'Search';
|
|
|
382
|
- var $formatkeyword,
|
|
|
383
|
- $formatkeywordinput;
|
|
|
384
|
|
532
|
|
385
|
- $formatkeyword = $.trim(window.keyword.toLowerCase());
|
|
|
386
|
- $formatkeywordinput = $.trim($keywordinput.toLowerCase());
|
|
|
387
|
- getSource(column, postition, event);
|
|
|
388
|
- if (window.link !== '' && window.keyword !== '' && $formatkeyword === $formatkeywordinput) {
|
|
|
389
|
- location.href = window.link.replace('\'', '');
|
|
|
390
|
- } else {
|
|
|
391
|
- if (window.reg.test($keywordinput)) {
|
|
|
392
|
- location.href = 'http://search.yohobuy.com/error?query=' + $keywordinput + '&result=error';
|
|
|
393
|
- } else {
|
|
|
394
|
- $('#searchForm').submit();
|
|
|
395
|
- return false;
|
|
|
396
|
- }
|
|
|
397
|
- }
|
|
|
398
|
-};
|
|
|
399
|
-/**
|
|
|
400
|
- * banner和地址的映射
|
|
|
401
|
- * @type {Object}
|
|
|
402
|
- */
|
|
|
403
|
-window.bannerMap = {
|
|
|
404
|
- listboys: '4f78b0f418fc42314d8b6e791cfb7fa8',
|
|
|
405
|
- listgirls: '00c1f025a51b6b597dc37925951ea27d',
|
|
|
406
|
- listkids: 'b02df11184727701ade1b6de9737d08c',
|
|
|
407
|
- listlifestyle: 'fd35c52dced0c880976ba858346d1fc5',
|
|
|
408
|
- searchboys: '9fb8986ea700cc27a8057361c3924394',
|
|
|
409
|
- searchgirls: 'e3e207a1443ca60c8037fe52a5560c18',
|
|
|
410
|
- searchkids: '620fc77f479da8feaeb06f2324e5d0bb',
|
|
|
411
|
- searchlifestyle: 'a3c93301c6ffaf3ed0f36a4a451be36d',
|
|
|
412
|
- uniquebrandboys: '2ebb0810c0d1a67e5229149c9c3aba7d',
|
|
|
413
|
- uniquebrandgirls: '99e23385f4ba4b65f406b7e2968ac821',
|
|
|
414
|
- uniquebrandkids: 'a74ebc9b17840c91b9ea46568111fe6b',
|
|
|
415
|
- uniquebrandlifestyle: '0e8c81ead53f56302baa4d0ad967f527',
|
|
|
416
|
- brandsboys: '77b352db07129c76a9d532acad149f9f',
|
|
|
417
|
- brandsgirls: 'bf047f16e52ebc38be5ce9c7623831e6',
|
|
|
418
|
- brandskids: 'e3ae1ce9b5e13c6d271ef3eccb831652',
|
|
|
419
|
- brandslifestyle: 'e4ac8029c30f65d7f1af030980d140fe',
|
|
|
420
|
- newboys: '869d3c5f3b450fb52101d00a61ce87cb',
|
|
|
421
|
- newgirls: 'd953b6dfdac02483d1dcce8d96055954',
|
|
|
422
|
- newkids: '0874cb6d75df8e0e78f2d475e53ecc08',
|
|
|
423
|
- newlifestyle: '43e8fc8e178115c262bbce2bd0012db7',
|
|
|
424
|
- saleboys: 'c846e3165c994769b4201d8c32f3ae9b',
|
|
|
425
|
- salegirls: '52b1d389edcbc62d65de71b80c4d6ad0',
|
|
|
426
|
- salekids: 'ad8b1703c761ba00973868ab5199cc27',
|
|
|
427
|
- salelifestyle: '7acc64905c70ac91846f43fb2cec4bbd',
|
|
|
428
|
- homeboys: 'b0856a771ef1b59ab1234c74688fa42d',
|
|
|
429
|
- homegirls: '2bd61fa12e4933211518f70fe5ce3c48',
|
|
|
430
|
- homekids: '895c59e8c64b40399c9533509507320c',
|
|
|
431
|
- homelifestyle: '2e037d4e25d2767352ca3e0a4627f7bd',
|
|
|
432
|
- indexboys: '0c911d3000f52e8ca7cffb74f5864c29',
|
|
|
433
|
- indexgirls: 'b645b8980c423ab30485e0a9d08c2ef7',
|
|
|
434
|
- indexkids: '17f6d5d5d454d2c507bc5fcbc90f7756',
|
|
|
435
|
- indexlifestyle: '735cd393e841762af8793c346abbbc36'
|
|
|
436
|
-};
|
|
|
437
|
|
533
|
|
438
|
/**
|
534
|
/**
|
439
|
* cookie 初始化
|
535
|
* cookie 初始化
|
440
|
* @return {[type]} [description]
|
536
|
* @return {[type]} [description]
|
441
|
*/
|
537
|
*/
|
442
|
function actionInitCookie() {
|
538
|
function actionInitCookie() {
|
443
|
- var $cookieGender = $.cookie('_Gender');
|
539
|
+ var $cookieGender = window.cookie('_Gender');
|
444
|
var $target = $('.cure');
|
540
|
var $target = $('.cure');
|
445
|
|
541
|
|
446
|
if (typeof $cookieGender !== 'undefined' && $cookieGender !== '') {
|
542
|
if (typeof $cookieGender !== 'undefined' && $cookieGender !== '') {
|
447
|
- $.setcookie('_Gender', 1, {
|
543
|
+ window.setCookie('_Gender', 1, {
|
448
|
path: '/',
|
544
|
path: '/',
|
449
|
domain: '.yohobuy.com',
|
545
|
domain: '.yohobuy.com',
|
450
|
expires: 7
|
546
|
expires: 7
|
451
|
});
|
547
|
});
|
452
|
}
|
548
|
}
|
453
|
if ($target.find('.name-cn a').text() === '男生') {
|
549
|
if ($target.find('.name-cn a').text() === '男生') {
|
454
|
- $.setcookie('_Gender', '1,3', {
|
550
|
+ window.setCookie('_Gender', '1,3', {
|
455
|
path: '/',
|
551
|
path: '/',
|
456
|
domain: '.yohobuy.com',
|
552
|
domain: '.yohobuy.com',
|
457
|
expires: 7
|
553
|
expires: 7
|
458
|
});
|
554
|
});
|
459
|
- $.setcookie('_Channel', 'boys', {
|
555
|
+ window.setCookie('_Channel', 'boys', {
|
460
|
path: '/',
|
556
|
path: '/',
|
461
|
domain: '.yohobuy.com',
|
557
|
domain: '.yohobuy.com',
|
462
|
expires: 7
|
558
|
expires: 7
|
463
|
});
|
559
|
});
|
464
|
}
|
560
|
}
|
465
|
if ($target.find('.name-cn a').text() === '女生') {
|
561
|
if ($target.find('.name-cn a').text() === '女生') {
|
466
|
- $.setcookie('_Gender', '2,3', {
|
562
|
+ window.setCookie('_Gender', '2,3', {
|
467
|
path: '/',
|
563
|
path: '/',
|
468
|
domain: '.yohobuy.com',
|
564
|
domain: '.yohobuy.com',
|
469
|
expires: 7
|
565
|
expires: 7
|
470
|
});
|
566
|
});
|
471
|
- $.setcookie('_Channel', 'girls', {
|
567
|
+ window.setCookie('_Channel', 'girls', {
|
472
|
path: '/',
|
568
|
path: '/',
|
473
|
domain: '.yohobuy.com',
|
569
|
domain: '.yohobuy.com',
|
474
|
expires: 7
|
570
|
expires: 7
|
475
|
});
|
571
|
});
|
476
|
}
|
572
|
}
|
477
|
if ($target.find('.name-cn a').text() === '创意生活') {
|
573
|
if ($target.find('.name-cn a').text() === '创意生活') {
|
478
|
- $.setcookie('_Channel', 'lifestyle', {
|
574
|
+ window.setCookie('_Channel', 'lifestyle', {
|
479
|
path: '/',
|
575
|
path: '/',
|
480
|
domain: '.yohobuy.com',
|
576
|
domain: '.yohobuy.com',
|
481
|
expires: 7
|
577
|
expires: 7
|
482
|
});
|
578
|
});
|
483
|
}
|
579
|
}
|
484
|
if ($target.find('.name-cn a').text() === '潮童') {
|
580
|
if ($target.find('.name-cn a').text() === '潮童') {
|
485
|
- $.setcookie('_Channel', 'kids', {
|
581
|
+ window.setCookie('_Channel', 'kids', {
|
486
|
path: '/',
|
582
|
path: '/',
|
487
|
domain: '.yohobuy.com',
|
583
|
domain: '.yohobuy.com',
|
488
|
expires: 7
|
584
|
expires: 7
|
|
@@ -494,8 +590,6 @@ function actionInitCookie() { |
|
@@ -494,8 +590,6 @@ function actionInitCookie() { |
494
|
* cookie集合
|
590
|
* cookie集合
|
495
|
* @type {Object}
|
591
|
* @type {Object}
|
496
|
*/
|
592
|
*/
|
497
|
-window.cookieMap = {};
|
|
|
498
|
-
|
|
|
499
|
function actionExeCookieMap() {
|
593
|
function actionExeCookieMap() {
|
500
|
var cookies = document.cookie;
|
594
|
var cookies = document.cookie;
|
501
|
var cookiearr = cookies.split(';');
|
595
|
var cookiearr = cookies.split(';');
|
|
@@ -505,8 +599,10 @@ function actionExeCookieMap() { |
|
@@ -505,8 +599,10 @@ function actionExeCookieMap() { |
505
|
|
599
|
|
506
|
for (i = 0; i < cookiearr.length; i++) {
|
600
|
for (i = 0; i < cookiearr.length; i++) {
|
507
|
temparr = cookiearr[i].split('=');
|
601
|
temparr = cookiearr[i].split('=');
|
508
|
- key = temparr[0].replace(/\s/g, '');
|
|
|
509
|
- window.cookieMap[key] = temparr[1];
|
602
|
+ if (typeof temparr[0] !== 'undefined') {
|
|
|
603
|
+ key = temparr[0].replace(/\s/g, '');
|
|
|
604
|
+ cookieMap[key] = temparr[1];
|
|
|
605
|
+ }
|
510
|
}
|
606
|
}
|
511
|
}
|
607
|
}
|
512
|
/**
|
608
|
/**
|
|
@@ -517,47 +613,47 @@ function actionFirstMenuClick() { |
|
@@ -517,47 +613,47 @@ function actionFirstMenuClick() { |
517
|
var $cookieGender;
|
613
|
var $cookieGender;
|
518
|
|
614
|
|
519
|
$('.first-nav-item').click(function() {
|
615
|
$('.first-nav-item').click(function() {
|
520
|
- $cookieGender = $.cookie('_Gender');
|
616
|
+ $cookieGender = window.cookie('_Gender');
|
521
|
if (typeof $cookieGender !== 'undefined' && $cookieGender !== '') {
|
617
|
if (typeof $cookieGender !== 'undefined' && $cookieGender !== '') {
|
522
|
- $.setcookie('_Gender', 1, {
|
618
|
+ window.setCookie('_Gender', 1, {
|
523
|
path: '/',
|
619
|
path: '/',
|
524
|
domain: '.yohobuy.com',
|
620
|
domain: '.yohobuy.com',
|
525
|
expires: 7
|
621
|
expires: 7
|
526
|
});
|
622
|
});
|
527
|
}
|
623
|
}
|
528
|
if ($(this).find('.name-cn a').text() === '男生') {
|
624
|
if ($(this).find('.name-cn a').text() === '男生') {
|
529
|
- $.setcookie('_Gender', '1,3', {
|
625
|
+ window.setCookie('_Gender', '1,3', {
|
530
|
path: '/',
|
626
|
path: '/',
|
531
|
domain: '.yohobuy.com',
|
627
|
domain: '.yohobuy.com',
|
532
|
expires: 7
|
628
|
expires: 7
|
533
|
});
|
629
|
});
|
534
|
- $.setcookie('_Channel', 'boys', {
|
630
|
+ window.setCookie('_Channel', 'boys', {
|
535
|
path: '/',
|
631
|
path: '/',
|
536
|
domain: '.yohobuy.com',
|
632
|
domain: '.yohobuy.com',
|
537
|
expires: 7
|
633
|
expires: 7
|
538
|
});
|
634
|
});
|
539
|
}
|
635
|
}
|
540
|
if ($(this).find('.name-cn a').text() === '女生') {
|
636
|
if ($(this).find('.name-cn a').text() === '女生') {
|
541
|
- $.setcookie('_Gender', '2,3', {
|
637
|
+ window.setCookie('_Gender', '2,3', {
|
542
|
path: '/',
|
638
|
path: '/',
|
543
|
domain: '.yohobuy.com',
|
639
|
domain: '.yohobuy.com',
|
544
|
expires: 7
|
640
|
expires: 7
|
545
|
});
|
641
|
});
|
546
|
- $.setcookie('_Channel', 'girls', {
|
642
|
+ window.setCookie('_Channel', 'girls', {
|
547
|
path: '/',
|
643
|
path: '/',
|
548
|
domain: '.yohobuy.com',
|
644
|
domain: '.yohobuy.com',
|
549
|
expires: 7
|
645
|
expires: 7
|
550
|
});
|
646
|
});
|
551
|
}
|
647
|
}
|
552
|
if ($(this).find('.name-cn a').text() === '创意生活') {
|
648
|
if ($(this).find('.name-cn a').text() === '创意生活') {
|
553
|
- $.setcookie('_Channel', 'lifestyle', {
|
649
|
+ window.setCookie('_Channel', 'lifestyle', {
|
554
|
path: '/',
|
650
|
path: '/',
|
555
|
domain: '.yohobuy.com',
|
651
|
domain: '.yohobuy.com',
|
556
|
expires: 7
|
652
|
expires: 7
|
557
|
});
|
653
|
});
|
558
|
}
|
654
|
}
|
559
|
if ($(this).find('.name-cn a').text() === '潮童') {
|
655
|
if ($(this).find('.name-cn a').text() === '潮童') {
|
560
|
- $.setcookie('_Channel', 'kids', {
|
656
|
+ window.setCookie('_Channel', 'kids', {
|
561
|
path: '/',
|
657
|
path: '/',
|
562
|
domain: '.yohobuy.com',
|
658
|
domain: '.yohobuy.com',
|
563
|
expires: 7
|
659
|
expires: 7
|
|
@@ -566,7 +662,7 @@ function actionFirstMenuClick() { |
|
@@ -566,7 +662,7 @@ function actionFirstMenuClick() { |
566
|
});
|
662
|
});
|
567
|
|
663
|
|
568
|
$('#backToOld').click(function() {
|
664
|
$('#backToOld').click(function() {
|
569
|
- $.setcookie('_New', 1, {
|
665
|
+ window.setCookie('_New', 1, {
|
570
|
path: '/',
|
666
|
path: '/',
|
571
|
domain: '.yohobuy.com'
|
667
|
domain: '.yohobuy.com'
|
572
|
});
|
668
|
});
|
|
@@ -597,10 +693,10 @@ function loadCartData() { |
|
@@ -597,10 +693,10 @@ function loadCartData() { |
597
|
method: 'open.Shoppingcart.getCartData',
|
693
|
method: 'open.Shoppingcart.getCartData',
|
598
|
shopping_key: $.getShoppingKey()
|
694
|
shopping_key: $.getShoppingKey()
|
599
|
}, function(jsonData) {
|
695
|
}, function(jsonData) {
|
600
|
- if (window.cartTpl === '') {
|
|
|
601
|
- window.cartTpl = handlebars.compile($('#mini-cart-tpl').html());
|
696
|
+ if (cartTpl === '') {
|
|
|
697
|
+ cartTpl = handlebars.compile($('#mini-cart-tpl').html());
|
602
|
}
|
698
|
}
|
603
|
- $('#miniCartBox').children('.gobuy-wrapper').html(window.cartTpl({
|
699
|
+ $('#miniCartBox').children('.gobuy-wrapper').html(cartTpl({
|
604
|
carData: jsonData
|
700
|
carData: jsonData
|
605
|
}));
|
701
|
}));
|
606
|
if (parseInt($('.ic-infomation').html()) === 0) {
|
702
|
if (parseInt($('.ic-infomation').html()) === 0) {
|
|
@@ -608,11 +704,11 @@ function loadCartData() { |
|
@@ -608,11 +704,11 @@ function loadCartData() { |
608
|
'<h3 class="information">您的购物车暂无商品</h3></div>');
|
704
|
'<h3 class="information">您的购物车暂无商品</h3></div>');
|
609
|
}
|
705
|
}
|
610
|
if ($('#miniCartBox .goods-list li').length < 1) {
|
706
|
if ($('#miniCartBox .goods-list li').length < 1) {
|
611
|
- shoppingInfo = $.cookie('_g');
|
707
|
+ shoppingInfo = window.cookie('_g');
|
612
|
shoppingData = json2.parse(shoppingInfo);
|
708
|
shoppingData = json2.parse(shoppingInfo);
|
613
|
if (shoppingData !== null) {
|
709
|
if (shoppingData !== null) {
|
614
|
strK = '{"_k":"' + shoppingData._k + '","_nac":0' + ',"_ac":0,"_r":0}';
|
710
|
strK = '{"_k":"' + shoppingData._k + '","_nac":0' + ',"_ac":0,"_r":0}';
|
615
|
- $.setcookie('_g', strK, {
|
711
|
+ window.setCookie('_g', strK, {
|
616
|
path: '/',
|
712
|
path: '/',
|
617
|
domain: '.yohobuy.com'
|
713
|
domain: '.yohobuy.com'
|
618
|
});
|
714
|
});
|
|
@@ -636,11 +732,11 @@ function delCartGoods(id, isreduce) { |
|
@@ -636,11 +732,11 @@ function delCartGoods(id, isreduce) { |
636
|
id: id,
|
732
|
id: id,
|
637
|
isreduce: isreduce
|
733
|
isreduce: isreduce
|
638
|
}, function(jsonData) {
|
734
|
}, function(jsonData) {
|
639
|
- var shoppingInfo = $.cookie('_g');
|
735
|
+ var shoppingInfo = window.cookie('_g');
|
640
|
var shoppingData = json2.parse(shoppingInfo);
|
736
|
var shoppingData = json2.parse(shoppingInfo);
|
641
|
var strK = '{"_k":"' + shoppingData._k + '","_nac":' + jsonData.total_goods_num + ',"_ac":0,"_r":0}';
|
737
|
var strK = '{"_k":"' + shoppingData._k + '","_nac":' + jsonData.total_goods_num + ',"_ac":0,"_r":0}';
|
642
|
|
738
|
|
643
|
- $.setcookie('_g', strK, {
|
739
|
+ window.setCookie('_g', strK, {
|
644
|
path: '/',
|
740
|
path: '/',
|
645
|
domain: '.yohobuy.com'
|
741
|
domain: '.yohobuy.com'
|
646
|
});
|
742
|
});
|
|
@@ -752,43 +848,42 @@ function actionGetBannerAndNotice() { |
|
@@ -752,43 +848,42 @@ function actionGetBannerAndNotice() { |
752
|
var firstarea;
|
848
|
var firstarea;
|
753
|
|
849
|
|
754
|
if (url.indexOf('search') !== -1) {
|
850
|
if (url.indexOf('search') !== -1) {
|
755
|
- code = window.bannerMap['search' + window.cookieMap._Channel];
|
851
|
+ code = bannerMap['search' + cookieMap._Channel];
|
756
|
}
|
852
|
}
|
757
|
if (url.indexOf('list') !== -1) {
|
853
|
if (url.indexOf('list') !== -1) {
|
758
|
- code = window.bannerMap['list' + window.cookieMap._Channel];
|
854
|
+ code = bannerMap['list' + cookieMap._Channel];
|
759
|
}
|
855
|
}
|
760
|
if (url.indexOf('brands') !== -1) {
|
856
|
if (url.indexOf('brands') !== -1) {
|
761
|
- code = window.bannerMap['brands' + window.cookieMap._Channel];
|
857
|
+ code = bannerMap['brands' + cookieMap._Channel];
|
762
|
}
|
858
|
}
|
763
|
if (url.indexOf('new') !== -1) {
|
859
|
if (url.indexOf('new') !== -1) {
|
764
|
- code = window.bannerMap['new' + window.cookieMap._Channel];
|
860
|
+ code = bannerMap['new' + cookieMap._Channel];
|
765
|
}
|
861
|
}
|
766
|
if (url.indexOf('sale') !== -1) {
|
862
|
if (url.indexOf('sale') !== -1) {
|
767
|
- code = window.bannerMap['sale' + window.cookieMap._Channel];
|
863
|
+ code = bannerMap['sale' + cookieMap._Channel];
|
768
|
}
|
864
|
}
|
769
|
if (url.indexOf('home') !== -1) {
|
865
|
if (url.indexOf('home') !== -1) {
|
770
|
- code = window.bannerMap['home' + window.cookieMap._Channel];
|
866
|
+ code = bannerMap['home' + cookieMap._Channel];
|
771
|
}
|
867
|
}
|
772
|
if (url.indexOf('kids') !== -1) {
|
868
|
if (url.indexOf('kids') !== -1) {
|
773
|
- code = window.bannerMap[INDEXKIDS];
|
869
|
+ code = bannerMap[INDEXKIDS];
|
774
|
}
|
870
|
}
|
775
|
if (url.indexOf('woman') !== -1) {
|
871
|
if (url.indexOf('woman') !== -1) {
|
776
|
- code = window.bannerMap[INDEXWOMAN];
|
872
|
+ code = bannerMap[INDEXWOMAN];
|
777
|
}
|
873
|
}
|
778
|
if (url.indexOf('lifestyle') !== -1) {
|
874
|
if (url.indexOf('lifestyle') !== -1) {
|
779
|
- code = window.bannerMap[INDEXLIFESTYLE];
|
875
|
+ code = bannerMap[INDEXLIFESTYLE];
|
780
|
}
|
876
|
}
|
781
|
if (url.indexOf('www.yohobuy.com') !== -1 && window.location.pathname === '/') {
|
877
|
if (url.indexOf('www.yohobuy.com') !== -1 && window.location.pathname === '/') {
|
782
|
- code = window.bannerMap[INDEXBOYS];
|
878
|
+ code = bannerMap[INDEXBOYS];
|
783
|
}
|
879
|
}
|
784
|
firstarea = host.split('.')[0];
|
880
|
firstarea = host.split('.')[0];
|
785
|
if (firstarea !== 'list' && firstarea !== 'search' && firstarea !== 'www' &&
|
881
|
if (firstarea !== 'list' && firstarea !== 'search' && firstarea !== 'www' &&
|
786
|
firstarea !== 'new' && firstarea !== 'item' && firstarea !== 'guang') {
|
882
|
firstarea !== 'new' && firstarea !== 'item' && firstarea !== 'guang') {
|
787
|
- code = window.bannerMap[UNIQUEBRAND + window.cookieMap._Channel];
|
883
|
+ code = bannerMap[UNIQUEBRAND + cookieMap._Channel];
|
788
|
}
|
884
|
}
|
789
|
|
885
|
|
790
|
getBannerData(code); //获得banner信息
|
886
|
getBannerData(code); //获得banner信息
|
791
|
- getNoticeData(code); //获得公告信息
|
|
|
792
|
|
887
|
|
793
|
}
|
888
|
}
|
794
|
|
889
|
|
|
@@ -879,12 +974,12 @@ function actionLoginState(_data) { |
|
@@ -879,12 +974,12 @@ function actionLoginState(_data) { |
879
|
'[<a href="http://www.yohobuy.com/reg.html" onclick="" class="list-a login-out">免费注册</a>]' +
|
974
|
'[<a href="http://www.yohobuy.com/reg.html" onclick="" class="list-a login-out">免费注册</a>]' +
|
880
|
'{{/equalone}}';
|
975
|
'{{/equalone}}';
|
881
|
var $boxObj = $('#loginBox');
|
976
|
var $boxObj = $('#loginBox');
|
882
|
- var info = $.cookie('_UID')||'';
|
|
|
883
|
- var name = _data.data.profile_name||'';
|
977
|
+ var info = window.cookie('_UID');
|
|
|
978
|
+ var name = _data.data.profile_name;
|
884
|
var _length = 0;
|
979
|
var _length = 0;
|
885
|
var t = 0;
|
980
|
var t = 0;
|
886
|
var char = '';
|
981
|
var char = '';
|
887
|
- var user = info.split('::')||'';
|
982
|
+ var user = info.split('::');
|
888
|
var userName = user[0] || ' ';
|
983
|
var userName = user[0] || ' ';
|
889
|
var _logout = '';
|
984
|
var _logout = '';
|
890
|
var islogin = '1';
|
985
|
var islogin = '1';
|
|
@@ -999,8 +1094,10 @@ function actionLoginInfo() { |
|
@@ -999,8 +1094,10 @@ function actionLoginInfo() { |
999
|
};
|
1094
|
};
|
1000
|
|
1095
|
|
1001
|
$.getData(apiDomain, param, function(_data) {
|
1096
|
$.getData(apiDomain, param, function(_data) {
|
1002
|
- actionLoginState(_data); // 更改登录状态
|
|
|
1003
|
- actionVipInfo(_data); //获得vip;
|
1097
|
+ if (_data.result !== -1) {
|
|
|
1098
|
+ actionLoginState(_data); // 更改登录状态
|
|
|
1099
|
+ actionVipInfo(_data); //获得vip;
|
|
|
1100
|
+ }
|
1004
|
});
|
1101
|
});
|
1005
|
}
|
1102
|
}
|
1006
|
/**
|
1103
|
/**
|
|
@@ -1011,6 +1108,7 @@ function init() { |
|
@@ -1011,6 +1108,7 @@ function init() { |
1011
|
actionExeTemplate(); //处理模板
|
1108
|
actionExeTemplate(); //处理模板
|
1012
|
actionInitCookie(); //初始化cookie
|
1109
|
actionInitCookie(); //初始化cookie
|
1013
|
actionExeCookieMap(); //格式化cookie
|
1110
|
actionExeCookieMap(); //格式化cookie
|
|
|
1111
|
+ actionGoodsCart(); //初始化购物车插件
|
1014
|
actionYoHoGroup(); // yoho集团鼠标效果
|
1112
|
actionYoHoGroup(); // yoho集团鼠标效果
|
1015
|
actionTopTagToggle(); // yoho上部分开关
|
1113
|
actionTopTagToggle(); // yoho上部分开关
|
1016
|
actionTopLogoAnimate(); //yoho logo动画
|
1114
|
actionTopLogoAnimate(); //yoho logo动画
|