fontselect.js
2 years ago
isimb-6310-admin-modal.js
2 years ago
isimb-6310-admin-script.js
11 months ago
isimb-6310-common.js
2 years ago
isimb-6310-nested-point.js
2 years ago
jquery.canvas.js
2 years ago
json-data.js
3 months ago
main-output-file.js
3 months ago
media-uploader.js
2 years ago
zoom-in-out-drag.js
1 year ago
main-output-file.js
895 lines
| 1 | let isimb_6310_Timeout; |
| 2 | let isimb_6310_LastId = ""; |
| 3 | let isimbPointerType = 0; |
| 4 | |
| 5 | window.addEventListener("load", function () { |
| 6 | setTimeout(function () { |
| 7 | jQuery(".isimb-6310-hover-content").each(function () { |
| 8 | jQuery("body").append(jQuery(this).clone()); |
| 9 | jQuery(this).remove(); |
| 10 | }); |
| 11 | jQuery(".isimb-6310-modal").each(function () { |
| 12 | jQuery("body").append(jQuery(this).clone()); |
| 13 | jQuery(this).remove(); |
| 14 | }); |
| 15 | |
| 16 | isimb_6310_polygon_color_change(); |
| 17 | }, 300); |
| 18 | |
| 19 | setTimeout(function () { |
| 20 | var allSliderImg = jQuery( |
| 21 | ".isimb-6310-modal-content img, .isimb-6310-hover-content img" |
| 22 | ); |
| 23 | allSliderImg.each(function () { |
| 24 | var src = |
| 25 | jQuery(this).attr("isimb-image-url") || |
| 26 | jQuery(this).attr("data-src") || |
| 27 | jQuery(this).attr("data-opt-src") || |
| 28 | jQuery(this).attr("data-lazy-src") || |
| 29 | jQuery(this).attr("src"); |
| 30 | var attributes = jQuery.map(this.attributes, function (item) { |
| 31 | return item.name; |
| 32 | }); |
| 33 | |
| 34 | var img = jQuery(this); |
| 35 | jQuery.each(attributes, function (i, item) { |
| 36 | img.removeAttr(item); |
| 37 | }); |
| 38 | img.attr("src", src); |
| 39 | }); |
| 40 | }, 1000); |
| 41 | |
| 42 | isimb_6310_RemoveLazyLoad(0); |
| 43 | isimb_6310_RemoveLazyLoad(500); |
| 44 | isimb_6310_RemoveLazyLoad(5000); |
| 45 | isimb_6310_RemoveLazyLoad(10000); |
| 46 | |
| 47 | isimb_6310_create_polygon(); |
| 48 | isimb_6310_hover_pointer(); |
| 49 | isimb_6310_close_button(); |
| 50 | isimb_6310_popup_open(); |
| 51 | isimb_6310_direct_link(); |
| 52 | |
| 53 | let classList = []; |
| 54 | let allClass = ""; |
| 55 | let boxList = document.querySelectorAll(".isimb-6310-builder-box"); |
| 56 | if (boxList.length) { |
| 57 | for (let i = 0; i < boxList.length; i++) { |
| 58 | //Collecting all data-tab-class attribute |
| 59 | let attr = boxList[i].getAttribute("data-tab-class"); |
| 60 | if (attr) { |
| 61 | if (allClass) { |
| 62 | allClass += ","; |
| 63 | } |
| 64 | allClass += attr.trim(); |
| 65 | } |
| 66 | } |
| 67 | if (allClass) { |
| 68 | allClass = allClass.split(","); |
| 69 | for (let i = 0; i < allClass.length; i++) { |
| 70 | if (allClass[i].trim().length) { |
| 71 | classList.push(allClass[i].trim()); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | if (classList.length) { |
| 76 | var uniqueClass = [...new Set(classList)]; |
| 77 | for (let i = 0; i < uniqueClass.length; i++) { |
| 78 | var selectedCls = this.document.querySelectorAll(uniqueClass[i]); |
| 79 | if (selectedCls.length) { |
| 80 | selectedCls.forEach(function (el) { |
| 81 | el.addEventListener("click", function () { |
| 82 | isimb_6310_create_polygon(); |
| 83 | }); |
| 84 | el.addEventListener("pointerup", function () { |
| 85 | isimb_6310_create_polygon(); |
| 86 | }); |
| 87 | }); |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | }); |
| 93 | |
| 94 | window.addEventListener("resize", function () { |
| 95 | let mainImgList = jQuery(".isimb-6310-main-image"); |
| 96 | mainImgList.each(function () { |
| 97 | let orgWidth = jQuery(this).width(); |
| 98 | let orgHeight = jQuery(this).height(); |
| 99 | if (orgWidth && orgHeight) { |
| 100 | let closest = jQuery(this).closest(".isimb-6310-builder-box"); |
| 101 | closest |
| 102 | .find(".isimb-6310-main-svg") |
| 103 | .attr("width", orgWidth) |
| 104 | .attr("height", orgHeight); |
| 105 | closest.find(".isimb-6310-main-svg").css({ |
| 106 | "background-size": orgWidth + "px " + orgHeight + "px", |
| 107 | display: "block", |
| 108 | }); |
| 109 | jQuery(this).css({ display: "none" }); |
| 110 | isimb_6310_default_polygon(closest, orgWidth, orgHeight); |
| 111 | } |
| 112 | }); |
| 113 | }); |
| 114 | |
| 115 | function isimb_6310_setTooltipPosition(pointId, alwaysShow = 2, icons) { |
| 116 | const closest = jQuery(".isimb-6310-pol-" + pointId).closest( |
| 117 | ".isimb-6310-builder-box" |
| 118 | ); |
| 119 | let jsonData = JSON.parse( |
| 120 | jQuery(".isimb-6310-pol-" + pointId).attr("data-json") |
| 121 | ); |
| 122 | |
| 123 | let polygonArea = isimb_6310_polygon_size(icons.attr("points")); |
| 124 | let areaWidth = polygonArea.x; |
| 125 | let areaHeight = polygonArea.y; |
| 126 | |
| 127 | if (jsonData.selectedTemplate == "02") { |
| 128 | let iFrame = jQuery(".isimb-6310-hover-content-" + pointId + " iframe"); |
| 129 | let width = iFrame.attr("width"); |
| 130 | let height = iFrame.attr("height"); |
| 131 | let windowWidth = jQuery(window).width(); |
| 132 | |
| 133 | if (!width) { |
| 134 | width = windowWidth > 700 ? 350 : windowWidth - 40; |
| 135 | height = windowWidth > 700 ? 290 : "auto"; |
| 136 | } else if (windowWidth < width) { |
| 137 | windowWidth -= 20; |
| 138 | height = (windowWidth * height) / width; |
| 139 | width = windowWidth; |
| 140 | } |
| 141 | |
| 142 | jQuery( |
| 143 | ".isimb-6310-hover-content-" + |
| 144 | pointId + |
| 145 | " iframe, .isimb-6310-hover-content-" + |
| 146 | pointId + |
| 147 | " .isimb-6310-template-02-hover-content" |
| 148 | ).css({ |
| 149 | width: width + "px", |
| 150 | height: height + "px", |
| 151 | }); |
| 152 | // iFrame |
| 153 | // .closest(".isimb-6310-template-02-content") |
| 154 | // .css({ width: "100%", height: "100%" }); |
| 155 | } |
| 156 | let content = jQuery(".isimb-6310-hover-content-" + pointId); |
| 157 | const tooltipType = Number(closest.attr("data-tooltip-position")); |
| 158 | if (tooltipType === 1) { |
| 159 | //Tooltip position Top Right |
| 160 | content.css({ |
| 161 | top: closest.attr("data-top-bottom") + "px", |
| 162 | right: closest.attr("data-left-right") + "px", |
| 163 | position: "fixed", |
| 164 | }); |
| 165 | } else if (tooltipType === 2) { |
| 166 | //Tooltip position Center Right |
| 167 | let contentHeight = content.height(); |
| 168 | let windowHeight = jQuery(window).height(); |
| 169 | let topPosition = windowHeight / 2 - contentHeight / 2; |
| 170 | content.css({ |
| 171 | top: topPosition + "px", |
| 172 | right: "10px", |
| 173 | position: "fixed", |
| 174 | }); |
| 175 | } else if (tooltipType === 3) { |
| 176 | //Tooltip position Bottom Right |
| 177 | content.css({ |
| 178 | bottom: closest.attr("data-top-bottom") + "px", |
| 179 | right: closest.attr("data-left-right") + "px", |
| 180 | position: "fixed", |
| 181 | }); |
| 182 | } else if (tooltipType === 4) { |
| 183 | //Tooltip position Top Left |
| 184 | content.css({ |
| 185 | top: closest.attr("data-top-bottom") + "px", |
| 186 | left: closest.attr("data-left-right") + "px", |
| 187 | position: "fixed", |
| 188 | }); |
| 189 | } else if (tooltipType === 5) { |
| 190 | //Tooltip position Center Right |
| 191 | let contentHeight = content.height(); |
| 192 | let windowHeight = jQuery(window).height(); |
| 193 | let topPosition = windowHeight / 2 - contentHeight / 2; |
| 194 | content.css({ |
| 195 | top: topPosition + "px", |
| 196 | left: "10px", |
| 197 | position: "fixed", |
| 198 | }); |
| 199 | } else if (tooltipType === 6) { |
| 200 | //Tooltip position Bottom Right |
| 201 | content.css({ |
| 202 | bottom: closest.attr("data-top-bottom") + "px", |
| 203 | left: closest.attr("data-left-right") + "px", |
| 204 | position: "fixed", |
| 205 | }); |
| 206 | } else { |
| 207 | let tempIconSize = areaWidth / 2; |
| 208 | let fromLeft = icons.offset().left; |
| 209 | let fromRight = jQuery(window).width() - fromLeft; |
| 210 | let fromTop = icons.offset().top; |
| 211 | let pointWidth = content.width() / 2; |
| 212 | let contentHeight = content.height(); |
| 213 | let toolTipPosition = isimb_6310_calculateToolTipPosition( |
| 214 | fromTop, |
| 215 | tempIconSize, |
| 216 | contentHeight |
| 217 | ); |
| 218 | |
| 219 | if (fromLeft + tempIconSize < pointWidth - 10) { |
| 220 | content.css({ |
| 221 | left: "10px", |
| 222 | right: "auto", |
| 223 | }); |
| 224 | } else if (fromRight + tempIconSize < pointWidth) { |
| 225 | content.css({ |
| 226 | left: "auto", |
| 227 | right: "10px", |
| 228 | }); |
| 229 | } else { |
| 230 | let temp = fromLeft + tempIconSize - pointWidth; |
| 231 | content.css({ |
| 232 | left: temp + "px", |
| 233 | right: "auto", |
| 234 | }); |
| 235 | } |
| 236 | |
| 237 | let topPos; |
| 238 | if (toolTipPosition == 1 || alwaysShow == 1) { |
| 239 | fromTop = fromTop + areaHeight / 2 - contentHeight; |
| 240 | topPos = fromTop + "px"; |
| 241 | } else if (toolTipPosition == 2) { |
| 242 | if (tooltipType === 7) { |
| 243 | //Show tooltip center of the polygon |
| 244 | areaHeight = areaHeight / 2; |
| 245 | } |
| 246 | fromTop += areaHeight; |
| 247 | topPos = fromTop + "px"; |
| 248 | } |
| 249 | if (parseInt(topPos) < 15) { |
| 250 | topPos = "15px"; |
| 251 | } |
| 252 | content.css({ |
| 253 | top: topPos, |
| 254 | }); |
| 255 | } |
| 256 | |
| 257 | //Hover iFrame tooltip responsive |
| 258 | let hoverContent = jQuery( |
| 259 | ".isimb-6310-hover-content .isimb-6310-template-02 iframe" |
| 260 | ); |
| 261 | if (hoverContent.length) { |
| 262 | hoverContent.each(function () { |
| 263 | let iframeWidth = jQuery(this).attr("width"); |
| 264 | let iframeHeight = jQuery(this).attr("height"); |
| 265 | let deviceWidth = jQuery(window).width(); |
| 266 | iframeWidth = |
| 267 | iframeWidth != undefined && iframeWidth != 0 && iframeWidth != "" |
| 268 | ? iframeWidth |
| 269 | : 496; |
| 270 | iframeHeight = |
| 271 | iframeHeight != undefined && iframeHeight != 0 && iframeHeight != "" |
| 272 | ? iframeHeight |
| 273 | : 397; |
| 274 | |
| 275 | if (deviceWidth < iframeWidth) { |
| 276 | iframeHeight = (iframeHeight * deviceWidth) / iframeWidth; |
| 277 | jQuery(this).attr("width", deviceWidth); |
| 278 | jQuery(this).attr("height", iframeHeight); |
| 279 | } |
| 280 | }); |
| 281 | } |
| 282 | |
| 283 | isimb_6310_RemoveLazyLoad(1000); |
| 284 | isimb_6310_RemoveLazyLoad(2000); |
| 285 | isimb_6310_RemoveLazyLoad(5000); |
| 286 | isimb_6310_RemoveLazyLoad(10000); |
| 287 | setTimeout(function () { |
| 288 | jQuery(".isimb-6310-point-icons").show(); |
| 289 | }, 500); |
| 290 | } |
| 291 | |
| 292 | function isimb_6310_calculateToolTipPosition( |
| 293 | fromTop, |
| 294 | tempIconSize, |
| 295 | contentHeight |
| 296 | ) { |
| 297 | let scrollTop = jQuery(window).scrollTop(); |
| 298 | let deviceHeight = jQuery(window).height(); |
| 299 | let center = scrollTop + deviceHeight / 2; |
| 300 | let iconCenter = fromTop + tempIconSize + 10; |
| 301 | |
| 302 | if (fromTop - contentHeight > scrollTop) { |
| 303 | //Space available in top |
| 304 | return 1; |
| 305 | } else if (iconCenter > center) { |
| 306 | //Space not available in top but more space than bottom |
| 307 | return 1; |
| 308 | } else { |
| 309 | return 2; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | function isimb_6310_RemoveLazyLoad(timeValue) { |
| 314 | //Remove lazyload |
| 315 | setTimeout(() => { |
| 316 | var $allImages = jQuery(".isimb-6310-img"); |
| 317 | $allImages.each(function () { |
| 318 | var image = jQuery(this).attr("data-isimb-value"); |
| 319 | var src = jQuery(this).attr("src"); |
| 320 | var alt = jQuery(this).attr("alt"); |
| 321 | var className = jQuery(this).attr("data-isimb-cls"); |
| 322 | |
| 323 | var attributes = this.attributes; |
| 324 | var i = attributes.length; |
| 325 | while (i--) { |
| 326 | let attrName = attributes[i].name.toLowerCase(); |
| 327 | if ( |
| 328 | attrName != "src" && |
| 329 | attrName != "class" && |
| 330 | attrName != "alt" && |
| 331 | attrName != "data-isimb-value" && |
| 332 | attrName != "data-isimb-cls" && |
| 333 | attrName != "style" |
| 334 | ) { |
| 335 | this.removeAttributeNode(attributes[i]); |
| 336 | } |
| 337 | } |
| 338 | if (src != image) { |
| 339 | jQuery(this).attr({ |
| 340 | src: image, |
| 341 | class: className, |
| 342 | alt: alt, |
| 343 | "data-isimb-value": image, |
| 344 | "data-isimb-cls": className, |
| 345 | }); |
| 346 | } else { |
| 347 | jQuery(this).attr({ class: className }); |
| 348 | } |
| 349 | }); |
| 350 | }, timeValue); |
| 351 | } |
| 352 | |
| 353 | function isimb_6310_default_polygon(closest, orgWidth, orgHeight) { |
| 354 | let polygon = closest.find(".isimb-6310-pol-loaded"); |
| 355 | if (polygon.length) { |
| 356 | polygon.each(function () { |
| 357 | let dataJson = jQuery(this).attr("data-json"); |
| 358 | dataJson = JSON.parse(dataJson); |
| 359 | let cords = isimb_6310_create_area( |
| 360 | dataJson.pointList, |
| 361 | dataJson.imageWidth, |
| 362 | dataJson.imageHeight, |
| 363 | orgWidth, |
| 364 | orgHeight |
| 365 | ); |
| 366 | jQuery(this).attr("points", cords); |
| 367 | |
| 368 | let currentId = jQuery(this).attr("data-id"); |
| 369 | let nestedList = dataJson.nestedList; |
| 370 | if (nestedList && nestedList.length) { |
| 371 | for (let i = 0; i < nestedList.length; i++) { |
| 372 | let cords = isimb_6310_create_area( |
| 373 | nestedList[i].nestedArea, |
| 374 | nestedList[i].nestedWidth, |
| 375 | nestedList[i].nestedHeight, |
| 376 | orgWidth, |
| 377 | orgHeight |
| 378 | ); |
| 379 | |
| 380 | jQuery( |
| 381 | ".isimb-6310-main-svg-" + |
| 382 | currentId.split("-")[0] + |
| 383 | " .isimb-6310-pol-nested-" + |
| 384 | currentId + |
| 385 | "-" + |
| 386 | nestedList[i].nestedId |
| 387 | ).attr("points", cords); |
| 388 | } |
| 389 | |
| 390 | let styleCSS = |
| 391 | "#isimb-6310-all-nested-point polygon[data-nested-id='" + |
| 392 | currentId + |
| 393 | "']{ fill: " + |
| 394 | dataJson.selectAreaColor + |
| 395 | " !important; stroke: " + |
| 396 | dataJson.areaBorderColor + |
| 397 | " !important; stroke-width: " + |
| 398 | dataJson.areaBorderSize + |
| 399 | "px !important; }"; |
| 400 | jQuery("<style type='text/css'>" + styleCSS + "</style>").appendTo( |
| 401 | "body" |
| 402 | ); |
| 403 | } |
| 404 | }); |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | function isimb_6310_create_area(cords, width, height, orgWidth, orgHeight) { |
| 409 | if (!cords) return ""; |
| 410 | let cordsList = cords.split(","); |
| 411 | cords = ""; |
| 412 | |
| 413 | for (let i = 0; i < cordsList.length; i++) { |
| 414 | if (i % 2 == 0) { |
| 415 | cords += isimb_6310_absolute_position(cordsList[i], width, orgWidth); |
| 416 | cords += ","; |
| 417 | } else { |
| 418 | cords += isimb_6310_absolute_position(cordsList[i], height, orgHeight); |
| 419 | cords += " "; |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | return cords.trim(); |
| 424 | } |
| 425 | |
| 426 | function isimb_6310_absolute_position(point, distance, orgDistance) { |
| 427 | return Math.round((point * orgDistance) / distance); |
| 428 | } |
| 429 | |
| 430 | function isimb_6310_hide() { |
| 431 | isimb_6310_Timeout = setTimeout( |
| 432 | function () { |
| 433 | jQuery(".isimb-6310-hover-content").each(function () { |
| 434 | if ( |
| 435 | jQuery(this).attr("data-always-show") == 1 && |
| 436 | window.innerWidth > 768 |
| 437 | ) { |
| 438 | jQuery(this).css("transform", "scale(1)"); |
| 439 | jQuery(this).show(); |
| 440 | } else { |
| 441 | jQuery(this).css("transform", "scale(0)"); |
| 442 | jQuery(this).hide(); |
| 443 | } |
| 444 | }); |
| 445 | |
| 446 | setTimeout(function () { |
| 447 | jQuery( |
| 448 | ".isimb-6310-hover-content .isimb-6310-template-02-hover-content" |
| 449 | ).css({ width: 0, height: 0 }); |
| 450 | jQuery(".isimb-6310-modal-content iframe").each(function () { |
| 451 | jQuery(this).closest(".isimb-6310-modal-content").removeAttr("style"); |
| 452 | }); |
| 453 | }, 100); |
| 454 | |
| 455 | jQuery( |
| 456 | ".isimb-6310-hover-content .isimb-6310-template-02-hover-content iframe" |
| 457 | ).removeAttr("style"); |
| 458 | |
| 459 | var closest = jQuery(".isimb-6310-hover-content iframe"); |
| 460 | if (closest.length) { |
| 461 | closest.each(function () { |
| 462 | let src = jQuery(this).attr("src"); |
| 463 | if (src.indexOf("google.com/maps/embed") === -1) { |
| 464 | jQuery(this).attr("src", ""); |
| 465 | jQuery(this).attr("src", src); |
| 466 | } |
| 467 | }); |
| 468 | } |
| 469 | }, |
| 470 | isimbPointerType ? 1500 : 500 |
| 471 | ); |
| 472 | } |
| 473 | |
| 474 | function isimb_6310_polygon_size(coords) { |
| 475 | var maxX = 0, |
| 476 | minX = 0, |
| 477 | maxY = 0, |
| 478 | minY = 0, |
| 479 | coordsArray = coords.split(" "); |
| 480 | |
| 481 | for (var j = 0; j < coordsArray.length; j++) { |
| 482 | var tempCords = coordsArray[j].split(","); |
| 483 | var x = parseFloat(tempCords[0]); |
| 484 | var y = parseFloat(tempCords[1]); |
| 485 | |
| 486 | if (j == 0) { |
| 487 | maxX = x; |
| 488 | minX = x; |
| 489 | maxY = y; |
| 490 | minY = y; |
| 491 | } else { |
| 492 | if (x > maxX) maxX = x; |
| 493 | if (x < minX) minX = x; |
| 494 | if (y > maxY) maxY = y; |
| 495 | if (y < minY) minY = y; |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | return { |
| 500 | x: maxX - minX, |
| 501 | y: maxY - minY, |
| 502 | }; |
| 503 | } |
| 504 | |
| 505 | function isimb_6310_close_button() { |
| 506 | jQuery("body").on("pointerup", function (event) { |
| 507 | if (event.target.closest(".isimb-6310-modal-content")) return; |
| 508 | if (!event.target.closest(".isimb-6310-modal")) return; |
| 509 | |
| 510 | jQuery(".isimb-6310-modal").css({ |
| 511 | display: "none", |
| 512 | }); |
| 513 | jQuery("body").css({ |
| 514 | overflow: "initial", |
| 515 | }); |
| 516 | |
| 517 | jQuery(".isimb-6310-template-02-hover-content iframe").removeAttr("style"); |
| 518 | |
| 519 | var closest = jQuery( |
| 520 | ".isimb-6310-hover-content iframe, .isimb-6310-modal iframe" |
| 521 | ); |
| 522 | if (closest.length) { |
| 523 | closest.each(function () { |
| 524 | let src = jQuery(this).attr("src"); |
| 525 | if (src.indexOf("google.com/maps/embed") === -1) { |
| 526 | jQuery(this).attr("src", ""); |
| 527 | jQuery(this).attr("src", src); |
| 528 | } |
| 529 | }); |
| 530 | } |
| 531 | |
| 532 | setTimeout(function () { |
| 533 | jQuery(".isimb-6310-template-02-hover-content").css({ |
| 534 | width: 0, |
| 535 | height: 0, |
| 536 | }); |
| 537 | jQuery(".isimb-6310-modal-content iframe").each(function () { |
| 538 | jQuery(this).closest(".isimb-6310-modal-content").removeAttr("style"); |
| 539 | }); |
| 540 | }, 100); |
| 541 | }); |
| 542 | |
| 543 | jQuery("body").on( |
| 544 | "pointerup", |
| 545 | ".isimb-6310-close-button", |
| 546 | function (event) { |
| 547 | jQuery(".isimb-6310-modal").css({ |
| 548 | display: "none", |
| 549 | }); |
| 550 | jQuery("body").css({ |
| 551 | overflow: "initial", |
| 552 | }); |
| 553 | |
| 554 | var closest = jQuery( |
| 555 | ".isimb-6310-hover-content iframe, .isimb-6310-modal iframe" |
| 556 | ); |
| 557 | if (closest.length) { |
| 558 | closest.each(function () { |
| 559 | let src = jQuery(this).attr("src"); |
| 560 | if (src.indexOf("google.com/maps/embed") === -1) { |
| 561 | jQuery(this).attr("src", ""); |
| 562 | jQuery(this).attr("src", src); |
| 563 | } |
| 564 | }); |
| 565 | } |
| 566 | |
| 567 | setTimeout(function () { |
| 568 | jQuery( |
| 569 | ".isimb-6310-hover-content .isimb-6310-template-02-hover-content" |
| 570 | ).css({ width: 0, height: 0 }); |
| 571 | jQuery(".isimb-6310-modal-content iframe").each(function () { |
| 572 | jQuery(this).closest(".isimb-6310-modal-content").removeAttr("style"); |
| 573 | }); |
| 574 | }, 500); |
| 575 | jQuery(this) |
| 576 | .closest(".isimb-6310-hover-content") |
| 577 | .css({ transform: "scale(0)" }); |
| 578 | jQuery(this).closest(".isimb-6310-hover-content").hide(); |
| 579 | } |
| 580 | ); |
| 581 | } |
| 582 | |
| 583 | function isimb_6310_popup_open() { |
| 584 | //Popup Open |
| 585 | jQuery("body").on( |
| 586 | "pointerup", |
| 587 | ".isimb-6310-pol-loaded, .isimb-6310-pol-loaded-nested", |
| 588 | function () { |
| 589 | // let directLink = jQuery(this) |
| 590 | // .closest(".isimb-6310-pol-loaded") |
| 591 | // .attr("data-link-url"); |
| 592 | |
| 593 | // if (directLink != undefined && directLink != null) { |
| 594 | // let target = jQuery(this) |
| 595 | // .closest(".isimb-6310-pol-loaded") |
| 596 | // .attr("data-target"); |
| 597 | // if (target != undefined && target != null) { |
| 598 | // window.open(directLink, "_blank"); |
| 599 | // win.focus(); |
| 600 | // } else { |
| 601 | // window.location.href = directLink; |
| 602 | // } |
| 603 | // } |
| 604 | |
| 605 | let dataId = |
| 606 | jQuery(this).closest("polygon").attr("data-id") || |
| 607 | jQuery(this).closest("polygon").attr("data-nested-id"); |
| 608 | |
| 609 | let hoverContentIframe = jQuery( |
| 610 | ".isimb-6310-hover-content-" + dataId + " iframe" |
| 611 | ); |
| 612 | if (hoverContentIframe.length) { |
| 613 | hoverContentIframe.show(); |
| 614 | } |
| 615 | |
| 616 | let selector = jQuery(".isimb-6310-popup-" + dataId); |
| 617 | if (selector.length) { |
| 618 | let windowWidth = jQuery(window).width(); |
| 619 | if (windowWidth < 768) { |
| 620 | jQuery(".isimb-6310-hover-content-" + dataId).css( |
| 621 | "transform", |
| 622 | "scale(0)" |
| 623 | ); |
| 624 | jQuery(".isimb-6310-hover-content-" + dataId).hide(); |
| 625 | } |
| 626 | let width = selector.find("iframe").attr("width"); |
| 627 | let height = selector.find("iframe").attr("height"); |
| 628 | |
| 629 | if (!width) { |
| 630 | width = windowWidth > 400 ? 350 : windowWidth - 40; |
| 631 | height = windowWidth > 400 ? 290 : "auto"; |
| 632 | } else if (windowWidth < width) { |
| 633 | windowWidth -= 40; |
| 634 | height = (windowWidth * height) / width; |
| 635 | width = windowWidth; |
| 636 | } |
| 637 | |
| 638 | selector.find("iframe").css({ |
| 639 | width: width + "px", |
| 640 | height: height + "px", |
| 641 | }); |
| 642 | selector.css({ |
| 643 | display: "block", |
| 644 | }); |
| 645 | selector.find(".isimb-6310-modal-content").css({ |
| 646 | display: "block", |
| 647 | width: width + "px", |
| 648 | height: height + "px", |
| 649 | }); |
| 650 | |
| 651 | selector.find(".isimb-6310-template-02-hover-content").css({ |
| 652 | display: "block", |
| 653 | width: width + "px", |
| 654 | height: height + "px", |
| 655 | }); |
| 656 | |
| 657 | jQuery("body").css({ |
| 658 | overflow: "hidden", |
| 659 | }); |
| 660 | } else { |
| 661 | selector = jQuery(".isimb-6310-hover-content-" + dataId).find("iframe"); |
| 662 | if (selector) { |
| 663 | let windowWidth = jQuery(window).width(); |
| 664 | jQuery(".isimb-6310-hover-content-" + dataId).css( |
| 665 | "transform", |
| 666 | "scale(1)" |
| 667 | ); |
| 668 | jQuery(".isimb-6310-hover-content-" + dataId).show(); |
| 669 | let width = selector.find("iframe").attr("width"); |
| 670 | let height = selector.find("iframe").attr("height"); |
| 671 | |
| 672 | if (!width) { |
| 673 | width = windowWidth > 700 ? 350 : windowWidth - 40; |
| 674 | height = windowWidth > 700 ? 290 : "auto"; |
| 675 | } else if (windowWidth < width) { |
| 676 | windowWidth -= 40; |
| 677 | height = (windowWidth * height) / width; |
| 678 | width = windowWidth; |
| 679 | } |
| 680 | jQuery(".isimb-6310-hover-content-" + dataId) |
| 681 | .find(".isimb-6310-template-02-hover-content") |
| 682 | .css({ |
| 683 | display: "block", |
| 684 | width: width + "px", |
| 685 | height: height + "px", |
| 686 | }); |
| 687 | selector.css({ |
| 688 | width: width + "px", |
| 689 | height: height + "px", |
| 690 | }); |
| 691 | } |
| 692 | } |
| 693 | } |
| 694 | ); |
| 695 | } |
| 696 | |
| 697 | function isimb_6310_hover_pointer() { |
| 698 | //Hover on pointer |
| 699 | jQuery(".isimb-6310-pol-loaded, .isimb-6310-pol-loaded-nested") |
| 700 | .on("pointerenter pointerdown", function (e) { |
| 701 | if (e.pointerType === "touch" && e.type === "pointerenter") { |
| 702 | return; |
| 703 | } |
| 704 | |
| 705 | clearTimeout(isimb_6310_Timeout); |
| 706 | let pointId = |
| 707 | jQuery(this).attr("data-id") || jQuery(this).attr("data-nested-id"); |
| 708 | isimbPointerType = Number( |
| 709 | jQuery(this) |
| 710 | .closest(".isimb-6310-builder-box") |
| 711 | .attr("data-tooltip-position") |
| 712 | ); |
| 713 | let alwaysShow = |
| 714 | jQuery(this).attr("data-always-show") == 1 && window.initialWidth > 768 |
| 715 | ? 1 |
| 716 | : 2; |
| 717 | isimb_6310_setTooltipPosition(pointId, alwaysShow, jQuery(this)); |
| 718 | if (isimb_6310_LastId && isimb_6310_LastId != pointId) { |
| 719 | jQuery(".isimb-6310-hover-content").each(function () { |
| 720 | if ( |
| 721 | jQuery(this).attr("data-always-show") == 1 && |
| 722 | window.innerWidth > 768 |
| 723 | ) { |
| 724 | jQuery(this).css("transform", "scale(1)"); |
| 725 | jQuery(this).show(); |
| 726 | } else { |
| 727 | jQuery(this).css("transform", "scale(0)"); |
| 728 | jQuery(this).hide(); |
| 729 | } |
| 730 | }); |
| 731 | } |
| 732 | isimb_6310_LastId = pointId; |
| 733 | jQuery(".isimb-6310-hover-content-" + pointId) |
| 734 | .stop() |
| 735 | .css("transform", "scale(1)"); |
| 736 | jQuery(".isimb-6310-hover-content-" + pointId).show(); |
| 737 | let hoverContentIframe = jQuery( |
| 738 | ".isimb-6310-hover-content-" + pointId + " iframe" |
| 739 | ); |
| 740 | if (hoverContentIframe.length) { |
| 741 | hoverContentIframe.show(); |
| 742 | } |
| 743 | }) |
| 744 | .mouseout(function () { |
| 745 | isimb_6310_hide(); |
| 746 | }); |
| 747 | |
| 748 | setTimeout(function () { |
| 749 | jQuery(".isimb-6310-hover-content") |
| 750 | .on("pointerenter pointerdown", function (e) { |
| 751 | if (e.pointerType === "touch" && e.type === "pointerenter") { |
| 752 | return; |
| 753 | } |
| 754 | clearTimeout(isimb_6310_Timeout); |
| 755 | }) |
| 756 | .mouseout(function () { |
| 757 | isimb_6310_hide(); |
| 758 | }); |
| 759 | }, 500); |
| 760 | } |
| 761 | |
| 762 | function isimb_6310_create_polygon() { |
| 763 | setTimeout(() => { |
| 764 | let mainImgList = jQuery(".isimb-6310-main-image"); |
| 765 | if (mainImgList.length) { |
| 766 | mainImgList.each(function () { |
| 767 | let mainImg = jQuery(this); |
| 768 | let orgWidth = mainImg.width(); |
| 769 | let orgHeight = mainImg.height(); |
| 770 | if (orgWidth && orgHeight) { |
| 771 | let closest = jQuery(this).closest(".isimb-6310-builder-box"); |
| 772 | closest |
| 773 | .find(".isimb-6310-main-svg") |
| 774 | .attr("width", orgWidth) |
| 775 | .attr("height", orgHeight); |
| 776 | closest.find(".isimb-6310-main-svg").css({ |
| 777 | "background-size": orgWidth + "px " + orgHeight + "px", |
| 778 | display: "block", |
| 779 | }); |
| 780 | mainImg.css({ display: "none" }); |
| 781 | isimb_6310_default_polygon(closest, orgWidth, orgHeight); |
| 782 | } |
| 783 | }); |
| 784 | } |
| 785 | }, 1000); |
| 786 | } |
| 787 | |
| 788 | function isimb_6310_direct_link() { |
| 789 | setTimeout(() => { |
| 790 | jQuery("body").on( |
| 791 | "pointerup", |
| 792 | "[isimb-6310-direct-link]", |
| 793 | function () { |
| 794 | var target = Number( |
| 795 | jQuery(this).closest("polygon").attr("isimb-6310-direct-link-target") |
| 796 | ); |
| 797 | var directLink = jQuery(this) |
| 798 | .closest("polygon") |
| 799 | .attr("isimb-6310-direct-link"); |
| 800 | |
| 801 | if (target) { |
| 802 | var win = window.open(directLink, "_blank"); |
| 803 | win.focus(); |
| 804 | } else { |
| 805 | window.location.href = directLink; |
| 806 | } |
| 807 | } |
| 808 | ); |
| 809 | }, 1000); |
| 810 | } |
| 811 | |
| 812 | function isimb_6310_polygon_color_change() { |
| 813 | jQuery("body").on( |
| 814 | "pointerenter pointerdown", |
| 815 | ".isimb-6310-pol-loaded-nested, .isimb-6310-pol-loaded", |
| 816 | function (e) { |
| 817 | if (e.pointerType === "touch" && e.type === "pointerenter") { |
| 818 | return; |
| 819 | } |
| 820 | jQuery(".isimb-6310-dynamic-css").remove(); |
| 821 | let parentId = |
| 822 | jQuery(this).attr("data-id") || jQuery(this).attr("data-nested-id"); |
| 823 | let mainId = parentId.split("-")[0]; |
| 824 | let jsonObj = JSON.parse( |
| 825 | jQuery( |
| 826 | ".isimb-6310-main-svg-" + mainId + " .isimb-6310-pol-" + parentId |
| 827 | ).attr("data-json") |
| 828 | ); |
| 829 | |
| 830 | let styleCSS = |
| 831 | ".isimb-6310-main-svg-" + |
| 832 | mainId + |
| 833 | " .isimb-6310-pol-" + |
| 834 | parentId + |
| 835 | ", .isimb-6310-main-svg-" + |
| 836 | mainId + |
| 837 | " polygon[data-nested-id='" + |
| 838 | parentId + |
| 839 | "']{ fill: " + |
| 840 | jsonObj.selectAreaHoverColor + |
| 841 | " !important; stroke:" + |
| 842 | jsonObj.areaBorderHoverColor + |
| 843 | " !important; stroke-width:" + |
| 844 | jsonObj.areaBorderSize + |
| 845 | "px !important; cursor: pointer; filter: drop-shadow(0px 0px " + |
| 846 | jsonObj.areaShadowith + |
| 847 | "px " + |
| 848 | jsonObj.areaShadowColor + |
| 849 | "); }"; |
| 850 | jQuery( |
| 851 | "<style type='text/css' class='isimb-6310-dynamic-css'>" + |
| 852 | styleCSS + |
| 853 | "</style>" |
| 854 | ).appendTo("body"); |
| 855 | } |
| 856 | ); |
| 857 | |
| 858 | jQuery("body").on( |
| 859 | "mouseout", |
| 860 | ".isimb-6310-pol-loaded-nested, .isimb-6310-pol-loaded", |
| 861 | function () { |
| 862 | jQuery(".isimb-6310-dynamic-css").remove(); |
| 863 | let parentId = |
| 864 | jQuery(this).attr("data-id") || jQuery(this).attr("data-nested-id"); |
| 865 | let mainId = parentId.split("-")[0]; |
| 866 | let jsonObj = JSON.parse( |
| 867 | jQuery( |
| 868 | ".isimb-6310-main-svg-" + mainId + " .isimb-6310-pol-" + parentId |
| 869 | ).attr("data-json") |
| 870 | ); |
| 871 | let styleCSS = |
| 872 | ".isimb-6310-main-svg-" + |
| 873 | mainId + |
| 874 | " .isimb-6310-pol-" + |
| 875 | parentId + |
| 876 | ", .isimb-6310-main-svg-" + |
| 877 | mainId + |
| 878 | " polygon[data-nested-id='" + |
| 879 | parentId + |
| 880 | "']{ fill: " + |
| 881 | jsonObj.selectAreaColor + |
| 882 | " !important; stroke: " + |
| 883 | jsonObj.areaBorderColor + |
| 884 | " !important; stroke-width: " + |
| 885 | jsonObj.areaBorderSize + |
| 886 | "px !important; }"; |
| 887 | jQuery( |
| 888 | "<style type='text/css' class='isimb-6310-dynamic-css'>" + |
| 889 | styleCSS + |
| 890 | "</style>" |
| 891 | ).appendTo("body"); |
| 892 | } |
| 893 | ); |
| 894 | } |
| 895 |