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 / isimb-6310-admin-script.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
isimb-6310-admin-script.js
717 lines
1 window.orgWidth = 0;
2 window.orgHeight = 0;
3
4 jQuery(window).load(function () {
5 isimb_6310_zoom_in_out_code();
6 isimb_6310_tooltip_fields();
7 //set SVG width and height
8 let mainImg = jQuery(".isimb-6310-main-image");
9 window.orgWidth = mainImg.width();
10 window.orgHeight = mainImg.height();
11
12 jQuery(".isimb-6310-main-svg")
13 .attr("width", window.orgWidth)
14 .attr("height", window.orgHeight);
15 jQuery(".isimb-6310-main-svg").css({
16 "background-size": window.orgWidth + "px " + window.orgHeight + "px",
17 });
18 jQuery(".isimb-6310-main-image").hide();
19 isimb_6310_default_polygon(window.orgWidth, window.orgHeight);
20 isimb_6310_icon_image_select();
21
22 /* Link Setting */
23 jQuery("body").on(
24 "click",
25 "#isimb-6310-add-point .isimb-6310_link_title_type",
26 function () {
27 if (Number(jQuery(this).val()) == 2) {
28 jQuery("#isimb-6310-add-point .isimb-6310_link").addClass(
29 "isimb-6310-hide"
30 );
31 } else {
32 jQuery("#isimb-6310-add-point .isimb-6310_link").removeClass(
33 "isimb-6310-hide"
34 );
35 if (
36 Number(
37 jQuery(
38 "#isimb-6310-add-point .isimb-6310_button_link:checked"
39 ).val()
40 ) == 2
41 ) {
42 jQuery("#isimb-6310-add-point .isimb-6310_button").addClass(
43 "isimb-6310-hide"
44 );
45 } else {
46 jQuery("#isimb-6310-add-point .isimb-6310_button").removeClass(
47 "isimb-6310-hide"
48 );
49 }
50 }
51 }
52 );
53
54 jQuery("body").on(
55 "click",
56 "#isimb-6310-add-point .isimb-6310_button_link",
57 function () {
58 if (Number(jQuery(this).val()) == 2) {
59 jQuery("#isimb-6310-add-point .isimb-6310_button").addClass(
60 "isimb-6310-hide"
61 );
62 } else {
63 jQuery("#isimb-6310-add-point .isimb-6310_button").removeClass(
64 "isimb-6310-hide"
65 );
66 }
67 }
68 );
69
70 /* Edit link Setting */
71 jQuery("body").on(
72 "click",
73 "#isimb-6310-edit-point .isimb-6310_link_title_type",
74 function () {
75 if (Number(jQuery(this).val()) == 2) {
76 jQuery("#isimb-6310-edit-point .isimb-6310_link").addClass(
77 "isimb-6310-hide"
78 );
79 } else {
80 jQuery("#isimb-6310-edit-point .isimb-6310_link").removeClass(
81 "isimb-6310-hide"
82 );
83 if (
84 Number(
85 jQuery(
86 "#isimb-6310-edit-point .isimb-6310_button_link:checked"
87 ).val()
88 ) == 2
89 ) {
90 jQuery("#isimb-6310-edit-point .isimb-6310_button").addClass(
91 "isimb-6310-hide"
92 );
93 } else {
94 jQuery("#isimb-6310-edit-point .isimb-6310_button").removeClass(
95 "isimb-6310-hide"
96 );
97 }
98 }
99 }
100 );
101
102 jQuery("body").on(
103 "click",
104 "#isimb-6310-edit-point .isimb-6310_button_link",
105 function () {
106 if (Number(jQuery(this).val()) == 2) {
107 jQuery("#isimb-6310-edit-point .isimb-6310_button").addClass(
108 "isimb-6310-hide"
109 );
110 } else {
111 jQuery("#isimb-6310-edit-point .isimb-6310_button").removeClass(
112 "isimb-6310-hide"
113 );
114 }
115 }
116 );
117
118 /* **************************************************************** */
119
120 //Add Point Script
121 let counter =
122 jQuery(".isimb-6310-main-svg polygon.isimb-6310-pol-loaded").length + 1;
123 jQuery("body").on("click", ".isimb-6310-add-place-save", function () {
124 window.currentPoint = counter;
125 let canvasArea = jQuery(".isimb-6310-canvas-area").val();
126 if (!canvasArea) {
127 alert("Please select area first");
128 return;
129 }
130 let elementType = Number(jQuery(".isimb-6310-section-select").val());
131 if (elementType == 0) {
132 alert("Please select element type");
133 jQuery(".isimb-6310-section-select").focus();
134 return;
135 }
136
137 let jsonObj = isimb_6310_set_generate_json_data("#isimb-6310-add-point ");
138 let jsonObjParse = JSON.stringify(jsonObj);
139 let cords = isimb_6310_create_area(
140 canvasArea,
141 jsonObj.imageWidth,
142 jsonObj.imageHeight,
143 window.orgWidth,
144 window.orgHeight
145 );
146 let html = `
147 <polygon data-id="${window.currentPoint}" class="isimb-6310-pol-loaded isimb-6310-pol-${counter}" points="${cords}"/>
148 `;
149 let styleCSS = `
150 .isimb-6310-main-svg .isimb-6310-pol-${counter}{
151 fill: ${jsonObj.selectAreaColor} !important;
152 stroke:${jsonObj.areaBorderColor} !important;
153 stroke-width:${jsonObj.areaBorderSize}px !important;
154 }
155 .isimb-6310-main-svg .isimb-6310-pol-${counter}:hover{
156 fill: ${jsonObj.selectAreaHoverColor} !important;
157 stroke:${jsonObj.areaBorderHoverColor} !important;
158 stroke-width:${jsonObj.areaBorderSize}px !important;
159 cursor: pointer;
160 filter: drop-shadow(0px 0px ${jsonObj.areaShadowith}px ${jsonObj.areaShadowColor});
161 }
162 `;
163 jQuery(".isimb-6310-main-svg").append(html);
164 jQuery(`.isimb-6310-pol-${counter}`).attr("data-json", jsonObjParse);
165 jQuery(`<style type='text/css'>${styleCSS}</style>`).appendTo(
166 `.isimb-6310-builder-box`
167 );
168
169 jQuery("#isimb-6310-add-point").fadeOut(500);
170 jQuery("body").css({
171 overflow: "initial",
172 });
173 jQuery(".isimb-6310-builder-box").html(
174 jQuery(".isimb-6310-builder-box").html()
175 );
176 counter++;
177 jQuery(".isimb-6310-canvas-area").val("");
178 });
179
180 //Delete Point Script
181 jQuery("body").on("click", ".isimb-6310-btn-point-delete", function (event) {
182 event.preventDefault();
183 jQuery(`.isimb-6310-point-${window.currentPoint}`).remove();
184 jQuery(`#isimb-6310-edit-point`).fadeOut(500);
185 jQuery("body").css({
186 overflow: "initial",
187 });
188 });
189
190 jQuery("body").on(
191 "change",
192 "#isimb-6310-add-point .isimb-6310-section-view-mood-select",
193 function () {
194 let val = parseInt(jQuery(this).val());
195 setTimeout(function () {
196 jQuery("#isimb-6310-add-point .isimb-6310-section-select:last").click();
197 jQuery(
198 "#isimb-6310-add-point .isimb-6310-section-select:first"
199 ).click();
200
201 if (val == 1) {
202 jQuery(".isimb-6310-model-content").addClass("isimb-6310-hide");
203 jQuery(
204 ".isimb-6310-link-content, .isimb-6310-linking-area-tr"
205 ).removeClass("isimb-6310-hide");
206 } else {
207 jQuery(".isimb-6310-model-content").removeClass("isimb-6310-hide");
208 jQuery(".isimb-6310-linking-area-tr").addClass("isimb-6310-hide");
209 }
210 }, 100);
211 }
212 );
213
214 jQuery("body").on(
215 "change",
216 "#isimb-6310-edit-point .isimb-6310-section-view-mood-select",
217 function () {
218 let val = parseInt(jQuery(this).val());
219 setTimeout(function () {
220 jQuery(
221 "#isimb-6310-edit-point .isimb-6310-section-select:last"
222 ).click();
223 jQuery(
224 "#isimb-6310-edit-point .isimb-6310-section-select:first"
225 ).click();
226
227 if (val == 1) {
228 jQuery(".isimb-6310-model-content").addClass("isimb-6310-hide");
229 jQuery(
230 ".isimb-6310-link-content, .isimb-6310-linking-area-tr"
231 ).removeClass("isimb-6310-hide");
232 } else {
233 jQuery(".isimb-6310-model-content").removeClass("isimb-6310-hide");
234 jQuery(".isimb-6310-linking-area-tr").addClass("isimb-6310-hide");
235 }
236 }, 100);
237 }
238 );
239
240 // Point Settings script
241 jQuery("body").on("change", ".isimb-6310-section-select", function () {
242 let val = parseInt(jQuery(this).val());
243 let parentId = jQuery(this).closest(".isimb-6310-modal").attr("id");
244 jQuery(
245 ".isimb-6310-tooltip-link, .isimb-6310-embided, .isimb-6310-external-link, .isimb-6310-templates, .isimb-6310-tooltip-img, .isimb_6310_custom_template, .isimb-6310-direct-link, .isimb-6310-link-content-direct"
246 ).addClass("isimb-6310-hide");
247 jQuery(`.isimb-6310-type-${val}, .isimb-6310_link-type`).removeClass(
248 "isimb-6310-hide"
249 );
250 if (val == 1) {
251 jQuery(".isimb_6310_textarea").removeClass("isimb-6310-hide");
252 jQuery(
253 ".isimb-6310-tooltip-link, .isimb-6310-templates, .toggle-tabs li[data-id='3']"
254 ).removeClass("isimb-6310-hide");
255 if (parentId == "isimb-6310-edit-point") {
256 jQuery(
257 `#${parentId} .isimb-6310-tooltip_img_section .isimb-6310-tooltip-img[data-id='01']`
258 ).addClass("isimb-6310-hide");
259 jQuery(
260 `#${parentId} .isimb-6310-tooltip_img_section .isimb-6310-tooltip-img[data-id='03'], #isimb_6310_custom_code-html, .isimb_6310_custom_code_popup-html`
261 ).trigger("click");
262 } else {
263 jQuery(
264 `#${parentId} .isimb-6310-tooltip_img_section .isimb-6310-tooltip-img[data-id='01']`
265 ).removeClass("isimb-6310-hide");
266 jQuery(
267 `#${parentId} .isimb-6310-tooltip_img_section .isimb-6310-type-${val}:first, #isimb_6310_custom_code-html, .isimb_6310_custom_code_popup-html`
268 ).trigger("click");
269 }
270 if (
271 jQuery(
272 `#${parentId} .isimb-6310-section-view-mood-select:checked`
273 ).val() == "1"
274 ) {
275 jQuery(
276 `#${parentId} .isimb-6310-tooltip-img[data-id='01']`
277 ).removeClass("isimb-6310-hide");
278 jQuery(`#${parentId} .isimb-6310-tooltip-img[data-id='04']`).click();
279 jQuery(`#${parentId} .isimb-6310-tooltip-img[data-id='01']`).click();
280 } else {
281 jQuery(`#${parentId} .isimb-6310-tooltip-img[data-id='01']`).addClass(
282 "isimb-6310-hide"
283 );
284 jQuery(`#${parentId} .isimb-6310-tooltip-img[data-id='03']`).click();
285 }
286 } else if (val == 2) {
287 jQuery(
288 ".isimb_6310_textarea, .isimb-6310-embided, .isimb-6310-templates"
289 ).removeClass("isimb-6310-hide");
290 jQuery('.toggle-tabs li[data-id="3"]').addClass("isimb-6310-hide");
291 jQuery(
292 `#${parentId} .isimb-6310-tooltip_img_section .isimb-6310-type-${val}:first, #isimb_6310_custom_code-html, .isimb_6310_custom_code_popup-html`
293 ).trigger("click");
294 } else if (val == 3) {
295 jQuery(".isimb_6310_custom_template").removeClass("isimb-6310-hide");
296 jQuery(
297 '.isimb_6310_font_prop, .isimb_6310_template_embedded, .toggle-tabs li[data-id="3"]'
298 ).addClass("isimb-6310-hide");
299 jQuery(".isimb_6310_template_description").addClass("isimb-6310-hide");
300 } else {
301 jQuery(
302 '.toggle-tabs li[data-id="3"], .isimb-6310-direct-link, .isimb-6310_link, .isimb-6310_link-type, .isimb-6310-link-content-direct'
303 ).removeClass("isimb-6310-hide");
304 jQuery(
305 ".isimb_6310_font_prop, .isimb_6310_template_embedded, .isimb_6310_custom_template, .isimb_6310_custom_template, .isimb_6310_template_description"
306 ).addClass("isimb-6310-hide");
307 }
308 });
309
310 //Template load script
311
312 jQuery("body").on("click", ".isimb-6310-tooltip-img", function () {
313 jQuery(".isimb-6310-tooltip-img").removeClass("isimb-6310-active");
314 jQuery(this)
315 .closest(".isimb-6310-tooltip-img")
316 .addClass("isimb-6310-active");
317 let val = jQuery(this).closest(".isimb-6310-tooltip-img").attr("data-id");
318 jQuery(".isimb-6310-form").addClass("isimb-6310-hide");
319 jQuery(`.isimb-6310-form-${val}`).removeClass("isimb-6310-hide");
320
321 isimb_6310_set_html_code(val);
322 });
323
324 // tooltip embedded code show hide add point
325
326 jQuery("body").on(
327 "change",
328 "#isimb-6310-add-point .isimb-6310-open-popup",
329 function () {
330 let val = parseInt(jQuery(this).val());
331 jQuery(
332 "#isimb-6310-add-point .popup-user-embedded, .tooltip-custom-html-css, .tooltip-embedded"
333 ).addClass("isimb-6310-hide");
334 if (val == 2) {
335 jQuery("#isimb-6310-add-point .popup-user-embedded").removeClass(
336 "isimb-6310-hide"
337 );
338 }
339 if (val == 1) {
340 jQuery(
341 "#isimb-6310-add-point .popup-user-embedded, .tooltip-custom-html-css, .tooltip-embedded"
342 ).addClass("isimb-6310-hide");
343 }
344 }
345 );
346 jQuery("body").on(
347 "change",
348 "#isimb-6310-add-point .isimb-6310-open-popup-custom-use",
349 function () {
350 let val = parseInt(jQuery(this).val());
351 jQuery("#isimb-6310-add-point .tooltip-embedded").removeClass(
352 "isimb-6310-hide"
353 );
354 if (val == 2) {
355 jQuery("#isimb-6310-add-point .tooltip-embedded").removeClass(
356 "isimb-6310-hide"
357 );
358 jQuery("#isimb-6310-add-point .tooltip-custom-html-css").addClass(
359 "isimb-6310-hide"
360 );
361 }
362 if (val == 1) {
363 jQuery("#isimb-6310-add-point .tooltip-embedded").addClass(
364 "isimb-6310-hide"
365 );
366 jQuery("#isimb-6310-add-point .tooltip-custom-html-css").removeClass(
367 "isimb-6310-hide"
368 );
369 }
370 }
371 );
372 // tooltip embedded code show hide edit point
373 jQuery("body").on(
374 "change",
375 "#isimb-6310-edit-point .isimb-6310-open-popup",
376 function () {
377 let val = parseInt(jQuery(this).val());
378 if (val == 2) {
379 jQuery("#isimb-6310-edit-point .popup-user-embedded").removeClass(
380 "isimb-6310-hide"
381 );
382 }
383 if (val == 1) {
384 jQuery(
385 "#isimb-6310-edit-point .popup-user-embedded, .tooltip-custom-html-css, .tooltip-embedded"
386 ).addClass("isimb-6310-hide");
387 }
388 }
389 );
390 jQuery("body").on(
391 "change",
392 "#isimb-6310-edit-point .isimb-6310-open-popup-custom-use",
393 function () {
394 let val = parseInt(jQuery(this).val());
395 jQuery("#isimb-6310-edit-point .tooltip-embedded").removeClass(
396 "isimb-6310-hide"
397 );
398 if (val == 2) {
399 jQuery("#isimb-6310-edit-point .tooltip-embedded").removeClass(
400 "isimb-6310-hide"
401 );
402 jQuery("#isimb-6310-edit-point .tooltip-custom-html-css").addClass(
403 "isimb-6310-hide"
404 );
405 }
406 if (val == 1) {
407 jQuery("#isimb-6310-edit-point .tooltip-embedded").addClass(
408 "isimb-6310-hide"
409 );
410 jQuery("#isimb-6310-edit-point .tooltip-custom-html-css").removeClass(
411 "isimb-6310-hide"
412 );
413 }
414 }
415 );
416
417 //Combine JSON and push it in an input field
418 jQuery("body").on("click", ".isimb-6310-insert-ja-data", function () {
419 let jsonCollection = [];
420 jQuery(`.isimb-6310-main-svg polygon`).each(function () {
421 let jsonObj = jQuery(this).attr("data-json");
422 if (jsonObj) {
423 jsonObj = JSON.parse(jsonObj);
424 jsonObj.points = jQuery(this).attr("points");
425 jsonCollection.push(jsonObj);
426 }
427 });
428 jQuery("#isimb_6310_json_field").val(JSON.stringify(jsonCollection));
429 });
430
431 //Manage icon remove start
432 jQuery("body").on("click", ".fa-minus-circle", function () {
433 jQuery(this).closest("td").find("input").val("");
434 });
435 //Manage icon remove end
436 });
437
438 function isimb_6310_set_html_code(val) {
439 let htmlCode = "";
440 if (val == "01") {
441 htmlCode = `
442 <div class="isimb-6310-tooltip isimb-6310-template-01">
443 <a href="#">Hover here</a>
444 <div class="isimb-6310-template-01-hover-content">Tooltip text</div>
445 </div>
446 `;
447 } else if (val == "03") {
448 htmlCode = `
449 <div class="isimb-6310-tooltip isimb-6310-template-03 isimb-6310-hide">
450 <a href="#"><img src="img/4 (2).png" alt="" ></a>
451 <div class="isimb-6310-template-03-hover-content">
452 <div class="isimb-6310-template-03-tooltip-testimonial">
453 <div class="isimb-6310-template-03-tooltip-pic">
454 <img src="img/7.png" alt="">
455 </div>
456 <div class="isimb-6310-template-03-tooltip-testimonial-content">
457 <div class="isimb-6310-template-03-tooltip-testimonial-title">Williamson
458 <div class="isimb-6310-template-03-tooltip-post">Web Designer</div>
459 </div>
460 <div class="isimb-6310-template-03-tooltip-description">
461 Lorem ipsum dolor sit amet, consectetur adipisicing elit. A aliquam amet animi blanditiis consequatur
462 debitis dicta distinctio, enim error eum iste libero modi nam natus perferendis possimus quasi sint sit
463 tempora voluptatem. Est, exercitationem id ipsa ipsum laboriosam perferendis temporibus!
464 </div>
465 </div>
466 </div>
467 </div>
468 </div>
469 `;
470 } else if (val == "04") {
471 htmlCode = `
472 <div class="isimb-6310-tooltip isimb-6310-template-04 isimb-6310-hide">
473 <a href="#"><img src="img/4 (2).png" alt=""></a>
474 <div class="isimb-6310-template-04-tooltip-testimonial">
475 <div class="isimb-6310-template-04-tooltip-testimonial-content">
476 <div class="isimb-6310-template-04-tooltip-pic">
477 <img src="img/7.png">
478 </div>
479 <div class="isimb-6310-template-04-tooltip-title">Williamson</div>
480 <div class="isimb-6310-template-04-tooltip-post">Web Developer</div>
481 </div>
482 <div class="isimb-6310-template-04-tooltip-description">
483 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dolor tellus, efficitur ut tortor id,
484 molestie egestas nibh. In blandit ex at erat vehicula molestie. Mauris vel volutpat nulla. Suspendisse lorem
485 ex, congue at elit id, tincidunt tempor orci. Nullam nec augue ac tellus rhoncus tincidunt nec ut ligula.
486 Praesent.
487 </div>
488 </div>
489 </div>
490 `;
491 } else if (val == "05") {
492 htmlCode = `
493 <div class="isimb-6310-tooltip isimb-6310-template-05 isimb-6310-hide">
494 <a href="#"><img src="img/4 (2).png" alt=""></a>
495 <div class="isimb-6310-template-05-hover-content">
496 <div class="isimb-6310-template-05-tooltip-testimonial">
497 <div class="isimb-6310-template-05-tooltip-testimonial-content">
498 <div class="isimb-6310-template-05-tooltip-pic">
499 <img src="img/7.png">
500 </div>
501 <div class="isimb-6310-template-05-tooltip-title">Williamson</div>
502 <div class="isimb-6310-template-05-tooltip-post">Web Developer</div>
503 </div>
504 <div class="isimb-6310-template-05-tooltip-description">
505 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dolor tellus, efficitur ut tortor id,
506 molestie egestas nibh. In blandit ex at erat vehicula molestie. Mauris vel volutpat nulla. Suspendisse lorem
507 ex, congue at elit id, tincidunt tempor orci. Nullam nec augue ac tellus rhoncus tincidunt nec ut ligula.
508 Praesent.
509 </div>
510 </div>
511 </div>
512 </div>
513 `;
514 } else if (val == "02") {
515 htmlCode = `
516 <div class="isimb-6310-tooltip isimb-6310-template-02">
517 <div class="isimb-6310-template-02-hover-content">
518 <div class="isimb-6310-template-02-content">
519 <iframe src="https://www.google.com/maps/embed?pb=!1m14!1m12!1m3!1d25125110.814096835!2d94.35061650599457!3d23.913222352616348!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2sbd!4v1636176093357!5m2!1sen!2sbd" width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy"></iframe>
520 </div>
521 </div>
522 </div>
523 `;
524 }
525
526 jQuery(`textarea[name='isimb_6310_custom_code']`).val(htmlCode);
527 jQuery(
528 `#isimb_6310_custom_code-html, .isimb_6310_custom_code_popup-html`
529 ).trigger("click");
530 }
531
532 function isimb_6310_icon_image_select() {
533 //Manage icon Start
534 jQuery("#icon-filter").on("keyup", function () {
535 var value = jQuery(this).val().toLowerCase();
536 jQuery(".isimb-6310-choose-icon li").filter(function () {
537 jQuery(this).toggle(
538 jQuery(this).attr(`data-icon-name`).toLowerCase().indexOf(value) > -1
539 );
540 });
541 });
542
543 jQuery("body").on(
544 "click",
545 "#isimb-6310-font-icon-close, .isimb-6310-font-awesome-close",
546 function () {
547 jQuery("#isimb_6310_social_icon").fadeOut(500);
548 }
549 );
550
551 jQuery("body").on(
552 "click",
553 "isimb-6310-plus-icons, .isimb-6310-plus-icons i",
554 function () {
555 let selIds = jQuery(this)
556 .closest(".isimb-6310-plus-icons")
557 .siblings(".isimb-6310-form-input")
558 .attr("id");
559 jQuery("ul.isimb-6310-choose-icon").attr("data-current-id", selIds);
560 if (jQuery("#icon-filter").val()) {
561 jQuery("#icon-filter").val("");
562 jQuery(".isimb-6310-choose-icon li").filter(function () {
563 jQuery(this).toggle();
564 });
565 }
566 jQuery("#isimb_6310_social_icon").fadeIn(500);
567 jQuery("body").css({
568 overflow: "hidden",
569 });
570 jQuery("#icon-filter").focus();
571 return false;
572 }
573 );
574
575 jQuery("body").on("click", "ul.isimb-6310-choose-icon li", function () {
576 let cls = jQuery(this).find("i").attr("class");
577 jQuery(
578 `.` + jQuery("ul.isimb-6310-choose-icon").attr("data-current-id")
579 ).val(cls);
580 jQuery("#isimb_6310_social_icon").fadeOut(500);
581 });
582 //Manage icon End
583
584 /* Main Image Upload ########### */
585 jQuery("body").on("click", ".isimb-6310-upload-image", function (e) {
586 e.preventDefault();
587 var image = wp
588 .media({
589 title: "Upload Image",
590 multiple: false,
591 })
592 .open()
593 .on("select", function (e) {
594 var uploaded_image = image.state().get("selection").first();
595 var image_url = uploaded_image.toJSON().url;
596 jQuery(`.isimb-6310-main-image`).attr("src", image_url);
597 jQuery(`input[name='main_image']`).val(image_url);
598 jQuery(`svg.isimb-6310-main-svg, svg.isimb-6310-main-multiple-svg`).css(
599 {
600 "background-image": `url(${image_url})`,
601 }
602 );
603 jQuery(
604 "input.isimb-6310-canvas-area, .isimb-6310-canvas-area-nested-edit, .isimb-6310-canvas-area-nested"
605 ).attr("isimb-6310-image-url", image_url);
606 setTimeout(function () {
607 let mainImg = jQuery(".isimb-6310-main-image");
608 window.orgWidth = mainImg.width();
609 window.orgHeight = mainImg.height();
610 jQuery(".isimb-6310-main-svg")
611 .attr("width", window.orgWidth)
612 .attr("height", window.orgHeight);
613 jQuery(".isimb-6310-main-svg").css({
614 "background-size":
615 window.orgWidth + "px " + window.orgHeight + "px",
616 });
617 }, 500);
618 });
619
620 jQuery("#isimb_6310_add_new_media").css({
621 "overflow-x": "hidden",
622 "overflow-y": "auto",
623 });
624 });
625
626 //Add Point
627 jQuery("body").on("change", ".isimb-6310_icon_type", function (e) {
628 let value = Number(jQuery(this).val());
629 jQuery(".isimb-6310-marker").addClass("isimb-6310-hide");
630 jQuery(`.isimb-6310-marker-type-${value}`).removeClass("isimb-6310-hide");
631 });
632
633 /* ######### Custom Icon Media Start ########### */
634 jQuery("body").on("click", ".isimb-6310-icon-upload", function (e) {
635 e.preventDefault();
636 let dataId = jQuery(this).attr("data-id");
637
638 var image = wp
639 .media({
640 title: "Upload Image",
641 multiple: false,
642 })
643 .open()
644 .on("select", function (e) {
645 var uploaded_image = image.state().get("selection").first();
646 var image_url = uploaded_image.toJSON().url;
647 jQuery(`.${dataId}`).val(image_url);
648 });
649
650 jQuery("#isimb_6310_add_new_media").css({
651 "overflow-x": "hidden",
652 "overflow-y": "auto",
653 });
654 });
655 /* ######### Custom Icon Media End ########### */
656 }
657
658 function isimb_6310_zoom_in_out_code() {
659 /* ######### Custom Icon For Zoom In/Out Start ########### */
660 /* Main Image Upload ########### */
661 jQuery("body").on("click", ".isimb-6310-zoom-icon", function (e) {
662 e.preventDefault();
663 const closest = jQuery(this);
664 var image = wp
665 .media({
666 title: "Upload Icon",
667 multiple: false,
668 })
669 .open()
670 .on("select", function (e) {
671 var uploaded_image = image.state().get("selection").first();
672 var image_url = uploaded_image.toJSON().url;
673 closest.closest("td").find(`img`).attr("src", image_url);
674 closest.closest("td").find(`input[type='hidden']`).val(image_url);
675 });
676
677 jQuery("#isimb_6310_add_new_media").css({
678 "overflow-x": "hidden",
679 "overflow-y": "auto",
680 });
681 });
682 /* ######### Custom Icon For Zoom In/Out End ########### */
683
684 const zoomFeature = Number(
685 jQuery("input[name='zoom_feature']:checked").val()
686 );
687 zoomFeature > 1
688 ? jQuery(".toggle-zoom-feature").show()
689 : jQuery(".toggle-zoom-feature").hide();
690
691 jQuery("body").on("change", "input[name='zoom_feature']", function () {
692 const value = Number(jQuery(this).val());
693 value > 1
694 ? jQuery(".toggle-zoom-feature").show()
695 : jQuery(".toggle-zoom-feature").hide();
696 });
697 }
698
699 function isimb_6310_tooltip_fields() {
700 const field = jQuery('select[name="tooltip_position"]');
701 Number(field.val())
702 ? jQuery(".tooltip-attribute").show()
703 : jQuery(".tooltip-attribute").hide();
704
705 jQuery("body").on("change", 'select[name="tooltip_position"]', function () {
706 const value = Number(jQuery(this).val());
707 if (value && value !== 2 && value !== 5) {
708 jQuery(".tooltip-attribute").show();
709 let selectedText = jQuery(this).find("option:selected").text().split(" ");
710 jQuery(".tooltip-attribute-text-1").text("Gap From " + selectedText[0]);
711 jQuery(".tooltip-attribute-text-2").text("Gap From " + selectedText[1]);
712 } else {
713 jQuery(".tooltip-attribute").hide();
714 }
715 });
716 }
717