har-down
Version:
har download 从 chrome 生成的 har 文件中下载整个网站所有资源
263 lines (176 loc) • 7.38 kB
JavaScript
$(document).ready(function() {
resizeFunction();
$( window ).resize(function() {
resizeFunction();
});
function resizeFunction(){
var deviceWidth = $(window).outerWidth();
/* JS for Desktop*/
if(deviceWidth > 750){
}
/* JS for Mobile*/
if(deviceWidth <= 750){
}
var bannerWidth = $(".desk_home_banner").width();
var bannerHeight = bannerWidth / 3.2;
$(".desk_home_banner").height(bannerHeight);
}
/*Read more */
if ($('.three_col_content .product_disc') != undefined && $('.three_col_content .product_disc').val() != "" && $('.three_col_content .product_disc').length > 0) {
$('.three_col_content .product_disc').readmore({
speed: 75,
maxHeight: 60,
moreLink: '<a href="#">Read more</a>',
lessLink: '<a href="#">Close</a>'
});
}
/* Product List Page */
$(".product_list .product_content p").each(function () {/* changed on Feb 12 */
var content = $(this);
if (content.html().length > 250) {
content.html(content.html().substr(0, 250));
content.append("...");
}
});
//$(".product_list .product li").hover(
// function(){
// $(this).css("background-color","#eaeaea");
// },
// function(){
// $(this).css("background-color","#fff");
// });
/* Product Detail Page*/
var hl_imgElement = $('.product_detail_cont .top_content .product_hl_img');
var vl_imgElement = $('.product_detail_cont .top_content .product_vl_img');
if(vl_imgElement.children().length < 1){
$('.product_detail_cont .top_content .product_vl_img').remove();
}
if(hl_imgElement.children().length < 1){
$('.product_detail_cont .top_content .product_hl_img').remove();
$('.product_detail_cont .top_content .product_cont').css("width", "100%");
}
/* Product Data Manual */
$('.data_manual .download_data>li>a').on('click', function (event) {
event.preventDefault();
if (event.handled !== true) { // This will prevent event triggering more then once
var className = $(this).find('span:last-of-type').attr('class');
if (className == 'right_arrow') {
$(this).find('span:last-of-type').removeClass('right_arrow').addClass('down_arrow');
} else {
$(this).find('span:last-of-type').removeClass('down_arrow').addClass('right_arrow');
}
$(this).next().slideToggle(300);
event.handled = true;
}
});
//left side navingation starts
$(".leftmenu_withsubmenu ul.multilevel > li").each(function () {
var submenu_len = $(this).find('ul li').length;
if (submenu_len > 0) {
$(this).find('>a span:first-of-type').addClass('dropdown_rarrow');
}
$(this).find('>ul >li').each(function () { /* Jan 5th changed*/
var levelTwoSubmenu_len = $(this).find('ul li').length;
if (levelTwoSubmenu_len > 0) {
$(this).find('>a span').addClass('dropdown_rarrow');
}
});
});
$(".leftmenu_withsubmenu ul.multilevel > li > a span").click(function () {
event.preventDefault();
$(".leftmenu_withsubmenu ul.multilevel > li > a .dropdown_darrow").each(function () {/* Jan 5th changed*/
$(this).removeClass('dropdown_darrow').addClass('dropdown_rarrow');
});
var arrow_classname = $(this).attr('class');
if ((arrow_classname == 'dropdown_rarrow') || (arrow_classname == 'dropdown_darrow')) {
if (arrow_classname == 'dropdown_rarrow') {
$(this).removeClass('dropdown_rarrow').addClass('dropdown_darrow');
} else {
$(this).removeClass('dropdown_darrow').addClass('dropdown_rarrow');
}
if (true == $(this).parent().next().is(':visible')) {
$(this).removeClass('dropdown_darrow').addClass('dropdown_rarrow');
}
}
// event.preventDefault();
//$(".leftmenu_withsubmenu ul.menu > li > a").css({"font-family": "PT Sans", "font-weight": "400"});
//$(this).css({"font-family": "PT Sans", "font-weight": "700" });
if (false == $(this).parent().next().is(':visible')) {
$('.leftmenu_withsubmenu ul li ul').slideUp(300);
// $(".leftmenu_withsubmenu ul li ul li a").css({"font-family": "PT Sans", "font-weight": "400"});
}
$(this).parent().next().slideToggle(300);
});
// left side navigation ends
/* Check for Datamanual Exist*/
if ($('.data_manual .download_data ').length == 0) {
$('.data_manual').remove();
$('.product_icon').css("width", "100%");
}
//if ($('.data_manual').is(':empty')) {
// alert('hiii');
// $(this).remove();
// $('.product_icon').css("width", "100%");
//}
/* Mobile Banner */
if ($('.mobile_banner').length > 0 && $('.mobile_banner') != undefined) {
$('.mobile_banner').bjqs({
height: 450,
width: 767,
responsive: true
});
}
//Added By Mindtree to stop the video when Modal pop up closes
$(document).on('hidden.bs.modal', '#product_video', function (event) { $('iframe').attr('src', ''); });
});
function CallServerSideGetProductFunction(methodName, resultsAlreadyRendered, resultToFetchPerCall, lastShownItemId, productRepositoryPath) {
var result = null;
result = $.ajax({
type: "POST",
url: '/GlobalService.asmx/' + methodName,
data: '{"resultsAlreadyRendered":"' + resultsAlreadyRendered + '","countResultsToFetch":"' + resultToFetchPerCall + '","lastShownItemId":"' + lastShownItemId + '","productRepositoryPath":"' + productRepositoryPath + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
cache: false,
success: OnSuccess,
failure: function (response) {
alert('failure');
}
});
return result;
function OnSuccess(response) {
if (typeof response.d == 'string') {
return response.parseJSON;
}
else {
return $.parseJSON(response.d);
}
}
};
// this method will be called for getting product videos
function CallServerSideGetVideosFunction(methodName, resultsAlreadyRendered, resultToFetchPerCall, languageName, lastShownItemId, datasource) {
var result = null;
result = $.ajax({
type: "POST",
url: '/GlobalService.asmx/' + methodName,
data: '{"resultsAlreadyRendered":"' + resultsAlreadyRendered + '","countResultsToFetch":"' + resultToFetchPerCall + '","languageName":"' + languageName + '","lastShownItemId":"' + lastShownItemId + '","datasource":"' + datasource + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
async: false,
cache: false,
success: OnSuccess,
failure: function (response) {
alert('failure');
}
});
return result;
function OnSuccess(response) {
if (typeof response.d == 'string') {
return response.parseJSON;
}
else {
return $.parseJSON(response.d);
}
}
};