// 全局方法
var pop_fashion_global = {
fn: {
/*-------------------window.location-------------------*/
getLocationParameter: function () { // 获取浏览器参数
var url = location.search; //获取url中"?"符后的字串
var theRequest = {};
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest;
},
textSize: function (cssList, text) { // 通过元素获取文字宽高
var a = pop_fashion_global.fn;
var span = document.createElement("span");
var result = {};
result.width = span.offsetWidth;
result.height = span.offsetWidth;
span.style.visibility = "hidden";
span.style.cssText = "font-size:14px;line-height:1em;display:inline;padding:0;margin:0;border:none;letter-spacing:0px";
span.style.fontSize = cssList["fontsize"] !== undefined ? cssList["fontsize"] + "px" : "14px";
span.style.lineHeight = cssList["lineheight"] !== undefined ? cssList["lineheight"] : "1em";
document.body.appendChild(span);
if (typeof span.textContent != "undefined") { span.textContent = text; } else { span.innerText = text; }
result.width = span.offsetWidth - result.width;
result.height = span.offsetHeight - result.height;
span.parentNode.removeChild(span);
return result.width;
},
cutByWidth: function (str, wid, fontSize) { //通过宽度截取字符串
var a = pop_fashion_global.fn, nstr = "";
if (typeof str === "string" && wid > 0) {
var nfs = fontSize !== undefined ? fontSize : 14;
nstr = str, limit_val = wid, is_length = false;
recursionFunc(nstr);
function recursionFunc(keys) {
var nw = a.textSize({
"fontSize": nfs
}, keys);
if (nw > limit_val) {
is_length = true;
var nkey = keys.substr(0, keys.length - 1);
arguments.callee(nkey);
} else {
if (is_length === true) {
nstr = keys + "...";
} else {
nstr = keys;
}
return keys;
}
}
}
return nstr;
},
/*----------------浏览器存储-----------------*/
getSto: function (key_name) { //获取本地存储
var a = pop_fashion_global.fn;
if (window.localStorage) {
// 支持localStorage
var val = localStorage.getItem(key_name);
if (val === "undefined") {
return "undefined";
} else if (typeof val === "number") {
return val;
} else if (val) {
return JSON.parse(val) ? JSON.parse(val) : "";
}
} else {
// 用cookie
return JSON.parse(a.getCookie(key_name)) ? JSON.parse(a.getCookie(key_name)) : "";
}
},
setSto: function (key_name, data) { // 存储本地
var a = pop_fashion_global.fn;
if (window.localStorage) {
localStorage.setItem(key_name, JSON.stringify(data));
} else {
a.setCookie(key_name, JSON.stringify(data), 10000);
}
},
delSto: function (key_name) { // 删除本地存储
var a = pop_fashion_global.fn;
if (window.localStorage) {
if (localStorage.getItem(key_name)) {
localStorage.removeItem(key_name);
}
} else {
if (a.getCookie(key_name)) {
a.setCookie(key_name, "", -1);
}
}
},
setCookie: function (name, value, Days) { // 设置cookie
var exp = new Date();
exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000); //设置过期时间
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
},
getCookie: function (name) { //获取cookie
var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
if (arr != null) {
return unescape(arr[2]);
} else {
return null;
}
},
/*----------------------------事件相关-----------------------------*/
stopBubble: function (ev) { // 阻止事件冒泡
var e = ev || window.event;
if (e && e.stopPropagation) {
e.stopPropagation();
} else {
window.event.cancelBubble = true;
}
return false;
},
subAjax: function (options) { //jquery ajax封装
var opt = {
"url": "",
"ctp": "",
"data": {},
"successFunc": null,
"errorFunc": null,
"isError": true,
"header": null,
"code": "code", //状态字段名称 默认为code
"code_value": 0, //请求成功码 默认为0
"message": "message" //请求失败话术字段名 默认为message
};
opt["url"] = options["url"] ? options["url"] : "";
opt["data"] = options["data"] ? options["data"] : {};
opt["ctp"] = options["ctp"] ? options["ctp"] : "application/json";
opt["successFunc"] = options["successFunc"] ? options["successFunc"] : null;
opt["errorFunc"] = options["errorFunc"] ? options["errorFunc"] : null;
opt["isError"] = options["isError"] !== undefined ? options["isError"] : false;
opt["code"] = options["code"] ? options["code"] : "code";
opt["code_value"] = options["code_value"] !== undefined ? options["code_value"] : 0;
opt["message"] = options["message"] !== undefined ? options["message"] : "message";
if (typeof options["header"] != "undefined") {
opt["header"] = options["header"];
} else {
/*这里设置默认头部
opt["header"]={
};*/
}
$.ajax({
headers: opt["header"],
type: "POST",
url: opt["url"],
data: opt["data"],
timeout: 20000,
dataType: "json",
contentType: opt["ctp"],
success: function (data) {
if (data[opt["code"]] === opt["code_value"]) {
if (opt.successFunc && opt.successFunc instanceof Function) {
opt.successFunc(data);
}
} else {
if (opt.errorFunc && opt.errorFunc instanceof Function) {
opt.errorFunc(data);
}
if (opt["isError"] === true) {
oCommon.noPower('', data[opt["message"]]);
}
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (opt["isError"] === true) {
if (opt.errorFunc && opt.errorFunc instanceof Function) {
oCommon.noPower('', "网络似乎出现了错误,请稍后重试。");
} else {
oCommon.noPower('', "网络似乎出现了错误,请稍后重试。");
}
} else {
if (opt.errorFunc && opt.errorFunc instanceof Function) {
opt.errorFunc();
}
}
}
});
},
subAjaxGet: function (options) { //jquery ajax封装
var opt = {
"url": "",
"ctp": "",
"successFunc": null,
"errorFunc": null,
"isError": true,
"header": null,
"code": "code", //状态字段名称 默认为code
"code_value": 0, //请求成功码 默认为0
"message": "message" //请求失败话术字段名 默认为message
};
opt["url"] = options["url"] ? options["url"] : "";
opt["ctp"] = options["ctp"] ? options["ctp"] : "application/json";
opt["successFunc"] = options["successFunc"] ? options["successFunc"] : null;
opt["errorFunc"] = options["errorFunc"] ? options["errorFunc"] : null;
opt["isError"] = options["isError"] !== undefined ? options["isError"] : false;
opt["code"] = options["code"] ? options["code"] : "code";
opt["code_value"] = options["code_value"] !== undefined ? options["code_value"] : 0;
opt["message"] = options["message"] !== undefined ? options["message"] : "message";
if (typeof options["header"] != "undefined") {
opt["header"] = options["header"];
} else {
/*这里设置默认头部
opt["header"]={
};*/
}
$.ajax({
headers: opt["header"],
type: "GET",
url: opt["url"],
timeout: 20000,
dataType: "json",
contentType: opt["ctp"],
success: function (data) {
if (data[opt["code"]] === opt["code_value"]) {
if (opt.successFunc && opt.successFunc instanceof Function) {
opt.successFunc(data);
}
} else {
if (opt.errorFunc && opt.errorFunc instanceof Function) {
opt.errorFunc(data);
}
if (opt["isError"] === true) {
oCommon.noPower('', data[opt["message"]]);
}
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (opt["isError"] === true) {
if (opt.errorFunc && opt.errorFunc instanceof Function) {
oCommon.noPower('', "网络似乎出现了错误,请稍后重试。");
} else {
oCommon.noPower('', "网络似乎出现了错误,请稍后重试。");
}
} else {
if (opt.errorFunc && opt.errorFunc instanceof Function) {
opt.errorFunc();
}
}
}
});
}
}
};
/*--------------------------2018/8/23 新增指纹识别技术------------------------------*/
!function(){
var fingerprint_hash=pop_fashion_global.fn.getCookie('userport_hash_print') || '';
if(fingerprint_hash==''){
new Fingerprint2().get(function(result,componts){
console.log(result)
fingerprint_hash=result;
pop_fashion_global.fn.setCookie('userport_hash_print',fingerprint_hash,365);
});
};
}();
var brandAll;
oCommon = {
// 顶部所有站显示与隐藏
'handleAllWeb': function () {
var $left = $('.leftT li.webIco');
var $conleft = $('.conleft');
var $allweb = $('.allWeb');
$left.on('mouseenter', function () {
$allweb.css('display', 'block');
});
$left.on('mouseleave', function () {
$allweb.css('display', 'none');
});
},
// 导航栏行业筛选
'industrySelect': function () {
var $navsx = $(".js-switch-area");
var $navlist = $('.navshaixuan-list');
$navsx.on('mouseover mouseleave', function (e) {
if (e.type == 'mouseover') {
$navlist.css('display', 'block');
} else if (e.type == 'mouseleave') {
$navlist.css('display', 'none');
}
});
},
// 客户服务下拉
'specialList': function () {
var timer;
var $sdown = $(".special_down");
var $slist = $(".special_list");
$sdown.on('mouseover', function () {
clearTimeout(timer);
$slist.css('display', 'block');
});
$sdown.on('mouseleave', function () {
timer = setTimeout(function () {
$slist.css('display', 'none');
}, 200);
});
},
// 窗口滚动时搜索框改变且出现回到顶端按钮
'windowScroll': function () {
var obj = this;
$(window).scroll(function () {
var scrollTop = $(this).scrollTop();
var $searchLi = $('.searchLi');
var $searchIn = $('.searchIn');
var $backTop = $('#backTop');
if (scrollTop > 40) {
// $searchLi.off('mouseenter');
// $searchIn.off('mouseleave');
// $searchLi.hide();
// $searchIn.fadeIn(200);
$backTop.fadeIn(100);
} else {
// $searchIn.stop(true,true).fadeOut(200);
// $searchLi.show();
$('#backTop').fadeOut(100);
// obj.headSearch();
}
});
},
/*底部广告*/
'bottomAds': function () {
var par = $("#footwrap");
var $self = $('#footwrap .closebtn');
var is_close = false;
$self.on('click', function () {
par.hide();
is_close = true;
});
function adsScroll() {
if (is_close == true) { return; }
var scrollTop = $(window).scrollTop();
if (scrollTop == 0) {
par.hide();
} else if (scrollTop > 0) {
par.show();
}
};
adsScroll();
$(window).scroll(function () {
adsScroll()
});
},
/*回到顶部*/
'backTop': function () {
$('#backTop').on('click', function () {
$("html,body").animate({ scrollTop: 0 }, 1000);
});
},
/*右侧小导航*/
'rightNav': function () {
var lis = $(".nav_fixed li");
lis.on('mouseenter mouseleave', function (e) {
if (e.type == 'mouseenter') {
$(this).find("i").stop(true, true).show(200).end().find(".show_left").stop(true, true).show(200);
} else {
$(this).find("i").stop(true, true).hide(100).end().find(".show_left").stop(true, true).hide(200);
}
});
// pop地图
$(".js-pop-map").on("mouseenter mouseleave", function (e) {
if (e.type == "mouseenter") {
$(this).find(".js-map-show").stop(true, true).show(200);
$(this).find(".js-arrow-map").show();
$(this).find(".js-map-img>iframe").attr("src", "http://www.pop-fashion.com/service/address/");
} else {
$(this).find(".js-map-show").stop(true, true).hide(100);
$(this).find(".js-arrow-map").hide();
$(this).find(".js-map-img>iframe").attr("src", "");
}
});
// pop地图定位
if ($(".js-pop-map").length) {
var mapTop = $(".js-pop-map")[0].getBoundingClientRect().top;
var windowHei = $(window).height();
var boxHei = parseInt(windowHei - mapTop);
if (boxHei < 370) {
$(".js-map-show").addClass("ab-fixed").removeClass("ab-absolute");
} else {
$(".js-map-show").addClass("ab-absolute").removeClass("ab-fixed");
}
}
},
'noPower': function (no_type, content) {
var no_type = parseInt(no_type);
var L = '';
if (!content) {
switch (no_type) {
case -1: L = '对不起,只有VIP用户才能使用此功能!'; break;
case -2: L = '对不起,只有设计师专属账号才能使用此功能,
请您添加或登录设计师专属账号!'; break;
case -3: L = '对不起,只有VIP用户才能访问该栏目!'; break;
case -4: L = '对不起,操作失败,请重试!'; break;
case -5: L = '对不起,只有VIP用户才能使用此功能,
请立即升级为本站VIP会员获取最新流行资讯!'; break;
case -6: L = '对不起,您正在浏览的是会员内容...
由于您尚未注册或登录,暂无权限查看详情,如需帮助请联系我们。'; break;
case -7: L = '对不起,您正在浏览的是会员内容...
由于您尚未成为VIP会员,暂无权限查看详情,如需帮助请联系我们。'; break;
case 1: L = '操作成功!'; break;
}
}
else {
L = content;
}
var shtml = '
' + L + '
'; //页面层-自定义 var oNoPowerLayer = layer.open({ type: 1, title: false, // scrollbar:false, closeBtn: 0, skin: 'quanxian_cont', area: ['550px', '115px'], maxWidth: '660px', content: shtml }); $('.quanxian_cont .qx_close').click(function () { layer.close(oNoPowerLayer); }); }, // 信息回馈 'feedback': function () { var $box = $('#txtArea'); var txtVal = $box.text(); $box.inputText({ txt: txtVal, lightColor: "#ccc", color: "#ccc", fontSize: "14px" }); $('#feedback').on('click', function () { var feedBackVal = $('#txtArea').val(); if (feedBackVal == '' || feedBackVal == '请输入您的反馈信息......') { oCommon.noPower('', '请输入您的反馈信息!!'); return false; } else { $.ajax({ type: 'POST', dataType: 'json', data: { feedBackVal: feedBackVal }, url: '/Ajax/userFeedBack/', success: function (data) { oCommon.noPower('', data.msg); $('#txtArea').val('请输入您的反馈信息......'); } }); }; }); }, 'collect': function (_this, iColumnId, sTableName, iPriId, iType, callback, status, para) { var that = this; if (status == 0) { var text = '您是否确认取消收藏?'; var url = '/collect/setcollect/' + iColumnId + '-' + sTableName + '-' + iPriId + '-' + iType + '-' + para + '/cancel/?' + Math.random(); } else { var text = '您是否确认收藏?'; var url = '/collect/setcollect/' + iColumnId + '-' + sTableName + '-' + iPriId + '-' + iType + '-' + para + '/?' + Math.random(); } //确认框 $.ajax({ type: 'get', url: url, anyc: true, success: function (e) { e = parseInt(e); if (e < 0) { that.noPower(e); return; } else { if (typeof callback == 'function') { callback(); } else { window.location.href = location.href; return; } } } }); }, 'loginLayer': function () { //登录弹框 var loginLayer = layer.open({ type: 2, title: false, closeBtn: 0, shade: [0.8, '#000'], area: ['840px', '540px'], content: ['/member/login/', 'no'] // iframe的url }); }, 'download': function (path) { window.location.href = '/download/dlsingle/?dl_link=' + encodeURIComponent(path) + '&' + Math.random(); }, //提示信息闪烁 'flicker': function () { var o = $(".wran"), i = 0, c = "tour_cus", times = 6; var t = setInterval(function () { i++; if (i % 2) { o.addClass(c); } else { o.removeClass(c); } if (i == times) { clearInterval(t); } }, 300); }, 'clickBeforeFlicker': function (obj) { return true; // 游客或者普通用户 var power = parseInt($('#link').data('pow')); if (power == 1 || power == 2) { if (typeof obj != 'undefined') { $(obj).parents('.showbox,.showdiv').css({ visibility: 'hidden' }); } this.flicker(); return false; } return true; }, // 行业性别筛选 'giClick': function () { var obj = this; // 性别行业点击处理 $('a[id^=gi_]').on('click', function () { var $box = $(this); var info = $box.prop('id').replace(/gi_/gi, ''); var infoa = info.split('_'); var type = parseInt(infoa[0]); var val = parseInt(infoa[1]); obj.replaceGI(val, type); }); }, 'replaceGI': function (val, type) { var name, pattern, pattern1, pattern2, alias, gcen; var rtrimSep = /\/+$/; var _anchor = '#anchor'; switch (type) { case 142: name = 'gender'; alias = 'gen_'; gcen = /\-?gcen_\d+/gi; pattern = /gen_\d+/gi; pattern1 = /\/\-?gen_\d+\-?/gi; pattern2 = /\-?gen_\d+/gi; break; case 158: name = 'industry'; alias = 'ind_'; gcen = ''; pattern = /ind_\d+/gi; pattern1 = /\/\-?ind_\d+\-?/gi; pattern2 = /\-?ind_\d+/gi; break; } if (val) { $.cookie(name, val, { domain: '.pop-fashion.com', path: '/' }); } // 删除 else { $.cookie(name, "", { domain: '.pop-fashion.com', path: '/', expires: -1 }); // 清除COOKIE } var url = window.location.href; url = url.replace(_anchor, '').replace(/[?&]m=[\.\d]+/gi, ''); // 页码如果存在则将页码去掉 if (url.indexOf('-page_') !== -1) { var reg = RegExp('-page_([^-]*)', 'gi'); url = url.replace(reg, ''); } else if (url.indexOf('page_') !== -1) { var reg = RegExp('page_([^-]*)', 'gi'); url = url.replace(reg, ''); } // 为了照顾款式在选择童装时可以筛选男童或女童而做的特殊处理 // 有则改之 if (pattern.test(url)) { // 全部时清除性别或行业 if (val == 0) { if (/\?key=/gi.test(url)) { var key = url.replace(/(.*)(\/\?key=.*)/gi, '$1|||$2'); var info = key.split('|||'); var _url = info[0]; var _key = info[1]; if (/\_/.test(_url)) { _url = _url.replace(pattern1, '/').replace(pattern2, ''); } _url = _url.replace(gcen, '').replace(rtrimSep, ''); url = _url + _key; } else { url = url.replace(pattern1, '/').replace(pattern2, '').replace(gcen, '').replace(rtrimSep, '') + '/'; } } else { if (/\?key=/gi.test(url)) { url = url.replace(pattern, alias + val).replace(gcen, ''); } else { url = url.replace(pattern, alias + val).replace(gcen, '').replace(rtrimSep, '') + '/'; } } } // 无则加勉 else { if (val) { // 带关键字 if (/\?key=/gi.test(url)) { var key = url.replace(/(.*)(\/\?key=.*)/gi, '$1|||$2'); var info = key.split('|||'); var _url = info[0].replace(gcen, '').replace(rtrimSep, ''); var _key = info[1]; if (/\_/.test(_url)) { _url = _url.replace(rtrimSep, '') + '-' + alias + val; } else { _url += '/' + alias + val; } url = _url + _key; } else { url = url.replace(gcen, '').replace(rtrimSep, '') + '/'; if (/\_/.test(url)) { url = url.replace(rtrimSep, '') + '-' + alias + val; } else { url += alias + val; } url = url.replace(rtrimSep, '') + '/'; } } else { // 带关键字 if (/\?key=/gi.test(url)) { // 不带随机数 if (!/m=/gi.test(url)) { url += '&m=' + Math.random(); } else { url = url.replace(/&m=[\.\d]+/gi, '&m=' + Math.random()); } } else { // 带随机数 if (!/m=/gi.test(url)) { url += '?m=' + Math.random(); } else { url = url.replace(/\?m=[\.\d]+/gi, '?m=' + Math.random()); } } } } window.location.href = url + _anchor; }, 'delGIClick': function () { //点击x,删除本身的条件 $(".del_self").on('click', function () { var _url = $(this).data('url'); if (_url == '#') { var url = window.location.href; // 改URL // 为了照顾款式在选择童装时可以筛选男童或女童而做的特殊处理 // 有则删之 if (/gen_\d+/.test(url)) { url = url.replace(/\-?gen_\d+/, '').replace(/\/+$/, '') + '/'; } $.cookie('gender', "", { domain: '.pop-fashion.com', path: '/', expires: -1 }); // 清除COOKIE window.location.href = url; } // 行业 else if (_url == '##') { var url = window.location.href; // 改URL // 为了照顾款式在选择童装时可以筛选男童或女童而做的特殊处理 // 有则删之 if (/ind_\d+/.test(url)) { url = url.replace(/\-?ind_\d+/, '').replace(/\/+$/, '') + '/'; } $.cookie('industry', "", { domain: '.pop-fashion.com', path: '/', expires: -1 }); window.location.href = url; } else { window.location.href = _url; } }); //点击性别或行业条件,删除本身的cookie值 $(".del").on('click', function () { var val = $(this).attr('href'); // 点击不做处理 if (val == '#' || val == '##') { return false; } // 性别 if (val == '#') { var url = window.location.href; // 改URL // 为了照顾款式在选择童装时可以筛选男童或女童而做的特殊处理 // 有则删之 if (/gen_\d+/.test(url)) { url = url.replace(/\-?gen_\d+/, '').replace(/\/+$/, '') + '/'; } $.cookie('gender', "", { domain: '.pop-fashion.com', path: '/', expires: -1 }); window.location.href = url; } // 行业 else if (val == '##') { var url = window.location.href; // 改URL // 为了照顾款式在选择童装时可以筛选男童或女童而做的特殊处理 // 有则删之 if (/ind_\d+/.test(url)) { url = url.replace(/\-?ind_\d+/, '').replace(/\/+$/, '') + '/'; } $.cookie('industry', "", { domain: '.pop-fashion.com', path: '/', expires: -1 }); window.location.href = url; } }); }, // 隐藏微信分享 hiddenWXshare: function () { $('#bdshare_weixin_qrcode_dialog_bg,#bdshare_weixin_qrcode_dialog').remove(); }, // 共 757743 个相关款式=>共 75... 个相关款式 // ellipsis:function(){ // var $result = $('#s_result'); // var w920 = parseInt($('.w920').width()); // if (w920 == 1220) { // $result.find('.findstyle a').css('max-width','auto'); // $result.find('.btn_page span.totalN').css({maxWidth: 'auto'}); // } else if(w920 == 920){ // $result.find('.findstyle a').css('max-width','40px'); // $result.find('.btn_page span.totalN').css({maxWidth:'28px'}); // } // }, // 大图缩放拖拽 SetImg: function (obj, maxW, maxH) { //初始化大图图片 var temp_img = new Image(); temp_img.onload = function () { var imgH = temp_img.height; var imgW = temp_img.width; //计算图片最大宽度 if ((imgW > maxW) && (imgW > imgH)) { obj.width = maxW; obj.height = imgH * (maxW / imgW); imgW = obj.width; imgH = obj.height; if (imgH > maxH) { obj.height = maxH; obj.width = imgW * (maxH / imgH); } } //计算图片最大高度 if ((imgH > maxH) && (imgH > imgW)) { obj.height = maxH; obj.width = imgW * (maxH / imgH); imgW = obj.width; imgH = obj.height; if (imgW > maxW) { obj.width = maxW; obj.height = imgH * (maxW / imgW); } } if ((imgW > maxW) && (imgW == imgH)) { obj.width = maxW; obj.height = imgH * (maxW / imgW); imgW = obj.width; imgH = obj.height; if (imgH > maxH) { obj.height = maxH; obj.width = imgW * (maxH / imgH); } } if ((imgW < maxW || imgW == maxW) && (imgH < maxH || imgH == maxH)) { obj.width = imgW; obj.height = imgH; } obj.width = imgW; obj.height = imgH; }; temp_img.src = obj.src; }, //栏目引导页 参数为引导页显示的位置 款式库 style 品牌库 brand 灵感源 inspiration 其他 other 报告 report 弹层 layer 交叉 mutual 工作台 workbench guidelayer: function (position) { var guide = $.cookie('guide') ? $.cookie('guide') : ''; guide = guide.split('-'); switch (position) { // case 'style'://款式库 1 // var $style = $('.shadow_index, .style_guide'); // if ($.inArray('1', guide) != -1) { // $style.hide(); // } else { // $style.show(); // guide.push('1'); // } // $('body').on('click', '.shadow_index, .style_guide, .styleKnow', function () { // $style.hide(); // }) // break; // case 'brand'://品牌库 2 // var $brand = $(".shadow_index1, .brand_guide"); // if ($.inArray('2', guide) != -1) { // $brand.hide(); // } else { // $brand.show(); // var step3=$(".brand_guide .brandStep3") // if(step3.length){ // var scrollN = step3.position().top; // $('html,body').animate({scrollTop:(scrollN -150) +'px'}, 500); // } // guide.push('2'); // } // $('body').on('click', '.shadow_index1, .brand_guide, .brandKnow', function () { // $brand.hide(); // }) // break; // case 'inspiration'://灵感源 3 // var $inspiration = $(".shadow_index2, .insp_guide"); // if($.inArray('3', guide) != -1){ // $inspiration.hide(); // }else { // $inspiration.show(); // guide.push('3'); // } // $('body').on('click', '.shadow_index2, .insp_guide, .inspKnow', function () { // $inspiration.hide(); // }) // break; // case 'other'://其他 4 // var $other = $(".shadow_index3, .a_guide"); // if($.inArray('4', guide) != -1){ // $other.hide(); // }else { // $other.show(); // guide.push('4'); // } // $('body').on('click', '.shadow_index3, .a_guide, .allKnow', function () { // $other.hide(); // }) // break; // case 'report'://报告弹层 5 // var $report = $(".report_guide, .shadow_index7"); // if($.inArray('5', guide) != -1){ // $report.hide(); // }else { // $report.show(); // guide.push('5'); // } // $('body').on('click', '.report_guide, .shadow_index7, .reportKnow', function () { // $report.hide(); // }) // break; // case 'layer'://款式弹层 6 // var $layer = $('.shadow_index6, .dlayer_guide'); // if($.inArray('6', guide) != -1){ // $layer.hide(); // }else { // $layer.show(); // guide.push('6'); // } // $('body').on('click', '.shadow_index6, .dlayer_guide, .dlayerKnow', function () { // $layer.hide(); // }) // break; // case 'mutual'://交叉 7 // var $mutual = $(".shadow_index5, .mu_guide"); // if($.inArray('7', guide) != -1){ // $mutual.hide(); // }else { // $mutual.show(); // guide.push('7'); // } // $('body').on('click', '.shadow_index5, .mu_guide, .muKnow', function () { // $mutual.hide(); // }) // break; // case 'workbench'://工作台 8 // var $workbench = $(".shadow_index4, .wookbench_guide"); // if($.inArray('8', guide) != -1){ // $workbench.hide(); // }else { // $workbench.show(); // guide.push('8'); // } // $('body').on('click', '.shadow_index4, .wookbench_guide, .wbKnow', function () { // $workbench.hide(); // }) // break; case 'ispc'://是否是pc端 9 var $ispc = $(".m_layer"); if ($.inArray('9', guide) != -1) { $ispc.hide(); } else { $ispc.show(); guide.push('9'); } case 'movelayer'://快反应页面动画 var $movetop = $(".moveLogo"); if ($.inArray('10', guide) != -1) { $movetop.addClass('nomove'); $movetop.removeClass('movelayer'); } else { $movetop.removeClass('nomove'); $movetop.addClass('movelayer'); guide.push('10'); } } var guideVal = guide.join('-').replace(/^-/, '').replace(/-$/, ''); $.cookie('guide', guideVal, { expires: 365, path: '/', domain: '.pop-fashion.com' });//一年 }, // 全站搜索时,将性别或行业追加到URL里面 // 返回值 gen_x||ind_x||空 x=数字 getGenIndInfo: function () { var gen, ind; var url = location.href; var genPattern = /.*gen_(\d+)?.*/; var indPattern = /.*ind_(\d+)?.*/; // URL优先 // 有性别 if (genPattern.test(url)) { gen = parseInt(url.replace(genPattern, '$1')); } else { gen = parseInt($.cookie('gender')); } if (indPattern.test(url)) { ind = parseInt(url.replace(indPattern, '$1')); } else { ind = parseInt($.cookie('industry')); } // cookie if (gen && ind) { return 'gen_' + gen + '-' + 'ind_' + ind + '/'; } else if (gen) { return 'gen_' + gen + '/'; } else if (ind) { return 'ind_' + ind + '/'; } else { return ''; } }, getDelGenIndInfo: function () { var url = location.href; var genPattern = /-?gen_\d+-?/; var indPattern = /-?ind_\d+-?/; if (genPattern.test(url)) { url = url.replace(genPattern, ''); } if (indPattern.test(url)) { url = url.replace(indPattern, ''); } url = url.replace(/\/\/\?/, '/?'); // 有隐患 return url; }, //游客/普通用户/试用会员 各类下载功能屏蔽 downloadPrivilege: function () { if ($.inArray(P_UserType.toString(), ['3', '4', '5']) > -1) { oCommon.noPower(-5);//提示文案 return false; } // console.log(P_UserType); return true; }, //特殊字符替换 popReplace: function (str) { str = str.replace(//g, 'pop390').replace(/-/g, 'pop380').replace(/_/g, 'pop381').replace(/~/g, 'pop382').replace(/!/g, 'pop383').replace(/\./g, 'pop384').replace(/\*/g, 'pop385').replace(/\(/g, 'pop386').replace(/\)/g, 'pop387').replace(/&/g, 'pop388').replace(/\'/g, 'pop391').replace(/\+/g, 'pop392').replace(/\#/g, 'pop35'); return str; }, // 显示自定义提示层 showTips: function (content, time) { time = time || 2000; layer.open({ type: 0, area: ['240px'], title: false, closeBtn: false, btn: [], shade: 0.4, time: time, shade: 0, skin: 'demo-class', content: '近日更新
'+(style.count||0)+'款近日更新
'+(pattern.count||0)+'款近日更新
'+(runways.count||0)+'场品牌趋势
'+(brands.count||0)+'