1jQuery(document).ready(function($) { 2 function onloader(error_call, filter, style, code) { 3 const toTZ = Intl.DateTimeFormat().resolvedOptions().timeZone; 4 var divIdHtml = $("#myDiv_" + filter).html(); 5 pageNumber = 1; 6 7 $.ajax({ 8 type: 'GET', 9 url: json_api_obj.restURL, 10 data: { 11 action: 'action_name', 12 filter: filter, 13 style: style, 14 code: code, 15 pageNumber: pageNumber, 16 security: json_api_obj.restNonce, 17 timezone: toTZ 18 }, 19 beforeSend: function() { 20 $("#loading-image").show(); 21 }, 22 23 success: function(response, status) { 24 setTimeout(function() { 25 //Details Fetching Issue handler 26 if ($.trim(response) == 'false_total_count' || $.trim(response) == 'false_data_fetch' || $.trim(response) == 'false_security_code') { 27 if (error_call !== undefined && !error_call) { 28 error_call = true; 29 $("#myDiv_" + filter).append('<h3>Processing Your Request</h3>'); 30 setTimeout(function() { 31 onloader(error_call, filter, style, code); 32 }, 2500); 33 } else { 34 $("#myDiv_" + filter).html(''); 35 $("#myDiv_" + filter).append('<h1 style="color:red;padding: 40px;">Server Timeout, Please Refresh Page again.</h1>') 36 } 37 } else if ($.trim(response) == 'false_sku_fetch') { 38 if (error_call !== undefined && !error_call) { 39 error_call = true; 40 $("#myDiv_" + filter).append('<h3>Processing Your Request</h3>'); 41 setTimeout(function() { 42 onloader(error_call, filter, style, code); 43 }, 2500); 44 } else { 45 $("#myDiv_" + filter).html(''); 46 $('#pagination_' + filter).hide(); 47 $('#easyPaginate1').html(''); 48 html_string = "<h3 style='text-align: center;color:#000;padding: 40px;font-size: 16px;'>No SKU</h3>"; 49 $("#myDiv_" + filter).append(html_string); 50 } 51 } else { 52 status = JSON.parse(response).statusCode; 53 if (status == 204) { //Empty Data handler 54 $("#myDiv_" + filter).html(''); 55 error_message = "No " + filter + " Auctions"; 56 if(filter == 'all'){ 57 error_message = "No Auctions Available"; 58 } 59 html_string = "<h3 style='text-align: center;color:#000;padding: 40px;font-size: 16px; text-transform: capitalize;'>" + error_message + "</h3>"; 60 $("#myDiv_" + filter).append(html_string) 61 } else { // Data Handler 62 records = JSON.parse(response).list; 63 // totalRecords = JSON.parse(response).count; 64 // totalRecords = totalRecords.TotalCount; 65 totalRecords = $("#filter_" + filter).attr('data-total_count'); 66 67 recPerPage = JSON.parse(response).per_page; 68 totalPages = Math.ceil(totalRecords / recPerPage); 69 // acutionList = JSON.parse(response).list; 70 71 prepare_data(response, filter, style, code); 72 // apply_pagination(totalPages, recPerPage); 73 apply_pagination(totalPages, recPerPage, filter, style, code); 74 } 75 76 } 77 }, 500); 78 }, 79 error: function(jqXHR, exception) { 80 81 if (jqXHR.status === 0) { 82 console.log('Not connect.\n Verify Network.'); 83 } else if (jqXHR.status == 404) { 84 console.log('Requested page not found. [404]'); 85 } else if (jqXHR.status == 500) { 86 console.log('Internal Server Error [500].'); 87 } else if (exception === 'parsererror') { 88 console.log('Requested JSON parse failed.'); 89 } else if (exception === 'timeout') { 90 console.log('Time out error.'); 91 } else if (exception === 'abort') { 92 console.log('Ajax request aborted.'); 93 } else { 94 console.log('Uncaught Error.\n' + jqXHR.responseText); 95 } 96 } 97 }); 98 } 99 100 function prepare_list_data(acutionList, option, filter) { 101
102 html_string = $styleString = ''; 103 104 if (option.titlefamily != 'Default') { 105 $styleString += 'font-family:' + option.titlefamily + ';'; 106 } 107 108 if (option.titlestyle == 'italic') { 109 $styleString += 'font-style:'; 110 } else if (option.titlestyle == 'underline') { 111 $styleString += 'text-decoration:'; 112 } else { 113 $styleString += 'font-weight:'; 114 } 115 $styleString += option.titlestyle; 116 117 var titlestyle = $styleString + '; color:' + option.titlecolor + '; font-size:' + option.titlesize + ';'; 118 var filteralldata = $("#filter_"+filter).data(); 119 120 $.each(acutionList, function(key, auction) { 121 var SKUNumber = ('SKUNumber' in auction) ? true : false; 122 var random = (Math.random() + 1).toString(36).substring(7); 123 var redirectURL = (SKUNumber) ? auction.ItemUrl : auction.RedirectionUrl; 124 var divider_space = 'margin:'+option.divider_space+'px auto'; 125 var imagecount = 1; 126 filterkeys = Object.keys(filteralldata); 127 128 htmlCol1 = '<div class="carosal col-lg-3 col-md-12">'; 129 htmlCol2 = '<div class="l-card-body l-card-sku col-lg-9 col-md-12 col-sm-12">'; 130 htmlCol3 = '<div class="l-card-body col-lg-9 col-md-12 col-sm-12">'; 131 // if (SKUNumber) { 132 if((filterkeys.includes('picture') && filteralldata.picture.toLowerCase() == 'off' ) || ( 133 ( !filterkeys.includes('picture') && option.auctionpicture == '') || 134 ( SKUNumber && !filterkeys.includes('picture') && option.skupicture == '') ) ) { 135 136 htmlCol1 = '<div class="carosal col-lg-3 col-md-12 hide-col">'; 137 htmlCol2 = '<div class="l-card-body l-card-sku col-lg-12 col-md-12 col-sm-12">'; 138 htmlCol3 = '<div class="l-card-body col-lg-12 col-md-12 col-sm-12">'; 139 } 140 // } 141 142 html_string += '<div class="l-card"> '+ htmlCol1 + 143 '<div class="carousel slide carouselControl' + random + '" data-bs-ride="carousel">' + 144 '<div class="carousel-inner">'; 145 if ('AuctionAssets' in auction || 'AuctionItemAssets' in auction) { 146 var images = ''; 147 if ('AuctionAssets' in auction) { 148 images = auction.AuctionAssets; 149 } else if ('AuctionItemAssets' in auction) { 150 images = auction.AuctionItemAssets 151 } 152 if (images.length > 0) { 153 imagecount = images.length; 154 $.each(images, function(akey, asset) { 155 var Activeclass = ''; 156 if (akey == 0) { 157 Activeclass = 'active'; 158 } 159 html_string += '<div class="carousel-item ' + Activeclass + '">' + 160 '<span data-auctionPath="' + redirectURL + '" class="auctionpath">' + 161 '<img src="' + asset.URL + '" class="d-block w-100" alt="...">' + 162 '</span></div>'; 163 }); 164 } else { 165 html_string += '<div class="carousel-item active">' + 166 '<span data-auctionPath="' + redirectURL + '" class="auctionpath" >' + 167 '<img src="' + auction.AssetsDummyImageURL + '" class="d-block w-100 default-img" alt="...">' + 168 '</span></div>'; 169 } 170 171 } else if ('ImageURL' in auction) { 172 html_string += '<div class="carousel-item active">' + 173 '<span data-auctionPath="' + redirectURL + '" class="auctionpath" >' + 174 '<img src="' + auction.ImageURL + '" class="d-block w-100 default-img" alt="...">' + 175 '</span></div>'; 176 } else { 177 html_string += '<div class="carousel-item active">' + 178 '<span data-auctionPath="' + redirectURL + '" class="auctionpath" >' + 179 '<img src="' + auction.AssetsDummyImageURL + '" class="d-block w-100 default-img" alt="...">' + 180 '</span></div>'; 181 } 182 183 if (SKUNumber) {
184 html_string += '</div>'; 185 if (imagecount > 1) { 186 html_string += '<button class="carousel-control-prev" type="button" data-bs-target=".carouselControl' + random + '" data-bs-slide="prev">' + 187 '<span class="carousel-control-prev-icon" aria-hidden="true"></span>' + 188 '<span class="visually-hidden">Previous</span>' + 189 '</button>' + 190 '<button class="carousel-control-next" type="button" data-bs-target=".carouselControl' + random + '" data-bs-slide="next">' + 191 '<span class="carousel-control-next-icon" aria-hidden="true"></span>' + 192 '<span class="visually-hidden">Next</span>' + 193 '</button>'; 194 } 195 196 html_string += '</div>' + 197 '</div>' + 198 htmlCol2 + 199 '<div class="maxarow col-12">' + 200 '<div class="product-desc skunumber-cont" data-URL="' + auction.ItemUrl + '">'; 201 202 if(( filterkeys.includes('itemname') && filteralldata.itemname.toLowerCase() == 'on' ) || ( !filterkeys.includes('itemname') && option.skuitemname == '1' )){ 203 if (auction.OriginalName) { 204 html_string += '<h5 class="l-card-title mt-2 pb-1">' + 205 '<a rel="noopener noreferrer" style="' + titlestyle + '">' + auction.OriginalName + '</a>' + 206 '</h5>'; 207 } 208 } 209 html_string += '<div class="l-card-desc">'; 210 211 212 if ( (filterkeys.includes('countdown') && filteralldata.countdown.toLowerCase() == 'on' ) || ( !filterkeys.includes('countdown') && option.skucountdown == '1')) { 213 if (auction.EndDate) { 214 html_string += '<div><span class="max-countdown" data-countdown="' + auction.countdownTime + '" ></span></div>'; 215 } 216 } 217 if((filterkeys.includes('bid') && filteralldata.bid.toLowerCase() == 'on' ) || ( !filterkeys.includes('bid') && option.skubidamount == '1')){ 218 if (auction.MinimumNextBidAmount) { 219 html_string += '<div><span class="max-bidamount" ><span>Bid</span> $' + auction.MinimumNextBidAmount + '</span></div>'; 220 } 221 } 222 if(( filterkeys.includes('description') && filteralldata.description.toLowerCase() == 'on' ) || ( !filterkeys.includes('description') && option.skudescription == '1')){ 223 if (auction.Description) { 224 html_string += '<div>' + auction.Description + '</div>'; 225 } 226 } 227 228 if(( filterkeys.includes('location') && filteralldata.location.toLowerCase() == 'on' ) || ( !filterkeys.includes('location') && option.skulocation == '1')){ 229 if (auction.Location) { 230 html_string += '<div>' + auction.Location + '</div>'; 231 } 232 } 233 html_string += '</div>' + 234 '</div>' + 235 '<div class="card-fter d-flex">'; 236 237 html_string += '</div>' + 238 239 '</div>' + 240 '</div>' + 241 '</div>' + 242 '<div class="br-btm-line" style="'+divider_space+'"></div>'; 243 } else { 244 html_string += '</div>'; 245 if (imagecount > 1) { 246 html_string += '<button class="carousel-control-prev" type="button" data-bs-target=".carouselControl' + random + '" data-bs-slide="prev">' + 247 '<span class="carousel-control-prev-icon" aria-hidden="true"></span>' + 248 '<span class="visually-hidden">Previous</span>' + 249 '</button>' + 250 '<button class="carousel-control-next" type="button" data-bs-target=".carouselControl' + random + '" data-bs-slide="next">' + 251 '<span class="carousel-control-next-icon" aria-hidden="true"></span>' + 252 '<span class="visually-hidden">Next</span>' + 253 '</button>'; 254 }
255 html_string += '</div>' + 256 '</div>' + htmlCol3 + 257 '<div class="maxarow col-12">' + 258 '<div class="product-desc" style="margin:' + option.list_stop + 'px ' + option.list_sside + 'px">'; 259 if(( filterkeys.includes('title') && filteralldata.title.toLowerCase() == 'on' ) || ( !filterkeys.includes('title') && option.auctiontitle == '1' )){ 260 html_string += '<h5 class="l-card-title mt-2 mb-0 pb-1">' + 261 '<span data-auctionPath="' + auction.RedirectionUrl + '" class="auctionpath" style="' + titlestyle + '">' + auction.AuctionName + '</span>' + 262 '</h5>'; 263 } 264 265 if(( filterkeys.includes('countdown') && filteralldata.countdown.toLowerCase() == 'on' ) || ( !filterkeys.includes('countdown') && option.countdown == '1' )){ 266 if (option.countdown == '1' && option.countdown_position == 'after_title') { 267 timer_title = '<p>' + option.timer_title + '</p>'; 268 html_string += '<div class="card-fter maxa-timer">'; 269 if (option.timer_position == 'up') { 270 html_string += timer_title; 271 } 272 if(auction.AuctionStatus != 'Ended'){ 273 html_string += '<span class="max-countdown" data-countdown="' + auction.countdownTime + '" data-message="' + option.timer_message + '" ></span>'; 274 } 275 if (option.timer_position == 'down') { 276 html_string += timer_title; 277 } 278 html_string += '</div>'; 279 } 280 } 281 if ((auction.AuctionTypes) && auction.AuctionTypes != undefined) { 282 html_string += ''; 283 } else { 284 html_string += '<span class="category-info">' + auction.AuctionTypes + '</span>'; 285 } 286 // console.log('highlights'+filterkeys.includes('highlights')+' '+filteralldata.highlights+' '+option.auctionhighlights); 287 if(( filterkeys.includes('highlights') && filteralldata.highlights.toLowerCase() == 'on' ) || ( !filterkeys.includes('highlights') && option.auctionhighlights == '1' )){ 288 html_string += '<div class="l-card-desc list-desc"><div>' + auction.AuctionHighlights + ' </div></div>'; 289 } 290 html_string += '</div><div class="product-date"><div class="m-t-sm pb-1">'; 291 292 if(( filterkeys.includes('startdate') && filteralldata.startdate.toLowerCase() == 'on' ) || ( !filterkeys.includes('startdate') && option.startdate == '1' )){ 293 html_string += '<div class="align-items-center d-flex mb-1">' + 294 '<div class="bid-content-date m-0">' + 295 '<i class="fa fa-calendar text-muted mr-1"> </i> Starts' + 296 '</div>' + 297 '<div class="mb-0 local-date-time" data-auc-date="' + auction.StartDate + '"> : ' + auction.StartDate + ' </div>' + 298 '</div>'; 299 } 300 if(( filterkeys.includes('enddate') && filteralldata.enddate.toLowerCase() == 'on' ) || ( !filterkeys.includes('enddate') && option.enddate == '1' )){ 301 html_string += '<div class="align-items-center d-flex mb-1">' + 302 '<div class="bid-content-date m-0">' + 303 '<i class="fa fa-calendar text-muted mr-1"> </i> Ends' + 304 '</div>' + 305 '<div class="mb-0 local-date-time" data-auc-date="' + auction.EndDate + '"> : ' + auction.EndDate + '</div>' + 306 '</div>'; 307 } 308 309 if(( filterkeys.includes('countdown') && filteralldata.countdown.toLowerCase() == 'on' ) || ( !filterkeys.includes('countdown') && option.countdown == '1' )){ 310 if (option.countdown == '1' && option.countdown_position == 'after_date') { 311 312 timer_title = '<p>' + option.timer_title + '</p>';
313 html_string += '<div class="card-fter maxa-timer">'; 314 if (option.timer_position == 'up') { 315 html_string += timer_title; 316 } 317 if(auction.AuctionStatus != 'Ended'){ 318 html_string += '<span class="max-countdown" data-countdown="' + auction.countdownTime + '" data-message="' + option.timer_message + '"></span>'; 319 } 320 if (option.timer_position == 'down') { 321 html_string += timer_title; 322 } 323 html_string += '</div>'; 324 } 325 } 326 html_string += '</div><div class="card-fter">'; 327 if(( filterkeys.includes('itemscount') && filteralldata.itemscount.toLowerCase() == 'on' ) || ( !filterkeys.includes('itemscount') && option.items == '1' )){ 328 NoOfItems = auction.NoOfItems+' Items'; 329 if(auction.NoOfItems == '1'){ NoOfItems = 'Current Bid: '+ auction.CurrentBidAmount } 330 html_string += '<span class="items">' + NoOfItems + '</span>'; 331 } 332 if (option.detailbutton == '1') { 333 dbcolor = (option.dbcolor != '') ? 'background-color:' + option.dbcolor + ' !important; color:' + option.dbtcolor + '!important; border-color:' + option.dbcolor + ' !important' : ''; 334 html_string += '<div class="my-2"><span class="l-bidnow"><button data-auctionPath="' + auction.RedirectionUrl + '" class="btn auctionpath" style="' + dbcolor + '">' + option.dblabel + '</button></span></div>'; 335 } 336 if (option.viewitembutton == '1') { 337 vibcolor = (option.vibcolor != '') ? 'background-color:' + option.vibcolor + ' !important; color:' + option.vibtcolor + '!important; border-color:' + option.vibcolor + ' !important' : ''; 338 html_string += '<div class="my-2"><span class="l-bidnow"><button data-auctionPath="' + auction.ItemUrl + '" class="btn auctionpath" style="' + vibcolor + '">' + option.viblabel + '</button></span></div>'; 339 } 340 html_string += '</div>' + 341 '</div>' + 342 '</div>' + 343 '</div>' + 344 '</div>' + 345 '</div>' + 346 '<div class="br-btm-line" style="'+divider_space+'"></div>'; 347 } 348 }); 349 return html_string; 350 } 351 352 function prepare_grid_data(acutionList, option, style, filter) { 353 354 html_string = $styleString = ''; 355 356 if (option.titlefamily != 'Default') { 357 $styleString += 'font-family:' + option.titlefamily + ';'; 358 } 359 360 if (option.titlestyle == 'italic') { 361 $styleString += 'font-style:'; 362 } else if (option.titlestyle == 'underline') { 363 $styleString += 'text-decoration:'; 364 } else { 365 $styleString += 'font-weight:'; 366 } 367 $styleString += option.titlestyle; 368 369 var titlestyle = $styleString + '; color:' + option.titlecolor + '; font-size:' + option.titlesize + ';'; 370 var filteralldata = $("#filter_"+filter).data(); 371 if (style == 'showcase') { 372 html_string += '<div class="owl-carousel owl-theme" >'; 373 } 374 $.each(acutionList, function(key, auction) { 375 376 var SKUNumber = ('SKUNumber' in auction) ? true : false; 377 var random = (Math.random() + 1).toString(36).substring(7); 378 skuclass = (SKUNumber) ? 'skucontain' : ''; 379 var redirectURL = (SKUNumber) ? auction.ItemUrl : auction.RedirectionUrl; 380 var imagecount = 1; 381 filterkeys = Object.keys(filteralldata); 382 383 if (style == 'showcase') { 384 html_string += '<div class="item py-3 ' + skuclass + '">'; 385 } else { 386 html_string += '<div class="col-lg-4 col-md-6 col-sm-6 col-xs-12 py-3 ' + skuclass + '">'; 387 }
388 html_string += '<div class="card px-2 pb-2"><div class="card-img">'; 389 // html_string += '<div class="col-lg-4 col-md-6 col-sm-6 col-xs-12 py-3 '+skuclass+'">' + 390 // '<div class="card px-2 pb-2"><div class="card-img">'; 391 // '<div class="card px-2 pb-2">'; 392 var TodayDate = new Date(); 393 var countdownTime= new Date(Date.parse(auction.countdownTime)); 394 395 // SKUflag = false; 396 pictureOption = false; card_sku = 'card-without-image'; 397 if((filterkeys.includes('picture') && filteralldata.picture.toLowerCase() == 'on' ) || ( !filterkeys.includes('picture') && option.auctionpicture == '1') || (SKUNumber && !filterkeys.includes('picture') && option.skupicture == '1')){ 398 // SKUflag = true; 399 pictureOption = true; 400 card_sku = ''; 401 } 402 403 // if (SKUNumber && ((option.skucountdown == '1' && countdownTime > TodayDate) || (option.skubidamount == '1' ) )) { 404 if (SKUNumber) { 405 html_countdown = ''; html_bidamount = ''; 406 if ( (filterkeys.includes('countdown') && filteralldata.countdown.toLowerCase() == 'on' ) || ( !filterkeys.includes('countdown') && option.skucountdown == '1')) { 407 html_countdown = '<span class="max-countdown" data-sku="true" data-countdown="' + auction.countdownTime + '" ></span>'; 408 } 409 if((filterkeys.includes('bid') && filteralldata.bid.toLowerCase() == 'on' ) || ( !filterkeys.includes('bid') && option.skubidamount == '1')){ 410 html_bidamount = '<span class="max-bidamount" ><span>Bid</span> $' + auction.MinimumNextBidAmount + '</span>'; 411 } 412 if( html_countdown !='' || html_bidamount != ''){ 413 html_string += '<div class="card-img card-img-sku '+ card_sku +'"><span data-auctionPath="' + redirectURL + '" target="_blank" class="card-thumb auctionpath">' 414 + html_countdown + html_bidamount + '</span></div>'; 415 } 416 } 417 418 // if( !SKUNumber || SKUflag){ 419 if( pictureOption ){ 420 html_string += 421 '<div class="carousel slide carouselControl' + random + '" data-bs-ride="carousel">' + 422 '<div class="carousel-inner">'; 423 if ('AuctionAssets' in auction || 'AuctionItemAssets' in auction) { 424 var images = ''; 425 if ('AuctionAssets' in auction) { 426 images = auction.AuctionAssets; 427 } else if ('AuctionItemAssets' in auction) { 428 images = auction.AuctionItemAssets 429 } 430 if (images.length > 0) { 431 imagecount = images.length; 432 $.each(images, function(akey, asset) { 433 var Activeclass = ''; 434 if (akey == 0) { 435 Activeclass = 'active'; 436 } 437 html_string += '<div class="carousel-item ' + Activeclass + '">' + 438 '<span data-auctionPath="' + redirectURL + '" class=" card-thumb auctionpath" ">' + 439 '<img src="' + asset.URL + '" class="img-top thumb" alt="...">' + 440 '</span></div>'; 441 }); 442 } else { 443 html_string += '<div class="carousel-item active">' + 444 '<span data-auctionPath="' + redirectURL + '" class=" card-thumb auctionpath" ">' + 445 '<img src="' + auction.AssetsDummyImageURL + '" class="img-top thumb" alt="...">' + 446 '</span></div>'; 447 } 448 449 } else if ('ImageURL' in auction) { 450 html_string += '<div class="carousel-item active">' + 451 '<span data-auctionPath="' + redirectURL + '" class=" card-thumb auctionpath" >' + 452 '<img src="' + auction.ImageURL + '" class="img-top thumb" alt="...">' + 453 '</span></div>'; 454 } else {
455 html_string += '<div class="carousel-item active">' + 456 '<span ata-auctionPath="' + redirectURL + '" class=" card-thumb auctionpath" ">' + 457 '<img src="' + auction.AssetsDummyImageURL + '" class="img-top thumb" alt="...">' + 458 '</span></div>'; 459 } 460 html_string += '</div>'; 461 if (imagecount > 1) { 462 html_string += '<button class="carousel-control-prev" type="button" data-bs-target=".carouselControl' + random + '" data-bs-slide="prev">' + 463 '<span class="carousel-control-prev-icon" aria-hidden="true"></span>' + 464 '<span class="visually-hidden">Previous</span>' + 465 '</button>' + 466 '<button class="carousel-control-next" type="button" data-bs-target=".carouselControl' + random + '" data-bs-slide="next">' + 467 '<span class="carousel-control-next-icon" aria-hidden="true"></span>' + 468 '<span class="visually-hidden">Next</span>' + 469 '</button>'; 470 } 471 html_string += '</div>'; 472 // '</div>'; 473 } 474 475 if (SKUNumber) { 476 477 html_string += '</div><div class="card-body g-card-sku p-0 skunumber-cont" data-URL="' + auction.ItemUrl + '">'; 478 originalName = '<h5 class="card-title mb-1 px-1 line_clamp" style="visibility:hidden;">' + 479 '<a rel="noopener noreferrer"></a></h5>'; 480 if(( filterkeys.includes('itemname') && filteralldata.itemname.toLowerCase() == 'on' ) || ( !filterkeys.includes('itemname') && option.skuitemname == '1' )){ 481 if (auction.OriginalName) { 482 originalName = '<h5 class="card-title mb-1 px-1 line_clamp">' + 483 '<a style="' + titlestyle + '">' + 484 auction.OriginalName + '</a></h5>'; 485 } 486 } 487 488 html_string += originalName; 489 490 if(( filterkeys.includes('description') && filteralldata.description.toLowerCase() == 'on' ) || ( !filterkeys.includes('description') && option.skudescription == '1')){ 491 if (auction.Description) { 492 html_string += '<div class="my-2 pr-sku-line">' + auction.Description + '</div>'; 493 } 494 } 495 if(( filterkeys.includes('location') && filteralldata.location.toLowerCase() == 'on' ) || ( !filterkeys.includes('location') && option.skulocation == '1')){ 496 if (auction.Location) { 497 html_string += '<div>' + auction.Location + '</div>'; 498 } 499 } 500 501 // html_string += '<div class="card-fter d-flex">'; 502 503 // if(option.skubidamount == '1'){ 504 // html_string += '<span class="max-bidamount" >$'+auction.MinimumNextBidAmount+'</span>'; 505 // } 506 html_string += '</div>' + 507 // '</div>' + 508 '</div>' + 509 '</div>'; 510 } else { 511 html_string += '</div><div class="card-body p-0">'; 512 513 if(( filterkeys.includes('title') && filteralldata.title.toLowerCase() == 'on' ) || ( !filterkeys.includes('title') && option.auctiontitle == '1' )){ 514 html_string += '<h5 class="card-title mb-1 px-1 line_clamp_grid">' + 515 '<span data-auctionPath="' + auction.RedirectionUrl + '" style="' + titlestyle + '" class="auctionpath">' + 516 auction.AuctionName + '</span></h5>'; 517 } 518 if(( filterkeys.includes('countdown') && filteralldata.countdown.toLowerCase() == 'on' ) || ( !filterkeys.includes('countdown') && option.countdown == '1' )){ 519 if(auction.AuctionStatus != 'Ended'){ 520 if (option.countdown == '1' && option.countdown_position == 'after_title') {
521 html_string += '<span class="max-countdown" data-countdown="' + auction.countdownTime + '" ></span>'; 522 } 523 } 524 } 525 if ((auction.AuctionTypes) && auction.AuctionTypes != undefined || auction.AuctionTypes == '') { 526 html_string += ''; 527 } else { 528 html_string += '<div class="category px-1">' + auction.AuctionTypes + '</div>'; 529 530 } 531 html_string += '<div class="m-t-sm pb-1">'; 532 533 if(( filterkeys.includes('startdate') && filteralldata.startdate.toLowerCase() == 'on' ) || ( !filterkeys.includes('startdate') && option.startdate == '1' )){ 534 html_string += '<div class="align-items-center d-flex my-2 px-1">' + 535 '<div class="bid-content-date m-0"><i class="fa fa-calendar text-muted mr-1"> </i> Starts</div>' + 536 '<div class="mb-0 local-date-time" data-auc-date="' + auction.StartDate + '"> : ' + auction.StartDate + '</div>' + 537 '</div>'; 538 } 539 if(( filterkeys.includes('enddate') && filteralldata.enddate.toLowerCase() == 'on' ) || ( !filterkeys.includes('enddate') && option.enddate == '1' )){ 540 html_string += '<div class="align-items-center d-flex mb-1 px-1">' + 541 '<div class="bid-content-date m-0"><i class="fa fa-calendar text-muted mr-1"> </i> Ends </div>' + 542 '<div class="mb-0 local-date-time" data-auc-date="' + auction.EndDate + '"> : ' + auction.EndDate + '</div>' + 543 '</div>'; 544 } 545 if(( filterkeys.includes('countdown') && filteralldata.countdown.toLowerCase() == 'on' ) || ( !filterkeys.includes('countdown') && option.countdown == '1' )){ 546 if(auction.AuctionStatus != 'Ended'){ 547 if (option.countdown == '1' && option.countdown_position == 'after_date') { 548 html_string += '<span class="max-countdown" data-countdown="' + auction.countdownTime + '" ></span>'; 549 } 550 } 551 } 552 html_string += '<div class="align-items-center d-flex mb-1 px-1">' + 553 //'<div class="max-countdown" data-countdown="'+auction.EndDate+'" ></div>'+ 554 '</div>' + 555 '</div>' + 556 '<div class="card-fter d-flex">'; 557 // if(option.countdown == '1'){ 558 // html_string += '<span class="max-countdown" data-countdown="'+auction.EndDate+'" ></span>'; 559 // } 560 if(( filterkeys.includes('itemscount') && filteralldata.itemscount.toLowerCase() == 'on' ) || ( !filterkeys.includes('itemscount') && option.items == '1' )){ 561 NoOfItems = auction.NoOfItems+' Items'; 562 if(auction.NoOfItems == '1'){ NoOfItems = 'Current Bid: '+ auction.CurrentBidAmount } 563 html_string += '<span class="items">' + NoOfItems + '</span>'; 564 } 565 html_string += '</div><div class="card-fter d-flex justify-content-md-end pt-2">'; 566 if (option.detailbutton == '1') { 567 dbcolor = (option.dbcolor != '') ? 'background-color:' + option.dbcolor + ' !important; border-color:' + option.dbcolor + ' !important; color:' + option.dbtcolor + '!important' : ''; 568 html_string += '<span class="bidnow me-2"><span data-auctionPath="' + auction.RedirectionUrl + '" class="btn auctionpath" style="' + dbcolor + '">' + option.dblabel + '</span></span>'; 569 } 570 if (option.viewitembutton == '1') { 571 vibcolor = (option.vibcolor != '') ? 'background-color:' + option.vibcolor + ' !important; border-color:' + option.vibcolor + ' !important; color:' + option.vibtcolor + '!important' : '';
572 html_string += '<span class="bidnow"><span data-auctionPath="' + auction.ItemUrl + '" class="btn auctionpath" style="' + vibcolor + '">' + option.viblabel + '</span></span>'; 573 } 574 html_string += '</div>' + 575 '</div>' + 576 '</div>' + 577 '</div>'; 578 } 579 }); 580 581 if (style == 'showcase') { 582 html_string += '</div><div class="owl-theme">' + 583 '<div class="owl-controls">' + 584 '<div class="custom-nav owl-nav"></div>' + 585 '</div></div>'; 586 } 587 return html_string; 588 } 589 590 function apply_pagination(totalPages, recPerPage, filter, style, code) { 591 // var totalPages = Math.ceil(totalCount / perpage); 592 var $pagination = $('body #pagination_' + filter); 593 // $('#pagination_'+filter).hide(); 594 595 // $pagination.twbsPagination({ 596 // totalPages: totalPages, 597 // visiblePages: 1, 598 // first: '<<', 599 // prev: '<', 600 // next: '>', 601 // last: '>>', 602 // // showGoTo: true, 603 // // goToPlaceholder: "", 604 // onPageClick: function(event, page) { 605 // displayRecordsIndex = Math.max(page - 1, 0) * recPerPage; 606 // endRec = (displayRecordsIndex) + recPerPage; 607 // displayRecords = records.slice(displayRecordsIndex, endRec); 608 // if (autorequest) { 609 // getdata(page, false, filter, style, code); 610 // } 611 // autorequest = true; 612 // } 613 // }); 614 615 if(totalPages > 1){ 616 $pagination.pagination({ 617 items: totalPages, 618 prevText:'<', 619 nextText:'>', 620 displayedPages:2, 621 ellipsePageSet:false, 622 edges:1, 623 onPageClick: function(pageNumber) { 624 getdata(pageNumber, false, filter, style, code); 625 } 626 }); 627 }else{ 628 $pagination.parent('#pager').hide(); 629 } 630 } 631 632 function SetCountdownfunc() { 633 const toTZ = Intl.DateTimeFormat().resolvedOptions().timeZone; 634 $('.max-countdown').each(function($index) { 635 //var nextYear = moment.tz($(this).data('countdown'), toTZ); 636 var countdownVal = $(this).data('countdown'); 637 if ($(this).data('sku')) { 638 $(this).countdown(countdownVal) 639 .on('update.countdown', function(event) { 640 // function(event) { 641 var $this = $(this).html(event.strftime('' + 642 '<span>%D</span>:' + 643 '<span>%H</span>:' + 644 '<span>%M</span>:' + 645 '<span>%S</span>')); 646 }).on('finish.countdown', function() { 647 $(this).css("visibility", "hidden"); 648 $(this).css("height", "29px"); 649 650 }); 651 } else { 652 $(this).countdown(countdownVal) 653 .on('update.countdown', function(event) { 654 // function(event) { 655 var $this = $(this).html(event.strftime('' + 656 '<span>%D</span> d : ' + 657 '<span>%H</span> h : ' + 658 '<span>%M</span> m : ' + 659 '<span>%S</span> s')); 660 }).on('finish.countdown', function() { 661 // $(this).css("visibility","hidden"); 662 663 $(this).html($(this).attr('data-message')); 664 $(this).css("height", "29px"); 665 }); 666 } 667 }); 668 669 } 670 671 function getdata(pageNumber, error_call, filter, style, code) { 672 const toTZ = Intl.DateTimeFormat().resolvedOptions().timeZone; 673 $('#easyPaginate_' + filter + '_' + style).addClass('loaderbg'); 674 $("#myDiv_" + filter).show(); 675 676 if (pageNumber === undefined) { 677 pageNumber = 1; 678 } 679 680 $.ajax({
681 type: 'GET', 682 url: json_api_obj.restURL, 683 data: { 684 action: 'action_name', 685 filter: filter, 686 style: style, 687 code: code, 688 pageNumber: pageNumber, 689 security: json_api_obj.restNonce, 690 timezone: toTZ 691 }, 692 beforeSend: function() { 693 $("#loading-image").show(); 694 }, 695 success: function(response) { 696 setTimeout(function() { 697 if ($.trim(response) == 'false_total_count' || $.trim(response) == 'false_data_fetch' || $.trim(response) == 'false_security_code') { 698 if (error_call !== undefined && !error_call) { 699 error_call = true; 700 $("#myDiv_" + filter).html(''); 701 $("#myDiv_" + filter).append('<h3>Processing Your Data</h3>') 702 setTimeout(function() { 703 getdata(pageNumber, true, filter, style); 704 }, 2500); 705 706 } else { 707 $("#myDiv_" + filter).html(''); 708 $('#pagination_' + filter).hide(); 709 // $('#easyPaginate1').html(''); 710 $("#myDiv_" + filter).append('<h1 style="color:red;padding: 40px;">Server Timeout, Please Refresh Page again.</h1>') 711 } 712 } else { 713 714 status = JSON.parse(response).statusCode; 715 html_string = ''; 716 if (status == 200) { 717 prepare_data(response, filter, style, code); 718 } 719 720 if (status == 204) { // Empty content 721 // $("#myDiv_"+filter).hide(); 722 // $('#pagination_'+filter).hide(); 723 // html_string = "<h2 style='text-align: center;'>No" + filter + "Auctions</h2>"; 724 // if (filter.toLowerCase() === 'list') { 725 // $('#easyPaginate1').append(html_string); 726 // } else { 727 // $('#easyPaginate_'+filter+'_'+style).append(html_string); 728 // } 729 } 730 } 731 }, 3000); 732 }, 733 error: function(jqXHR, exception) { 734 if (jqXHR.status === 0) { 735 alert('Not connect.\n Verify Network.'); 736 } else if (jqXHR.status == 404) { 737 alert('Requested page not found. [404]'); 738 } else if (jqXHR.status == 500) { 739 alert('Internal Server Error [500].'); 740 } else if (exception === 'parsererror') { 741 alert('Requested JSON parse failed.'); 742 } else if (exception === 'timeout') { 743 alert('Time out error.'); 744 } else if (exception === 'abort') { 745 alert('Ajax request aborted.'); 746 } else { 747 alert('Uncaught Error.\n' + jqXHR.responseText); 748 } 749 } 750 }); 751 } 752 753 function prepare_data(response, filter, style, code) { 754 acutionList = JSON.parse(response).list; 755 if (acutionList != '') { 756 option = JSON.parse(response).option; 757 html_string = ''; 758 if (style.toLowerCase() === 'list') { 759 html_string = prepare_list_data(acutionList, option, filter); 760 } else { 761 html_string = prepare_grid_data(acutionList, option, style.toLowerCase(), filter); 762 } 763 764 $("#myDiv_" + filter).hide(); 765 $('#easyPaginate_' + filter + '_' + style).html(''); 766 $('#easyPaginate_' + filter + '_' + style).removeClass('overlay'); 767 $('#easyPaginate_' + filter + '_' + style).append(html_string); 768 $('#easyPaginate_' + filter + '_' + style).removeClass('loaderbg'); 769 $('#pagination_' + filter).show(); 770 771 772 $("<style>.l-card-desc.list-desc * { font-size: " + option.des_fsize + "px; }</style>").appendTo("head"); 773 SetCountdownfunc(); 774 // $('.fancybox').jqPhotoSwipe({ 775 // galleryOpen: function (gallery) { 776 // } 777 // }); 778 var owl = $('.owl-carousel'); 779 780 if(option.showcaseautoplay == 1){ 781 var Json_owl = { 782 loop: true, 783 margin: 10, 784 autoplay: true, 785 // navSpeed: 0, 786 rewind: false, 787 slideTransition: 'linear', 788 autoplayTimeout: 1500, 789 stopOnHover: true, 790 autoplaySpeed: 1500, 791 autoplayHoverPause: true, 792 navText: [ 793 '<i class="fa fa-angle-left" aria-hidden="true"></i>', 794 '<i class="fa fa-angle-right" aria-hidden="true"></i>' 795 ], 796 navContainer: '.custom-nav', 797 responsive: { 798 0: { 799 items: 1 800 }, 801 600: { 802 items: 3 803 }, 804 1000: { 805 items: 4 806 } 807 } 808 } 809 owl.owlCarousel(Json_owl); 810 }else{ 811 812 var Json_owl = { 813 // stagePadding: 50, 814 items: 1.5, 815 loop: true, 816 margin: 10, 817 autoplay: false, 818 dots: false, 819 nav: true, 820 slideTransition: 'linear', 821 autoplayTimeout: 1500, 822 stopOnHover: true, 823 autoplaySpeed: 1500, 824 autoplayHoverPause: true, 825 mouseDrag : false, 826 navText: [ 827 '<i class="fa fa-angle-left" aria-hidden="true"></i>', 828 '<i class="fa fa-angle-right" aria-hidden="true"></i>' 829 ], 830 navContainer: '.custom-nav', 831 responsive: { 832 0: { 833 items: 1 834 }, 835 600: { 836 items: 3 837 }, 838 1000: { 839 items: 4 840 } 841 } 842 } 843 owl.owlCarousel(Json_owl); 844 $('.custom-nav > button:first').mouseover(function() { 845 owl.trigger('prev.owl.carousel', [1500]); 846 }); 847 848 $('.custom-nav >
848 button:last').mouseover(function() { 849 owl.trigger('next.owl.carousel', [1500]); 850 }); 851 } 852 if($(window).width() < 576) { 853 $('.owl-stage-outer').width($(".owl-item").width()); 854 } 855 /* $('.custom-nav > button:last', '.custom-nav > button:last').mouseout(function() { 856 owl.trigger('stop.owl.autoplay'); 857 }); 858 */ 859 860 // $('.owl-carousel').owlCarousel({ 861 // loop:true, 862 // margin:10, 863 // responsiveClass:true, 864 // autoplay:true, 865 // dots: false, 866 // nav: true, 867 // navText: [ 868 // '<i class="fa fa-angle-left" aria-hidden="true"></i>', 869 // '<i class="fa fa-angle-right" aria-hidden="true"></i>' 870 // ], 871 // navContainer: '.custom-nav', 872 // responsive:{ 873 // 0:{ 874 // items:1, 875 // }, 876 // 600:{ 877 // items:3, 878 // }, 879 // 1000:{ 880 // items:4, 881 // } 882 // } 883 // }); 884 885 // setTimeout(function() { 886 // $('.pagination').each(function(index) { 887 // var pageid = $(this).attr('id'); 888 // var pageData = $("#" + pageid).data(); 889 // if (typeof pageData !== "undefined") { 890 // if (pageData.twbsPagination.options.totalPages == 1 || $("#" + pageid).data('style') == 'showcase') { 891 // $("#" + pageid).twbsPagination('destroy'); 892 // } 893 // } 894 // }); 895 // }, 500); 896 897 } else { 898 $("#myDiv_" + filter).hide(); 899 $('#pagination_' + filter).hide(); 900 error_message = "No " + filter + " Auctions"; 901 if(filter == 'all'){ 902 error_message = "No Auctions Available"; 903 } 904 html_string = "<h3 style='text-align: center;color:#000;padding: 40px;font-size: 16px; text-transform: capitalize;'>" + error_message + "</h3>"; 905 if (filter.toLowerCase() === 'list') { 906 $('#easyPaginate1').append(html_string); 907 } else { 908 $('#easyPaginate_' + filter + '_' + style).append(html_string); 909 } 910 } 911 } 912 913 function init() { 914 setTimeout(function() { 915 var filters = new Array(); 916 filters.push($('#filter_current').val()); 917 filters.push($('#filter_past').val()); 918 filters.push($('#filter_future').val()); 919 filters.push($('#filter_all').val()); 920 // filters.push($('[id^=filter_sku_]').val()); 921 $('[id^=filter_sku_]').each(function(index, element) { 922 filters.push($(this).val()); 923 }); 924 925 var time = 0; 926 927 $.each(filters, function(index, filter) { 928 if (filter !== undefined) { 929 setTimeout(function() { 930 var __filter = $('#' + filter).data('filter'); 931 var style = $('#' + filter).data('style'); 932 var code = $('#' + filter).data('code'); 933 onloader(false, __filter, style, code); 934 }, time); 935 time = time + 1200; 936 } 937 }); 938 }, 200); 939 } 940 init(); 941 942 // $( document ).ready(function() { 943 // $(document).on('keyup', '.bs-searchbox input', function (e) { 944 // var searchData = e.target.value; 945 // $.ajax({
946 // type: 'GET', 947 // url: json_api_obj.restURL, 948 // data: { 949 // action: 'categorysearch', 950 // security: json_api_obj.restNonce, 951 // itemCategories: searchData, 952 // }, 953 // beforeSend: function() { 954 // // $("ul.dropdown-menu.inner").html(''); 955 // }, 956 // success: function(response, status) { 957 // var response = $.parseJSON(response); 958 // if(response.status === true){ 959 // $('.selectpicker').html(response.html); 960 // $(".selectpicker").selectpicker("refresh"); 961 // } 962 // }, 963 // error: function(jqXHR, exception) { 964 // } 965 // }); 966 // }); 967 968 //Multiselect action and category 969 $('.selectpicker.categoryselect, .selectpicker.itemselect').on('change', function() { 970 971 var $this = $(this); 972 //Check Action or Cateogry 973 var type = 'AuctionType'; 974 if ($this.hasClass('itemselect')) { 975 type = 'Cateogry'; 976 } 977 978 if ($this.val() === null) { 979 $(this).selectpicker('val', ''); 980 if (type == 'AuctionType') { 981 $('.cat-sub-btn.category-go').attr('data-url', ''); 982 } else { 983 $('.cat-sub-btn.items-go').attr('data-url', ''); 984 } 985 } else { 986 var selectArr = $this.val(); 987 var selectedItems = selectArr.toString(); 988 989 // categoryArr = []; 990 // $('.selectpicker.categoryselect option:selected').each(function() { 991 // categoryArr.push({ 992 // 'id':$(this).val(), 993 // 'code':$(this).text(), 994 // }); 995 // }); 996 997 $('.cat-sub-btn.category-go').prop('disabled', true); 998 $('.cat-sub-btn.items-go').prop('disabled', true); 999 if (type == 'AuctionType') { 1000 $('.cat-sub-btn.category-go').attr('data-url', ''); 1001 } else { 1002 $('.cat-sub-btn.items-go').attr('data-url', ''); 1003 } 1004 $.ajax({
1005 type: 'GET', 1006 url: json_api_obj.restURL, 1007 data: { 1008 action: 'categorysearch', 1009 type: type, 1010 selectedItems: selectedItems, 1011 security: json_api_obj.restNonce, 1012 }, 1013 beforeSend: function() { 1014 var spinner = '<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>'; 1015 if (type == 'AuctionType') { 1016 $('.cat-sub-btn.category-go').html(spinner); 1017 } else { 1018 $('.cat-sub-btn.items-go').html(spinner); 1019 } 1020 }, 1021 success: function(response, status) { 1022 var response = $.parseJSON(response); 1023 if (response.status === true) { 1024 if (type == 'AuctionType') { 1025 $('.cat-sub-btn.category-go').attr('data-url', response.returnURL); 1026 } else { 1027 $('.cat-sub-btn.items-go').attr('data-url', response.returnURL); 1028 } 1029 1030 } 1031 $('.cat-sub-btn.category-go').prop('disabled', false); 1032 $('.cat-sub-btn.items-go').prop('disabled', false); 1033 }, 1034 error: function(jqXHR, exception) { 1035 console.log(jqXHR); 1036 }, 1037 complete: function() { 1038 if ($this.val() === null) { 1039 $(this).selectpicker('val', ''); 1040 if (type == 'AuctionType') { 1041 $('.cat-sub-btn.category-go').attr('data-url', ''); 1042 } else { 1043 $('.cat-sub-btn.items-go').attr('data-url', ''); 1044 } 1045 } 1046 var btntext = 'Go'; 1047 if (type == 'AuctionType') { 1048 $('.cat-sub-btn.category-go').html(btntext); 1049 } else { 1050 $('.cat-sub-btn.items-go').html(btntext); 1051 } 1052 }, 1053 }); 1054 } 1055 }); 1056 1057 //Action and Category redirection 1058 $('.cat-sub-btn').on('click', function(event) { 1059 event.preventDefault(); 1060 $redirectURL = $(this).attr('data-url'); 1061 if ($redirectURL != '') { 1062 window.open($redirectURL, '_blank'); 1063 } 1064 }); 1065 1066 function searchformajax($searchfilter, $search) { 1067 $.ajax({
1068 type: 'GET', 1069 url: json_api_obj.restURL, 1070 dataType: 'json', 1071 data: { 1072 action: 'action_name', 1073 search_url: $searchfilter + '&searchText=' + $search, 1074 security: json_api_obj.restNonce, 1075 }, 1076 beforeSend: function() { 1077 $('.searchfilter').prop('disabled', true); 1078 $('.searchfilter i').attr('class', 'fa fa-spinner fa-spin'); 1079 }, 1080 success: function(response, status) { 1081 $('.searchfilter i').attr('class', 'fa fa-search'); 1082 $('.searchfilter').prop('disabled', false); 1083 window.open(response.url, '_blank'); 1084 }, 1085 error: function(jqXHR, exception) { 1086 console.log(jqXHR); 1087 } 1088 }); 1089 1090 } 1091 //Search box redirection 1092 $('.searchfilter').on('click', function(event) { 1093 event.preventDefault(); 1094 var $searchfilter = $(this).attr('data-url'); 1095 var $search = $(this).parents('.input-group').find('.form-control').val(); 1096 $(this).parents('.input-group').removeClass('must'); 1097 1098 if ($search != '') { 1099 searchformajax($searchfilter, $search); 1100 } else { 1101 $(this).parents('.input-group').addClass('must'); 1102 } 1103 1104 }); 1105 1106 $(document).ready(function() { 1107 $("#searchform").submit(function(e) { 1108 e.preventDefault(e); 1109 $this = $('.searchfilter'); 1110 $this.parents('.input-group').removeClass('must'); 1111 var $searchfilter = $this.attr('data-url'); 1112 var $search = $this.parents('.input-group').find('.form-control').val(); 1113 if ($search != '') { 1114 searchformajax($searchfilter, $search); 1115 } else { 1116 $this.parents('.input-group').addClass('must'); 1117 } 1118 }); 1119 }); 1120 1121 $(document).on('click', '.auctionpath', function() { 1122 $auctionPath = $(this).attr('data-auctionPath'); 1123 window.open($auctionPath, '_blank'); 1124 }); 1125 1126 $(document).on('click', '.skunumber-cont', function() { 1127 $redirectURL = $(this).attr('data-url'); 1128 window.open($redirectURL, '_blank'); 1129 }); 1130});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.