// JavaScript Documen
//show input bids //
function show_bids_photo_detail() {
var main_div_contype = '#MainContents_Exhibit_GridArea';
var url = window.location.href;
if (url.indexOf('bidnoThumb.aspx') >= 0) { main_div_contype = '#MainContents_ExhibitText_GridArea'; }
var main_div = document.querySelectorAll(main_div_contype);
var th = $(main_div).find('table').find('thead').find('tr');
$(th).append("
Biding Inputs | ");
var div = " | " ;
$.each($(main_div).find('table:eq(0)').find('tbody:eq(0)').children(),function( i, val ) {
$(this).find('.aaDate').find('input').attr('tabindex','-1');
$(this).find('.carLink').parent().attr('tabindex','-1');
$(this).css({'border':'solid rgba(0, 106, 183, 1)','margin': '5px','height':'120px'});
$(this).find('.carImg').eq(0).css({'margin-right':'2px' ,'padding' : '0px 0px 0px 0px' , 'height' : '170px','max-height':'170px'});
$(this).find('.multiRow').eq(0).css({'height' : '100px'});
$('.grid th,.grid td,.imgGrid td').css({'word-break':'normal'});
$('.grid table,.imgGrid table,.favorite table').css({'width':'auto'});
$(this).append(div);
$(this).find('.price').css({'text-align':'center','height' : '100px','width' : '67px', 'color': 'red', 'word-break' : 'normal', 'font-size': '12px', 'font-weight': 'bold', 'background-color': 'white'});
$(this).find('.iconOff').css({'padding':'0px 0px 0px 0px','background-color' : 'rgba(76, 174, 76, 1)','line-height' : 'normal'});
});
}
var url_check = window.location.href;
if (url_check.indexOf("modelThumb.aspx") >= 0 || url_check.indexOf("exhibitThumb.aspx") >= 0 || url_check.indexOf("bidnoThumb.aspx") >= 0 || url_check.indexOf("cornerThumb.aspx") >= 0) {
if($('#th_heading').length == 0 ) {
show_bids_photo_detail();
}
}
function show_bids_photo() {
var is_simple_photo_ie = localStorage.getItem('is_simple_photo');
$.each($('#ExhibitGrid .item'),function(){
$(this).parent().find('.bMark').find('td').find('input').attr('tabindex','-1');
$(this).find('.carImg').parent().attr('tabindex','-1');
$(this).find('.num').css({'font-weight':'bold','font-size':'15px'});
var children = $(this).children();
if(is_simple_photo_ie != 1 ){ $(children[1]).css('background-color','rgba(221, 221, 221, 1)'); }
if(is_simple_photo_ie != 1 ) { $(children[2]).css('background-color','rgba(70, 184, 218, 1)'); }
var bids = "";
$(this).append(bids);
$(this).css({'height' : '600px','overflow-y':'scroll','overflow-x':'hidden'});
if(is_simple_photo_ie != 1 ){
$(this).find('.info2').children().eq(3).css({'width' : '165px','color': 'red', 'font-size': '12px', 'font-weight': 'bold', 'background-color': 'white'});
}else {
$(this).find('.info2').children().eq(3).css({'width' : '','color': '', 'font-size': '', 'font-weight': '', 'background-color': ''});
}
if(is_simple_photo_ie != 1 ){
$(this).find('.info2').children().eq(4).css({'width' : '165px','color': 'blue', 'font-size': '12px', 'font-weight': 'bold', 'background-color': 'white'});
}
else {
$(this).find('.info2').children().eq(4).css({'width' : '','color': '', 'font-size': '', 'font-weight': '', 'background-color': ''});
}
});
}
if (url_check.indexOf("modelImg.aspx") >= 0 || url_check.indexOf("exhibitImg.aspx") >= 0 || url_check.indexOf("bidnoImg.aspx") >= 0 || url_check.indexOf("cornerImg.aspx") >= 0) {
if($('.add_bits_data_photo').length == 0 ) {
show_bids_photo();
}
}
//end bids//
$("body").on("keypress",".photo_detail",function(e){
if(e.which == 32)
{
e.preventDefault();
$(this).next().focus();
}
});
$("body").on("keypress",".photo_only",function(e){
if(e.which == 32)
{
e.preventDefault();
$(this).next().focus();
}
});
setTimeout(function(){
//move cursor by space in input field //
$("body").on("keypress",".photo_detail",function(e){
if(e.which == 32)
{
e.preventDefault();
$(this).next().focus();
}
});
} , 2000);
//end //
var url_23= window.location.href;
if (url_23.indexOf("modelMore.aspx") >= 0) {
setTimeout(function(){
$("select").css({"width" : "auto"});
},1000);
}
//Search Criteria//
//Grade selection//
$('body').on('click',"input[name = 'MultiGrade']",function(){
var value = $(this).val();
var username = $("#janusername").val();
var action = "save_uss_user_data";
if ($(this).prop('checked')==true){
action = "save_uss_user_data";
}
else
{
action = "delete_uss_user_data";
}
$.ajax({
type: 'POST'
, url: 'https://iauc.jjonlinesystems.com/ajphp_v41.php'
, crossDomain: true
, async: true
, data: {
action: action,
username :username ,
grade : value
}
, success: function (data) {
//console.log(data);
}
,error :function(){
console.log("Error on save data");
}
});
});
$("body").on("click","#MainContents_MoreOption_LnkMultiGrade",function(){
var uss_user_data = "";
var username = $("#janusername").val();
if(username && username.length != 0 )
{
$.ajax({
type: 'POST'
, url: 'https://iauc.jjonlinesystems.com/ajphp_v41.php'
, crossDomain: true
, async: true
, data: {
action: "get_uss_user_data",
username :username
}
, success: function (data) {
uss_user_data = JSON.parse(data);
setTimeout(function(){
$(".header").css({'height' : '29px'});
for(var key in uss_user_data) {
var row = uss_user_data[key];
$.each( $("input[name='MultiGrade']") ,function( i, val ) {
var a_v = $(this).val();
if(a_v == row.value)
{
$(this).attr('checked','checked');
}
});
}
},1000);
}
,error :function(){
console.log("Error on save data");
}
});
}
});
///////////////
// Type seceltion//
$('body').on('click',"input[name = 'MultiCarType']",function(){
var value = $(this).val();
var username = $("#janusername").val();
var action = "save_uss_user_data";
if ($(this).prop('checked')==true){
action = "save_uss_user_data";
}
else
{
action = "delete_uss_user_data";
}
$.ajax({
type: 'POST'
, url: 'https://iauc.jjonlinesystems.com/ajphp_v41.php'
, crossDomain: true
, async: true
, data: {
action: action,
username :username ,
grade : value
}
, success: function (data) {
//console.log(data);
}
,error :function(){
console.log("Error on save data");
}
});
});
$("body").on("click","#MainContents_MoreOption_LnkMultiCarType",function(){
var uss_user_data = "";
var username = $("#janusername").val();
if(username && username.length != 0 )
{
$.ajax({
type: 'POST'
, url: 'https://iauc.jjonlinesystems.com/ajphp_v41.php'
, crossDomain: true
, async: true
, data: {
action: "get_uss_user_data",
username :username
}
, success: function (data) {
uss_user_data = JSON.parse(data);
setTimeout(function(){
$(".header").css({'height' : '29px'});
for(var key in uss_user_data) {
var row = uss_user_data[key];
$.each( $("input[name='MultiCarType']") ,function( i, val ) {
var a_v = $(this).val();
if(a_v == row.value)
{
$(this).attr('checked','checked');
}
});
}
},1000);
}
,error :function(){
console.log("Error on save data");
}
});
}
});
//end //
//start it will show //
var global_window_obj = '';
$('body').on('click', '.show_image_detail', function () {
var url = window.location.href;
var href = "";
//type//
var main_obj_one = $(this).parent().parent().find(".info1").find("div").eq(0).text();
//end //
//photo view //
if (url.indexOf("modelImg.aspx") >= 0 || url.indexOf("exhibitImg.aspx") >= 0) {
var td = $(this).parent().parent().find('.imgRow').find('a');
href = $(td).attr('href');
url = url.split('en');
url = url[0] + href;
}
//tabuler view
else {
var td = $(this).parent().parent().find('td:eq(3)').find('tr');
var a = $(td).find('td:eq(1)').find('a');
href = $(a).attr('href');
url = url.split('en');
url = url[0] + href;
}
var params = {};
url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (s, k, v) { params[k] = v });
params['__VIEWSTATE'] = $('#__VIEWSTATE').val();
params['__VIEWSTATEGENERATOR'] = $('#__VIEWSTATEGENERATOR').val();
params['AAResultOpen'] = $('#AAResultOpen').val();
params['AAResultType'] = $('#AAResultType').val();
params['AATermOpen'] = $('#AATermOpen').val();
params['Aircon'] = $('#Aircon').val();
params['AuctionTerm'] = $('#AuctionTerm').val();
params['BrandCode'] = $('#BrandCode').val();
params['BrandScrollTop'] = $('#BrandScrollTop').val();
params['CarCategoryNo'] = $('#CarCategoryNo').val();
params['CarType'] = $('#CarType').val();
params['CarTypeMatch'] = $('#CarTypeMatch').val();
params['CarTypeText'] = $('#CarTypeText').val();
params['Color'] = $('#Color').val();
params['CommercialType'] = $('#CommercialType').val();
params['DisplacementFrom'] = $('#DisplacementFrom').val();
params['DisplacementTo'] = $('#DisplacementTo').val();
params['Drive'] = $('#Drive').val();
params['ExInf'] = $('#ExInf').val();
params['ExKeyList'] = $('#ExKeyList').val();
params['FinalPriceFrom'] = $('#FinalPriceFrom').val();
params['FinalPriceTo'] = $('#FinalPriceTo').val();
params['Grade'] = $('#Grade').val();
params['GradeMatch'] = $('#GradeMatch').val();
params['GradeText'] = $('#GradeText').val();
params['ImportedHandle'] = $('#ImportedHandle').val();
params['ImportedModelYearFrom'] = $('#ImportedModelYearFrom').val();
params['ImportedModelYearTo'] = $('#ImportedModelYearTo').val();
params['ImportedType'] = $('#ImportedType').val();
params['IsEquipAW'] = $('#IsEquipAW').val();
params['IsEquipLeather'] = $('#IsEquipLeather').val();
params['IsEquipNavi'] = $('#IsEquipNavi').val();
params['IsEquipPS'] = $('#IsEquipPS').val();
params['IsEquipPW'] = $('#IsEquipPW').val();
params['IsEquipSR'] = $('#IsEquipSR').val();
params['ListMode'] = $('#ListMode').val();
params['MaxListRow'] = $('#MaxListRow').val();
params['MaxRow'] = $('#MaxRow').val();
params['MileageFrom'] = $('#MileageFrom').val();
params['MileageTo'] = $('#MileageTo').val();
params['MileageType'] = $('#MileageType').val();
params['MileType'] = $('#MileType').val();
params['ModelScrollTop'] = $('#ModelScrollTop').val();
params['ModelYearFrom'] = $('#ModelYearFrom').val();
params['ModelYearTo'] = $('#ModelYearTo').val();
params['Mot'] = $('#Mot').val();
params['OrderNo'] = $('#OrderNo').val();
params['PageNo'] = $('#PageNo').val();
params['RecordNo'] = $('#RecordNo').val();
params['Score'] = $('#Score').val();
params['ScrollTop'] = $('#ScrollTop').val();
params['SearchFlow'] = $('#SearchFlow').val();
params['SearchType'] = $('#SearchType').val();
params['Shift'] = $('#Shift').val();
params['SortNo'] = $('#SortNo').val();
params['StartPriceFrom'] = $('#StartPriceFrom').val();
params['StartPriceTo'] = $('#StartPriceTo').val();
params['Tieup'] = $('#Tieup').val();
params['TieupWeek'] = $('#TieupWeek').val();
params['Uss'] = $('#Uss').val();
params['UssWeek'] = $('#UssWeek').val();
//newly added//
params['KaijoCode'] = $('#KaijoCode').val();
params['ViewTarget'] = $('#ViewTarget').val();
params['AuctionCountTxt'] = $('#AuctionCountTxt').val();
params['CanShare'] = $('#CanShare').val();
params['BackPath'] = $('#BackPath').val();
params['FavBranchCode'] = $('#FavBranchCode').val();
params['FilterFavMark'] = $('#FilterFavMark').val();
params['UssWeek'] = $('#UssWeek').val();
//end //
$.ajax({
type: 'POST',
url: url,
headers: { Accept: 'text/html, application/xhtml+xml, image/jxr, */*', 'Content-Type': 'application/x-www-form-urlencoded' },
data: params,
success: function (response) {
car_detail = response;
//it will find out chassis_code OR type from object //
var obj_one = $(response);
var type_code = $(obj_one).find("td.cType").text();
if(type_code)
{
type_code = type_code.split(" ");
type_code = type_code[0];
}
if(main_obj_one)
{
main_obj_one = main_obj_one.replace(/ /g, "_");
console.log(main_obj_one + " => " + type_code);
localStorage.setItem(main_obj_one,type_code);
}
//end //
if (global_window_obj) {
global_window_obj.close();
}
global_window_obj = '';
var height = $(window).height();
height = parseInt(height) + 100;
global_window_obj = window.open('#Car Detail#', '_blank', 'toolbar=yes,scrollbars=yes,resizable=yes,top=5,left=5,height=' + height + ',width=920');
if(global_window_obj)
global_window_obj.document.write('Car Detail');
car_detail += ' ';
global_window_obj.document.write(car_detail);
car_detail = '';
}
});
});
//end //
$("#MainContents_Exhibit_sortArea").css({ 'float': 'right' });
$("#MainContents_Exhibit_sortArea").find('span:eq(0)').css({ 'float': 'left' });
$("#SortSelect").css({ 'width': '125px', 'float': 'left' });
$("#MainContents_Exhibit_SortSelect_OrderSel").css({ 'float': 'left' });
//it will show bids detail of user under images detail
$('body').on('click', '#show_bids_photo_id', function () {
//console.log("ok");
//alert('wa o ');
var url = window.location.href;
if (url.indexOf("modelImg.aspx") >= 0 || url.indexOf("exhibitImg.aspx") >= 0 || url.indexOf("bidnoImg.aspx") >= 0) {
var cars_data_list = [];
var arr = document.querySelectorAll('#ExhibitGrid .item');
//console.log(arr);
var jans_auction_date = $(".jans_auction_date")
.val();
var jans_auction_dates = jans_auction_date.split('-');
jans_auction_date = jans_auction_dates[2] + '-' + jans_auction_dates[0] + '-' + jans_auction_dates[1];
for (var key in arr) {
var new_obj = {
name: ""
, lot_no: ""
, date: jans_auction_date
};
var lot_no = $(arr[key])
.find(".info1")
.find("div:eq(0)");
if (lot_no) {
lot_no = $(lot_no)
.text();
lot_no = lot_no.trim();
lot_no = lot_no.split("No.");
//company name
if (lot_no && lot_no[0]) {
var lot = lot_no[0].replace('.', '');
lot = lot.trim();
new_obj.name = "USS " + lot; //"AAA";
}
//lot_no
if (lot_no && lot_no[1]) {
new_obj.lot_no = lot_no[1];
}
cars_data_list.push(new_obj);
}
}
$.ajax({
type: 'POST'
, url: 'https://iauc.jjonlinesystems.com/ajphp_v41.php'
, crossDomain: true
, async: true
, data: {
action: "get_user_bids"
, username: localStorage.getItem("janusername")
, data: JSON.stringify(cars_data_list)
}
, success: function (data) {
if (data) {
data = JSON.parse(data);
if (data.data == '') {
if ($('body .jan_purchased_s_h')
.prop('checked') == true) {
$(".row_box")
.hide();
}
}
data = data.data;
if (data) {
for (var key in data) {
var row = data[key];
var name = row.company_name;
if (name) {
name = name.trim();
name = name.toLowerCase();
}
if (row.hr_name == "u.a.e") {
row.hr_name = "uae";
}
var lot_no = row.lot_no;
if (lot_no) {
lot_no = lot_no.split("//");
if (lot_no[1]) {
lot_no = lot_no[1].trim();
} else {
lot_no = lot_no[0].trim();
}
}
//console.log("Name : " + name + " Lot_no : " + lot_no );
var lot_no_dom, name_dom;
for (var key in arr) {
lot_no_dom = $(arr[key])
.find(".info1")
.find("div:eq(0)");
if (lot_no_dom) {
lot_no_dom = $(lot_no_dom)
.text();
lot_no_dom = lot_no_dom.trim();
lot_no_dom = lot_no_dom.split("No.");
//company name
if (lot_no_dom && lot_no_dom[0]) {
var lot = lot_no_dom[0].replace('.', '');
lot = lot.trim();
name_dom = lot;
if (name_dom)
name_dom = name_dom.trim();
}
//lot_no
if (lot_no_dom && lot_no_dom[1]) {
lot_no_dom = lot_no_dom[1];
if (lot_no_dom)
lot_no_dom = lot_no_dom.trim();
}
name_dom = name_dom.toLowerCase();
if (lot_no_dom == lot_no) { //&& name_dom == name) {
var show_bid_name = row.country_name + "(" + row.login_id + ")";
var f_bid_price = "";
if (row.auction_details_bid != null)
f_bid_price = row.auction_details_bid;
else
f_bid_price = row.bid_price;
if ($(arr[key])
.find("." + row.id)
.length == 0) {
var add_bid = '';
$(arr[key])
.append(add_bid);
}
}
}
}
}
}
}
}
});
} else {
var cars_data_list = [];
var arr = document.querySelectorAll('#ExhibitGrid .item');
var jans_auction_date = $(".jans_auction_date")
.val();
var jans_auction_dates = jans_auction_date.split('-');
jans_auction_date = jans_auction_dates[2] + '-' + jans_auction_dates[0] + '-' + jans_auction_dates[1];
var main_div = document.querySelectorAll('#MainContents_Exhibit_GridArea');
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var new_obj = {
name: ""
, lot_no: ""
, date: jans_auction_date
};
var lot_no = $(this)
.find(".bidNo")
.html();
if (lot_no) {
lot_no = lot_no.split("
");
//company name
if (lot_no && lot_no[1]) {
new_obj.name = "USS " + lot_no[1];
}
//lot_no
if (lot_no && lot_no[0]) {
new_obj.lot_no = lot_no[0];
}
cars_data_list.push(new_obj);
}
});
$.ajax({
type: 'POST'
, url: 'https://iauc.jjonlinesystems.com/ajphp_v41.php'
, crossDomain: true
, async: true
, data: {
action: "get_user_bids"
, username: localStorage.getItem("janusername")
, data: JSON.stringify(cars_data_list)
}
, success: function (data) {
if (data) {
data = JSON.parse(data);
if (data.data == '') {
if ($('body .jan_purchased_s_h')
.prop('checked') == true) {
$(".row_box")
.hide();
}
}
data = data.data;
if (data) {
for (var key in data) {
var start_ = 0;
var row = data[key];
var name = row.company_name;
if (name) {
name = name.trim();
name = name.toLowerCase();
}
if (row.hr_name == "u.a.e") {
row.hr_name = "uae";
}
var lot_no = row.lot_no;
if (lot_no) {
lot_no = lot_no.split("//");
if (lot_no[1]) {
lot_no = lot_no[1].trim();
} else {
lot_no = lot_no[0].trim();
}
}
//console.log("Name : " + name + " Lot_no : " + lot_no );
var lot_no_dom, name_dom;
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var lot_no_dom = $(this)
.find(".bidNo")
.html();
if (lot_no_dom) {
lot_no_dom = lot_no_dom.split("
");
//company name
if (lot_no_dom && lot_no_dom[1]) {
name_dom = lot_no_dom[1];
name_dom = name_dom.toLowerCase();
}
//lot_no_dom
if (lot_no_dom && lot_no_dom[0]) {
lot_no_dom = lot_no_dom[0];
}
if (lot_no_dom == lot_no) {
var show_bid_name = row.country_name + "(" + row.login_id + ")";
var f_bid_price = "";
if (row.auction_details_bid != null)
f_bid_price = row.auction_details_bid;
else
f_bid_price = row.bid_price;
if ($(this)
.find("." + row.id)
.length == 0) {
var add_bid= '';
$(this)
.find(".show_already_existing_bids")
.append(add_bid);
}
}
}
});
}
}
}
}
});
}
});
//it will show suggested bids under cars details
$("body").on("click", "#suggested_bdis", function () {
var url = window.location.href;
var arr_obj = [];
var image_detail_arr = [];
//image detail//
if (url.indexOf("modelThumb.aspx") >= 0) {
var main_div = document.querySelectorAll('#MainContents_Exhibit_GridArea');
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var obj = {};
var year = $(this).find(".mYear").text();
var type = $(this).find(".cTypeDir").text();
obj["Year"] = "year." + year;
obj["country_id"] = $('#jans_user_country').val();
obj["part_1"] = type;
obj["key"] = $(this).find(".bidNo").text();
arr_obj.push(obj);
image_detail_arr.push(this);
});
$.ajax({
type: 'POST',
url: 'https://iauc.jjonlinesystems.com/ajphp_v41.php',
crossDomain: true,
async: true,
data: { action: "get_suggested_bid_price_uss", data: JSON.stringify(arr_obj) },
success: function (data) {
data = JSON.parse(data);
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var key_value = $(this).find(".bidNo").text();
for (var outer_key in data) {
if(data[outer_key] == key_value)
{
$(this).find(".eximg").append('Suggested Bid Pirce : '+ data[outer_key] +"
");
break;
}
}
});
},
error: function (error) {
// console.log(error);
}
});
}
else {
var arr = document.querySelectorAll('#ExhibitGrid .item');
for (var key in arr) {
var obj = {};
var year = $(arr[key]).find(".info2").find(".col1").first().text();
if (year && year.length != 0) {
year = year.split("[Year]");
if (year && year[1]) {
year = year[1];
}
}
obj["key"] = $(arr[key]).find(".info1").find("div").first().text();
obj["Year"] = "year." + year;
obj["country_id"] = $('#jans_user_country').val();
arr_obj.push(obj);
}
$.ajax({
type: 'POST',
url: 'https://iauc.jjonlinesystems.com/ajphp_v41.php',
crossDomain: true,
async: true,
data: { action: "get_suggested_bid_price_uss", data: JSON.stringify(arr_obj) },
success: function (data) {
data = JSON.parse(data);
for (var outer_key in data) {
//console.log(data[outer_key]);
for (var key in arr) {
var key_value = $(arr[key]).find(".info1").find("div").first().text();
if (data[outer_key] == key_value) {
$(arr[key]).find(".icon").append('Suggested Bid Pirce : ' + data[outer_key] + "
");
break;
}
}
}
},
error: function (error) {
// console.log(error);
}
});
}
});
function getUrlVars(url) {
var vars = {};
var parts = "";
if(url && url.length != 0 )
{
var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
vars[key] = value;
});
}
return vars;
}
//hide book mark images//
function book_mark() {
var url = window.location.href;
//image detail//
if (url.indexOf("modelThumb.aspx") >= 0) {
var main_div = document.querySelectorAll('#MainContents_Exhibit_GridArea');
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var img = $(this)
.find(".carLink")
.parent()
.next();
if (img && ($(img)
.html())
.length != 0) {
$(this).toggle();
}
});
} else {
//image only//
var arr = document.querySelectorAll('#ExhibitGrid .item');
for (var key in arr) {
var book = $(arr[key])
.find('.icon > img');
if (book && book.length != 0) {
if (book[1]) {
book = book[1];
}
if (book[0]) {
book[0] = book[0];
}
var src = $(book)
.attr("src");
if (src.indexOf("com_favorites_E.gif") >= 0) {
$(arr[key])
.parent()
.toggle();
}
//$(arr[key]).parent().addClass("book_mark");
}
}
}
}
//hide hover image
$("body")
.on("click", ".jans_hide_seen", function () {
var url = window.location.href;
if (url.indexOf("modelThumb.aspx") >= 0) {
$(".show_hide").toggle();
} else {
$(".show_hide").toggle();
}
});
//hide book mark image
$("body")
.on("click", ".jans_h_s_listed", function () {
book_mark();
});
//it will show images hide show that have explored by User.
function show_hide() {
var arr_hide = localStorage.getItem("hide_arr");
if (arr_hide) {
arr_hide = JSON.parse(arr_hide);
}
// console.log(arr_hide);
var url = window.location.href;
if (url.indexOf("modelThumb.aspx") >= 0) {
var main_div = document.querySelectorAll('#MainContents_Exhibit_GridArea');
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var obj = $(this)
.find(".carImg");
var img = $(obj)
.attr("src");
for (var inner_key in arr_hide) {
if (img == arr_hide[inner_key]) {
$(obj)
.css({
"border": "solid"
, "border-color": "red"
, "border-width": "3px"
});
$(this)
.addClass("show_hide");
}
}
});
} else {
var arr = document.querySelectorAll('#ExhibitGrid .item');
var i = 0;
var length = 0;
if (arr_hide)
length = parseInt(arr_hide.length);
for (var key in arr) {
var src_obj = $(arr[key])
.find(".carImg");
if (src_obj) {
var src = $(src_obj)
.attr("src");
if (src && src.length != 0) {
//console.log("outerkey : " + src );
for (var inner_key in arr_hide) {
if (src == arr_hide[inner_key] && key != 'item') {
//console.log(src + " = " + arr_hide[inner_key] );
$(arr[key])
.addClass("show_hide");
$(arr[key])
.find(".imgRow")
.css({
"border": "solid"
, "border-color": "red"
, "border-width": "3px"
});
i = parseInt(i) + 1;
//console.log(i + " : " + length);
if (i == length) {
//console.log("ok");
return true;
}
break;
}
}
}
}
}
}
}
show_hide();
// car_photo => it will red color image when user will explore to see cat detail page//
$('body').on('click', '.item', function (e) {
var car_image_detail = $(this).find(".carImg");
var img_path = $(car_image_detail).attr("src");
$(this).addClass("show_hide");
if ($(car_image_detail).css('border-color') == undefined || $(car_image_detail).css('border-color') == '') {
$(car_image_detail).css({ "border": "solid", "border-color": "red", "border-width": "3px" });
}
var arr = localStorage.getItem("hide_arr");
if (img_path && img_path.length >= 2) {
if (arr) {
arr = JSON.parse(arr);
if (arr.indexOf(img_path) == -1) {
arr.push(img_path);
}
} else {
arr = [];
arr.push(img_path);
}
localStorage.setItem("hide_arr", JSON.stringify(arr));
}
});
//car_detail Page it will red color image when user will explore to see cat detail page//
$('body').on('click', '.add_bits_data', function (e) {
var self_obj = $(this).parent().parent();
book_mark_data(self_obj,44);
var car_image_detail = $(self_obj).find(".carImg");
var img_path = $(car_image_detail).attr("src");
$(self_obj).addClass("show_hide");
if ($(car_image_detail).css('border-color') == undefined || $(car_image_detail).css('border-color') == '') {
$(car_image_detail).css({ "border": "solid", "border-color": "red", "border-width": "3px" });
}
var arr = localStorage.getItem("hide_arr");
if (img_path && img_path.length >= 2) {
if (arr) {
arr = JSON.parse(arr);
if (arr.indexOf(img_path) == -1) {
arr.push(img_path);
}
} else {
arr = [];
arr.push(img_path);
}
localStorage.setItem("hide_arr", JSON.stringify(arr));
}
});
//it will highlight image and add in arr that user will explore
$('body')
.on('mouseover', ".carImg", function () {
var url = window.location.href;
//photo detail only//
if (url.indexOf("modelThumb.aspx") >= 0) {
var tr_obj = $(this)
.parent()
.parent()
.parent()
.parent()
.parent()
.parent();
$(this)
.css({
"border": "solid"
, "border-color": "red"
, "border-width": "3px"
});
$(tr_obj)
.addClass("show_hide");
var arr = localStorage.getItem("hide_arr");
var img_path = $(this)
.attr("src");
if (img_path && img_path.length >= 2) {
if (arr) {
arr = JSON.parse(arr);
if (arr.indexOf(img_path) == -1) {
arr.push(img_path);
}
} else {
arr = [];
arr.push(img_path);
}
localStorage.setItem("hide_arr", JSON.stringify(arr));
}
} else {
var lot_no = $(this)
.attr("src");
if (lot_no && lot_no.length >= 2) {
$(this)
.parent()
.parent()
.css({
"border": "solid"
, "border-color": "red"
, "border-width": "3px"
});
$(this)
.parent()
.parent()
.parent()
.addClass("show_hide");
var arr = localStorage.getItem("hide_arr");
if (arr) {
arr = JSON.parse(arr);
if (arr.indexOf(lot_no) == -1) {
arr.push(lot_no);
}
//console.log(arr);
} else {
arr = [];
arr.push(lot_no);
}
localStorage.setItem("hide_arr", JSON.stringify(arr));
}
}
});