1 2$(function() { 3 4 // var flag = false 5 // Navigation old code 6 /* $('ul.header-nav-menu li').click(function () { 7 var headerDropdown = $(this).find('.header-dropdown'); 8 if (headerDropdown.is(':visible')) { 9 headerDropdown.slideUp(function () { 10 $(this).find("a.header-nav-text, .header-dropdown").removeClass("is-open").css('display', ''); 11 $('body').removeClass("sub-header-open"); 12 }); 13 } 14 else { 15 headerDropdown.slideDown(); 16 $('ul.header-nav-menu li a.header-nav-text, ul.header-nav-menu li .header-dropdown').removeClass('is-open'); 17 $(this).find("a.header-nav-text, .header-dropdown").addClass("is-open").css('display', ''); 18 $('body').addClass("sub-header-open"); 19 } 20 }); 21 22 //Navigation close submenu 23 24 $('.header-dropdown-close').on("click", function (e) { 25 var headerDropdown = $(this).closest('li').find('.header-dropdown'); 26 if (headerDropdown.is(':visible')) { 27 headerDropdown.slideUp(function () { 28 $(this).find("a.header-nav-text, .header-dropdown").removeClass("is-open").css('display', ''); 29 $('body').removeClass("sub-header-open"); 30 }); 31 } 32 });*/ 33 34 // Navigation new code 35 36 // $('.header-nav-item').click(function () { 37 // $('.menuDropdown').find("a.header-nav-text").removeClass("nuxt-link-active ") 38 39 // }) 40 41 // $('.menuDropdown').click(function () { 42 // $('.header-nav-text').removeClass('nuxt-link-active') 43 // $(this).find("a.header-nav-text").addClass("nuxt-link-active ").css('display', '') 44 // var headerDropdown = $('.header-dropdown') 45 // if (!headerDropdown.is(':visible')) { 46 // headerDropdown.slideDown() 47 // // $('ul.header-nav-menu li a.header-nav-text, ul.header-nav-menu li .header-dropdown').removeClass('is-open'); 48 49 // $(this).find(".header-dropdown").addClass("is-open").css('display', '') 50 // $('body').addClass("sub-header-open") 51 // } 52 53 // }) 54 55//fix for broken images 56setTimeout(()=>{ 57 fixImage(); 58 $("img").each(function () { 59 if ( 60 (typeof this.naturalWidth != "undefined" && 61 this.naturalWidth == 0) || 62 this.readyState == "uninitialized" 63 ) { 64 65 $(this).attr('src', `${$(this).attr('src')}?width=100%`) 66 } 67 }); 68 69},200); 70 71 //thiet bi gia dung 72 $(".header-nav-item").click(function(e) { 73 $(".menuDropdownHomeApp") 74 .find("a.header-nav-text") 75 .removeClass("nuxt-link-active ") 76 $(".headerDesktop").removeClass("region-is-open") 77 var header_dropdown = $(".header-dropdown") 78 if ( 79 !header_dropdown.is(e.target) && 80 header_dropdown.has(e.target).length === 0 81 ) { 82 $(".menuDropdown") 83 .find("a.header-nav-text, .header-dropdown") 84 .removeClass("is-open") 85 .css("display", "") 86 } 87 }) 88 89 90 $(".menuDropdownHomeApp").click(function(e) { 91 $(".header-nav-text").removeClass("nuxt-link-active") 92 $(this) 93 .find("a.header-nav-text") 94 .addClass("nuxt-link-active ") 95 .css("display", "") 96 var headerDropdownHomeApp = $(".header-dropdown-homeAppliance") 97 if (!headerDropdownHomeApp.is(":visible")) { 98 headerDropdownHomeApp.slideDown() 99 $(this) 100 .find(".header-dropdown-homeAppliance") 101 .addClass("is-open") 102 .css("display", "") 103 $("body").addClass("sub-header-open") 104 } 105 e.stopPropagation() 106 }) 107 //region 108 $(".header-nav-item").click(function() { 109 $(".menuDropdownRegion") 110 .find("a.header-nav-text") 111 .removeClass("nuxt-link-active ") 112}) 113 114$(".menuDropdownRegion").click(function(e) { 115 $(".header-nav-text").removeClass("nuxt-link-active") 116 $(this) 117 .find("a.header-nav-text") 118 .addClass("nuxt-link-active ") 119 .css("display", "") 120 var headerDropdownRegion = $(".header-dropdown-region") 121 if (!headerDropdownRegion.is(":visible")) { 122 headerDropdownRegion.slideDown() 123 $(this) 124 .find(".header-dropdown-region") 125 .addClass("is-open") 126 .css("display", "") 127 $("body").addClass("sub-header-open") 128 $(".headerDesktop").addClass("region-is-open") 129 } 130 e.stopPropagation() 131}) 132 ///giai phap toa nha 133 $(".header-nav-item").click(function() { 134 $(".menuDropdownBuildingSolutions") 135 .find("a.header-nav-text") 136 .removeClass("nuxt-link-active ") 137 }) 138 139 $(".menuDropdownBuildingSolutions").click(function(e) { 140 $(".header-nav-text").removeClass("nuxt-link-active") 141 $(this) 142 .find("a.header-nav-text") 143 .addClass("nuxt-link-active ") 144 .css("display", "") 145 var headerDropdownBuildingSolutions = $(this).find( 146 ".header-dropdown-buildingSolutions" 147 ) 148 if (!headerDropdownBuildingSolutions.is(":visible")) { 149 headerDropdownBuildingSolutions.slideDown() 150 $(this) 151 .find(".header-dropdown-buildingSolutions") 152 .addClass("is-open") 153 .css("display", "") 154 $("body").addClass("sub-header-open") 155 } 156 e.stopPropagation() 157 }) 158 //thang may va thang cuon 159 $(".header-nav-item").click(function() { 160 $(".menuDropdownElevators") 161 .find("a.header-nav-text") 162 .removeClass("nuxt-link-active ") 163 }) 164 165 $(".menuDropdownElevators").click(function(e) { 166 $(".header-nav-text").removeClass("nuxt-link-active") 167 $(this) 168 .find("a.header-nav-text") 169 .addClass("nuxt-link-active ") 170 .css("display", "") 171 var headerDropdownElevators = $(this).find(".header-dropdown-elevators") 172 if (!headerDropdownElevators.is(":visible")) { 173 headerDropdownElevators.slideDown() 174 $(this) 175 .find(".header-dropdown-elevators") 176 .addClass("is-open") 177 .css("display", "") 178 $("body").addClass("sub-header-open") 179 } 180 e.stopPropagation() 181 }) 182 //tu dong hoa cong nghiep 183 $(".header-nav-item").click(function() { 184 $(".menuDropdownFactoryAutomation") 185 .find("a.header-nav-text") 186 .removeClass("nuxt-link-active ") 187 }) 188 189 $(".menuDropdownFactoryAutomation").click(function(e) { 190 $(".header-nav-text").removeClass("nuxt-link-active") 191 $(this) 192 .find("a.header-nav-text") 193 .addClass("nuxt-link-active ") 194 .css("display", "") 195 var headerDropdownFactoryAutomation = $( 196 ".header-dropdown-factoryAutomation" 197 ) 198 if (!headerDropdownFactoryAutomation.is(":visible")) { 199 headerDropdownFactoryAutomation.slideDown() 200 $(this) 201 .find(".header-dropdown-factoryAutomation") 202 .addClass("is-open") 203 .css("display", "") 204 $("body").addClass("sub-header-open") 205 e.stopPropagation() 206 } 207 }) 208 //about 209 $(".header-nav-item").click(function() { 210 $(".menuDropdownAbout") 211 .find("a.header-nav-text") 212 .removeClass("nuxt-link-active ") 213 }) 214 215 $(".menuDropdownAbout").click(function(e) { 216 $(".header-nav-text").removeClass("nuxt-link-active") 217 $(this) 218 .find("a.header-nav-text") 219 .addClass("nuxt-link-active ") 220 .css("display", "") 221 var headerDropdownFactoryAutomation = $(".header-dropdown-about") 222 if (!headerDropdownFactoryAutomation.is(":visible")) { 223 headerDropdownFactoryAutomation.slideDown() 224 $(this) 225 .find(".header-dropdown-about") 226 .addClass("is-open") 227 .css("display", "") 228 $("body").addClass("sub-header-open") 229 e.stopPropagation() 230 } 231 }) 232 //tin tuc 233 $(".header-nav-item").click(function() { 234 $(".menuDropdownNews") 235 .find("a.header-nav-text") 236 .removeClass("nuxt-link-active ") 237 }) 238 239 $(".menuDropdownNews").click(function(e) { 240 $(".header-nav-text").removeClass("nuxt-link-active") 241 $(this) 242 .find("a.header-nav-text") 243 .addClass("nuxt-link-active ") 244 .css("display", "") 245 var headerDropdownFactoryAutomation = $(".header-dropdown-news") 246 if (!headerDropdownFactoryAutomation.is(":visible")) { 247 headerDropdownFactoryAutomation.slideDown() 248 $(this) 249 .find(".header-dropdown-news") 250 .addClass("is-open") 251 .css("display", "") 252 $("body").addClass("sub-header-open") 253 e.stopPropagation() 254 } 255 }) 256 257 //Navigation close submenu 258 259 $(".header-dropdown-close").on("click", function(e) { 260 var headerDropdownHomeApp = $(this) 261 .closest("li") 262 .find(".header-dropdown") 263 if (headerDropdownHomeApp.is(":visible")) { 264 headerDropdownHomeApp.slideUp(function() { 265 $(this) 266 .find("a.header-nav-text, .header-dropdown") 267 .removeClass("is-open") 268 .css("display", "") 269 $("body").removeClass("sub-header-open") 270 }) 271 } 272 273 //giai phap toa nha 274 var headerDropdownBuildingSolutions = $(this) 275 .closest("li") 276 .find(".header-dropdown-buildingSolutions") 277 if (headerDropdownBuildingSolutions.is(":visible")) { 278 headerDropdownBuildingSolutions.slideUp(function() { 279 $(this) 280 .find("a.header-nav-text, .header-dropdown-buildingSolutions") 281 .removeClass("is-open") 282 .css("display", "") 283 $("body").removeClass("sub-header-open") 284 }) 285 } 286 //thang may va thang cuon 287 var headerDropdownElevators = $(this) 288 .closest("li") 289 .find(".header-dropdown-elevators") 290 if (headerDropdownElevators.is(":visible")) { 291 headerDropdownElevators.slideUp(function() { 292 $(this) 293 .find("a.header-nav-text, .header-dropdown-elevators") 294 .removeClass("is-open") 295 .css("display", "") 296 $("body").removeClass("sub-header-open") 297 }) 298 } 299 //tu dong hoa cong nghiep 300 var headerDropdownFactoryAutomation = $(this) 301 .closest("li") 302 .find(".header-dropdown-factoryAutomation") 303 if (headerDropdownFactoryAutomation.is(":visible")) {
304 headerDropdownFactoryAutomation.slideUp(function() { 305 $(this) 306 .find("a.header-nav-text, .header-dropdown-factoryAutomation") 307 .removeClass("is-open") 308 .css("display", "") 309 $("body").removeClass("sub-header-open") 310 }) 311 } 312 //about 313 var headerDropdownAbout = $(this) 314 .closest("li") 315 .find(".header-dropdown-about") 316 if (headerDropdownAbout.is(":visible")) { 317 headerDropdownAbout.slideUp(function() { 318 $(this) 319 .find("a.header-nav-text, .header-dropdown-about") 320 .removeClass("is-open") 321 .css("display", "") 322 $("body").removeClass("sub-header-open") 323 }) 324 } 325 //tin tuc 326 var headerDropdownNews = $(this) 327 .closest("li") 328 .find(".header-dropdown-news") 329 if (headerDropdownNews.is(":visible")) { 330 headerDropdownNews.slideUp(function() { 331 $(this) 332 .find("a.header-nav-text, .header-dropdown-news") 333 .removeClass("is-open") 334 .css("display", "") 335 $("body").removeClass("sub-header-open") 336 }) 337 } 338 e.stopPropagation() 339 }) 340 341 $(".header-dropdown-list>.header-dropdown-item>a").on("click", function(e) { 342 var header_dropdownHomeApp = $(".header-dropdown-homeAppliance") 343 header_dropdownHomeApp.slideUp(function() { 344 $(this) 345 .find("a.header-nav-text, .header-dropdown-homeAppliance") 346 .removeClass("is-open") 347 .css("display", "") 348 $("body").removeClass("sub-header-open") 349 }) 350 //region 351 var header_dropdownRegion = $(".header-dropdown-region") 352 header_dropdownRegion.slideUp(function() { 353 $(this) 354 .find("a.header-nav-text, .header-dropdown-region") 355 .removeClass("is-open") 356 .css("display", "") 357 $("body").removeClass("sub-header-open") 358 }) 359 //giai phap toa nha 360 var header_dropdownBuildingSolutions = $( 361 ".header-dropdown-buildingSolutions" 362 ) 363 header_dropdownBuildingSolutions.slideUp(function() { 364 $(this) 365 .find("a.header-nav-text, .header-dropdown-buildingSolutions") 366 .removeClass("is-open") 367 .css("display", "") 368 $("body").removeClass("sub-header-open") 369 }) 370 //tu dong hoa cong nghiep 371 var header_dropdownFactoryAutomation = $( 372 ".header-dropdown-factoryAutomation" 373 ) 374 header_dropdownFactoryAutomation.slideUp(function() { 375 $(this) 376 .find("a.header-nav-text, .header-dropdown-factoryAutomation") 377 .removeClass("is-open") 378 .css("display", "") 379 $("body").removeClass("sub-header-open") 380 }) 381 //about 382 var header_dropdownAbout = $(".header-dropdown-about") 383 header_dropdownAbout.slideUp(function() { 384 $(this) 385 .find("a.header-nav-text, .header-dropdown-about") 386 .removeClass("is-open") 387 .css("display", "") 388 $("body").removeClass("sub-header-open") 389 }) 390 //tin tuc 391 var header_dropdownNews = $(".header-dropdown-news") 392 header_dropdownNews.slideUp(function() { 393 $(this) 394 .find("a.header-nav-text, .header-dropdown-news") 395 .removeClass("is-open") 396 .css("display", "") 397 $("body").removeClass("sub-header-open") 398 }) 399 e.stopPropagation() 400 }) 401 402 $(document).click(function(e) { 403 var header_dropdown = $(".header-dropdown") 404 if ( 405 !header_dropdown.is(e.target) && 406 header_dropdown.has(e.target).length === 0 407 ) { 408 header_dropdown.slideUp(function() { 409 $(this) 410 .find("a.header-nav-text, .header-dropdown") 411 .removeClass("is-open") 412 .css("display", "") 413 $(".menuDropdown") 414 .find("a.header-nav-text") 415 .removeClass("nuxt-link-active ") 416 $("body").removeClass("sub-header-open") 417 }) 418 } 419 420 // //giai phap toa nha 421 // var header_dropdownBuildingSolutions = $('.header-dropdown-buildingSolutions') 422 // if (!header_dropdownBuildingSolutions.is(e.target) && 423 // header_dropdownBuildingSolutions.has(e.target).length === 0) { 424 // header_dropdownBuildingSolutions.slideUp(function () { 425 // $(this).find("a.header-nav-text, .header-dropdown-buildingSolutions").removeClass("is-open").css('display', '') 426 // $('.menuDropdownBuildingSolutions').find("a.header-nav-text").removeClass("nuxt-link-active ") 427 // $('body').removeClass("sub-header-open") 428 // }) 429 // } 430 // //tu dong hoa cong nghiep 431 // var header_dropdownFactoryAutomation = $('.header-dropdown-factoryAutomation') 432 // if (!header_dropdownFactoryAutomation.is(e.target) && 433 // header_dropdownFactoryAutomation.has(e.target).length === 0) {
434 // header_dropdownFactoryAutomation.slideUp(function () { 435 // $(this).find("a.header-nav-text, .header-dropdown-factoryAutomation").removeClass("is-open").css('display', '') 436 // $('.menuDropdownFactoryAutomation').find("a.header-nav-text").removeClass("nuxt-link-active ") 437 // $('body').removeClass("sub-header-open") 438 // }) 439 // } 440 // //about 441 // var header_dropdownAbout = $('.header-dropdown-about') 442 // if (!header_dropdownAbout.is(e.target) && 443 // header_dropdownAbout.has(e.target).length === 0) { 444 // header_dropdownAbout.slideUp(function () { 445 // $(this).find("a.header-nav-text, .header-dropdown-about").removeClass("is-open").css('display', '') 446 // $('.menuDropdownAbout').find("a.header-nav-text").removeClass("nuxt-link-active ") 447 // $('body').removeClass("sub-header-open") 448 // }) 449 // } 450 // //tin tuc 451 // var header_dropdownNews = $('.header-dropdown-news') 452 // if (!header_dropdownNews.is(e.target) && 453 // header_dropdownNews.has(e.target).length === 0) { 454 // header_dropdownNews.slideUp(function () { 455 // $(this).find("a.header-nav-text, .header-dropdown-news").removeClass("is-open").css('display', '') 456 // $('.menuDropdownNews').find("a.header-nav-text").removeClass("nuxt-link-active ") 457 // $('body').removeClass("sub-header-open") 458 // }) 459 // } 460 }) 461 462 $(".header-nav-item .header-nav-text").click(function() { 463 if ($(".header-nav").hasClass("is-open-small")) { 464 $(this).removeClass("is-open-small") 465 if ($(".header-nav").length > 0) 466 $(".header-nav").removeClass("is-open-small") 467 if ($(".header-inner .search").length > 0) 468 $(".header-inner .search").removeClass("is-open-small") 469 } 470 }) 471 472 // Navigation Button Search 473 // $(".search-btn").click(function (e) { 474 // e.preventDefault() 475 // if ($(".header-inner").hasClass("is-search-open")) { 476 // if ($(".header-inner").length > 0) $(".header-inner").removeClass("is-search-open") 477 // if ($(".header-inner .search").length > 0) $(".header-inner .search").removeClass("is-open") 478 // } else { 479 // if ($(".header-inner").length > 0) $(".header-inner").addClass("is-search-open") 480 // if ($(".header-inner .search").length > 0) $(".header-inner .search").addClass("is-open") 481 // } 482 // }) 483 484 ///Region regionMobile 485 $(".regionMobile").click(function() { 486 if ($(".header-nav-region").hasClass("is-open-small")) { 487 $(this).removeClass("is-open-small") 488 if ($(".header-nav-region").length > 0) 489 $(".header-nav-region").removeClass("is-open-small") 490 $('body').removeClass("sub-header-open") 491 } else { 492 $(this).addClass("is-open-small") 493 if ($(".header-nav-region").length > 0) 494 $(".header-nav-region").addClass("is-open-small") 495 $('body').addClass("sub-header-open") 496 } 497 if ($(".header-nav-menu-mobile").hasClass("is-open-small")) { 498 $(this).removeClass("is-open-small") 499 $('body').removeClass("sub-header-open") 500 if ($(".header-nav-menu-mobile").length > 0) 501 $(".header-nav-menu-mobile").removeClass("is-open-small") 502 if ($(".header-inner .search").length > 0) 503 $(".header-inner .search").removeClass("is-open-small") 504 } 505 }) 506 507 $(".header-dropdown-close-region").click(function() { 508 $(".header-nav-region").removeClass("is-open-small") 509 $('body').removeClass("sub-header-open") 510 }) 511 512 513 //Navigation Button Hamburger 514 // $("#idHamburger").click(function() { 515 // if ($(".header-nav-menu-mobile").hasClass("is-open-small")) { 516 // $(this).removeClass("is-open-small") 517 // if ($(".header-nav-menu-mobile").length > 0) 518 // $(".header-nav-menu-mobile").removeClass("is-open-small") 519 // if ($(".header-inner .search").length > 0) 520 // $(".header-inner .search").removeClass("is-open-small") 521 // } else { 522 // $(this).addClass("is-open-small") 523 // if ($(".header-nav-menu-mobile").length > 0) 524 // $(".header-nav-menu-mobile").addClass("is-open-small") 525 // if ($(".header-inner .search").length > 0) 526 // $(".header-inner .search").addClass("is-open-small") 527 // } 528 529 // if ($(".header-nav-region").hasClass("is-open-small")) { 530 // $(this).removeClass("is-open-small") 531 // if ($(".header-nav-region").length > 0) 532 // $(".header-nav-region").removeClass("is-open-small") 533 // } 534 // }) 535
536 if ($(".pg-infrastructure .owl-carousel").length > 0) { 537 $(".pg-infrastructure .owl-carousel").owlCarousel({ 538 loop: false, 539 margin: 10, 540 responsiveClass: true, 541 dots: false, 542 navText: [ 543 '<i class="fa fa-angle-left" aria-hidden="true"></i>', 544 '<i class="fa fa-angle-right" aria-hidden="true"></i>' 545 ], 546 responsive: { 547 0: { 548 items: 3, 549 nav: true 550 }, 551 767: { 552 items: 3, 553 nav: true 554 }, 555 768: { 556 items: 4, 557 nav: true 558 } 559 } 560 }) 561 } 562 563 if ($(".pg-home-applications .owl-carousel").length > 0) { 564 $(".pg-home-applications .owl-carousel").owlCarousel({ 565 loop: false, 566 margin: 10, 567 responsiveClass: true, 568 dots: false, 569 navText: [ 570 '<i class="fa fa-angle-left" aria-hidden="true"></i>', 571 '<i class="fa fa-angle-right" aria-hidden="true"></i>' 572 ], 573 responsive: { 574 0: { 575 items: 3, 576 nav: true 577 }, 578 767: { 579 items: 3, 580 nav: true 581 }, 582 768: { 583 items: 5, 584 nav: true 585 } 586 } 587 }) 588 } 589 590 setTimeout(function() { 591 $("img").each(function () { 592 if ( 593 ($(this).attr("src") != null || $(this).attr("src") != "" || $(this).attr("src") != undefined) 594 && ((typeof this.naturalWidth != "undefined" && this.naturalWidth == 0) || this.readyState == "uninitialized") 595 ) { 596 var bg_img = $(this).attr("src"); 597 var bg_img_ele = $(this); 598 var img = new Image(); 599 img.src = bg_img; 600 img.onerror = function() { 601 // Image failed to load (corrupted or not found) 602 603 var url = new URL(bg_img); 604 var img_width = url.searchParams.get('width'); 605 if(img_width === null){ 606 $(bg_img_ele).attr("src", bg_img+"?width=100%"); 607 } 608 else if(img_width.indexOf('%')==-1){ 609 url.searchParams.set('width',img_width+'px'); 610 $(bg_img_ele).attr("src", url.toString()); 611 }; 612 } 613 } 614 }); 615 616 var observerBody = new MutationObserver((mutations) => { 617 mutations.forEach((mutation) => { 618 let oldValue = mutation.oldValue; 619 let newValue = mutation.target.textContent; 620 621 if (oldValue !== newValue) { 622 623 setTimeout(function(){ 624 document.querySelectorAll('.img-background').forEach((item) => { 625 const imageURL = window.getComputedStyle(item).getPropertyValue('background-image'); 626 const rgURL = /url\(['|"](.+)['|"]\)/gi; 627 const imgSrc = (rgURL).exec(imageURL)[1]; 628 if(imgSrc.indexOf('?width') < 0) 629 { 630 const img = document.createElement('img'); 631 img.setAttribute('src', imgSrc); 632 img.addEventListener('error', ({ target }) => { 633 console.warn(`${target.src} is not found`); 634 item.style.backgroundImage = `url(${target.src}?width=100%)`; 635 }) 636 } 637 }); 638 },200); 639 } 640 else{ 641 console.log('nothing changed'); 642 } 643 }); 644 }); 645 observerBody.observe(document.body, { 646 attributes : true, attributeFilter : ['style', 'class'] 647 }); 648 649 }, 1000) 650 651}) 652 653function fixImage() { 654 $('*[style*="background-image"]').each(function () { 655 if ($(this).css('background-image') != 'undefined' && $(this).css('background-image') != '') { 656 var bg_img = $(this).css('background-image').replace(/^url\(['"](.+)['"]\)/, '$1'); 657 // Use Image object to check if the image is valid 658 var bg_img_ele = $(this); 659 var img = new Image(); 660 img.src = bg_img; 661 img.onerror = function() { 662 // Image failed to load (corrupted or not found) 663 664 var url = new URL(bg_img); 665 var img_width = url.searchParams.get('width'); 666 if(img_width === null){ 667 $(bg_img_ele).css( 668 "background-image", 669 "url(" + bg_img + "?width=100%" + ")"); 670 } 671 else if(img_width.indexOf('%')==-1){ 672 url.searchParams.set('width',parseInt(img_width) +1); 673 var img_height = url.searchParams.get('height'); 674 675 $(bg_img_ele).css( 676 "background-image", 677 "url(" + url.toString() + ")"); 678 } 679 }; 680 681 } 682 683 }); 684 685 $("img").each(function () { 686 if ( 687 ($(this).attr("src") != null || $(this).attr("src") != "" || $(this).attr("src") != undefined)
688 && ((typeof this.naturalWidth != "undefined" && this.naturalWidth == 0) || this.readyState == "uninitialized") 689 ) { 690 691 var bg_img = $(this).attr("src"); 692 var bg_img_ele = $(this); 693 var img = new Image(); 694 img.src = bg_img; 695 img.onerror = function() { 696 // Image failed to load (corrupted or not found) 697 698 var url = new URL(bg_img); 699 var img_width = url.searchParams.get('width'); 700 if(img_width === null){ 701 $(bg_img_ele).attr("src", bg_img+"?width=100%"); 702 } 703 else if(img_width.indexOf('%')==-1){ 704 url.searchParams.set('width',parseInt(img_width) +1); 705 var img_height = url.searchParams.get('height'); 706 if(img_height!==null){ 707 708 url.searchParams.set('height',parseInt(img_height) +1) 709 710 } 711 $(bg_img_ele).attr("src", url.toString()); 712 }; 713 } 714 } 715 }); 716 var iframeContents = $('iframe').contents(); 717 for (let content of iframeContents) { 718 var imgs = $(content).find('img'); 719 720 imgs.each(function () { 721 if ( 722 ($(this).attr("src") != null || $(this).attr("src") != "" || $(this).attr("src") != undefined) 723 && ((typeof this.naturalWidth != "undefined" && this.naturalWidth == 0) || this.readyState == "uninitialized") 724 ) { 725 var bg_img = $(this).attr("src"); 726 var bg_img_ele = $(this); 727 var img = new Image(); 728 img.src = bg_img; 729 img.onerror = function() { 730 // Image failed to load (corrupted or not found) 731 732 var url = new URL(bg_img); 733 var img_width = url.searchParams.get('width'); 734 if(img_width === null){ 735 $(bg_img_ele).attr("src", bg_img+"?width=100%"); 736 } 737 else if(img_width.indexOf('%')==-1){ 738 url.searchParams.set('width',parseInt(img_width) +1); 739 var img_height = url.searchParams.get('height'); 740 if(img_height!==null){ 741 url.searchParams.set('height',parseInt(img_height) +1) 742 } 743 $(bg_img_ele).attr("src", url.toString()); 744 }; 745 } 746 } 747 }); 748 749 } 750 setTimeout(fixImage, 2000); 751}
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.