/* 未能缩小。正在返回未缩小的内容。
(449,1-2): run-time warning JS1002: Syntax error: }
*/
$(function () {
var Controller = $("#menu_list_id").val();
var WebConfig = $("#webfig").val();
//顶部查询--------------------------------------开始----------------------------------
var st = 0;
$(".show_link").mouseenter(function () {
var link = $(this).attr("values");
if (st == 0) {
$(".list_link .top_search_3").each(function () {
var val = $(this).attr("values");
if (val == link) {
$(this).hide().siblings().show();
}
})
$(".list_link").show();
st = 1;
}
})
var controllerStr = $("#menu_list_id").val();
var defaulttxt = $("." + controllerStr).text();
var claass = $(".show_link").attr("values");
$(".show_link").removeClass(claass).addClass(controllerStr).text(defaulttxt).attr("values", controllerStr);
$(".list_link").hide();
$("#Search_div").mouseleave(function () {
$(".list_link").hide();
st = 0;
})
$(".list_link .top_search_3").click(function () {
var val = $(this).attr("values");
var txt = $(this).text();
var claass = $(".show_link").attr("values");
$(".show_link").removeClass(claass).addClass(val).text(txt).attr("values", val);
$(".list_link").hide();
st = 0;
})
//点击查询
$(".top_search_r").click(function () {
var SearchValues = $(".top_search_c").val();
var Controllers = $(".show_link").attr("values");
var url = WebConfig + "/" + Controllers + "/QueryLink?SearchValues=" + SearchValues;
ShadeShowBg(true);
window.location.href = url;
})
//顶部查询--------------------------------------结束----------------------------------
//选择条件切换效果------------------------------开始----------------------------------
$(".menu1").mouseenter(function () {
$(this).removeClass("outa").addClass("ina").siblings().addClass("outa").removeClass("ina");
var values = $(this).attr("values");
if (values == "1") {
$("#list_c").show().siblings().hide();
}
if (values == "2") {
$("#list_b").show().siblings().hide();
}
if (values == "3") {
$("#list_I").show().siblings().hide();
}
})
//选择条件切换效果------------------------------结束----------------------------------
//品牌------------------------------------------开始----------------------------------
$("#brand_return").hide();
//品牌更多展开效果
$("#brand_more").click(function () {
//初始化更多默认值
$.post(WebConfig + "/select/GetBrand", { pinyin: "a", brandname: "" }, function (data) {
$(".gdt1").html(data);
})
$("#brand_list_more").show();
$(".brand_A").addClass("js1ina").removeClass("js1outa")
$("#brand_list").hide();
$("#brand_return").show();
$(this).hide();
})
//品牌更多收起效果
$("#brand_return").click(function () {
$(this).removeClass("js1outa").addClass("js1ina").parent().siblings().find(".sp_a").find("a").addClass("js1outa").removeClass("js1ina");
$("#brand_list_more").hide();
$("#brand_list").show();
$("#brand_more").show();
$(this).hide();
})
//$("input").attr("disabled", "disabled");
//品牌-更多 鼠标进入切换效果
$(".zimu").live("click", function () {
$(this).removeClass("js1outa").addClass("js1ina").parent().siblings().find("a").addClass("js1outa").removeClass("js1ina");
var zimu = $(this).text();
$.post(WebConfig + "/select/GetBrand", { pinyin: zimu, brandname: '' }, function (data) {
$(".gdt1").html(data);
})
})
//品牌-更多-搜索效果
$("#BrandSeach_text").keyup(function () {
var txt = $(this).val();
var zimu = $(".js1ina").text();
//查询
$.post(WebConfig + "/select/GetBrand", { pinyin: zimu, brandname: txt }, function (data) {
$(".gdt1").html(data);
})
})
//品牌------------------------------------------结束----------------------------------
////猜你喜欢--------------------------------------开始----------------------------------
//$.ajax({
// url: "http://new.gkw.cn/Action/GuessLikeAction.ashx?action=GetHtml&HorS=2&PageType=3&showstyle=1&ChannelType=4&count=3&Channel=1&callback=?",
// dataType: "jsonp",
// jsonpCallback: "person",
// success: function (data) {
// $("#guess").html(data.value);
// }
//});
////猜你喜欢--------------------------------------结束----------------------------------
//来源选择--------------------------------------开始----------------------------------
var fromtype = $("#h_fromType").val();
$("#S_SelectMain").val(fromtype)
$("#S_SelectMain").change(function () {
var thisval = $(this).val();
var url ="";
if (thisval != 0) {
url = WebConfig + "/select/QueryLink?pageIndex=1&pageSize=10&sort=0&SearchValues=&sortType=1&fromType=" + thisval;
}
else {
url = WebConfig + "/select/QueryLink?pageIndex=1&pageSize=10&sort=0&SearchValues=&sortType=1";
}
window.location.href = url;
})
//来源选择--------------------------------------结束----------------------------------
})
//邮箱验证
function chkEmail(strEmail) {
if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(strEmail)) {
return false;
}
else {
return true;
}
}
//正整数验证
function isPInt(str) {
var g = /^[1-9]*[1-9][0-9]*$/;
return g.test(str.trim());
};//显示灰色 jQuery 遮罩层
function ShadeShowBg(isshowdialog) {
var bh = document.body.scrollHeight;//$("body").height();
var bw = $("body").width();
$("#shadefullbg").css({
height: bh,
width: bw,
display: "block"
});
if (isshowdialog) {
$("#shadedialog").show();
}
else {
$("#shadedialog").hide();
}
}
//关闭灰色 jQuery 遮罩
function ShadeCloseBg() {
$("#shadefullbg,#shadedialog").hide();
}
document.write("");
document.write("
");
document.write("");
document.write("
");
document.write("
");
document.write("
");
document.write("");
;//记录页面访问日志
//comePageType 来源 pagelist |pageinfo |pagedefault
//elementType 内容类型
//companyCode 公司Code
//elementCode 内容Code
//下面是各自对应的不同的类型(elementType )设置,可参考使用,如果不能满足需求,需要自己定义一定规则的类型
//详情页:
//新闻news|产品product|文章paper|资料datum|供求trade|公司company |销售sale|库存stock|专题Special|市场活动Marketing
//应用频道类型:
//applyindex
//applynews
//applycompany
//applyproduct
//applydesign
//产品频道类型
//pc_index
//pc_news
//pc_datum
//pc_paper
//pc_trade
//pc_company
//pc_select
//pc_design
//pc_buy
//pc_install
//pc_use
//pc_MRO
//需求链频道
//link_index
//link_select
//link_design
//link_buy
//link_install
//link_use
//link_MRO
//link_upgrade
//其他频道首页:
//newsindex
//datumindex
//tradeindex
//companyindex
//Marketingindex
//saleindex
//新闻列表页 newslist
function RecordLog(comePageType, elementType, companyCode, elementCode) {
//用户直接读取Cookie
//记录日志tracing
var userCode = GetCookie("TracingInfo", "UserID");
var url = "http://srv.gongkong.com/GongKongRedis.aspx?cf=gongkong&ch=" + comePageType + "&wh=" + escape(window.location.href) + "&et=" + elementType + "&uid=" + userCode + "&cid=" + companyCode + "&aid=&id=" + elementCode + "&pre=" + escape(document.referrer);
//$("body").append("");
$.ajax({
url: url,
type: "GET",
dataType: "jsonp",
jsonp: "jsoncallback",
data: null,
async: false,
success: function (data) { }
});
}
//专为广告专栏广告用的日志记录
//companyCode,广告关联的公司code
//adid,广告id
function RecordLogAD(companyCode, adid) {
//用户直接读取Cookie
//记录日志tracing
var userCode = GetCookie("TracingInfo", "UserID");
var url = "http://srv.gongkong.com/GongKongRedis.aspx?cf=gongkong&ch=pageinfo&wh=" + escape(window.location.href) + "&et=adv&uid=" + userCode + "&cid=" + companyCode + "&aid=" + adid + "&id=" + adid + "&pre=" + escape(document.referrer);
//$("body").append("");
$.ajax({
url: url,
type: "GET",
dataType: "jsonp",
jsonp: "jsoncallback",
data: null,
async: false,
success: function (data) { }
});
}
function RecordLogUrl(comePageType, elementType, companyCode, elementCode, elementUrl) {
//用户直接读取Cookie
//记录日志tracing
var userCode = GetCookie("TracingInfo", "UserID");
var url = "http://srv.gongkong.com/GongKongRedis.aspx?cf=gongkong&ch=" + comePageType + "&wh=" + escape(elementUrl) + "&et=" + elementType + "&uid=" + userCode + "&cid=" + companyCode + "&aid=&id=" + elementCode;
//$("body").append("");
$.ajax({
url: url,
type: "GET",
dataType: "jsonp",
jsonp: "jsoncallback",
data: null,
async: false,
success: function (data) {
}
});
}
function GetCookie(sMainName, sSubName) {
var re = new RegExp((sSubName ? sMainName + "=(?:.*?&)*?" + sSubName + "=([^&;$]*)" : sMainName + "=([^;$]*)"), "i");
return re.test(unescape(document.cookie)) ? RegExp["$1"] : "";
}
//记录日志并跳转
//jumpUrl不为空跳转到jumpUrl
//jumpTarget:“_blank” "_self"
function RecordLogJump(comePageType, elementType, companyCode, elementCode, jumpUrl, jumpTarget) {
//记录日志tracing
RecordLogUrl(comePageType, elementType, companyCode, elementCode, jumpUrl);
if (jumpUrl != null && jumpUrl != "undefined" && jumpUrl != "") {
switch (jumpTarget) {
case "_blank":
window.open(jumpUrl, "_blank");
break;
default:
window.location.href = jumpUrl;
break;
}
}
}
//为了测试是否通过js记录进去了
function RecordLogTest(elementType, companyCode, elementCode) {
//用户直接读取Cookie
//记录日志tracing
var userCode = GetCookie("TracingInfo", "UserID");
var url = "http://c.gongkong.com/WebForms/TestLog.aspx?flag=300&wh=" + escape(window.location.href) + "&et=" + elementType + "&uid=" + userCode + "&cid=" + companyCode + "&id=" + elementCode;
$.ajax({
url: url,
type: "GET",
dataType: "jsonp",
jsonp: "jsoncallback",
data: null,
async: false,
success: function (data) { }
});
}
function HitLog(keyword,url)
{
//$.ajax({
// url: "//s.gongkong.com/webapi/InLineLog?wd=" + keyword+"url="+url,
// type: "GET",
// dataType: "jsonp",
// jsonp: "jsoncallback",
// data: null,
// async: false,
// success: function (data) {
// console.log(data);
// }
//});
$.post('//s.gongkong.com/webapi/InLineLog',
{
wd: keyword,
url: url
}, function (data) {
console.log(data)
});
}
;//���ض���
function a(x, y) {
l = $('#main').offset().left;
w = $('#main').width();
$('#tbox').css('left', (l + w + x) + 'px');
$('#tbox').css('bottom', y + 'px');
}
function b() {
h = $(window).height();
t = $(document).scrollTop();
if (t > h) {
$('#gotop').fadeIn('slow');
} else {
$('#gotop').fadeOut('slow');
}
}
$(document).ready(function (e) {
a(10, 10);//#tbox ��
b();
$('#gotop').click(function () {
$(document).scrollTop(0);
})
});
$(window).resize(function () {
a(10, 10);//#tbox
});
$(window).scroll(function (e) {
b();
}) ;/*
by zjw 2013-10-11
图片等比缩放,并且在容器中居中显示。一定要在img的onload事件中调用
*/
function imgReset(img, maxWidth, maxHeight) {
var imgWidth = img.offsetWidth;
var imgHeight = img.offsetHeight;
//高图,以高为准
if (parseFloat(maxWidth) / parseFloat(maxHeight) > parseFloat(imgWidth) / parseFloat(imgHeight)) {
var width = parseInt(imgWidth * maxHeight / imgHeight);
img.style.height = maxHeight + "px";
img.style.width = width + "px";
if (img.parentNode.tagName == "A") {
img.parentNode.style.height = maxHeight + "px";
img.parentNode.style.width = width + "px";
img.parentNode.style.display = "block";
img.parentNode.style.marginLeft = parseInt((maxWidth - width) / 2) + "px";
} else {
img.style.marginLeft = parseInt((maxWidth - width) / 2) + "px";
}
}
else {//宽图,以宽为准
var height = parseInt(imgHeight * maxWidth / imgWidth);
img.style.height = height + "px";
img.style.width = maxWidth + "px";
if (img.parentNode.tagName == "A") {
img.parentNode.style.height = height + "px";
img.parentNode.style.width = maxWidth + "px";
img.parentNode.style.display = "inline-block";//兼容ie7,在ie7下margin-top失效
img.parentNode.style.marginTop = parseInt((maxHeight - height) / 2) + "px";
} else {
img.style.marginTop = parseInt((maxHeight - height) / 2) + "px";
}
}
}
;/*百度推广代码,加到标签内---20160318*/
var _hmt = _hmt || [];
(function () {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?187676c35ec498cf9260061a5c85ce68";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
//(function (i, s, o, g, r, a, m) {
// i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
// (i[r].q = i[r].q || []).push(arguments)
// }, i[r].l = 1 * new Date(); a = s.createElement(o),
// m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
//})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
//ga('create', 'UA-83023020-1', 'auto');
//ga('send', 'pageview');
//镜像网站跳转处理----begin----
//var host = window.location.host;
//var site = "www.gongkong.com";
//if (host != site) {
// alert(window.location.host + ':为非法镜像网站,为了您的安全正在带您回到原网站');
// //location.href = 'http://' + site + window.location.pathname;
// location.href = 'http://www.gongkong.com';
//}
//镜像网站跳转处理----end----;(function () {
var bp = document.createElement('script');
bp.src = '//push.zhanzhang.baidu.com/push.js';
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
;