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