// JavaScript Document /* * pathway, target 的 pdf 下载,名称换行 * 名称小于3行的时候,采用 word-warp: break-word 换行 * 名称大于3行的时候,采用 word-break: break-all 换行 * 如果pathway, pathway 名称里面的单个单词比包含块宽,采用 break-all 换行 */ $(function () { var oPdfName = $(".pdf-name"); var iPdfNameWidth = oPdfName.width(); var iHeight = parseInt($(oPdfName).css("height")); var iLineHeight = parseInt($(oPdfName).css("line-height")); var iLineNum = parseInt(iHeight/iLineHeight); var sPdfName = $(oPdfName).text(); var apdfName = []; apdfName = sPdfName.split(" "); for(var i = 0; i < apdfName.length; i++){ $(".pdf-name-width").text(apdfName[i]); var iPdfNameWidth = $(".pdf-name-width").width(); if(iPdfNameWidth > oPdfName.width()){ // console.log (iPdfNameWidth); $(oPdfName).css({"word-break":"break-all"}) } } iLineNum <=3 ? $(oPdfName).css({"word-warp":"break-word"}) : $(oPdfName).css({"word-break":"break-all"}); }); //=====================================// // all products // //=====================================// $(document).ready(function () { $('.ctg_sub_tbl').each(function () { $(this).find("tr:first").find("td").css({"border-top": "0px"}); }); $('.ctg_libkits_tbl').each(function () { $(this).find("tr:first").find("td").css({"border-top": "0"}); $(this).find("tr").find("td:first").css({"border-left": "0"}); }); $('.ctg_natural_tbl').each(function () { $(this).find("tr:first").find("td").css({"border-top": "0"}); $(this).find("tr").find("td:first").css({"border-left": "0"}); }); $("#ctg_pathway_tbl th:first").css({"border-top": "0px"}); $("#ctg_pathway_tbl td:first").css({"border-top": "0px"}); }); $(document).ready(function () { if ($("#inhibitorsAgonistsUL").find("li").length == 0) { $('#listDiv1').css("display", "none"); } if ($("#naturalProductsUL").find("li").length == 0) { $('#listDiv2').css("display", "none"); } if ($("#dyeReagentsUL").find("li").length == 0) { $('#listDiv4').css("display", "none"); } }); //=====================================// // inhibitor list // //=====================================// $(document).ready(function () { $(".kit_list_tbl table tr").find('td:last').css({"padding-right": "0"}); $(".kit_list_tbl table tr").find('th:last').css({"padding-right": "0"}); }); $(document).ready(function () { $("#ctg_pathway_tbl tr:last").find("th").css({"border-bottom": "0"}); $("#ctg_pathway_tbl tr:last").find("td").css({"border-bottom": "0"}); for (var i = 0; i < $("#ctg_pathway_tbl > table").length; i++) { if ($("#ctg_pathway_tbl_" + i + " tr").length == 1) { $("#ctg_pathway_tbl_" + i + " >td").css({"color": "#F00"}); } else { $("#ctg_pathway_tbl_" + i + " >td").css({"height": "100%"}); } $("#ctg_pathway_tbl_" + i + " tr:last").find("td").css({"border-bottom": "0"}); } }); //=====================================// // sub categories // //=====================================// $(document).ready(function () { //$(".sub_ctg_search tr:first").find("td").css({"border-top": "0"}); //$(".sub_ctg_search tr:first").find("th").css({"border-top": "0"}); //new products // $(".new_list_con tr:first").find("td").css({"border-top": "0"}); //$(".new_list_con tr:first").find("th").css({"border-top": "0"}); }); //=====================================// //pathway // //=====================================// $(document).ready(function () { // var targetNum = $("#target_list").find("li").length; // // if (targetNum % 3 == 1) { // $("#target_list").append('
  •  
  •  
  • '); // } // else if (targetNum % 3 == 2) { // $("#target_list").append('
  •  
  • '); // } // // if (targetNum <= 18) { // $("#target_list_vc").find(".view_more").css({"display": "none"}); // } // else { // $("#target_list").find("li:nth-child(18)").nextAll().hide(); // $("#target_list_vc").find(".view_more").click(function () { // $("#target_list").find("li:nth-child(18)").nextAll().show(); // $("#target_list_vc .view_more").css({"display": "none"}); // $("#target_list_vc .collapse").css({"display": "block"}); // }) // $("#target_list_vc").find(".collapse").click(function () { // $("#target_list").find("li:nth-child(18)").nextAll().hide(); // $("#target_list_vc .view_more").css({"display": "block"}); // $("#target_list_vc .collapse").css({"display": "none"}); // }) // } // $("#pathwayThumbnailImg").error(function(){ // $('#pathwayThumbnail').hide(); // $('#pathwayImg').hide(); // }) // // // if($("#pathwayThumbnailImg").length>0){ // alert("111"); // } //show pathway images $("#pathwayThumbnail").click(function () { $(".ctg_mask").show(); $("#pathwayImg").css({ "top": ($(window).height() - $("#pathwayImg").outerHeight()) / 2 + "px", "left": ($(window).width() - $("#pathwayImg").outerWidth()) / 2 + "px" }); $("#pathwayImg").show(); }); $(document).click(function () { $(".ctg_mask").hide(); $("#pathwayImg").hide(); $('.pm-popup').hide(); }); $("#pathwayThumbnail,#pathwayImg img").click(function (event) { event.stopPropagation(); }); }) function showMetabolicCollapseList(listId, initLen, toggeleSHID){ var targetNum1 = $(listId).find("li").length; if (targetNum1 % 3 == 1) { $(listId).append('
  •  
  •  
  • '); } else if (targetNum1 % 3 == 2) { $(listId).append('
  •  
  • '); } if (targetNum1 <= initLen) { $(toggeleSHID).find(".view_more").css({"display": "none"}); } else { $(toggeleSHID).find(".view_more").css({"display": "block"}); $(listId).find("li:nth-child(" + initLen + ")").nextAll().hide(); $(toggeleSHID).find(".view_more").click(function () { $(listId).find("li:nth-child(" + initLen + ")").nextAll().show(); viewMore(toggeleSHID); }) $(toggeleSHID).find(".collapse").click(function () { $(listId).find("li:nth-child(" + initLen + ")").nextAll().hide(); collapse(toggeleSHID); }) } } function showAntibodyCalssCollapseList(listId, initLen, toggeleSHID){ var targetNum1 = $(listId).find("label").length; if (targetNum1 % 3 == 1) { $(listId).append('
  •  
  •  
  • '); } else if (targetNum1 % 3 == 2) { $(listId).append('
  •  
  • '); } if (targetNum1 <= initLen) { $(toggeleSHID).find(".view_more").css({"display": "none"}); } else { $(toggeleSHID).find(".view_more").css({"display": "block"}); $(listId).find("li:nth-child(" + initLen + ")").nextAll().hide(); $(toggeleSHID).find(".view_more").click(function () { $(listId).find("li:nth-child(" + initLen + ")").nextAll().show(); viewMore(toggeleSHID); }) $(toggeleSHID).find(".collapse").click(function () { $(listId).find("li:nth-child(" + initLen + ")").nextAll().hide(); collapse(toggeleSHID); }) } } //siteMap $(document).ready(function () { $(".site_map_pro").find("ul li:nth-child(1)").css("border-top", "0"); $(".site_map_pro").find("ul li:nth-child(2)").css("border-top", "0"); var proNum = $(".site_map_pro").find("ul").length; for(var i=0; i ") } } }) //=====================================// // Natural Products // //=====================================// $(document).ready(function () { var targetNum = $("#natural_list").find("li").length; if (targetNum % 3 == 1) { $("#natural_list").append('
  •  
  •  
  • '); } else if (targetNum % 3 == 2) { $("#natural_list").append('
  •  
  • '); } }); //=====================================// // Protein Products // //=====================================// var isLoadPeotein=0; $(document).ready(function () { if(isLoadPeotein==0) { $(".protein-list").each(function (index) { var targetNum = $(this).find("li").length; if (targetNum % 3 == 1) { $(this).append('
  •  
  •  
  • '); } else if (targetNum % 3 == 2) { $(this).append('
  •  
  • '); } }); $(".last-child-list").each(function (index) { var targetNum = $(this).find("li").length; if (targetNum % 3 == 1) { $(this).append('
  •  
  •  
  • '); } else if (targetNum % 3 == 2) { $(this).append('
  •  
  • '); } }); isLoadPeotein++; } }); //=====================================// //Search Result // //=====================================// function initSearchTargetViewMore() { $("#search_by_targets").addClass("div_auto").removeClass("div_h72"); console.log('height: ' + $("#search_by_targets").height()); if ($("#search_by_targets").height() > 72){ $("#search_by_targets").addClass("div_h72").removeClass("div_auto"); $("#sh_search_target").css({"display":"block"}); $("#sh_search_target").find(".view_more").css({"display":"block"}); $("#sh_search_target").find(".collapse").css({"display":"none"}); } else { $("#sh_search_target").css({"display":"none"}); } } window.initSearchTargetViewMore = initSearchTargetViewMore; $(document).ready(function () { //view More & Collapse initSearchTargetViewMore(); $("#sh_search_target").find(".view_more").click(function () { viewMore("#sh_search_target"); $("#search_by_targets").addClass("div_auto").removeClass("div_h72"); }) $("#sh_search_target").find(".collapse").click(function () { collapse("#sh_search_target"); $("#search_by_targets").addClass("div_h72").removeClass("div_auto"); }) }); function viewMore(divId) { $(divId).find(".view_more").css({"display":"none"}); $(divId).find(".collapse").css({"display":"block"}); } function collapse(divId){ $(divId).find(".view_more").css({"display":"block"}); $(divId).find(".collapse").css({"display":"none"}); } $(document).ready(function () { // $(".sub_ctg_search tr:first").find("td").css({"border-top": "0"}); // $(".sub_ctg_search tr:first").find("th").css({"border-top": "0"}); }); function goPosition(name){ var sTop = $("#"+name).offset().top - 80; $("body,html").animate({scrollTop: sTop+"px"}, 0); } function goPositionAnimate(infoName) { replaceParamVal('typeName', infoName.replaceAll('_', ' ')); var sTop = $("#" + infoName).offset().top - 100; $("body,html").animate({scrollTop: sTop + "px"}, 800); } $(function () { $(".more-details").on("click", function () { if ($(this).hasClass("icon-plus")) { $(".list-references li").find("p").css("display", "block"); $(this).addClass("icon-minus").removeClass("icon-plus"); } else { $(".list-references li").find("p").css("display", ""); $(this).removeClass("icon-minus").addClass("icon-plus"); } }); $("#en_desc_more").on("click", function () { if ($(this).find('.view_more').css('display') == 'none') { $(this).find('.view_more').show(); $(this).find('.collapse').hide(); $('#en_desc').addClass('max-desc'); } else { $(this).find('.view_more').hide(); $(this).find('.collapse').show(); $('#en_desc').removeClass('max-desc'); } }); }); function goTop(acceleration, time) { acceleration = acceleration || 10; time = time || 0; var x1 = 0; var y1 = 0; var x2 = 0; var y2 = 0; var x3 = 0; var y3 = 0; if(document.documentElement) { x1 = document.documentElement.scrollLeft || 0; y1 = document.documentElement.scrollTop || 0; } if(document.body) { x2 = document.body.scrollLeft || 0; y2 = document.body.scrollTop || 0; } var x3 = window.scrollX || 0; var y3 = window.scrollY || 0; // 滚动条到页面顶部的水平距离 var x = Math.max(x1, Math.max(x2, x3)); // 滚动条到页面顶部的垂直距离 var y = Math.max(y1, Math.max(y2, y3)); // 滚动距离 = 目前距离 / 速度, 因为距离原来越小, 速度是大于1 的数, 所以滚动距离会越来越小 var speed = 1 + acceleration; window.scrollTo(Math.floor(x/speed), Math.floor(y/speed)); // 如果距离不为, 继续调用迭代本函数 if(x > 0 || y > 0) { var invokeFunction = "goTop("+ acceleration + ", "+ time + ")"; window.setTimeout(invokeFunction, time); } } function getPage(current){ var pagecount=parseInt($("#pageMaxNum").val()); current=parseInt(current); /* var html = ''; //alert(html); $(".ui-paging-container").html(html); for (var i = 1; i <= pagecount; i++) { if(current==i){ //alert("page_table_"+i); $("#page_table_"+i).show(); }else{ $("#page_table_"+i).hide(); } } if (current == 1) { $('.js-page-prev', $(".ui-paging-container")).addClass('ui-pager-disabled ui-prev-disabled'); //$('.js-page-first', container).addClass('ui-pager-disabled'); } if (current == pagecount) { $('.js-page-next', $(".ui-paging-container")).addClass('ui-pager-disabled ui-next-disabled'); //$('.js-page-last', container).addClass('ui-pager-disabled'); } $(".ui-paging-container").find('li[data-page="' + current + '"]').addClass('focus').siblings().removeClass('focus'); */ var html = ''; if(pagecount==1){ html = ''; } $(".ui-paging-container").html(html); for (var i = 1; i <= pagecount; i++) { if(current==i){ //alert("page_table_"+i); $("#page_table_"+i).show(); }else{ $("#page_table_"+i).hide(); } } if (current == 1) { $('.js-page-prev', $(".ui-paging-container")).addClass('ui-pager-disabled ui-prev-disabled'); } if (current == pagecount) { $('.js-page-next', $(".ui-paging-container")).addClass('ui-pager-disabled ui-next-disabled'); } $(".ui-paging-container").find('li[data-page="' + current + '"]').addClass('focus').siblings().removeClass('focus'); goTop(); } function toPage(current){ var pagecount=parseInt($("#pageMaxNum").val()); current=parseInt(current); function composePageLink(page, text) { text = text || page; if (page == current) { return text; } else { var search = location.search; if (/\bpage=\d+/.test(search)) { search = search.replace(/\bpage=\d+/, 'page=' + page); } else if (search) { search += '&page=' + page; } else { search += '?page=' + page; } return '' + text + ''; } } var html = ''; if(pagecount==1){ html = ''; } $(".ui-paging-container").html(html); for (var i = 1; i <= pagecount; i++) { if(current==i){ //alert("page_table_"+i); $("#page_table_"+i).show(); }else{ $("#page_table_"+i).hide(); } } if (current == 1) { $('.js-page-prev', $(".ui-paging-container")).addClass('ui-pager-disabled ui-prev-disabled'); } if (current == pagecount) { $('.js-page-next', $(".ui-paging-container")).addClass('ui-pager-disabled ui-next-disabled'); } $(".ui-paging-container").find('li[data-page="' + current + '"]').addClass('focus').siblings().removeClass('focus'); } function getPage2(current){ var pagecount=parseInt($("#pageMaxNum").val())+1; current=parseInt(current); var html = ''; if(pagecount==1){ html = ''; } $(".ui-paging-container").html(html); if(current!=1){ for (var i = 1; i <= pagecount; i++) { if(current==i){ $("#page_table_"+(i-1)).show(); }else{ $("#page_table_"+(i-1)).hide(); } } } if (current == 1) { $('.js-page-prev', $(".ui-paging-container")).addClass('ui-pager-disabled ui-prev-disabled'); } if (current == pagecount) { $('.js-page-next', $(".ui-paging-container")).addClass('ui-pager-disabled ui-next-disabled'); } $(".ui-paging-container").find('li[data-page="' + current + '"]').addClass('focus').siblings().removeClass('focus'); goTop(); } function getPage3(current, pageCount){ current = parseInt(current); var html = ''; if(pageCount <= 1){ html = ''; } $(".ui-paging-container").html(html); $(".ui-paging-container").find('li[data-page="' + current + '"]').addClass('focus').siblings().removeClass('focus'); goTop(); }