|
|
/*start ͨÓú¯Êý*/
|
|
|
if (!this.JSON) {
|
|
|
this.JSON = {};
|
|
|
}
|
|
|
|
|
|
(function() {
|
|
|
function f(n) {
|
|
|
return n < 10 ? '0' + n : n;
|
|
|
}
|
|
|
if (typeof Date.prototype.toJSON !== 'function') {
|
|
|
Date.prototype.toJSON = function(key) {
|
|
|
|
|
|
return isFinite(this.valueOf()) ?
|
|
|
this.getUTCFullYear() + '-' +
|
|
|
f(this.getUTCMonth() + 1) + '-' +
|
|
|
f(this.getUTCDate()) + 'T' +
|
|
|
f(this.getUTCHours()) + ':' +
|
|
|
f(this.getUTCMinutes()) + ':' +
|
|
|
f(this.getUTCSeconds()) + 'Z' : null;
|
|
|
};
|
|
|
|
|
|
String.prototype.toJSON =
|
|
|
Number.prototype.toJSON =
|
|
|
Boolean.prototype.toJSON = function(key) {
|
|
|
return this.valueOf();
|
|
|
};
|
|
|
}
|
|
|
|
|
|
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
|
|
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
|
|
|
gap,
|
|
|
indent,
|
|
|
meta = { // table of character substitutions
|
|
|
'\b': '\\b',
|
|
|
'\t': '\\t',
|
|
|
'\n': '\\n',
|
|
|
'\f': '\\f',
|
|
|
'\r': '\\r',
|
|
|
'"': '\\"',
|
|
|
'\\': '\\\\'
|
|
|
},
|
|
|
rep;
|
|
|
|
|
|
function quote(string) {
|
|
|
escapable.lastIndex = 0;
|
|
|
return escapable.test(string) ?
|
|
|
'"' + string.replace(escapable, function(a) {
|
|
|
var c = meta[a];
|
|
|
return typeof c === 'string' ? c :
|
|
|
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
|
|
}) + '"' :
|
|
|
'"' + string + '"';
|
|
|
}
|
|
|
function str(key, holder) {
|
|
|
var i, // The loop counter.
|
|
|
k, // The member key.
|
|
|
v, // The member value.
|
|
|
length,
|
|
|
mind = gap,
|
|
|
partial,
|
|
|
value = holder[key];
|
|
|
|
|
|
if (value && typeof value === 'object' &&
|
|
|
typeof value.toJSON === 'function') {
|
|
|
value = value.toJSON(key);
|
|
|
}
|
|
|
|
|
|
if (typeof rep === 'function') {
|
|
|
value = rep.call(holder, key, value);
|
|
|
}
|
|
|
|
|
|
switch (typeof value) {
|
|
|
case 'string':
|
|
|
return quote(value);
|
|
|
case 'number':
|
|
|
return isFinite(value) ? String(value) : 'null';
|
|
|
case 'boolean':
|
|
|
case 'null':
|
|
|
return String(value);
|
|
|
case 'object':
|
|
|
if (!value) {
|
|
|
return 'null';
|
|
|
}
|
|
|
gap += indent;
|
|
|
partial = [];
|
|
|
|
|
|
if (Object.prototype.toString.apply(value) === '[object Array]') {
|
|
|
length = value.length;
|
|
|
for (i = 0; i < length; i += 1) {
|
|
|
partial[i] = str(i, value) || 'null';
|
|
|
}
|
|
|
|
|
|
v = partial.length === 0 ? '[]' :
|
|
|
gap ? '[\n' + gap +
|
|
|
partial.join(',\n' + gap) + '\n' +
|
|
|
mind + ']' :
|
|
|
'[' + partial.join(',') + ']';
|
|
|
gap = mind;
|
|
|
return v;
|
|
|
}
|
|
|
|
|
|
if (rep && typeof rep === 'object') {
|
|
|
length = rep.length;
|
|
|
for (i = 0; i < length; i += 1) {
|
|
|
k = rep[i];
|
|
|
if (typeof k === 'string') {
|
|
|
v = str(k, value);
|
|
|
if (v) {
|
|
|
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
for (k in value) {
|
|
|
if (Object.hasOwnProperty.call(value, k)) {
|
|
|
v = str(k, value);
|
|
|
if (v) {
|
|
|
partial.push(quote(k) + (gap ? ': ' : ':') + v);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
v = partial.length === 0 ? '{}' :
|
|
|
gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
|
|
|
mind + '}' : '{' + partial.join(',') + '}';
|
|
|
gap = mind;
|
|
|
return v;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (typeof JSON.stringify !== 'function') {
|
|
|
JSON.stringify = function(value, replacer, space) {
|
|
|
var i;
|
|
|
gap = '';
|
|
|
indent = '';
|
|
|
|
|
|
if (typeof space === 'number') {
|
|
|
for (i = 0; i < space; i += 1) {
|
|
|
indent += ' ';
|
|
|
}
|
|
|
|
|
|
} else if (typeof space === 'string') {
|
|
|
indent = space;
|
|
|
}
|
|
|
rep = replacer;
|
|
|
if (replacer && typeof replacer !== 'function' &&
|
|
|
(typeof replacer !== 'object' ||
|
|
|
typeof replacer.length !== 'number')) {
|
|
|
throw new Error('JSON.stringify');
|
|
|
}
|
|
|
|
|
|
return str('', { '': value });
|
|
|
};
|
|
|
}
|
|
|
|
|
|
if (typeof JSON.parse !== 'function') {
|
|
|
JSON.parse = function(text, reviver) {
|
|
|
var j;
|
|
|
function walk(holder, key) {
|
|
|
var k, v, value = holder[key];
|
|
|
if (value && typeof value === 'object') {
|
|
|
for (k in value) {
|
|
|
if (Object.hasOwnProperty.call(value, k)) {
|
|
|
v = walk(value, k);
|
|
|
if (v !== undefined) {
|
|
|
value[k] = v;
|
|
|
} else {
|
|
|
delete value[k];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return reviver.call(holder, key, value);
|
|
|
}
|
|
|
|
|
|
text = String(text);
|
|
|
cx.lastIndex = 0;
|
|
|
if (cx.test(text)) {
|
|
|
text = text.replace(cx, function(a) {
|
|
|
return '\\u' +
|
|
|
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (/^[\],:{}\s]*$/.
|
|
|
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
|
|
|
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
|
|
|
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|
|
|
|
|
j = eval('(' + text + ')');
|
|
|
|
|
|
return typeof reviver === 'function' ?
|
|
|
walk({ '': j }, '') : j;
|
|
|
}
|
|
|
throw new SyntaxError('JSON.parse');
|
|
|
};
|
|
|
}
|
|
|
} ());
|
|
|
|
|
|
(function($) {
|
|
|
$.newegg = {
|
|
|
isSecurePage: function() {
|
|
|
return location.protocol == 'https:';
|
|
|
},
|
|
|
buildCurrent: function(relativePath) {
|
|
|
if (location.host.indexOf(":8008") != -1) {
|
|
|
return location.protocol + '//' + location.host + '/WebUI/' + relativePath;
|
|
|
}
|
|
|
else {
|
|
|
return location.protocol + '//' + location.host + '/' + relativePath;
|
|
|
}
|
|
|
},
|
|
|
buildWWW: function(relativePath) {
|
|
|
return wwwSite + '/' + relativePath;
|
|
|
},
|
|
|
buildShopper: function(relativePath) {
|
|
|
return shopperSite + '/' + relativePath;
|
|
|
},
|
|
|
buildSSL: function(relativePath) {
|
|
|
return sslSite + '/' + relativePath;
|
|
|
},
|
|
|
format: function(source, params) {
|
|
|
if (arguments.length == 1)
|
|
|
return function() {
|
|
|
var args = $.makeArray(arguments);
|
|
|
args.unshift(source);
|
|
|
return $.newegg.format.apply(this, args);
|
|
|
};
|
|
|
if (arguments.length > 2 && params.constructor != Array) {
|
|
|
params = $.makeArray(arguments).slice(1);
|
|
|
}
|
|
|
if (params.constructor != Array) {
|
|
|
params = [params];
|
|
|
}
|
|
|
$.each(params, function(i, n) {
|
|
|
source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
|
|
|
});
|
|
|
return source;
|
|
|
},
|
|
|
format2: function(source, params) {
|
|
|
if (arguments.length == 1)
|
|
|
return function() {
|
|
|
var args = $.makeArray(arguments);
|
|
|
args.unshift(source);
|
|
|
return $.newegg.format.apply(this, args);
|
|
|
};
|
|
|
if (arguments.length > 2 && params.constructor != Array) {
|
|
|
params = $.makeArray(arguments).slice(1);
|
|
|
}
|
|
|
if (params.constructor != Array) {
|
|
|
params = [params];
|
|
|
}
|
|
|
$.each(params, function(i, n) {
|
|
|
source = source.replace("{" + i + "}", n);
|
|
|
});
|
|
|
return source;
|
|
|
},
|
|
|
cookie: {
|
|
|
set: function(name, value, options) {
|
|
|
var cv = "";
|
|
|
options = options || {};
|
|
|
value = value || null;
|
|
|
|
|
|
if (value == null) {
|
|
|
options = $.extend({}, options);
|
|
|
options.expires = -1;
|
|
|
}
|
|
|
|
|
|
if (value != null && typeof (value) == "string") {
|
|
|
cv = escape(value);
|
|
|
} else if (value != null && typeof (value) == "object") {
|
|
|
var jsonv = $.newegg.cookie.ToJson($.newegg.cookie.get(name));
|
|
|
if (jsonv == false) jsonv = {};
|
|
|
for (var k in value) {
|
|
|
eval("jsonv." + k + "=\"" + value[k] + "\"");
|
|
|
}
|
|
|
for (var k in jsonv) {
|
|
|
cv += k + '=' + escape(jsonv[k]) + '&';
|
|
|
}
|
|
|
cv = cv.substring(0, cv.length - 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();
|
|
|
}
|
|
|
var path = options.path ? "; path=" + (options.path) : "; path=/";
|
|
|
var domain = options.domain ? "; domain=" + (options.domain) : "";
|
|
|
if (options.topdomain) {
|
|
|
var host = location.hostname
|
|
|
hostindex = host.indexOf('.');
|
|
|
if (hostindex > 0) {
|
|
|
host = host.substring(hostindex);
|
|
|
domain = "; domain=" + host;
|
|
|
}
|
|
|
}
|
|
|
var secure = options.secure ? "; secure" : "";
|
|
|
document.cookie = [name, '=', cv, expires, path, domain, secure].join('');
|
|
|
},
|
|
|
get: function(n, k) {
|
|
|
var reg = new RegExp("(^| )" + n + "=([^;]*)(;|$)");
|
|
|
var arr = document.cookie.match(reg);
|
|
|
if (arguments.length == 2) {
|
|
|
if (arr != null) {
|
|
|
var kArr, kReg = new RegExp("(^| |&)" + k + "=([^&]*)(&|$)");
|
|
|
var c = arr[2];
|
|
|
var c = c ? c : document.cookie;
|
|
|
if (kArr = c.match(kReg)) {
|
|
|
return unescape(kArr[2]);
|
|
|
} else {
|
|
|
return "";
|
|
|
}
|
|
|
} else {
|
|
|
return "";
|
|
|
}
|
|
|
} else if (arguments.length == 1) {
|
|
|
if (arr != null) {
|
|
|
return unescape(arr[2]);
|
|
|
} else {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
ToJson: function(cv) {
|
|
|
var cv = cv.replace(new RegExp("=", "gi"), ":'").replace(new RegExp("&", "gi"), "',").replace(new RegExp(";\\s", "gi"), "',");
|
|
|
return eval("({" + cv + (cv.length > 0 ? "'" : "") + "})");
|
|
|
},
|
|
|
clear: function(name, options) {
|
|
|
var expires = ";expires=Thu, 01-Jan-1900 00:00:01 GMT";
|
|
|
var path = options.path ? "; path=" + (options.path) : "; path=/";
|
|
|
var domain = options.domain ? "; domain=" + (options.domain) : "";
|
|
|
if (options.topdomain) {
|
|
|
var host = location.hostname
|
|
|
hostindex = host.indexOf('.');
|
|
|
if (hostindex > 0) {
|
|
|
host = host.substring(hostindex);
|
|
|
domain = "; domain=" + host;
|
|
|
}
|
|
|
}
|
|
|
var secure = options.secure ? "; secure" : "";
|
|
|
document.cookie = [name, '=', expires, path, domain, secure].join('');
|
|
|
}
|
|
|
},
|
|
|
querystring: {
|
|
|
get: function(key) {
|
|
|
var qs = $.newegg.querystring.parse();
|
|
|
var value = qs[key];
|
|
|
return (value != null) ? value : "";
|
|
|
},
|
|
|
set: function(key, value) {
|
|
|
var qs = $.newegg.querystring.parse();
|
|
|
qs[key] = encodeURIComponent(value);
|
|
|
return $.newegg.querystring.toString(qs);
|
|
|
},
|
|
|
parse: function(qs) {
|
|
|
var params = {};
|
|
|
|
|
|
if (qs == null) qs = location.search.substring(1, location.search.length);
|
|
|
if (qs.length == 0) return params;
|
|
|
|
|
|
qs = qs.replace(/\+/g, ' ');
|
|
|
var args = qs.split('&');
|
|
|
for (var i = 0, l = args.length; i < l; i++) {
|
|
|
var pair = args[i].split('=');
|
|
|
var name = pair[0];
|
|
|
|
|
|
var value = (pair.length == 2)
|
|
|
? pair[1]
|
|
|
: name;
|
|
|
params[name] = value;
|
|
|
}
|
|
|
|
|
|
return params;
|
|
|
},
|
|
|
toString: function(qs) {
|
|
|
if (qs == null) qs = $.newegg.querystring.parse();
|
|
|
|
|
|
var val = "";
|
|
|
for (var k in qs) {
|
|
|
if (val == "") val = "?";
|
|
|
val = val + k + "=" + qs[k] + "&";
|
|
|
}
|
|
|
val = val.substring(0, val.length - 1);
|
|
|
return val;
|
|
|
}
|
|
|
},
|
|
|
imgLoad: {
|
|
|
objArray: [],
|
|
|
loadImg: function(obj) {
|
|
|
if (obj && obj.length > 0) {
|
|
|
for (var i = 0, l = obj.length; i < l; i++) {
|
|
|
if ($.inArray(obj[i], $.newegg.imgLoad.objArray) == -1) {
|
|
|
$.newegg.imgLoad.objArray.push(obj[i]);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$.newegg.imgLoad.load();
|
|
|
},
|
|
|
pageTop: function() {
|
|
|
return document.documentElement.clientHeight + Math.max(document.documentElement.scrollTop, document.body.scrollTop);
|
|
|
},
|
|
|
load: function() {
|
|
|
for (var i = 0, l = $.newegg.imgLoad.objArray.length; i < l; i++) {
|
|
|
var jObj = $("#" + $.newegg.imgLoad.objArray[i]);
|
|
|
if (jObj) {
|
|
|
jObj.find("img").each(function() {
|
|
|
if ($(this).offset().top <= $.newegg.imgLoad.pageTop()) {
|
|
|
var src2 = $(this).attr("src2");
|
|
|
if (src2) {
|
|
|
$(this).attr("src", src2).removeAttr("src2");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
})(jQuery);
|
|
|
/*end ͨÓú¯Êý*/
|
|
|
|
|
|
/*start ͨÓÃЧ¹ûº¯Êý*/
|
|
|
/*Èç¹û1280¿ª¹Ø¹Ø±Õ£¬ÔòĬÈÏÊÇ1024*/
|
|
|
if (typeof (resolution) == "undefined") {
|
|
|
resolution = 0;
|
|
|
}
|
|
|
|
|
|
function startTabA(w) { //¿ªÆôÖ¸¶¨ÈÝÆ÷ÄÚµÄTAB¹¦ÄÜ£¬²ÎÊýΪ°üº¬TAB×é¼þµÄÍⲿÈÝÆ÷
|
|
|
var sWrap = "." + w;
|
|
|
var wrap = $(sWrap); //°üº¬TABµÄÍⲿÈÝÆ÷
|
|
|
if (wrap.length) { //ÅжÏÈÝÆ÷ÊÇ·ñ´æÔÚ
|
|
|
$(sWrap + " .tab a").click(function() {
|
|
|
//µ±´°¿ÚÖÐtabsÏÂÃæµÄÁ´½Óµã»÷ʱ
|
|
|
|
|
|
var prop = $(this).attr("prop");
|
|
|
if (prop == "viewMore") {
|
|
|
var cmd = $(this).attr("command");
|
|
|
if (cmd) {
|
|
|
eval(cmd + "(this);");
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
var contentID = $(this).parents(sWrap).get(0).id;
|
|
|
var tab = $(this).parents(".tabs").children("*");
|
|
|
var tabNum = tab.length; //»ñÈ¡TAB¸öÊý
|
|
|
tab.removeClass("currentBtn");
|
|
|
if ($(this).parents(".tabs").children("a").length > 0)
|
|
|
$(this).addClass("currentBtn");
|
|
|
else
|
|
|
$(this).parent().addClass("currentBtn");
|
|
|
for (var i = 1; i <= tabNum; i++) {
|
|
|
$("#" + contentID + "_" + i).hide(); //ÏȽ«ËùÓÐtabContentÒþ²Ø
|
|
|
}
|
|
|
$("#" + contentID + "_" + this.rel).show(); //½«Ëùµã»÷Á´½ÓËù¶ÔÓ¦µÄtabContentÏÔʾ
|
|
|
$.newegg.imgLoad.loadImg([contentID + "_" + this.rel]);
|
|
|
|
|
|
var cmd = $(this).attr("command");
|
|
|
if (cmd) {
|
|
|
eval(cmd + "(this);");
|
|
|
}
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
if ($(sWrap + " .prevView").length) { //Èç¹û´æÔÚÏòÇ°°´Å¥ÔòÖ´ÐÐ
|
|
|
$(sWrap + " .prevView").click(function() {
|
|
|
var contentID = $(this).parents(sWrap).get(0).id;
|
|
|
var curNum = parseInt($("#" + contentID + " .tabs .currentBtn").attr("rel")) - 1;
|
|
|
if (curNum < 1) curNum = $("#" + contentID + " .tabs a").length;
|
|
|
$("#" + contentID + " .tabs a").eq(curNum - 1).click();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if ($(sWrap + " .nextView").length) { //Èç¹û´æÔÚÏòºó°´Å¥ÔòÖ´ÐÐ
|
|
|
$(sWrap + " .nextView").click(function() {
|
|
|
var contentID = $(this).parents(sWrap).get(0).id;
|
|
|
var curNum = parseInt($("#" + contentID + " .tabs .currentBtn").attr("rel")) + 1;
|
|
|
if (curNum > $("#" + contentID + " .tabs a").length) curNum = 1;
|
|
|
$("#" + contentID + " .tabs a").eq(curNum - 1).click();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function startTabB(w) { //ÔÚstartTabA»ù´¡ÉÏÔö¼ÓÊó±ê»®¹ýTAB°´Å¥Ò²Çл»TABµÄ¹¦ÄÜ
|
|
|
var sWrap = "." + w;
|
|
|
var wrap = $(sWrap); //°üº¬TABµÄÍⲿÈÝÆ÷
|
|
|
if (wrap.length) {
|
|
|
sWrap = "." + w;
|
|
|
$(sWrap + " .tab a").mouseover(function() {
|
|
|
$(this).click();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function onoff(s) {
|
|
|
var objStyle = "." + s;
|
|
|
var obj = $(objStyle);
|
|
|
if (obj.length) {
|
|
|
if ($.browser.msie) {
|
|
|
obj.parent().hover(function() {
|
|
|
$(this).addClass("over");
|
|
|
}, function() {
|
|
|
obj.parent().removeClass("over");
|
|
|
});
|
|
|
} else {
|
|
|
obj.parent().mouseover(function() {
|
|
|
$(this).addClass("over");
|
|
|
}).mouseout(function() {
|
|
|
$(this).removeClass("over");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function onoff_2(s) {
|
|
|
var obj = $(s);
|
|
|
if (obj.length) {
|
|
|
obj.mouseover(function() {
|
|
|
obj.removeClass("over");
|
|
|
$(this).addClass("over");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//µ¯³ö²ã¿É¸ù¾Ý¾àÀëÒ³Ãæµ×²¿¾àÀë¾ö¶¨ÊÇ·ñÏòÉϵ¯³ö Ä¿Ç°ÓÃÓÚ×ó²à´øµ¯³ö²Ëµ¥µÄ·ÖÀർº½
|
|
|
function onoff_3(s) {
|
|
|
var objStyle = "." + s;
|
|
|
var obj = $(objStyle);
|
|
|
if (obj.length) {
|
|
|
if ($.browser.msie) {
|
|
|
obj.parent().hover(function() {
|
|
|
var offset = $(this).offset();
|
|
|
var scrollTop = document.documentElement.scrollTop;
|
|
|
var windowHeight = document.documentElement.clientHeight;
|
|
|
var objHeight = $(objStyle, this).height();
|
|
|
|
|
|
if (offset.top - scrollTop > objHeight) {
|
|
|
if ((windowHeight - offset.top + scrollTop) < objHeight) {
|
|
|
$(objStyle, this).addClass("dirUp");
|
|
|
$(objStyle, this).css("top", 23 - objHeight);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$(this).addClass("over");
|
|
|
}, function() {
|
|
|
obj.parent().removeClass("over");
|
|
|
$(objStyle, this).removeClass("dirUp");
|
|
|
$(objStyle, this).css("top", "1px");
|
|
|
});
|
|
|
} else {
|
|
|
obj.parent().mouseover(function() {
|
|
|
var offset = $(this).offset();
|
|
|
var scrollTop = document.documentElement.scrollTop + document.body.scrollTop; //½â¾öFF,CHROME,SAFARIµÄ²»¼æÈÝÎÊÌâ
|
|
|
var windowHeight = document.documentElement.clientHeight;
|
|
|
var objHeight = $(objStyle, this).height();
|
|
|
if (offset.top - scrollTop > objHeight) {
|
|
|
if ((windowHeight - offset.top + scrollTop) < objHeight) {
|
|
|
$(objStyle, this).addClass("dirUp");
|
|
|
}
|
|
|
}
|
|
|
$(this).addClass("over");
|
|
|
}).mouseout(function() {
|
|
|
$(this).removeClass("over");
|
|
|
$(objStyle, this).removeClass("dirUp");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function onoffDelay(s) {
|
|
|
var timer, timer2;
|
|
|
var objStyle = "." + s;
|
|
|
var obj = $(objStyle);
|
|
|
obj.parent().mouseover(function() {
|
|
|
var current = $(this);
|
|
|
if ($(this).find(objStyle).css("display") == "block") {
|
|
|
current.addClass('over');
|
|
|
clearTimeout(timer2);
|
|
|
} else {
|
|
|
timer = setTimeout(function() {
|
|
|
current.addClass('over');
|
|
|
}, 350);
|
|
|
}
|
|
|
}).mouseout(function() {
|
|
|
var current = $(this);
|
|
|
if (timer) {
|
|
|
clearTimeout(timer);
|
|
|
timer2 = setTimeout(function() {
|
|
|
current.removeClass('over');
|
|
|
}, 350);
|
|
|
}
|
|
|
});
|
|
|
obj.mouseover(function() {
|
|
|
$(this).parent().addClass('over');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/*ΪҳÃæÉÏÌض¨ÊäÈëÔªËØÔö¼ÓĬÈÏÎÄ×ÖµÄЧ¹û*/
|
|
|
function defaultText() {
|
|
|
var obj = $(".hasDefaultText");
|
|
|
var tmpText = new Array();
|
|
|
var objIndex = 0;
|
|
|
for (i = 1, l = obj.length; i <= l; i++) {
|
|
|
tmpText[i - 1] = obj.eq(i - 1).val();
|
|
|
}
|
|
|
obj.focus(function() {
|
|
|
objIndex = obj.index($(this));
|
|
|
if ($(this).val() == tmpText[objIndex]) {
|
|
|
$(this).val("");
|
|
|
$(this).removeClass("hasDefaultText");
|
|
|
}
|
|
|
});
|
|
|
obj.blur(function() {
|
|
|
objIndex = obj.index($(this));
|
|
|
if ($(this).val() == "") {
|
|
|
$(this).val(tmpText[objIndex]);
|
|
|
$(this).addClass("hasDefaultText");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
var hasOnePopupShow = false;
|
|
|
//ÐèÒªµÈ´ýÒì²½·µ»ØµÄÕ¹¿ªÐ§¹û
|
|
|
// hasOnePopupShow ±íʾҳͷÓе¯³ö¿òÏÔʾ£¬´Ëʱ´¦ÓÚ¼ÓÔØ״̬µÄÆäËûµ¯³ö¿ò²»ÏÔʾ
|
|
|
// objFor.attr("display", "true");£¬±íʾµ±Ç°½ÚµãÔÚÏÔʾ״̬¡£½öµ±trueʱ£¬²åÈë»Øµ÷Êý¾Ý
|
|
|
function onoff_4(s, fn) {
|
|
|
var objStyle = "#" + s;
|
|
|
var obj = $(objStyle);
|
|
|
if (obj.length) {
|
|
|
obj.parent().unbind();
|
|
|
if ($.browser.msie) {
|
|
|
obj.parent().hover(function() {
|
|
|
var objFor = $(this);
|
|
|
objFor.attr("data-display", "true");
|
|
|
if (typeof fn != "undefined") {
|
|
|
fn(obj, function() {
|
|
|
|
|
|
if (hasOnePopupShow) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (objFor.attr("data-display") == "true") {
|
|
|
objFor.find(".opener").addClass("now");
|
|
|
//$("#minicart").show();
|
|
|
hasOnePopupShow = true;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}, function() {
|
|
|
hasOnePopupShow = false;
|
|
|
var objFor = $(this);
|
|
|
objFor.attr("data-display", "false");
|
|
|
$(this).find(".opener").removeClass("now");
|
|
|
//$("#minicart").hide();
|
|
|
});
|
|
|
} else {
|
|
|
obj.parent().mouseover(function() {
|
|
|
var objFor = $(this);
|
|
|
objFor.attr("data-display", "true");
|
|
|
if (typeof fn != "undefined") {
|
|
|
fn(obj, function() {
|
|
|
|
|
|
if (hasOnePopupShow) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (objFor.attr("data-display") == "true") {
|
|
|
objFor.find(".opener").addClass("now");
|
|
|
if ($("#headerCartCount").text() > 0) {
|
|
|
//$("#minicart").show();
|
|
|
}
|
|
|
hasOnePopupShow = true;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}).mouseout(function() {
|
|
|
hasOnePopupShow = false;
|
|
|
var objFor = $(this);
|
|
|
objFor.attr("data-display", "false");
|
|
|
$(this).find(".opener").removeClass("now");
|
|
|
//$("#minicart").hide();
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*ͨÓõÄ×óÓÒ¹ö¶¯º¯Êý*/
|
|
|
function scrollV(o, num, step, scrollTime, autoPlay, autoTime) { /*²ÎÊý£º°üΧ¶ÔÏóid£¬Ã¿ÆÁÏÔʾÊýÁ¿£¬Ã¿´Î¹ö¶¯ÊýÁ¿£¬¹ö¶¯Ê±¼ä£¬ÊÇ·ñ×Ô¶¯¹ö¶¯£¬×Ô¶¯¹ö¶¯¼ä¸ôʱ¼ä*/
|
|
|
var obj = $("#" + o);
|
|
|
var cell = $("#" + o + " .moveable li");
|
|
|
var total = cell.length;
|
|
|
var btnPre = $("#" + o + " .pre");
|
|
|
var btnNext = $("#" + o + " .next");
|
|
|
autoFilledKeywords.clickObj = btnNext[0];
|
|
|
var moveLimit = Math.ceil((total - num) / step);
|
|
|
var moveNum = 0;
|
|
|
var currLeft = 0;
|
|
|
var moveWidth = 0;
|
|
|
if (total > num) {
|
|
|
//btnPre.addClass("preDisable");
|
|
|
btnNext.click(function() {
|
|
|
moveWidth = (parseInt(cell.width()) + parseInt(cell.css("margin-right")) + parseInt(cell.css("margin-left")) + parseInt(cell.css("padding-right")) + parseInt(cell.css("padding-left")) + parseInt(cell.css("border-right-width")) + parseInt(cell.css("border-left-width"))) * step;
|
|
|
if (moveNum < moveLimit) {
|
|
|
moveNum++;
|
|
|
currLeft = currLeft - moveWidth;
|
|
|
}
|
|
|
else {
|
|
|
moveNum = 0;
|
|
|
currLeft = 0;
|
|
|
}
|
|
|
$(this).parents("#" + o).find(".moveable").animate({ left: currLeft + "px" }, scrollTime);
|
|
|
});
|
|
|
btnPre.click(function() {
|
|
|
moveWidth = (parseInt(cell.width()) + parseInt(cell.css("margin-right")) + parseInt(cell.css("margin-left")) + parseInt(cell.css("padding-right")) + parseInt(cell.css("padding-left")) + parseInt(cell.css("border-right-width")) + parseInt(cell.css("border-left-width"))) * step;
|
|
|
if (moveNum > 0) {
|
|
|
moveNum--;
|
|
|
currLeft = currLeft + moveWidth;
|
|
|
}
|
|
|
else {
|
|
|
moveNum = moveLimit;
|
|
|
currLeft = 0 - moveLimit * moveWidth;
|
|
|
}
|
|
|
$(this).parents("#" + o).find(".moveable").animate({ left: currLeft + "px" }, scrollTime);
|
|
|
});
|
|
|
|
|
|
if (autoPlay == true) {
|
|
|
autoChange = setInterval(function() {
|
|
|
btnNext.click();
|
|
|
}, autoTime);
|
|
|
obj.mouseenter(function() {
|
|
|
clearInterval(autoChange);
|
|
|
});
|
|
|
obj.mouseleave(function() {
|
|
|
autoChange = setInterval(function() {
|
|
|
btnNext.click();
|
|
|
}, autoTime);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
btnPre.addClass("preDisable");
|
|
|
btnNext.addClass("nextDisable");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*µ¯³ö´°¿Ú*/
|
|
|
function popWinA(s, hover) {
|
|
|
var objOpner = $("." + s + " .opener");
|
|
|
var objShuter = $("." + s + " .shuter");
|
|
|
if (hover == false) {
|
|
|
if (objOpner.length) {
|
|
|
objOpner.click(function() {
|
|
|
if ($(this).parents(".over").length) {
|
|
|
$(this).parents("." + s).removeClass("over");
|
|
|
}
|
|
|
else {
|
|
|
$("." + s).removeClass("over");
|
|
|
$(this).parents("." + s).addClass("over");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
if (objShuter.length) {
|
|
|
objShuter.click(function() {
|
|
|
$(this).parents("." + s).removeClass("over");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
if (hover == true) {
|
|
|
if ($.browser.msie) {
|
|
|
objOpner.parents("." + s).hover(function() {
|
|
|
$(this).addClass("over");
|
|
|
}, function() {
|
|
|
$(this).removeClass("over");
|
|
|
});
|
|
|
} else {
|
|
|
objOpner.parents("." + s).mouseover(function() {
|
|
|
$(this).addClass("over");
|
|
|
}).mouseout(function() {
|
|
|
$(this).removeClass("over");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/*´øÓÐÑÓʱµÄµ¯³ö´°¿Ú*/
|
|
|
function popWinB(s, hover) {
|
|
|
var current;
|
|
|
var timer, timer2;
|
|
|
var objOpner = $("." + s + " .opener");
|
|
|
var objShuter = $("." + s + " .shuter");
|
|
|
if (hover == false) {
|
|
|
if (objOpner.length) {
|
|
|
objOpner.click(function() {
|
|
|
if ($(this).parents(".over").length) {
|
|
|
$(this).parents("." + s).removeClass("over");
|
|
|
}
|
|
|
else {
|
|
|
$("." + s).removeClass("over");
|
|
|
$(this).parents("." + s).addClass("over");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
if (objShuter.length) {
|
|
|
objShuter.click(function() {
|
|
|
$(this).parents("." + s).removeClass("over");
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
if (hover == true) {
|
|
|
if ($.browser.msie) {
|
|
|
objOpner.parents("." + s).hover(function() {
|
|
|
current = $(this);
|
|
|
if (timer2) {
|
|
|
clearTimeout(timer2);
|
|
|
}
|
|
|
timer = setTimeout(function() {
|
|
|
current.parent().children(".over").removeClass("over");
|
|
|
current.addClass("over");
|
|
|
}, 350);
|
|
|
}, function() {
|
|
|
if (timer) {
|
|
|
clearTimeout(timer);
|
|
|
timer2 = setTimeout(function() {
|
|
|
current.parent().children(".over").removeClass("over");
|
|
|
}, 350);
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
objOpner.parents("." + s).mouseover(function() {
|
|
|
current = $(this);
|
|
|
if (timer2) {
|
|
|
clearTimeout(timer2);
|
|
|
}
|
|
|
timer = setTimeout(function() {
|
|
|
current.parent().children(".over").removeClass("over");
|
|
|
current.addClass("over");
|
|
|
}, 350);
|
|
|
})
|
|
|
objOpner.parents("." + s).mouseleave(function() {
|
|
|
if (timer) {
|
|
|
clearTimeout(timer);
|
|
|
timer2 = setTimeout(function() {
|
|
|
current.parent().children(".over").removeClass("over");
|
|
|
}, 350);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*ͨÓõÄÒ³Ãæ¾ÓÖе¯³ö²ãº¯Êý*/
|
|
|
function letCenter(o) {
|
|
|
obj = $("#" + o);
|
|
|
var A = document.documentElement.clientWidth;
|
|
|
var E = document.documentElement.clientHeight;
|
|
|
var D = obj.height();
|
|
|
var B = obj.width();
|
|
|
var C = document.documentElement.scrollTop + document.body.scrollTop
|
|
|
obj.css({ position: "absolute", top: E / 2 - D / 2 + C, left: A / 2 - B / 2 });
|
|
|
}
|
|
|
function centerPopA(o, clickOut) {
|
|
|
var opener = $("#" + o + "Opener");
|
|
|
var popup = $("#" + o);
|
|
|
opener.click(function() {
|
|
|
$("#popBack").css({ opacity: "0" });
|
|
|
$("#popBack").show();
|
|
|
popup.show();
|
|
|
letCenter(o);
|
|
|
$(".shuter").click(function() {
|
|
|
popup.hide();
|
|
|
$("#popBack").hide();
|
|
|
});
|
|
|
if (clickOut == true) {
|
|
|
$("#popBack").click(function() {
|
|
|
popup.hide();
|
|
|
$("#popBack").hide();
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
var centerPopB = {
|
|
|
open: function() {
|
|
|
$("#popBack").css({ opacity: "0" });
|
|
|
$("#popBack").show();
|
|
|
},
|
|
|
close: function() {
|
|
|
$("#popBack").hide();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function clearLine(o, clearRight, clearBot) {
|
|
|
//È¥³ý¾Å¹¬¸ñÅÅÁеIJúÆ·µÄ×îºóÒ»¸öµ¥ÔªµÄ×ÝÏò·Ö¸ôÏߣ¬ÒÔ¼°×îºóÒ»Ðеĵײ¿·Ö¸ôÏß
|
|
|
//²ÎÊý£º°üΧ´°¿ÚID»òCLASS | ÊÇ·ñÇå³ýÓÒ±ßÏß boolÖµ | ÊÇ·ñÇå³ý×îºóÒ»ÐеÄÏß boolÖµ
|
|
|
var obj = $(o);
|
|
|
var cell = obj.children(".itemCell")
|
|
|
var totalCell = cell.length;
|
|
|
|
|
|
if (clearRight == true) {
|
|
|
for (i = 4; i <= totalCell; i = i + 4) {
|
|
|
cell.children(".inner").eq(i - 1).addClass("bdrRW");
|
|
|
}
|
|
|
}
|
|
|
if (clearBot == true) {
|
|
|
var lastLine = totalCell % 4;
|
|
|
if (lastLine == 0) {
|
|
|
lastLine = 4;
|
|
|
}
|
|
|
for (i = totalCell - lastLine + 1; i <= totalCell; i++) {
|
|
|
cell.eq(i - 1).addClass("noBdrBot");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*×Ô¶¨ÒåÏÔʾҳÊý·ÖÒ³¿Ø¼þ*/
|
|
|
function initPaginationBarA(defaultText) {
|
|
|
if (!$("#setShowPageNav").length || !$("#btnSetShowPageNav").length) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$("#setShowPageNav").focus(function() {
|
|
|
$("#btnSetShowPageNav").show();
|
|
|
});
|
|
|
$("#setShowPageNav").keydown(function(event) {
|
|
|
if (event.keyCode == 13 || event.keyCode == 32) {
|
|
|
$("#btnSetShowPageNav").click();
|
|
|
}
|
|
|
});
|
|
|
$("#setShowPageNav").blur(function() {
|
|
|
if ($("#setShowPageNav").val() == "" || $("#setShowPageNav").val() == defaultText) {
|
|
|
$("#btnSetShowPageNav").hide();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#btnSetShowPageNav").click(function() {
|
|
|
var url = $("#btnSetShowPageNav").attr("ref1");
|
|
|
var qty = $.trim($("#setShowPageNav").val());
|
|
|
var page = parseInt(qty, 10);
|
|
|
var number = 1;
|
|
|
var regexNumber = /^[0-9]*[1-9][0-9]*$/;
|
|
|
|
|
|
if (regexNumber.test(qty) == false || isNaN(page) == true || page <= 0) {
|
|
|
number = 1;
|
|
|
}
|
|
|
else if (page > 9999) {
|
|
|
number = 9999;
|
|
|
}
|
|
|
else {
|
|
|
number = page;
|
|
|
}
|
|
|
|
|
|
url = url.replace("paramPageNumber", number);
|
|
|
window.location.href = url;
|
|
|
return false;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/*¿ØÖƲúÆ·ºáÁлò×ÝÁв¼¾Ö*/
|
|
|
function initProductListLayout() {
|
|
|
|
|
|
if (!$(".viewtype").length || !$("#listByRow").length || !$("#listByGrid").length) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$("#listByRow").click(function() {
|
|
|
switchRowStyle();
|
|
|
var jsonObject = JSON.parse('{"GridRow":"Row"}');
|
|
|
$.newegg.cookie.set("ProductLayOut", jsonObject);
|
|
|
});
|
|
|
|
|
|
$("#listByGrid").click(function() {
|
|
|
switchGridStyle();
|
|
|
var jsonObject = JSON.parse('{"GridRow":"Grid"}')
|
|
|
$.newegg.cookie.set("ProductLayOut", jsonObject);
|
|
|
|
|
|
});
|
|
|
$(".viewtype a").each(function() {
|
|
|
var page = $(this).find("span");
|
|
|
if (page.length) {
|
|
|
var pageSize = page.text();
|
|
|
$(this).click(function() {
|
|
|
var jsonObject = JSON.parse('{"PageSize":"' + pageSize + '"}');
|
|
|
$.newegg.cookie.set("ProductLayOut", jsonObject);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
var style = $.newegg.cookie.get("ProductLayOut", "GridRow");
|
|
|
if (style == 'Grid') {
|
|
|
switchGridStyle();
|
|
|
}
|
|
|
else if (style == 'Row') {
|
|
|
switchRowStyle();
|
|
|
}
|
|
|
else {
|
|
|
switchGridStyle();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*Áбíת»»ÎªrowÅÅÁÐ*/
|
|
|
function switchRowStyle() {
|
|
|
$(".prolist").addClass("viewlist");
|
|
|
$("#listByRow").addClass("alistnow");
|
|
|
$("#listByGrid").removeClass("awindnow");
|
|
|
|
|
|
// $("#listByRow").removeClass("listByRow").addClass("listByRowOn");
|
|
|
// $("#listByGrid").removeClass("listByGridOn").addClass("listByGrid");
|
|
|
//$(".itemGridB").children(".itemCell").removeClass("noBdrBot");
|
|
|
//clearLine(".itemGridB",true,false);
|
|
|
//$(".itemGridB").children(".itemCell").last().addClass("noBdrBot");
|
|
|
}
|
|
|
|
|
|
/*Áбíת»»ÎªGridÅÅÁÐ*/
|
|
|
function switchGridStyle() {
|
|
|
$(".prolist").removeClass("viewlist");
|
|
|
$("#listByRow").removeClass("alistnow");
|
|
|
$("#listByGrid").addClass("awindnow");
|
|
|
//$(".itemGridA").children(".itemCell").removeClass("noBdrBot");
|
|
|
//clearLine(".itemGridA",true,true);
|
|
|
}
|
|
|
|
|
|
/* jeff.s.zan
|
|
|
* Date: 2010-09-20
|
|
|
* ²ÎÊý: ÈÝÆ÷ID(´ø#ºÅ), Ò»ÆÁÏÔʾµÄµ¼º½Ïî¸öÊý Çл»¼ä¸ôʱ¼ä£¨ºÁÃ룩,¶¯»Ê±¼ä£¨µ¥Ö¡Çл»µÄʱ¼ä£©
|
|
|
* ʹÓ÷½·¨:
|
|
|
* var ¶ÔÏóÃû = new MyImgPlayer();
|
|
|
* ¶ÔÏóÃû.loading("#TopAD", 2, 2000);
|
|
|
*/
|
|
|
var slideBannerA = function() {
|
|
|
var o;
|
|
|
var nav
|
|
|
var navCell;
|
|
|
var btnPre;
|
|
|
var btnNext;
|
|
|
var showedCell;
|
|
|
var currBanner = 0;
|
|
|
var currScreen = 1;
|
|
|
var bannerNum = 0;
|
|
|
var moveEvent;
|
|
|
var stepTime = 0;
|
|
|
var moveHeight = 0;
|
|
|
var moveWidth = 0;
|
|
|
var currHeight = 0;
|
|
|
var currWidth = 0;
|
|
|
var self = this;
|
|
|
var aniTime = 300;
|
|
|
var timer, timer2;
|
|
|
|
|
|
this.loading = function(obj, showCell, alterTime, animTime) {
|
|
|
o = $(obj);
|
|
|
nav = o.children(".slideNav");
|
|
|
navCell = nav.children(".navOuter").children(".moveable").children("a");
|
|
|
btnPre = nav.children(".pre");
|
|
|
btnNext = nav.children(".next");
|
|
|
stepTime = alterTime;
|
|
|
showedCell = showCell;
|
|
|
aniTime = animTime;
|
|
|
bannerNum = $(".bannerOuter a", obj).length;
|
|
|
moveHeight = o.children(".bannerOuter").children(".moveable").children("a").height();
|
|
|
moveWidth = (parseInt(navCell.width()) + parseInt(navCell.css("margin-right")) + parseInt(navCell.css("margin-left")) + parseInt(navCell.css("padding-right")) + parseInt(navCell.css("padding-left")) + parseInt(navCell.css("border-right-width")) + parseInt(navCell.css("border-left-width"))) * showedCell;
|
|
|
|
|
|
if (bannerNum == 0) {
|
|
|
o.hide();
|
|
|
}
|
|
|
else if (bannerNum == 1) {
|
|
|
nav.hide();
|
|
|
}
|
|
|
else {
|
|
|
navCell.eq(0).addClass("curr");
|
|
|
|
|
|
this.alterBanner();
|
|
|
|
|
|
(o).children(".bannerOuter").mouseenter(function() {
|
|
|
clearInterval(moveEvent);
|
|
|
});
|
|
|
(o).children(".bannerOuter").mouseleave(function() {
|
|
|
self.alterBanner();
|
|
|
});
|
|
|
navCell.mouseenter(function() {
|
|
|
clearInterval(moveEvent);
|
|
|
navCell.eq(currBanner).removeClass("curr");
|
|
|
currBanner = navCell.index(this);
|
|
|
self.changeBig(true);
|
|
|
});
|
|
|
navCell.mouseleave(function() {
|
|
|
self.alterBanner();
|
|
|
});
|
|
|
|
|
|
if (showedCell < bannerNum) {
|
|
|
btnNext.click(function() {
|
|
|
currScreen++;
|
|
|
self.changeScreen(false);
|
|
|
});
|
|
|
btnPre.click(function() {
|
|
|
currScreen--;
|
|
|
self.changeScreen(false);
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
btnPre.addClass("preDisable")
|
|
|
btnNext.addClass("nextDisable")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.alterBanner = function() {
|
|
|
moveEvent = setInterval(function() {
|
|
|
currBanner++;
|
|
|
|
|
|
if (currBanner > 1 && (currBanner % showedCell) == 0 && currBanner < bannerNum) {
|
|
|
currScreen++;
|
|
|
self.changeScreen(true);
|
|
|
}
|
|
|
else if (currBanner >= bannerNum) {
|
|
|
currBanner = 0;
|
|
|
currScreen = 1;
|
|
|
self.changeScreen(false);
|
|
|
}
|
|
|
else {
|
|
|
self.changeBig(true);
|
|
|
}
|
|
|
}, stepTime);
|
|
|
}
|
|
|
|
|
|
this.changeBig = function(isDelay) {
|
|
|
nav.children(".navOuter").children(".moveable").children(".curr").removeClass("curr");
|
|
|
navCell.eq(currBanner).addClass("curr");
|
|
|
currHeight = (0 - moveHeight * currBanner) + "px";
|
|
|
if (isDelay == false) {
|
|
|
o.children(".bannerOuter").children(".moveable").css("margin-top", currHeight);
|
|
|
}
|
|
|
else {
|
|
|
o.children(".bannerOuter").children(".moveable").animate({ marginTop: currHeight }, aniTime);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.changeScreen = function(isDelay) {
|
|
|
if (currScreen > Math.ceil(bannerNum / showedCell)) {
|
|
|
currScreen = 1;
|
|
|
}
|
|
|
if (currScreen < 1) {
|
|
|
currScreen = Math.ceil(bannerNum / showedCell);
|
|
|
}
|
|
|
currWidth = (0 - moveWidth * (currScreen - 1)) + "px";
|
|
|
nav.children(".navOuter").children(".moveable").animate({ left: currWidth }, aniTime);
|
|
|
currBanner = showedCell * (currScreen - 1);
|
|
|
self.changeBig(isDelay);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var slideProA = function() {
|
|
|
var obj;
|
|
|
var cell;
|
|
|
var step;
|
|
|
var total;
|
|
|
var btnPre;
|
|
|
var btnNext;
|
|
|
var stepTime;
|
|
|
var currLeft;
|
|
|
var self = this;
|
|
|
var dir;
|
|
|
|
|
|
this.loading = function(o, num, moveStep, time, isAutoPlay, autoTime) { /*²ÎÊý£º°üΧ¶ÔÏóid£¬Ã¿ÆÁÏÔʾÊýÁ¿£¬Ã¿´Î¹ö¶¯ÊýÁ¿£¬¹ö¶¯Ê±¼ä,ÊÇ·ñ×Ô¶¯¹ö¶¯,×Ô¶¯¹ö¶¯¼ä¸ôʱ¼ä*/
|
|
|
obj = $("#" + o);
|
|
|
cell = $("#" + o + " .moveable .itemCell");
|
|
|
stepTime = time;
|
|
|
step = moveStep;
|
|
|
total = cell.length;
|
|
|
btnPre = $("#" + o + " .pre");
|
|
|
btnNext = $("#" + o + " .next");
|
|
|
currLeft = 0;
|
|
|
dir = "right";
|
|
|
screenNum = num
|
|
|
|
|
|
if (total <= screenNum) {
|
|
|
btnPre.addClass("preDisable");
|
|
|
btnNext.addClass("nextDisable");
|
|
|
}
|
|
|
else {
|
|
|
//µã»÷ÏòÓÒ¹ö¶¯°´Å¥
|
|
|
btnNext.click(function() {
|
|
|
//alert(currLeft);
|
|
|
dir = "right";
|
|
|
self.moveCell();
|
|
|
currLeft = currLeft + step;
|
|
|
if (currLeft >= total) {
|
|
|
currLeft = 0;
|
|
|
self.showAll();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//µã»÷ÏòÓÒ¹ö¶¯°´Å¥
|
|
|
btnPre.click(function() {
|
|
|
currLeft = currLeft - step;
|
|
|
dir = "left";
|
|
|
if (currLeft <= 0 - step) {
|
|
|
currLeft = total - step;
|
|
|
self.hideAll();
|
|
|
self.moveCell();
|
|
|
}
|
|
|
else {
|
|
|
self.moveCell();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//×Ô¶¯²¥·Å
|
|
|
if (isAutoPlay == true) {
|
|
|
var autoPlay = setInterval(function() {
|
|
|
btnNext.click();
|
|
|
}, autoTime);
|
|
|
obj.mouseenter(function() {
|
|
|
clearInterval(autoPlay);
|
|
|
});
|
|
|
obj.mouseleave(function() {
|
|
|
autoPlay = setInterval(function() {
|
|
|
btnNext.click();
|
|
|
}, autoTime);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.showAll = function() { /*ÏÔʾȫ²¿µ¥Ôª*/
|
|
|
cell.fadeIn(stepTime);
|
|
|
}
|
|
|
this.hideAll = function() { /*Òþ²ØÈ«²¿µ¥Ôª*/
|
|
|
cell.fadeOut(stepTime);
|
|
|
}
|
|
|
|
|
|
this.moveCell = function() { /*¹ö¶¯ËõÂÔͼ*/
|
|
|
if (dir == "right") {
|
|
|
for (i = currLeft; i <= currLeft + step - 1; i++) {
|
|
|
cell.eq(i).fadeOut(stepTime);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
for (i = currLeft; i <= currLeft + step - 1; i++) {
|
|
|
cell.eq(i).fadeIn(stepTime);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*ҳͷËùÓÐÉÌÆ··ÖÀà²Ëµ¥Õ¹¿ªÐ§¹û*/
|
|
|
function allCateNav() {
|
|
|
var timer;
|
|
|
var currNo;
|
|
|
var currPop;
|
|
|
var currNav;
|
|
|
var tempCurr;
|
|
|
|
|
|
$(".allCateNav").mouseenter(function() {
|
|
|
$(".allCateNav .catePop").removeClass("catePopShow");
|
|
|
});
|
|
|
|
|
|
$(".allCateNav .cateLevel1 li").mouseenter(function() {
|
|
|
currNo = $(this).find("a").attr("rel");
|
|
|
tempCurr = $(this);
|
|
|
currPop = $(".allCateNav .catePop" + currNo);
|
|
|
currNav = tempCurr;
|
|
|
|
|
|
if (timer) {
|
|
|
clearTimeout(timer);
|
|
|
}
|
|
|
timer = setTimeout(function() {
|
|
|
$(".allCateNav .cateLevel1 .over").removeClass("over");
|
|
|
$(".allCateNav .catePopShow").removeClass("catePopShow");
|
|
|
currNav.addClass("over");
|
|
|
currPop.addClass("catePopShow");
|
|
|
|
|
|
|
|
|
}, 350);
|
|
|
});
|
|
|
|
|
|
$(".allCateNav .cateLevel1 li").mouseleave(function() {
|
|
|
if (timer) {
|
|
|
clearTimeout(timer);
|
|
|
}
|
|
|
timer = setTimeout(function() {
|
|
|
currNav.removeClass("over");
|
|
|
currPop.removeClass("catePopShow");
|
|
|
}, 350);
|
|
|
});
|
|
|
$(".allCateNav .catePop").mouseenter(function() {
|
|
|
if (timer) {
|
|
|
clearTimeout(timer);
|
|
|
}
|
|
|
});
|
|
|
$(".allCateNav .catePop").mouseleave(function() {
|
|
|
currPop = $(".allCateNav .catePopShow");
|
|
|
currNav = $(".allCateNav .cateLevel1 .over");
|
|
|
if (timer) {
|
|
|
clearTimeout(timer);
|
|
|
}
|
|
|
timer = setTimeout(function() {
|
|
|
currNav.removeClass("over");
|
|
|
currPop.removeClass("catePopShow");
|
|
|
}, 350);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/*ÏÞÖÆtextAreaÊäÈë¿òµÄ³¤¶È*/
|
|
|
var limitTextAreaInputLength = {
|
|
|
byID: function(id, len) {
|
|
|
var textArea = $("#" + id);
|
|
|
if (!textArea.length) { return; }
|
|
|
|
|
|
limitTextAreaInputLength.addEvent(textArea, len);
|
|
|
},
|
|
|
byClass: function(className, len) {
|
|
|
var textAreaList = $("." + className);
|
|
|
if (!textAreaList.length) { return; }
|
|
|
|
|
|
textAreaList.each(function() {
|
|
|
limitTextAreaInputLength.addEvent($(this), len);
|
|
|
});
|
|
|
},
|
|
|
addEvent: function(obj, len) {
|
|
|
obj.keydown(function() {
|
|
|
if ($(this).val().length > len) { return false; }
|
|
|
return true;
|
|
|
});
|
|
|
|
|
|
obj.keyup(function() {
|
|
|
var text = $(this).val();
|
|
|
if (text.length > len) {
|
|
|
$(this).val(text.substring(0, len));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*end ͨÓÃЧ¹ûº¯Êý*/
|
|
|
|
|
|
/*start ÒµÎñº¯Êý*/
|
|
|
//ËÑË÷Ìáʾ
|
|
|
var autoFilledKeywords = {
|
|
|
json: null,
|
|
|
xml: null,
|
|
|
index: 0,
|
|
|
key: "",
|
|
|
formID: "Search",
|
|
|
textboxID: "topSearch", // ÊäÈë¿ò ID
|
|
|
autofilledviewID: "searchtip", // µ¯³ö²ã ID
|
|
|
url: "",
|
|
|
deferExec: null,
|
|
|
keyIndex: 0,
|
|
|
returnIndex: 0,
|
|
|
clickObj: null,
|
|
|
|
|
|
onload: function() {
|
|
|
var afk = autoFilledKeywords;
|
|
|
if ($(afk.autofilledviewID)) {
|
|
|
$("#" + afk.autofilledviewID).mouseover(function(event) {
|
|
|
var o = event.srcElement || event.target;
|
|
|
if (o) {
|
|
|
if (o.nodeName == "A") {
|
|
|
var lastId = afk.index;
|
|
|
afk.index = o["id"].replace(/[a-z]/ig, "");
|
|
|
if (lastId == 0 || lastId != afk.index) {
|
|
|
afk.highlight(afk.index, lastId);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#" + afk.autofilledviewID).click(function(event) {
|
|
|
var o = event.srcElement || event.target;
|
|
|
var keyWord = afk.decodeHtml($(o).text());
|
|
|
$("#" + afk.textboxID).val(keyWord);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if ($(afk.textboxID)) {
|
|
|
$("#" + afk.textboxID).keyup(afk.query);
|
|
|
$("#" + afk.textboxID).blur(function() {
|
|
|
afk.keyIndex = 0;
|
|
|
afk.returnIndex = 0;
|
|
|
});
|
|
|
};
|
|
|
|
|
|
$("body").click(function(event) {
|
|
|
var o = event.srcElement || event.target;
|
|
|
if (o["id"] != afk.autofilledviewID && o["id"] != afk.textboxID && autoFilledKeywords.clickObj != event.target) {
|
|
|
afk.hide();
|
|
|
};
|
|
|
});
|
|
|
},
|
|
|
|
|
|
query: function(event) {
|
|
|
var afk = autoFilledKeywords;
|
|
|
var keyCode = event.which || event.keyCode;
|
|
|
switch (keyCode) {
|
|
|
case 13:
|
|
|
case 37:
|
|
|
case 39:
|
|
|
break;
|
|
|
|
|
|
case 27:
|
|
|
afk.clear();
|
|
|
break;
|
|
|
|
|
|
case 38:
|
|
|
if ($("#" + afk.autofilledviewID).html().length > 0) {
|
|
|
afk.show();
|
|
|
var lastId = afk.index;
|
|
|
if (lastId <= 1) {
|
|
|
afk.index = $("#" + afk.autofilledviewID + " a").length;
|
|
|
} else {
|
|
|
--afk.index;
|
|
|
};
|
|
|
$("#" + afk.textboxID).val(afk.decodeHtml($("#line" + afk.index).text()));
|
|
|
afk.highlight(afk.index, lastId);
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case 40:
|
|
|
if ($("#" + afk.autofilledviewID).html().length > 0) {
|
|
|
afk.show();
|
|
|
var lastId = afk.index;
|
|
|
if (lastId >= $("#" + afk.autofilledviewID + " a").length) {
|
|
|
afk.index = 1;
|
|
|
} else {
|
|
|
++afk.index;
|
|
|
};
|
|
|
$("#" + afk.textboxID).val(afk.decodeHtml($("#line" + afk.index).text()));
|
|
|
afk.highlight(afk.index, lastId);
|
|
|
};
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
if (this.id) {
|
|
|
var key = jQuery("#" + this.id).val();
|
|
|
if (key == "") {
|
|
|
afk.clear();
|
|
|
afk.key = "";
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
clearTimeout(afk.deferExec);
|
|
|
afk.deferExec = setTimeout(function() {
|
|
|
var igonreKeys = ",9,16,17,19,20,33,34,35,36,37,38,39,40,45,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,144,145,";
|
|
|
var n = (igonreKeys.split("," + keyCode + ",")).length - 1;
|
|
|
if (n <= 0) {
|
|
|
afk.keyIndex++;
|
|
|
key = escape(key).replace(/\*/g, "%2A").replace(/\+/g, "%2B").replace(/-/g, "%2D").replace(/\./g, "%2E").replace(/\//g, "%2F").replace(/@/g, "%40").replace(/_/g, "%5F");
|
|
|
$.ajax({
|
|
|
type: "GET",
|
|
|
dataType: "json",
|
|
|
url: afk.url,
|
|
|
data: "Keyword=" + key,
|
|
|
success: function(msg) {
|
|
|
afk.returnIndex++;
|
|
|
if (afk.keyIndex == afk.returnIndex) {
|
|
|
afk.fill(msg.Data);
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
afk.returnIndex++;
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
}, 300);
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
|
|
|
clear: function() {
|
|
|
var afk = autoFilledKeywords;
|
|
|
afk.abort();
|
|
|
var o = $(afk.autofilledviewID);
|
|
|
if (o) {
|
|
|
$(o).empty();
|
|
|
afk.hide();
|
|
|
};
|
|
|
afk.index = 0;
|
|
|
},
|
|
|
|
|
|
abort: function() {
|
|
|
var afk = autoFilledKeywords;
|
|
|
if (afk.xml) {
|
|
|
afk.xml.abort();
|
|
|
};
|
|
|
},
|
|
|
|
|
|
show: function() {
|
|
|
// ÏÔʾµ¯³ö¿ò
|
|
|
$("#" + autoFilledKeywords.autofilledviewID).show();
|
|
|
},
|
|
|
|
|
|
hide: function() {
|
|
|
// Òþ²Øµ¯³ö¿ò
|
|
|
$("#" + autoFilledKeywords.autofilledviewID).hide();
|
|
|
},
|
|
|
|
|
|
highlight: function(id, lastId) {
|
|
|
if (id) {
|
|
|
var o = $("#line" + id);
|
|
|
if (o) {
|
|
|
$(o).css("background", "#DEDEDE");
|
|
|
$(o).css("font-weight", "bold");
|
|
|
$(o).css("color", "#F60");
|
|
|
$(o).css("text-decoration", "none");
|
|
|
};
|
|
|
};
|
|
|
if (lastId) {
|
|
|
var lasto = jQuery("#line" + lastId);
|
|
|
if (lasto) {
|
|
|
$(lasto).css("background", "");
|
|
|
$(lasto).css("font-weight", "");
|
|
|
$(lasto).css("color", "");
|
|
|
$(lasto).css("text-decoration", "");
|
|
|
};
|
|
|
};
|
|
|
},
|
|
|
|
|
|
fill: function(el) {
|
|
|
var afk = autoFilledKeywords;
|
|
|
json = el;
|
|
|
if (json) {
|
|
|
var html = [];
|
|
|
for (var i = 0, l = $(json).length; i < l; i++) {
|
|
|
var keyd = json[i].Keyword.replace(/\&/g, "&").replace(/\>/g, ">").replace(/\</g, "<").replace(/\'/g, "'").replace(/\"/g, """);
|
|
|
html.push('<li><a id="line' + (i + 1) + '"href="javascript:void(0);">' + keyd + '</a></li>');
|
|
|
};
|
|
|
|
|
|
$("#" + this.autofilledviewID).html("<ul>" + html.join("") + "</ul>");
|
|
|
if ($(json).length > 0) {
|
|
|
afk.show();
|
|
|
} else {
|
|
|
afk.hide();
|
|
|
};
|
|
|
} else {
|
|
|
afk.hide();
|
|
|
};
|
|
|
},
|
|
|
decodeHtml: function(val) {
|
|
|
return val.replace(/(")/g, "\"").replace(/(')/ig, "'").replace(/(<)/ig, "<").replace(/(>)/ig, ">").replace(/(&)/ig, "&");
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//д°¿Ú´ò¿ª
|
|
|
var openWinMode = {
|
|
|
setAsycBlank: function(obj) {
|
|
|
if ($.newegg.cookie.get("Blank") != "C" && $("#" + obj)) {
|
|
|
var regexProductDetail = /Product\/\w{2,3}-\w{2,3}-\w{2,3}-?\w{0,3}\.htm/i;
|
|
|
$("#" + obj).find("a").each(function() {
|
|
|
if (regexProductDetail.test($(this).attr("href"))) {
|
|
|
$(this).attr("target", '_blank');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
setAllElement: function(objIdOrClass) {
|
|
|
if ($.newegg.cookie.get("Blank") != "C") {
|
|
|
$(objIdOrClass).find("a").each(function(i, link) {
|
|
|
|
|
|
if ($(link).attr('ref') != 'noBlank') {
|
|
|
$(link).attr("target", '_blank');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
setElement: function(idOrClass, page, target, flag) {
|
|
|
|
|
|
flag = flag || "i";
|
|
|
var reg = new RegExp(page, flag);
|
|
|
if (reg.test(window.location.href)) {
|
|
|
$(idOrClass).attr("target", target);
|
|
|
}
|
|
|
},
|
|
|
setBlank: function(blank) {
|
|
|
blank = blank == 'N' ? '_blank' : '';
|
|
|
var currentUrl = window.location.href;
|
|
|
var links = document.getElementsByTagName("a");
|
|
|
var regexProductDetail = /Product\/\w{2,3}-\w{2,3}-\w{2,3}-?\w{0,3}\.htm/i; // Ã÷ϸҳÃæ
|
|
|
var regexShoppingCart = /Shopping\/ShoppingCart\.aspx/i; // ¹ºÎï³µ
|
|
|
var regexWishList = /Customer\/WishList\.aspx/i; // ÎÒµÄÊÕ²Ø
|
|
|
var regexHelpCenter = /Service\/HelpCenter\.aspx/i; // °ïæÖÐÐÄ
|
|
|
var regexNews = /News\/.*\.htm/i; // ¹«¸æÃ÷ϸ
|
|
|
var regexNewsList = /NewsList\/.*\.htm/i; // ¹«¸æÁбí
|
|
|
var regexPromotion = /Promotion.*\.htm/i; // ´ÙÏúÒ³Ãæ
|
|
|
var regexSearch = /Search.aspx/i; // ËÑË÷Ò³Ãæ
|
|
|
var regexLogin = /Customer\/Login.aspx/i; // µÇ½ҳÃæ
|
|
|
var regexRegister = /Customer\/Register.aspx/i; // ×¢²áÒ³Ãæ
|
|
|
var regexLogout = /Customer\/Logout.aspx/i; // Í˳öÒ³Ãæ
|
|
|
var regexCustomerDefault = /Customer\/Default.aspx/i; // ÎÒµÄÕË»§ÖÐÐÄÒ³Ãæ
|
|
|
|
|
|
var isHome = false;
|
|
|
if (location.href.toLowerCase() == $.newegg.buildWWW("default.aspx").toLowerCase() || location.href.toLowerCase() == $.newegg.buildWWW('').toLowerCase()) {
|
|
|
isHome = true;
|
|
|
}
|
|
|
var link, isCurrentPage;
|
|
|
var length = links.length;
|
|
|
|
|
|
for (var i = length; i--; ) {
|
|
|
link = links[i];
|
|
|
var linkHref = $(link).attr('href');
|
|
|
var linkAttr = $(link).attr('ref');
|
|
|
if (!linkHref) {
|
|
|
linkHref = '';
|
|
|
}
|
|
|
if (!linkAttr) {
|
|
|
linkAttr = '';
|
|
|
}
|
|
|
|
|
|
isCurrentPage = linkHref.indexOf('#') == -1 ? false : true;
|
|
|
if (isHome == true) {
|
|
|
if (linkHref != '' && linkHref.indexOf('javascript') == -1 && linkHref != currentUrl && linkAttr != 'noBlank'
|
|
|
&& !regexLogin.test(link) && !regexRegister.test(link) && !regexLogout.test(link) && !regexSearch.test(link)
|
|
|
&& isCurrentPage == false) {
|
|
|
link.target = blank;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
if (linkAttr != 'noBlank') {
|
|
|
if (linkAttr == 'blank') {
|
|
|
var regexCountDown = /CountDown.*\.htm/i // ÏÞʱÇÀ¹º
|
|
|
var regexTreasurehunt = /Treasurehunt.*\.htm/i // Ñ°±¦×¨Çø
|
|
|
var regexOrderQuery = /Order\/OrderQuery.aspx/i // ÎҵĶ©µ¥
|
|
|
var regexMyGiftCard = /Customer\/MyGiftCard.aspx/i // ÎÒµÄÀñÆ·¿¨
|
|
|
|
|
|
if (linkHref == currentUrl
|
|
|
|| (regexCountDown.test(link) && regexCountDown.test(currentUrl))
|
|
|
|| (regexOrderQuery.test(link) && regexOrderQuery.test(currentUrl))
|
|
|
|| (regexMyGiftCard.test(link) && regexMyGiftCard.test(currentUrl))
|
|
|
|| (regexWishList.test(link) && regexWishList.test(currentUrl))
|
|
|
|| (regexSearch.test(link) && regexSearch.test(currentUrl))
|
|
|
|| (regexShoppingCart.test(link) && regexShoppingCart.test(currentUrl))
|
|
|
|| (regexTreasurehunt.test(link) && regexTreasurehunt.test(currentUrl))) {
|
|
|
link.target = '';
|
|
|
}
|
|
|
else {
|
|
|
link.target = blank;
|
|
|
}
|
|
|
}
|
|
|
else if (regexProductDetail.test(link) && isCurrentPage == false) // ÉÌÆ·Ã÷ϸ
|
|
|
{
|
|
|
link.target = blank;
|
|
|
}
|
|
|
else if (regexHelpCenter.test(link) && !regexHelpCenter.test(currentUrl)) // °ïæÖÐÐÄ
|
|
|
{
|
|
|
link.target = blank;
|
|
|
}
|
|
|
else if (regexNews.test(link) && blank == '_blank') // ¹«¸æÃ÷¼š
|
|
|
{
|
|
|
link.target = blank;
|
|
|
}
|
|
|
else if (regexPromotion.test(link) && !regexPromotion.test(currentUrl)) // ´ÙÏúÒ³Ãæ
|
|
|
{
|
|
|
link.target = blank;
|
|
|
}
|
|
|
else if (regexNewsList.test(link) && !regexNewsList.test(currentUrl)) // ¹«¸æÁбí
|
|
|
{
|
|
|
link.target = blank;
|
|
|
}
|
|
|
else if (regexShoppingCart.test(link) && !regexShoppingCart.test(currentUrl)) // ¹ºÎï³µ
|
|
|
{
|
|
|
link.target = blank;
|
|
|
}
|
|
|
else if (regexWishList.test(link) && !regexWishList.test(currentUrl)) // ÎÒµÄÊÕ²Ø
|
|
|
{
|
|
|
link.target = blank;
|
|
|
}
|
|
|
else if (regexCustomerDefault.test(link) && !regexCustomerDefault.test(currentUrl)) // ÎҵĸöÈËÖÐÐÄ
|
|
|
{
|
|
|
link.target = blank;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
updateState: function(v) {
|
|
|
var blank = $.newegg.cookie.get('Blank');
|
|
|
if (blank == v) {
|
|
|
return;
|
|
|
}
|
|
|
if (v) {
|
|
|
$.newegg.cookie.set('Blank', v, { topdomain: true, expires: 9999 });
|
|
|
openWinMode.setBlank(v);
|
|
|
var customerID = $.newegg.cookie.get('CustomerLogin', 'ID');
|
|
|
if (customerID != '') {
|
|
|
$.post('Ajax/Customer/AjaxCustomerWebsiteProfile.aspx', { displayMethod: v });
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
openWinMode.setBlank(blank);
|
|
|
};
|
|
|
},
|
|
|
initButtonState: function(stateBlank) {
|
|
|
if (stateBlank == 'N') {
|
|
|
$("#btnNoBlank a").removeClass("curr");
|
|
|
$("#btnNewBlank a").addClass("curr");
|
|
|
}
|
|
|
else if (stateBlank == 'C') {
|
|
|
$("#btnNewBlank a").removeClass("curr");
|
|
|
$("#btnNoBlank a").addClass("curr");
|
|
|
}
|
|
|
},
|
|
|
init: function() {
|
|
|
var blank = $.newegg.cookie.get('Blank');
|
|
|
|
|
|
if ($("#openSet").length) {
|
|
|
// ½öÊ×Ò³ÓÐÏÔʾ
|
|
|
$(".btnNewWin").click(function() {
|
|
|
if ($.newegg.cookie.get('Blank') == 'N')
|
|
|
return;
|
|
|
|
|
|
$("#setOk").show();
|
|
|
$("#setOk").fadeOut(3000);
|
|
|
|
|
|
openWinMode.initButtonState('N');
|
|
|
openWinMode.updateState('N');
|
|
|
|
|
|
});
|
|
|
//µã»÷д°¿Ú°´Å¥£¬ÏÔʾÉèÖóɹ¦¡£
|
|
|
$(".btnOldWin").click(function() {
|
|
|
if ($.newegg.cookie.get('Blank') == 'C')
|
|
|
return;
|
|
|
|
|
|
$("#setOk").show();
|
|
|
$("#setOk").fadeOut(3000);
|
|
|
|
|
|
openWinMode.initButtonState('C');
|
|
|
openWinMode.updateState('C');
|
|
|
|
|
|
});
|
|
|
|
|
|
//µã»÷Ô´°¿Ú°´Å¥£¬ÏÔʾÉèÖóɹ¦¡£
|
|
|
if (blank == 'N' || blank == 'C') {
|
|
|
openWinMode.initButtonState(blank);
|
|
|
openWinMode.setBlank(blank);
|
|
|
}
|
|
|
else {
|
|
|
openWinMode.initButtonState('N');
|
|
|
openWinMode.setBlank('N');
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
// ·ÇÊ×Ò³²»ÏÔʾÉèÖÃ
|
|
|
// µ«ÐèÒªÉèÖÃÊÇ·ñд°¿Ú
|
|
|
if (blank != 'C') {
|
|
|
openWinMode.setBlank('N');
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
var init_mycart = function(obj) {
|
|
|
var mycartpage = 1;
|
|
|
var mycartcur = 1;
|
|
|
|
|
|
var $this = $(obj),
|
|
|
totalnum = $this.find("li").length,
|
|
|
numperpage = 5,
|
|
|
temp = $this.find("ul");
|
|
|
|
|
|
mycartpage = Math.ceil(totalnum / numperpage)
|
|
|
|
|
|
var app = function() {
|
|
|
temp = $("<ul />").append(temp.find("li:gt(" + (numperpage - 1) + ")")).appendTo($this.find(".mover"));
|
|
|
if (temp.find("li").length > numperpage) {
|
|
|
app();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//mycartpage > 1 && app();
|
|
|
|
|
|
$this.find(".navi .num").text(mycartcur + "/" + mycartpage);
|
|
|
|
|
|
if (mycartpage > 1) {
|
|
|
$this.find(".inner").css({
|
|
|
height: 305
|
|
|
});
|
|
|
$this.find(".abtn,dd .num").show();
|
|
|
} else {
|
|
|
$this.find(".abtn,dd .num").hide();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this.find("li").hover(function() {
|
|
|
$(this).addClass("hover");
|
|
|
}, function() {
|
|
|
$(this).removeClass("hover");
|
|
|
});
|
|
|
|
|
|
UI.Xslider(obj, {
|
|
|
numtoMove: 1,
|
|
|
unitLen: 343,
|
|
|
viewedSize: 343,
|
|
|
scrollObj: ".mover",
|
|
|
scrollunits: "ul",
|
|
|
beforeStart: function(e) {
|
|
|
if ($(e.eventTrigger).is(".aleft")) {
|
|
|
mycartcur--;
|
|
|
} else {
|
|
|
mycartcur++;
|
|
|
};
|
|
|
$this.find(".navi .num").text(mycartcur + "/" + mycartpage);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
var loadingMiniCart = false;
|
|
|
//ÃÔÄ㹺Îï³µ
|
|
|
function miniCart(product, action, obj, callBack) {
|
|
|
var data = {};
|
|
|
if (action == 'load') {
|
|
|
if ($.trim(obj.html()) != "") {
|
|
|
if (typeof (callBack) != "undefined") callBack();
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
else if (action == 'delete') {
|
|
|
data = { action: 'del', productno: product };
|
|
|
}
|
|
|
|
|
|
if (loadingMiniCart) {
|
|
|
return;
|
|
|
}
|
|
|
loadingMiniCart = true;
|
|
|
|
|
|
var url = $.newegg.buildCurrent('Ajax/Shopping/MiniCart.aspx');
|
|
|
if ($.newegg.isSecurePage() == true) {
|
|
|
url += '?site=SSLSite';
|
|
|
}
|
|
|
|
|
|
$.get(url, data, function(result) {
|
|
|
loadingMiniCart = false;
|
|
|
|
|
|
if (action == 'delete' && location.href.toLowerCase().indexOf('shoppingcart.aspx') > 0) {
|
|
|
window.location.reload();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$("#minicart").html($(result));
|
|
|
$("#minicart").find("a").removeAttr("target");
|
|
|
$("#headerCartCount").text($("#minicartTotalQty").attr("value"));
|
|
|
if (typeof (callBack) != "undefined") callBack();
|
|
|
init_mycart(".mycart");
|
|
|
$(".prolist").find("li").hover(function() {
|
|
|
$(this).addClass("hover");
|
|
|
}, function() {
|
|
|
$(this).removeClass("hover");
|
|
|
});
|
|
|
},
|
|
|
"html"
|
|
|
);
|
|
|
}
|
|
|
|
|
|
|
|
|
//³õʼ»¯ËÑË÷
|
|
|
function initSearch() {
|
|
|
var searchObj = $('#topSearch');
|
|
|
if (!searchObj) { return; }
|
|
|
|
|
|
searchObj.keydown(function(event) {
|
|
|
if (event.keyCode == 13) {
|
|
|
doSearch();
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
//µã»÷ËÑË÷
|
|
|
function doSearch() {
|
|
|
var searchObj = $('#topSearch');
|
|
|
var keywords = $.trim(searchObj.val());
|
|
|
var searchValue = "ËÑË÷ÉÌÆ·";
|
|
|
if (keywords.length == 0 || keywords == searchValue) {
|
|
|
alert(resources_Head.mustInputKeyWords);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
keywords = escape(keywords);
|
|
|
keywords = keywords.replace(/\#/g, "%23").replace(/\&/g, "%26").replace(/\+/g, "%2B");
|
|
|
|
|
|
|
|
|
var currentUrl = window.location.href;
|
|
|
var regexSearch = /Search.aspx/i;
|
|
|
var isHome = false;
|
|
|
if (location.href.toLowerCase() == $.newegg.buildWWW("default.aspx").toLowerCase() || location.href.toLowerCase() == $.newegg.buildWWW('').toLowerCase()) {
|
|
|
isHome = true;
|
|
|
}
|
|
|
|
|
|
if (isHome == true || regexSearch.test(currentUrl)) {
|
|
|
location.href = $.newegg.buildWWW('Search.aspx') + "?keyword=" + keywords;
|
|
|
}
|
|
|
else {
|
|
|
window.open($.newegg.buildWWW('Search.aspx') + "?keyword=" + keywords);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//»ý·ÖËÑË÷
|
|
|
function pointSearch(obj) {
|
|
|
var pointVal = $(obj).prev().find('dt a').attr('val');
|
|
|
|
|
|
if (typeof pointVal == 'undefined' || pointVal=='')
|
|
|
return;
|
|
|
|
|
|
var currentUrl = window.location.href;
|
|
|
var regexSearch = /Search.aspx/i;
|
|
|
var isHome = false;
|
|
|
if (location.href.toLowerCase() == $.newegg.buildWWW("default.aspx").toLowerCase() || location.href.toLowerCase() == $.newegg.buildWWW('').toLowerCase()) {
|
|
|
isHome = true;
|
|
|
}
|
|
|
|
|
|
if (isHome == true || regexSearch.test(currentUrl)) {
|
|
|
location.href = $.newegg.buildWWW('Search.aspx') + '?point=' + pointVal;
|
|
|
}
|
|
|
else {
|
|
|
window.open($.newegg.buildWWW('Search.aspx') + '?point=' + pointVal);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//ÏÞʱÇÀ¹º
|
|
|
var countDown = {
|
|
|
interv: {},
|
|
|
array: [],
|
|
|
init: function(pageType, pageID) {
|
|
|
if ($(".timeLeft").length) {
|
|
|
var url = $.newegg.buildWWW("Ajax/Common/AjaxHomepageCountDown.aspx?PageType=" + pageType + "&PageID=" + pageID);
|
|
|
$.getJSON(url, function(data) {
|
|
|
$(".timeLeft").each(function() {
|
|
|
var obj = this;
|
|
|
var cid = $(this).attr("id");
|
|
|
countDown.array.push({ cID: cid, cObj: obj, left: 0 });
|
|
|
});
|
|
|
if ($(data).length) {
|
|
|
for (var i = 0, l = countDown.array.length; i < l; i++) {
|
|
|
$(data).each(function() {
|
|
|
if (this.id == countDown.array[i].cID) {
|
|
|
countDown.array[i].left = this.leftTime;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
countDown.interv = setInterval(countDown.start, 1000);
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
},
|
|
|
start: function() {
|
|
|
var allStopped = true;
|
|
|
for (var i = 0, l = countDown.array.length; i < l; i++) {
|
|
|
if (countDown.array[i].cObj != null) {
|
|
|
allStopped = false;
|
|
|
var obj = countDown.array[i].cObj;
|
|
|
countDown.array[i].left -= 1;
|
|
|
var leftTime = countDown.array[i].left;
|
|
|
|
|
|
if (leftTime <= 0) {
|
|
|
countDown.array[i].cObj = null;
|
|
|
|
|
|
$(obj).find("em").each(function(i) {
|
|
|
if (i == 0) {
|
|
|
$(this).text(0);
|
|
|
}
|
|
|
else if (i == 1) {
|
|
|
$(this).text(0);
|
|
|
}
|
|
|
else if (i == 2) {
|
|
|
$(this).text(0);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
var over = $(obj).parent().find(".iconPromA");
|
|
|
if (over.length) {
|
|
|
over.html('<span class="end"><strong>' + resources_Head.countOver + '</strong></span>');
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
var nH = Math.floor(leftTime / (60 * 60));
|
|
|
var nM = Math.floor(leftTime / (60)) % 60;
|
|
|
var nS = Math.floor(leftTime) % 60;
|
|
|
|
|
|
$(obj).find("em").each(function(i) {
|
|
|
if (i == 0) {
|
|
|
$(this).text(nH);
|
|
|
}
|
|
|
else if (i == 1) {
|
|
|
$(this).text(nM);
|
|
|
}
|
|
|
else if (i == 2) {
|
|
|
$(this).text(nS);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (allStopped == true) {
|
|
|
clearInterval(countDown.interv);
|
|
|
countDown.array = null;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//аæҳͷ»¶Ó by Ted 2011-4-7
|
|
|
function initLogin() {
|
|
|
if (decodeURI(escape($.newegg.cookie.get("CustomerLogin"))) == "") {
|
|
|
$('#divUserInfo').show();
|
|
|
|
|
|
}
|
|
|
|
|
|
var displayName = Base64Converter.decode($.newegg.cookie.get("CustomerLogin", "LoginName"));
|
|
|
var nickName = Base64Converter.decode($.newegg.cookie.get("CustomerLogin", "NickName"));
|
|
|
var CustomerType = decodeURI(escape($.newegg.cookie.get("CustomerLogin", "Type")));
|
|
|
if (nickName.length > 0) {
|
|
|
displayName = nickName
|
|
|
}
|
|
|
|
|
|
displayName = countWidth(displayName, 15, "...");
|
|
|
|
|
|
var customerID = decodeURI(escape($.newegg.cookie.get("CustomerLogin", "ID")))
|
|
|
//customerID = $.newegg.cookie.get("CustomerLogin", "ID")
|
|
|
, validScore = $.newegg.cookie.get("LoginValidate", "ValidScore")
|
|
|
, ThirdPartType = decodeURI(escape($.newegg.cookie.get('LoginValidate', 'Type')))
|
|
|
, ThirdPartName = decodeURI(escape($.newegg.cookie.get('LoginValidate', 'ThirdPartName')))
|
|
|
, ThirdPartSubName = decodeURI(escape($.newegg.cookie.get('LoginValidate', 'ThirdPartSubName')))
|
|
|
, ThirdPartCustomerName = decodeURI(escape($.newegg.cookie.get('LoginValidate', 'ThirdPartCustomerName')))
|
|
|
, loginWelcomeInfo = ''
|
|
|
, loginInfo = '';
|
|
|
|
|
|
//ÐÂ×¢²áÓû§
|
|
|
if (!validScore) {
|
|
|
validScore = 0;
|
|
|
}
|
|
|
|
|
|
var goodDay = getDateWelcome();
|
|
|
var customerNameFirst
|
|
|
var customerNameSecond
|
|
|
if (customerID != '' && ThirdPartType == '' && CustomerType != 'G') {
|
|
|
//cookieÖÐÖ»ÓÐcustomerID£¬Óû§
|
|
|
//Barkbread ÍíÉϺÃ,»¶ÓÀ´ÕÐÉÌÒøÐÐÐÅÓÿ¨É̳ǹºÎ ²»ÊÇ Barkbread...? ÖØеǼ
|
|
|
// if(resolution!="1280")
|
|
|
// {
|
|
|
// customerNameFirst=countWidth(customerID,13,"...")
|
|
|
// customerNameSecond=countWidth(customerID,9,"...")
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// customerNameFirst=countWidth(customerID,20,"...")
|
|
|
// customerNameSecond=countWidth(customerID,20,"...")
|
|
|
// }
|
|
|
// loginWelcomeInfo = $.newegg.format( resources_Head.welcome_Login4 , customerNameFirst , goodDay );
|
|
|
if (validScore == 0) {
|
|
|
//loginWelcomeInfo = $.newegg.format(resources_Head.welcome_LoginRemovePoint, customerID);
|
|
|
loginWelcomeInfo = $.newegg.format2(resources_Head.welcome_LoginRemovePoint, displayName);
|
|
|
}
|
|
|
else {
|
|
|
loginWelcomeInfo = $.newegg.format(resources_Head.welcome_Login4, displayName, validScore);
|
|
|
//¸üÐÂÉÌÆ·ÏêÇéÓû§»ý·ÖÐÅÏ¢
|
|
|
$("#sValidScore").text(validScore).parent("span").show().prev("b").show();
|
|
|
}
|
|
|
// loginInfo = $.newegg.format(resources_Head.logOut2, $.newegg.buildSSL("Customer/Logout.aspx"), customerNameSecond );
|
|
|
}
|
|
|
else if (customerID != '' && ThirdPartType != '' && CustomerType != 'G') {
|
|
|
//µÚÈý·½µÇ¼
|
|
|
//Ç×°®µÄQQ/²Æ¸¶Í¨Óû§ BarkbreadÄúºÃ£¡ ²»ÊÇ Barkbread...? ÖØеǼ
|
|
|
var customerName = decodeURI(escape($.newegg.cookie.get('LoginValidate', 'ThirdPartPassportUserName')))
|
|
|
|| decodeURI(escape($.newegg.cookie.get('LoginValidate', 'ThirdPartCustomerName')))
|
|
|
|| customerID;
|
|
|
var showThirdPartyName = ThirdPartSubName.length > 0 ? ThirdPartSubName : ThirdPartName;
|
|
|
|
|
|
//ÏÔʾµÚÈý·½µÇ¼Óû§Ãû
|
|
|
if (resolution != "1280") {
|
|
|
customerNameFirst = countWidth(customerName, 9, "...")
|
|
|
customerNameSecond = countWidth(customerName, 6, "...")
|
|
|
}
|
|
|
else {
|
|
|
customerNameFirst = countWidth(customerName, 20, "...")
|
|
|
customerNameSecond = countWidth(customerName, 20, "...")
|
|
|
}
|
|
|
loginWelcomeInfo = $.newegg.format(resources_Head.welcome_ThirdLogin2, showThirdPartyName, customerNameFirst);
|
|
|
loginInfo = $.newegg.format(resources_Head.logOut2, $.newegg.buildSSL("Customer/Logout.aspx"), customerNameSecond);
|
|
|
}
|
|
|
else //if(customerID==''&& ThirdPartType=='')
|
|
|
{
|
|
|
//cookieÖÐûÓÐÈκμǼ
|
|
|
//ÍíÉϺÃ,»¶ÓÀ´ÕÐÉÌÒøÐÐÐÅÓÿ¨É̳ǹºÎ ÇëµÇ¼ Ãâ·Ñ×¢²á
|
|
|
//loginWelcomeInfo = $.newegg.format( resources_Head.welcome_Login3 , goodDay );
|
|
|
//loginInfo = $.newegg.format(resources_Head.login2, $.newegg.buildSSL("Customer/Login.aspx"),$.newegg.buildSSL("Customer/Register.aspx"));
|
|
|
$('#divUserInfo').show();
|
|
|
return;
|
|
|
}
|
|
|
$('#ShoppingCartMsgForNotLogged').hide().next().show();
|
|
|
// $('.welcome').html(loginWelcomeInfo + loginInfo);
|
|
|
$('#divUserInfo').html(loginWelcomeInfo).show();
|
|
|
|
|
|
if (decodeURI(escape($.newegg.cookie.get("CustomerLogin", "Type"))) != "G") {
|
|
|
$(".topnav .nologinOrder").hide();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function countWidth(str, maxWidth, symbol) {
|
|
|
//ÖÐÎÄ×ÖÔ¼µÈÓÚ2¸ö×ÖĸµÄ¿í¶È
|
|
|
var tmp = "";
|
|
|
var strLength = str.replace(/[^\x00-\xff]/g, "**").length
|
|
|
while (strLength > maxWidth) {
|
|
|
str = str.slice(0, -1);
|
|
|
strLength = str.replace(/[^\x00-\xff]/g, "**").length
|
|
|
if (strLength <= maxWidth) {
|
|
|
while ((maxWidth - str.replace(/[^\x00-\xff]/g, "**").length) < 3) {
|
|
|
str = str.slice(0, -1);
|
|
|
}
|
|
|
str += symbol;
|
|
|
}
|
|
|
}
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
function getDateWelcome() {
|
|
|
var now = new Date();
|
|
|
var hour = now.getHours();
|
|
|
|
|
|
var welcome = '';
|
|
|
if (hour >= 5 && hour < 9) {
|
|
|
welcome = resources_Head.Morning1;
|
|
|
}
|
|
|
else if (hour >= 9 && hour < 12) {
|
|
|
welcome = resources_Head.Morning2;
|
|
|
}
|
|
|
else if (hour >= 12 && hour < 14) {
|
|
|
welcome = resources_Head.Noon;
|
|
|
}
|
|
|
else if (hour >= 14 && hour < 18) {
|
|
|
welcome = resources_Head.Afternoon;
|
|
|
}
|
|
|
else {
|
|
|
welcome = resources_Head.Night;
|
|
|
}
|
|
|
|
|
|
return welcome;
|
|
|
}
|
|
|
|
|
|
//cm_mmc
|
|
|
function initCMMC() {
|
|
|
var cmmc = $.trim($.newegg.querystring.get('cm_mmc'));
|
|
|
if (!cmmc) {
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
var cmpType = 'cmp';
|
|
|
if (cmmc.indexOf('google') > -1) {
|
|
|
cmpType = 'google';
|
|
|
};
|
|
|
|
|
|
$.newegg.cookie.set('NewAdvEffectMonitor', { Advalue: cmmc, Type: cmpType }, { topdomain: true, expires: 10 });
|
|
|
}
|
|
|
|
|
|
//¶©ÔÄÌØ»ÝÐÅÏ¢
|
|
|
function subScription() {
|
|
|
var mail = $.trim($("#txtEmail").val());
|
|
|
if (mail.length == 0) {
|
|
|
alert("ÇëÊäÈëÓÊÏäµØÖ·");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var validateReg = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/;
|
|
|
var pattern = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;
|
|
|
|
|
|
if (validateReg.test(mail) == true || pattern.test(mail) == false) {
|
|
|
alert("ÇëÊäÈëºÏ·¨ÓÊÏäµØÖ·");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var mailData = { txtEmail: escape(mail) };
|
|
|
var url = $.newegg.buildWWW("Ajax/Common/AjaxSubscription.aspx");
|
|
|
$.post(url, mailData,
|
|
|
function(data) {
|
|
|
alert(data.Description);
|
|
|
$("#txtEmail").attr("value", 'ÇëÊäÈëÄúµÄÓÊÏäµØÖ·');
|
|
|
$("#txtEmail").removeClass("hasDefaultTextOn");
|
|
|
defaultText();
|
|
|
},
|
|
|
"json");
|
|
|
}
|
|
|
|
|
|
function openPostWindow(url, data) {
|
|
|
var form = $("<form></form>")
|
|
|
form.attr('action', url)
|
|
|
form.attr('method', 'post')
|
|
|
form.attr('target', '_blank')
|
|
|
input1 = $("<input type='hidden' name='tempForm1Content' />")
|
|
|
input1.attr('value', data)
|
|
|
form.append(input1);
|
|
|
form.appendTo("body");
|
|
|
form.css('display', 'none');
|
|
|
form.submit();
|
|
|
}
|
|
|
|
|
|
function getPollResultItemList(pollItems, isTextArea) {
|
|
|
var pollResultItemList = new Array();
|
|
|
if (typeof (pollItems) != 'undefined') {
|
|
|
var length = pollItems.length;
|
|
|
if (length > 0) {
|
|
|
var tempIdArray;
|
|
|
var tempPollItem;
|
|
|
pollItems.each(function() {
|
|
|
if (isTextArea == false ||
|
|
|
$.trim($(this).val()).length > 0) {
|
|
|
tempIdArray = $(this).attr('id').split('-');
|
|
|
tempPollItem = {
|
|
|
"PollGroupType": tempIdArray[0],
|
|
|
"PollGroupSysNo": tempIdArray[1],
|
|
|
"PollGroupItemSysNo": tempIdArray[2]
|
|
|
};
|
|
|
if (isTextArea) {
|
|
|
tempPollItem.AnswerContent = $.trim($(this).val());
|
|
|
}
|
|
|
else if (tempIdArray[2] == 0) {
|
|
|
tempPollItem.AnswerContent = ''
|
|
|
}
|
|
|
pollResultItemList.push(tempPollItem);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
return pollResultItemList;
|
|
|
}
|
|
|
|
|
|
function clickNPoll(pollSysNo, pollDivId) {
|
|
|
var url = $.newegg.buildWWW("Service/Poll.aspx") + "?PollSysno=" + pollSysNo;
|
|
|
if (pollDivId != "OnlyView") {
|
|
|
var pollResultInfo = {};
|
|
|
pollResultInfo.PollSysNo = pollSysNo;
|
|
|
var pollItems = $("#" + pollDivId + " input:checked");
|
|
|
pollResultInfo.ResultItemList = getPollResultItemList(pollItems, false);
|
|
|
pollItems = $("#" + pollDivId).find("textarea");
|
|
|
pollResultInfo.ResultItemList = pollResultInfo.ResultItemList.concat(getPollResultItemList(pollItems, true));
|
|
|
openPostWindow(url, JSON.stringify(pollResultInfo));
|
|
|
}
|
|
|
else {
|
|
|
window.open(url, "", "");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//Óû§·´À¡
|
|
|
function SubmitFeekback(pollSysNo, pollDivId) {
|
|
|
if (pollDivId != "OnlyView") {
|
|
|
var pollResultInfo = {};
|
|
|
pollResultInfo.PollSysNo = pollSysNo;
|
|
|
var pollItems = $("#" + pollDivId + " input:checked");
|
|
|
pollResultInfo.ResultItemList = getPollResultItemList(pollItems, false);
|
|
|
|
|
|
pollItems = $("#" + pollDivId).find("textarea");
|
|
|
pollResultInfo.ResultItemList = pollResultInfo.ResultItemList.concat(getPollResultItemList(pollItems, true));
|
|
|
if (pollResultInfo.ResultItemList.length == 0) {
|
|
|
$.Showmsg("ÄÚÈÝΪ¿Õ£¬ÇëÌîд·´À¡ºóÌá½»£¡")
|
|
|
return;
|
|
|
}
|
|
|
else {
|
|
|
$.post($.newegg.buildWWW("Ajax/Feedback/AjaxCreateFeedback.aspx"),
|
|
|
{ pollResult: JSON.stringify(pollResultInfo) },
|
|
|
function(data) {
|
|
|
if (data.Type == 0) {
|
|
|
//GA
|
|
|
try {
|
|
|
_gaq.push(['_trackPageview', '/feedback/questionairethankyou']);
|
|
|
} catch (err) { }
|
|
|
|
|
|
$('input[type="radio"]').attr('checked', false);
|
|
|
$(".cmnTArea").val("");
|
|
|
$("#voteDiv").hide();
|
|
|
$("#submitSuccess").show();
|
|
|
// $.Showmsg(data.Data);
|
|
|
}
|
|
|
else {
|
|
|
$.Showmsg(data.Data);
|
|
|
}
|
|
|
},
|
|
|
"json"
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//ͶƱ
|
|
|
function clickPoll(pollSysNo, type) {
|
|
|
var pollItemSysNo = $(".voteContent input:checked").val();
|
|
|
if (typeof (pollItemSysNo) == 'undefined') {
|
|
|
pollItemSysNo = 0;
|
|
|
}
|
|
|
var url = $.newegg.buildWWW("Service/Poll.aspx") + "?" + "PollSysno=" + pollSysNo + "&PollType=" + type;
|
|
|
if (type == "1") {
|
|
|
url += "&PollItemSysno=" + pollItemSysNo;
|
|
|
}
|
|
|
window.open(url, "", "");
|
|
|
}
|
|
|
|
|
|
/* ¿ÉÐÅÕ¾µã */
|
|
|
function change_CNNIC(eleId) {
|
|
|
var str = document.getElementById(eleId).href;
|
|
|
var str1 = str.substring(0, (str.length - 6));
|
|
|
str1 += RndNum_CNNIC(6);
|
|
|
document.getElementById(eleId).href = str1;
|
|
|
}
|
|
|
|
|
|
function RndNum_CNNIC(k) {
|
|
|
var rnd = "";
|
|
|
|
|
|
for (var i = 0; i < k; i++)
|
|
|
|
|
|
rnd += Math.floor(Math.random() * 10);
|
|
|
|
|
|
return rnd;
|
|
|
}
|
|
|
// ¼ÓÔØÎÒµÄÊÕ²ØÊý¾Ý
|
|
|
var loadingMyFavorite = false;
|
|
|
function myFavorite(obj, callBack) {
|
|
|
if (obj.html() != "") {
|
|
|
if (callBack) callBack();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (loadingMyFavorite) {
|
|
|
return;
|
|
|
}
|
|
|
loadingMyFavorite = true;
|
|
|
|
|
|
//ÒòΪÕâ¸öÀïÃæÓзµ»Ø²úƷͼƬÁ´½Ó£¬Òò´ËÒªÌØÊâ´¦Àí£¬·ÃÎʲ»Í¬µÄajaxÒ³Ãæ
|
|
|
var url = $.newegg.buildCurrent('Ajax/Customer/AjaxMyWishList.aspx');
|
|
|
|
|
|
if ($.newegg.isSecurePage() == true) {
|
|
|
url += '?site=SSLSite';
|
|
|
}
|
|
|
|
|
|
$.get(url, null, function(result) {
|
|
|
loadingMyFavorite = false;
|
|
|
obj.html($(result));
|
|
|
if (callBack) callBack();
|
|
|
},
|
|
|
"html"
|
|
|
);
|
|
|
}
|
|
|
// ¼ÓÔØҳͷä¯ÀÀ¼Ç¼
|
|
|
var loadingBrowserHistory = false;
|
|
|
function browserHistory(obj, callBack, force) {
|
|
|
if (!force && obj.html() != "") {
|
|
|
if (callBack) callBack();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (loadingBrowserHistory) {
|
|
|
return;
|
|
|
}
|
|
|
loadingBrowserHistory = true;
|
|
|
|
|
|
var url = $.newegg.buildCurrent('Ajax/Product/AjaxProBrowseH.aspx?type=head');
|
|
|
|
|
|
if ($.newegg.isSecurePage() == true) {
|
|
|
url += '&site=SSLSite';
|
|
|
}
|
|
|
|
|
|
$.get(url, null, function(result) {
|
|
|
loadingBrowserHistory = false;
|
|
|
obj.html($(result));
|
|
|
if (callBack) callBack();
|
|
|
},
|
|
|
"html"
|
|
|
);
|
|
|
}
|
|
|
// ¼ÓÔØҳͷµ¼º½²Ëµ¥
|
|
|
var loadingHeaderAllCateNav = false;
|
|
|
function headerAllCateNav(obj, callBack) {
|
|
|
if (obj.html() != "") {
|
|
|
if (callBack) callBack();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (loadingHeaderAllCateNav) {
|
|
|
return;
|
|
|
}
|
|
|
loadingHeaderAllCateNav = true;
|
|
|
|
|
|
var url = $.newegg.buildCurrent('Ajax/Navigation/Navigation.aspx');
|
|
|
|
|
|
if ($.newegg.isSecurePage() == true) {
|
|
|
url += '?site=SSLSite';
|
|
|
}
|
|
|
|
|
|
$.get(url, null, function(result) {
|
|
|
loadingHeaderAllCateNav = false;
|
|
|
obj.html($(result));
|
|
|
//³õʼ»¯Ò³Í·Àà±ðµÄµ¼º½²Ëµ¥¶¯×÷
|
|
|
allCateNav();
|
|
|
|
|
|
if (callBack) callBack();
|
|
|
},
|
|
|
"html"
|
|
|
);
|
|
|
}
|
|
|
// Çå³ýҳͷÉÌÆ·ä¯ÀÀ¼Ç¼
|
|
|
function clearBrowserHistory() {
|
|
|
$.newegg.cookie.clear('BrowsedProductSysNoList', { topdomain: true });
|
|
|
if ($("#browserhistory").length) {
|
|
|
browserHistory($("#browserhistory"), null, true);
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
// Çå³ýҳͷËÑË÷¼Ç¼
|
|
|
function clearSearchHistory() {
|
|
|
$.newegg.cookie.clear('SearchKeyword', { topdomain: true });
|
|
|
if ($("#browserhistory").length) {
|
|
|
browserHistory($("#browserhistory"), null, true);
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
/*Ê×ҳҳͷ¶¥²¿µÄÕ¹¿ªÊÕËõ¹ã¸æЧ¹û*/
|
|
|
var bannerAdTopTimer;
|
|
|
function bannerAdTop() {
|
|
|
if ($("#bannerAdTop").length && $("#bannerAdTopS").length) {
|
|
|
$.newegg.cookie.set("AdTop", JSON.parse('{"adSysNo":' + adSysNo + '}'), JSON.parse('{"expires":9999}'));
|
|
|
bannerAdTopTimer = setTimeout(function() {
|
|
|
$("#bannerAdTop").slideUp("slow");
|
|
|
$("#bannerAdTopS").delay(200).slideDown();
|
|
|
}, 5000);
|
|
|
}
|
|
|
}
|
|
|
function bannerAdTopClick() {
|
|
|
if ($("#bannerAdTop").length && $("#bannerAdTopS").length) {
|
|
|
$("#bannerAdTopS").click(function() {
|
|
|
$(this).slideUp();
|
|
|
$("#bannerAdTop").slideDown("slow");
|
|
|
});
|
|
|
|
|
|
$("#bannerAdTop .shuter").click(function() {
|
|
|
$("#bannerAdTop").slideUp("slow");
|
|
|
$("#bannerAdTopS").delay(200).slideDown();
|
|
|
clearTimeout(bannerAdTopTimer);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*end ÒµÎñº¯Êý*/
|
|
|
|
|
|
//Í·²¿¼ÓÔØÍê³ÉºóÖ´ÐÐ
|
|
|
$(document).ready(function() {
|
|
|
|
|
|
//³õʼ»¯µÇ½»¶ÓÐÅÏ¢
|
|
|
if ($("#divUserInfo").length) {
|
|
|
initLogin();
|
|
|
}
|
|
|
|
|
|
|
|
|
//ƽ°²ÍòÀïͨ
|
|
|
var thridLogin = $.newegg.cookie.get("ThirdPartyLogin", "LogonType");
|
|
|
if (thridLogin == "PingAn") {
|
|
|
if ($(".wanlitong").length) $(".wanlitong").show();
|
|
|
}
|
|
|
|
|
|
//¿ªÆôĬÈÏÎÄ×ÖЧ¹û
|
|
|
try { defaultText(); } catch (ex) { }
|
|
|
|
|
|
//ҳͷµ¯³ö´°¿Ú
|
|
|
popWinA("topBarPopup", true);
|
|
|
|
|
|
//ҳͷÀà±ðµÄµ¼º½²Ëµ¥ÊÇ·ñĬÈÏÕ¹¿ª
|
|
|
if (typeof (showAllCate) != 'undefined' && showAllCate == true) {
|
|
|
// $("#topNav .allCateNav").addClass("over");
|
|
|
//³õʼ»¯Ò³Í·Àà±ðµÄµ¼º½²Ëµ¥¶¯×÷
|
|
|
allCateNav();
|
|
|
}
|
|
|
else {
|
|
|
// Òì²½¼ÓÔØҳͷÀà±ðµÄµ¼º½²Ëµ¥
|
|
|
if ($("#headerAllCateNav").length) {
|
|
|
onoff_4("headerAllCateNav", function(obj, callBack) { headerAllCateNav(obj, callBack) });
|
|
|
}
|
|
|
// popWinB("allCateNav", true);
|
|
|
}
|
|
|
|
|
|
//ÃÔÄ㹺Îï³µµÄÏÔʾ×ÜÊý
|
|
|
if ($("#headerCartCount").length) {
|
|
|
var minniCart = $.newegg.cookie.get("CartCookie", "cartQty");
|
|
|
if (minniCart == '') minniCart = 0;
|
|
|
$("#headerCartCount").text(minniCart);
|
|
|
}
|
|
|
|
|
|
// ÃÔÄ㹺Îï³µ
|
|
|
if ($("#minicart").length) {
|
|
|
onoff_4("minicart", function(obj, callBack) { miniCart('', 'load', obj, callBack) });
|
|
|
}
|
|
|
|
|
|
// ÎÒµÄÊÕ²Ø
|
|
|
if ($("#favorite").length) {
|
|
|
onoff_4("favorite", function(obj, callBack) { myFavorite(obj, callBack) });
|
|
|
}
|
|
|
// ä¯ÀÀ¼Ç¼
|
|
|
if ($("#browserhistory").length) {
|
|
|
onoff_4("browserhistory", function(obj, callBack) { browserHistory(obj, callBack) });
|
|
|
}
|
|
|
|
|
|
|
|
|
//³õʼ»¯×Ô¶¯ËÑË÷Ìáʾ
|
|
|
if ($("#topSearch").length) {
|
|
|
autoFilledKeywords.url = $.newegg.buildCurrent("Ajax/Common/AutoFilledKeywords.aspx");
|
|
|
autoFilledKeywords.textboxID = "topSearch"; // ÊäÈë¿ò ID
|
|
|
autoFilledKeywords.autofilledviewID = "searchtip"; // µ¯³ö²ã ID
|
|
|
autoFilledKeywords.onload();
|
|
|
|
|
|
//³õʼ»¯ËÑË÷°´Å¥Ê¼þ
|
|
|
initSearch("topSearch");
|
|
|
}
|
|
|
|
|
|
var username = decodeURI(escape($.newegg.cookie.get('LoginValidate', 'CID')));
|
|
|
if (username.length > 0) {
|
|
|
$(".loginBox #username,.loginBox #txtMiniUser").val(decodeURI(escape($.newegg.cookie.get('LoginValidate', 'CID'))));
|
|
|
}
|
|
|
});
|
|
|
|
|
|
jQuery(function($) {
|
|
|
//³õʼ»¯CMMC cookie
|
|
|
initCMMC();
|
|
|
//Banner
|
|
|
// imgPlayer.init();
|
|
|
//д°¿Ú´ò¿ª,ÔÝʱȥµô
|
|
|
//openWinMode.init();
|
|
|
});
|
|
|
|
|
|
function getQueryString(paras) {
|
|
|
var url = location.href;
|
|
|
var paraString = url.substring(url.indexOf("?") + 1, url.length).split("&");
|
|
|
var paraObj = {}
|
|
|
for (i = 0; j = paraString[i]; i++) {
|
|
|
paraObj[j.substring(0, j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=") + 1, j.length);
|
|
|
}
|
|
|
var returnValue = paraObj[paras.toLowerCase()];
|
|
|
if (typeof (returnValue) == "undefined") {
|
|
|
return "";
|
|
|
} else {
|
|
|
return returnValue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function customerCoreMetrics(pageid, pagecg) {
|
|
|
var ifIEJumpList = getQueryString("source");
|
|
|
if (ifIEJumpList == "IE9jumplist") {
|
|
|
cmCreatePageviewTag(pageid + ":IE9jumplist", pagecg, null, null);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* @Method CheckLoginTime
|
|
|
* ¼ì²éÓû§µÇ½ʱ¼ä£¬Èç¹ûµÇ¼ʱ¼äСÓÚ1Сʱ£¬·µ»ØTrue£¬·ñÔò·µ»ØFalse
|
|
|
*/
|
|
|
function CheckLoginTime(checkOutTimer) {
|
|
|
// ÕË»§£¬¼ì²éÊÇ·ñÊÇһСʱÒÔÄڵǼ£¬Èç¹û²»ÊÇÌøתµ½µÇ½ҳÃæÇ¿ÖƵǼ
|
|
|
var datetime = $.newegg.cookie.get('CustomerLogin', 'LoginTime');
|
|
|
|
|
|
if (datetime === '') {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
// ÌÞ³öÐèÒª¹¹½¨µÄ²ÎÊý£¨Äê¡¢Ô¡¢ÈÕ¡¢Ê±¡¢·Ö£©
|
|
|
var year = datetime.substr(0, 4);
|
|
|
datetime = datetime.substr(4, datetime.length);
|
|
|
var month = datetime.substr(0, 2);
|
|
|
month = parseFloat(month); //parseInt('08')=0 FF Bug?
|
|
|
month--;
|
|
|
datetime = datetime.substr(2, datetime.length);
|
|
|
var day = datetime.substr(0, 2);
|
|
|
datetime = datetime.substr(2, datetime.length);
|
|
|
var hours = datetime.substr(0, 2);
|
|
|
hours = parseFloat(hours);
|
|
|
datetime = datetime.substr(2, datetime.length);
|
|
|
var minutes = datetime.substr(0, 2);
|
|
|
minutes = parseFloat(minutes);
|
|
|
datetime = datetime.substr(2, datetime.length);
|
|
|
var second = datetime.substr(0, 2);
|
|
|
second = parseFloat(second);
|
|
|
|
|
|
// ¹¹½¨±È½Ï±äÁ¿
|
|
|
var compare1 = new Date();
|
|
|
var compare2 = new Date();
|
|
|
compare2.setFullYear(year);
|
|
|
compare2.setMonth(month);
|
|
|
compare2.setDate(day);
|
|
|
compare2.setHours(hours);
|
|
|
compare2.setMinutes(minutes);
|
|
|
compare2.setSeconds(second);
|
|
|
|
|
|
var compareVal = compare1.getTime() - compare2.getTime();
|
|
|
|
|
|
return compareVal < checkOutTimer * 1000;
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* @Method MiniShopCartCheckOut
|
|
|
* ÃÔÄ㹺Îï³µÌøתCheckOutÒ³Ãæ
|
|
|
* Èç¹ûÊÇÓû§ÇÒһСʱÒÔÄڵǽµÄÖ±½ÓÌøתµ½CheckOutÒ³Ãæ
|
|
|
*/
|
|
|
function MiniShopCartCheckOut(checkOutTimer) {
|
|
|
var url = $.newegg.buildSSL('shopping/CheckOut.aspx');
|
|
|
var loginTime = $.newegg.cookie.get('CustomerLogin', 'LoginTime');
|
|
|
if ($.newegg.cookie.get('LoginValidate', "Type").length > 0
|
|
|
|| (
|
|
|
$.newegg.cookie.get('ThirdPartyLogin', "LogonType").length > 0
|
|
|
&& $.newegg.cookie.get('ThirdPartyLogin', "LogonType") != "None")
|
|
|
) {
|
|
|
window.location = url;
|
|
|
}
|
|
|
else if (loginTime !== "") {
|
|
|
if (CheckLoginTime(checkOutTimer)) {
|
|
|
window.location = url;
|
|
|
} else {
|
|
|
window.location = $.newegg.buildWWW("Customer/Login.aspx", "secure") + "?ReturnUrl=" + encodeURIComponent(url);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
window.location = $.newegg.buildWWW("Customer/Login.aspx", "secure") + "?ReturnUrl=" + encodeURIComponent(url);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function popWinB(s) {
|
|
|
var objOpner = $(s).find(".opener"),
|
|
|
objC = $(s).find(".openerC");
|
|
|
|
|
|
objOpner.parents(s).click(function() {
|
|
|
objOpner.addClass("now");
|
|
|
objC.show();
|
|
|
}, function() {
|
|
|
objOpner.removeClass("now");
|
|
|
objC.hide();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/* µÇ¼¿ªÊ¼ */
|
|
|
$(function() {
|
|
|
$(".miniloginform").keydown(function(event) {
|
|
|
if (event.keyCode == 13) {
|
|
|
myLogin();
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
function MiniLogin(user, pwd, vcode, rememberMe) {
|
|
|
try {
|
|
|
_gaq.push(['_trackEvent', 'login', 'loginapply']);
|
|
|
} catch (err) { }
|
|
|
|
|
|
var url = $.newegg.buildSSL('Ajax/Customer/AjaxMiniLogin.aspx');
|
|
|
url += $.newegg.format("?u={0}&p={1}&v={2}&chk_RememberMe={3}&Type=nopop_header", [user, pwd, vcode, rememberMe]);
|
|
|
$.getScript(url);
|
|
|
}
|
|
|
|
|
|
function myLogin() {
|
|
|
var user = $("#txtMiniUser").val();
|
|
|
var pwd = $("#txtMiniPwd").val();
|
|
|
var vcode = $("#txtMiniVCode").val();
|
|
|
var rememberMe = $("#chk_RememberMe").attr("checked") ? 1 : 0;
|
|
|
|
|
|
var errorNum = 0;
|
|
|
|
|
|
if ($.trim(user) == "" || $.trim(user) == "ÊÖ»ú/ÓÊÏä/³öÐÐÒ×ÕË»§") {
|
|
|
buildWarningMessage($("#txtMiniUser"), "ÇëÊäÈëÕË»§Ãû");
|
|
|
errorNum++;
|
|
|
}
|
|
|
if ($.trim(pwd) == "") {
|
|
|
buildWarningMessage($("#txtMiniPwd"), "ÇëÊäÈëÃÜÂë");
|
|
|
errorNum++;
|
|
|
}
|
|
|
if ($(".miniloginform .validCode").hasClass("show") && $.trim(vcode) == "") {
|
|
|
buildWarningMessage($("#txtMiniVCode"), "ÇëÊäÈëÑéÖ¤Âë");
|
|
|
errorNum++;
|
|
|
}
|
|
|
|
|
|
if (errorNum > 0) {
|
|
|
return;
|
|
|
}
|
|
|
MiniLogin(user, pwd, vcode, rememberMe);
|
|
|
}
|
|
|
|
|
|
function LoginHandler(result) {
|
|
|
var loginTimes = $.newegg.cookie.get("LoginTimes");
|
|
|
var verifyArea;
|
|
|
|
|
|
|
|
|
if (result.success) {
|
|
|
try {
|
|
|
_gaq.push(['_trackEvent', 'login', 'loginsuccessful']);
|
|
|
} catch (err) { }
|
|
|
|
|
|
if ($("#isFromCart").val() == "1") {
|
|
|
parent.window.location = $.newegg.buildSSL('shopping/CheckOut.aspx');
|
|
|
} else if ($("#loginFlag").val() == "addwish") {
|
|
|
parent.$("a[tag='" + $("#loginData").val() + "']").click();
|
|
|
parent.pop_miniLogin.fn.popOut();
|
|
|
parent.initLogin();
|
|
|
} else {
|
|
|
parent.pop_miniLogin.fn.popOut();
|
|
|
parent.initLogin();
|
|
|
if ($("#Validform_msg").length > 0) {
|
|
|
$.Hidemsg();
|
|
|
}
|
|
|
if ($("#redirectUrl").val() != "") {
|
|
|
parent.window.location = $("#redirectUrl").val();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
try {
|
|
|
_gaq.push(['_trackEvent', 'login', 'loginfailed']);
|
|
|
} catch (err) { }
|
|
|
|
|
|
//ÃÔÄãµÇ¼ÑéÖ¤Âë
|
|
|
verifyArea = $(".miniloginform .validCode");
|
|
|
if (loginTimes && loginTimes >= 3) {
|
|
|
refreshValidator('#imgMiniVCode', '#txtMiniVCode');
|
|
|
verifyArea.addClass("show").show();
|
|
|
}
|
|
|
else {
|
|
|
verifyArea.removeClass("show").hide();
|
|
|
}
|
|
|
if (result.error.indexOf("ÑéÖ¤Âë") >= 0) {
|
|
|
buildWarningMessage($("#txtMiniVCode"), result.error);
|
|
|
$("#txtMiniVCode").focus();
|
|
|
} else {
|
|
|
buildWarningMessage($("#txtMiniUser"), result.error);
|
|
|
$("#txtMiniPwd").val("").focus();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function buildWarningMessage(jqueryObj, msg) {
|
|
|
jqueryObj.nextAll(".Validform_info:first").removeClass("errormsg").addClass("errormsg").show();
|
|
|
jqueryObj.nextAll(".Validform_info:first").find(".tip").hide();
|
|
|
jqueryObj.nextAll(".Validform_info:first").find(".Validform_checktip").removeClass().addClass("Validform_wrong Validform_checktip").text(msg).show();
|
|
|
}
|
|
|
|
|
|
/* µÇ¼½áÊø */
|
|
|
|
|
|
window.old_alert = window.alert;
|
|
|
|
|
|
window.alert = function(message) {
|
|
|
if (typeof ($.Showmsg) == "function") {
|
|
|
$.Showmsg(message);
|
|
|
}
|
|
|
else {
|
|
|
old_alert(message);
|
|
|
}
|
|
|
}
|
|
|
//$(function() {
|
|
|
// $("body").click(function() {
|
|
|
// if ($("#Validform_msg").length > 0) {
|
|
|
// $.Hidemsg();
|
|
|
// }
|
|
|
// });
|
|
|
//});
|
|
|
function commonPopMiniLogin() {
|
|
|
popupHTML = $("#miniLogin").html();
|
|
|
if (popupHTML) {
|
|
|
var top = ($(window).height() - $("#miniLogin").height()) / 2;
|
|
|
var btn = {};
|
|
|
$.prompt(popupHTML, {
|
|
|
callback: function() { },
|
|
|
prefix: 'cmPopup',
|
|
|
top: top,
|
|
|
buttons: btn,
|
|
|
opacity: 0.3
|
|
|
});
|
|
|
$(".cmPopupmessage").keydown(function(event) {
|
|
|
if (event.keyCode == 13 && $(this).find("#myCartUser").length > 0) {
|
|
|
commonMiniLogin($("input:first", this));
|
|
|
return false;
|
|
|
}
|
|
|
}).find("input:first").focus();
|
|
|
}
|
|
|
}
|
|
|
function commonMiniLogin(obj) {
|
|
|
var loginPopup = $(obj).closest(".loginPopup");
|
|
|
if (loginPopup.length > 0) {
|
|
|
var user = loginPopup.find("#myCartUser").val();
|
|
|
var pwd = loginPopup.find("#myCartPwd").val();
|
|
|
var vcode = loginPopup.find("#myCartVCode").val();
|
|
|
if ($.trim(user) == "") {
|
|
|
$(".cmPopupmessage .Validform_checktip").css("display", "block").text("ÇëÊäÈëÕ˺Å");
|
|
|
loginPopup.find("#myCartUser").focus();
|
|
|
return;
|
|
|
}
|
|
|
if ($.trim(pwd) == "") {
|
|
|
$(".cmPopupmessage .Validform_checktip").css("display", "block").text("ÇëÊäÈëÃÜÂë");
|
|
|
loginPopup.find("#myCartPwd").focus();
|
|
|
return;
|
|
|
}
|
|
|
if ($(".cmPopupmessage ").hasClass("show") && $.trim(vcode) == "") {
|
|
|
$(".cmPopupmessage .Validform_checktip").css("display", "block").text("ÇëÊäÈëÑéÖ¤Âë");
|
|
|
loginPopup.find("#myCartVCode").focus();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
MiniLogin(user, pwd, vcode, "0");
|
|
|
}
|
|
|
}
|
|
|
function checkLogined(linkObj) {
|
|
|
if (decodeURI(escape($.newegg.cookie.get("CustomerLogin"))) == "") {
|
|
|
commonPopMiniLogin();
|
|
|
$("#miniLogin").attr("rel", $(linkObj).attr("href"));
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
//µã»÷´ó·ÖÀർº½´¥·¢µÄʼþ
|
|
|
function showTableCategory(id) {
|
|
|
var idLink = $(id).find("strong a").attr("href");
|
|
|
location.href = idLink;
|
|
|
}
|
|
|
|
|
|
//Ë¢ÐÂÑéÖ¤Âë
|
|
|
function refreshValidator(img, input) {
|
|
|
var url = $(img).attr('ref1');
|
|
|
newurl = url + "&r=" + Math.random();
|
|
|
$(img).attr('src', newurl);
|
|
|
$(input).val('');
|
|
|
}
|
|
|
|
|
|
function popEWinLogin(type, username) {
|
|
|
if (window.pop_EWinLogin != undefined) {
|
|
|
window.pop_EWinLogin.fn.popOut();
|
|
|
}
|
|
|
if (username == undefined) {
|
|
|
username = "";
|
|
|
}
|
|
|
var url = $.newegg.buildSSL("customer/EWinLogin.aspx?guidkey=c608f668791c213f26bf0c8b4f19e390&MerchantData=c608f668791c213f26bf0c8b4f19e390%7cSSLSite%7c&account=" + username);
|
|
|
|
|
|
var loginHtml = '<div class="Validform_info themes_green formsub popWin" id="ewin_pop" style="display:none;">\
|
|
|
<h4>ÄúÒÑ×¢²áÁË</h4>\
|
|
|
<p class="errtip">´ËÕ˺ÅÒÑÔÚ³öÐÐÒ××¢²á£¬Äú¿ÉÒÔʹÓóöÐÐÒ×µÄÃÜÂëÖ±½ÓµÇ¼¡£</p>\
|
|
|
<div class="popinner">\
|
|
|
<iframe id="loginFrame" src="" height="220" width="360" scrolling="no" frameborder="0"></iframe>\
|
|
|
</div>\
|
|
|
<a href="###" class="close inblock" title="¹Ø±Õ">¹Ø±Õ</a>\
|
|
|
</div>';
|
|
|
if ($("#ewin_pop").length == 0) {
|
|
|
$("body").append(loginHtml);
|
|
|
window.pop_EWinLogin = PopWin("#ewin_pop", {
|
|
|
animate: true,
|
|
|
olOpacity: 0.5
|
|
|
});
|
|
|
}
|
|
|
$("#ewin_pop #loginFrame").attr("src", url);
|
|
|
window.pop_EWinLogin.fn.popIn();
|
|
|
}
|
|
|
|
|
|
function popOutEWinLogin(type) {
|
|
|
if (window.pop_EWinLogin != undefined) {
|
|
|
window.pop_EWinLogin.fn.popOut();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function popCMBChinaLogin(type, username) {
|
|
|
if (window.pop_EWinLogin != undefined) {
|
|
|
window.pop_EWinLogin.fn.popOut();
|
|
|
}
|
|
|
if (username == undefined) {
|
|
|
username = "";
|
|
|
}
|
|
|
var url = $.newegg.buildSSL("customer/EWinLogin.aspx?guidkey=c608f668791c213f26bf0c8b4f19e390&MerchantData=c608f668791c213f26bf0c8b4f19e390%7cSSLSite%7c&account=" + username);
|
|
|
|
|
|
var loginHtml = '<div class="Validform_info themes_red formsub popWin" id="cmb_pop" style="display:none;">\
|
|
|
<h4>ÄúÒÑ×¢²áÁË</h4>\
|
|
|
<p class="errtip">´ËÕ˺ÅÒÑÔÚÒ»Íøͨע²á£¬Äú¿ÉÒÔʹÓÃÒ»ÍøͨµÄÃÜÂëÖ±½ÓµÇ¼¡£</p>\
|
|
|
<div class="popinner">\
|
|
|
<iframe id="loginFrame" src="" height="220" width="360" scrolling="no" frameborder="0"></iframe>\
|
|
|
</div>\
|
|
|
<a href="###" class="close inblock" title="¹Ø±Õ">¹Ø±Õ</a>\
|
|
|
</div>';
|
|
|
if ($("#cmb_pop").length == 0) {
|
|
|
$("body").append(loginHtml);
|
|
|
window.pop_EWinLogin = PopWin("#cmb_pop", {
|
|
|
animate: true,
|
|
|
olOpacity: 0.5
|
|
|
});
|
|
|
}
|
|
|
$("#cmb_pop #loginFrame").attr("src", url);
|
|
|
window.pop_EWinLogin.fn.popIn();
|
|
|
}
|
|
|
|
|
|
function popMiniLogin(returnUrl, options) {
|
|
|
if (options == undefined) {
|
|
|
options = {};
|
|
|
}
|
|
|
if (returnUrl == undefined) {
|
|
|
returnUrl = "";
|
|
|
}
|
|
|
if (window.pop_miniRegister != undefined) {
|
|
|
window.pop_miniRegister.fn.popOut();
|
|
|
}
|
|
|
|
|
|
var url = $.newegg.buildSSL("customer/EWinLogin.aspx?guidkey=c608f668791c213f26bf0c8b4f19e390&MerchantData=c608f668791c213f26bf0c8b4f19e390|WWWSite|" + returnUrl + "&") + $.param(options);
|
|
|
if (options.IsFromCart == 1) {
|
|
|
var loginHtml = '<div id="pop_minilogin" class="popWin pop_minilogin" style="display: none;">\
|
|
|
<h3>¿ìËٵǼ</h3>\
|
|
|
<div class="popboy">\
|
|
|
<div class="loginBox minilogin" style="top:45px;left:0px;">\
|
|
|
<div class="boxbody">\
|
|
|
<div class="head" style="height:44px;">\
|
|
|
<img src="../WebResources/default/Nest/img/login_sprite_bg2.png" alt="" />\
|
|
|
<span>ÕÐÉÌÒøÐÐÒ»Íøͨ¡¢ÍøÉÏÉ̳ǡ¢³öÐÐÒ×Óû§¾ù¿ÉʹÓÃÊÖ»ú»òÓÊÏäÖ±½ÓµÇ¼£¬Ôݲ»Ö§³ÖÒ»ÍøͨÓû§Ê¹ÓÃ\"µÇ¼Ãû\"µÇ¼</span>\
|
|
|
</div>\
|
|
|
<div style="margin:40px 0px 0px 60px;">\
|
|
|
<iframe id="loginFrame" src="" height="220" width="360" scrolling="no" frameborder="0"></iframe>\
|
|
|
</div>\
|
|
|
<div class="bottomArea">\
|
|
|
<h4>»¹Ã»ÓÐÕ˺ţ¿</h4>\
|
|
|
<p>Ö»ÐèÒ»·ÖÖÓ£¬<a href="javascript:void(0);" onclick="popMiniRegister();" class="red">Ãâ·Ñ×¢²á</a></p>\
|
|
|
<div class="shopnow">\
|
|
|
<a href="javascript:void(0);" onclick="BizShopping.checkoutWithNoLogin();" class="shopping"><span>Ö±½Ó¹ºÂò</span></a>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
<a href="javascript:void(0);" class="close"><span class="ie6png">¹Ø±Õ</span></a>\
|
|
|
</div>';
|
|
|
} else if (options.IsDirectBuy == 1) {
|
|
|
var loginHtml = '<div id="pop_minilogin" class="popWin pop_minilogin" style="display: none;">\
|
|
|
<h3>¿ìËٵǼ</h3>\
|
|
|
<div class="popboy">\
|
|
|
<div class="loginBox minilogin" style="top:45px;left:0px;">\
|
|
|
<div class="boxbody">\
|
|
|
<div class="head" style="height:44px;">\
|
|
|
<img src="../WebResources/default/Nest/img/login_sprite_bg2.png" alt="" />\
|
|
|
<span>ÕÐÉÌÒøÐÐÒ»Íøͨ¡¢ÍøÉÏÉ̳ǡ¢³öÐÐÒ×Óû§¾ù¿ÉʹÓÃÊÖ»ú»òÓÊÏäÖ±½ÓµÇ¼£¬Ôݲ»Ö§³ÖÒ»ÍøͨÓû§Ê¹ÓÃ\"µÇ¼Ãû\"µÇ¼</span>\
|
|
|
</div>\
|
|
|
<div style="margin:40px 0px 0px 60px;">\
|
|
|
<iframe id="loginFrame" src="" height="220" width="360" scrolling="no" frameborder="0"></iframe>\
|
|
|
</div>\
|
|
|
<div class="bottomArea">\
|
|
|
<h4>»¹Ã»ÓÐÕ˺ţ¿</h4>\
|
|
|
<p>Ö»ÐèÒ»·ÖÖÓ£¬<a href="javascript:void(0);" onclick="popMiniRegister();" class="red">Ãâ·Ñ×¢²á</a></p>\
|
|
|
<div class="shopnow">\
|
|
|
<a href="javascript:void(0);" onclick="product_DirectBuy.addToCheckOut(1);" class="shopping"><span>Ö±½Ó¹ºÂò</span></a>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
<a href="javascript:void(0);" id="proDetailLogin" class="close"><span class="ie6png">¹Ø±Õ</span></a>\
|
|
|
</div>';
|
|
|
} else {
|
|
|
var loginHtml = '<div id="pop_minilogin" class="popWin pop_minilogin" style="display: none;">\
|
|
|
<h3>¿ìËٵǼ</h3>\
|
|
|
<div class="popboy">\
|
|
|
<div class="loginBox minilogin" style="top:45px;left:0px;">\
|
|
|
<div class="boxbody">\
|
|
|
<div class="head" style="height:44px;">\
|
|
|
<img src="../WebResources/default/Nest/img/login_sprite_bg2.png" alt="" />\
|
|
|
<span>ÕÐÉÌÒøÐÐÒ»Íøͨ¡¢ÍøÉÏÉ̳ǡ¢³öÐÐÒ×Óû§¾ù¿ÉʹÓÃÊÖ»ú»òÓÊÏäÖ±½ÓµÇ¼£¬Ôݲ»Ö§³ÖÒ»ÍøͨÓû§Ê¹ÓÃ\"µÇ¼Ãû\"µÇ¼</span>\
|
|
|
</div>\
|
|
|
<div style="margin:40px 0px 0px 60px;">\
|
|
|
<iframe id="loginFrame" src="" height="220" width="360" scrolling="no" frameborder="0"></iframe>\
|
|
|
</div>\
|
|
|
<div class="bottomArea">\
|
|
|
<h4>»¹Ã»ÓÐÕ˺ţ¿</h4>\
|
|
|
<p>Ö»ÐèÒ»·ÖÖÓ£¬<a href="javascript:void(0);" onclick="popMiniRegister();" class="red">Ãâ·Ñ×¢²á</a></p>\
|
|
|
<div class="shopnow"></div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
</div>\
|
|
|
<a href="javascript:void(0);" class="close"><span class="ie6png">¹Ø±Õ</span></a>\
|
|
|
</div>';
|
|
|
}
|
|
|
$("#pop_minilogin").remove();
|
|
|
if ($("#pop_minilogin").length == 0) {
|
|
|
$("body").append(loginHtml);
|
|
|
window.pop_miniLogin = PopWin("#pop_minilogin", {
|
|
|
animate: true,
|
|
|
olOpacity: 0.5
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (window.pop_miniRegister != undefined) {
|
|
|
$("#pop_minilogin #loginFrame").attr("src", url);
|
|
|
window.pop_miniLogin.fn.popIn();
|
|
|
}
|
|
|
else {
|
|
|
if (window.parent.pop_miniRegister != undefined) {
|
|
|
window.parent.pop_miniRegister.fn.popOut(false);
|
|
|
|
|
|
window.parent.pop_miniLogin.fn.popIn(false);
|
|
|
}
|
|
|
else {
|
|
|
$("#pop_minilogin #loginFrame").attr("src", url);
|
|
|
window.pop_miniLogin.fn.popIn();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
function popMiniRegister() {
|
|
|
var url = $.newegg.buildSSL("customer/miniregister.aspx");
|
|
|
var loginHtml = '<div id="pop_miniregister" class="popWin pop_miniregister" style="display: none;">\
|
|
|
<h3>\
|
|
|
¿ìËÙ×¢²á</h3>\
|
|
|
<div class="popboy">\
|
|
|
<iframe id="registerFrame" src="" height="390" width="100%" scrolling="no" frameborder="0"></iframe>\
|
|
|
</div>\
|
|
|
<a href="javascript:void(0);" class="close"><span class="ie6png">¹Ø±Õ</span></a>\
|
|
|
</div>';
|
|
|
if ($("#pop_miniregister").length == 0) {
|
|
|
$("body").append(loginHtml);
|
|
|
window.pop_miniRegister = PopWin("#pop_miniregister", {
|
|
|
animate: true,
|
|
|
olOpacity: 0.5
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (window.pop_miniLogin != undefined) {
|
|
|
window.pop_miniLogin.fn.popOut(false, function() {
|
|
|
$("#pop_miniregister #registerFrame").attr("src", url);
|
|
|
window.pop_miniRegister.fn.popIn(false);
|
|
|
});
|
|
|
} else {
|
|
|
$("#pop_miniregister #registerFrame").attr("src", url);
|
|
|
window.pop_miniRegister.fn.popIn();
|
|
|
}
|
|
|
|
|
|
} |