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 / json-data.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
json-data.js
725 lines
1 function isimb_6310_set_generate_json_data(
2 selector = "#isimb-6310-add-point "
3 ) {
4 let myObj = {};
5 let myCSS = {};
6 myObj.pointList = jQuery(selector + ".isimb-6310-canvas-area").val();
7 myObj.imageWidth = jQuery(selector + ".isimb-6310-canvas").attr("width");
8 myObj.imageHeight = jQuery(selector + ".isimb-6310-canvas").attr("height");
9 let viewMoodType = Number(
10 jQuery(selector + ".isimb-6310-section-view-mood-select:checked").val()
11 );
12
13 let elementType = Number(
14 jQuery(selector + ".isimb-6310-section-select:checked").val()
15 );
16 myObj.selectModelContent = jQuery(
17 selector + ".isimb_6310_modal_content"
18 ).val();
19 myObj.ModalContentFontSize = jQuery(
20 selector + ".isimb_6310_modal_content_font_size"
21 ).val();
22 myObj.ModalContentColor = jQuery(
23 selector + ".isimb_6310_modal_content_color"
24 ).val();
25
26 myObj.ModalContentBgColor = jQuery(
27 selector + ".isimb_6310_modal_content_background_color"
28 ).val();
29 myObj.selectAreaColor = jQuery(
30 selector + ".isimb_6310_select_area_color"
31 ).val();
32 myObj.selectAreaHoverColor = jQuery(
33 selector + ".isimb_6310_select_area_hover_color"
34 ).val();
35 myObj.areaBorderSize = jQuery(
36 selector + ".isimb-6310_area_border_size"
37 ).val();
38 myObj.customFirstImg = jQuery(selector + ".isimb-6310-image-edit-1").val();
39 myObj.customSecondImg = jQuery(selector + ".isimb-6310-image-edit-2").val();
40 myObj.customTextSize = jQuery(
41 selector + ".isimb_6310_custom_text_font_size"
42 ).val();
43 myObj.areaBorderColor = jQuery(
44 selector + ".isimb_6310_area_border_color"
45 ).val();
46 myObj.areaBorderHoverColor = jQuery(
47 selector + ".isimb_6310_area_border_hover_color"
48 ).val();
49 myObj.areaShadowith = jQuery(
50 selector + ".isimb-6310_area_shadow_width"
51 ).val();
52 myObj.areaShadowColor = jQuery(
53 selector + ".isimb_6310_area_shadow_hover_color"
54 ).val();
55 myObj.customTextBgColor = jQuery(
56 selector + ".isimb_6310_custom_text_font_bg_color"
57 ).val();
58 myObj.customeCode = jQuery(
59 selector + `textarea[name='isimb_6310_custom_code']`
60 ).val();
61 myObj.mouseType = jQuery(selector + ".isimb-6310_popover_type:checked").val();
62
63 // check element type
64
65 myObj.selectedTemplate = jQuery(selector + ".isimb-6310-active").attr(
66 "data-id"
67 );
68
69 myObj.popupEmbedded = jQuery(selector + ".popup_embedded").val();
70 myObj.selectedTemplate = jQuery(selector + ".isimb-6310-active").attr(
71 "data-id"
72 );
73
74 // check selector type
75
76 myObj.linkText = jQuery(selector + ".isimb_6310_link_text").val();
77 myObj.linkURL = jQuery(selector + ".isimb_6310_custom_link_url").val();
78 myObj.openNewTab = jQuery(
79 selector + ".isimb-6310-open-new-tab:checked"
80 ).val();
81 myObj.linkingArea = 0;
82 myObj.openPopup = jQuery(selector + ".isimb-6310-open-popup:checked").val();
83 myObj.openPopupCustomUse = jQuery(
84 selector + ".isimb-6310-open-popup-custom-use:checked"
85 ).val();
86 myObj.openDesImg = jQuery(selector + ".isimb-6310-des-img").val();
87 myObj.openDescription = jQuery(
88 selector + ".isimb-6310-tooltip_discription"
89 ).val();
90 myObj.openDesFontSize = jQuery(
91 selector + ".isimb-6310-tooltip_discription_font_size"
92 ).val();
93 myObj.openDesFontColor = jQuery(
94 selector + ".isimb-6310-tooltip_discription_font_color"
95 ).val();
96 myObj.customButtonLinkType = jQuery(
97 selector + ".isimb-6310_button_link:checked"
98 ).val();
99 myObj.customButtonText = jQuery(selector + ".isimb-6310-button-text").val();
100 myObj.customButtonUrl = jQuery(selector + ".isimb-6310-button-url").val();
101 myObj.customButtonTextSize = jQuery(
102 selector + ".isimb_6310_button_text_size"
103 ).val();
104 myObj.customButtonTextColor = jQuery(
105 selector + ".isimb_6310_button_text_color"
106 ).val();
107 myObj.customButtonBgcolor = jQuery(
108 selector + ".isimb_6310_button_bg_color"
109 ).val();
110 myObj.tempCommonFontSize = jQuery(
111 selector + ".isimb_6310_template_font_size"
112 ).val();
113 myObj.tempCommonFontColor = jQuery(
114 selector + ".isimb_6310_template_font_color"
115 ).val();
116 myObj.tempCommonBgColor = jQuery(
117 selector + ".isimb_6310_template_bg_color"
118 ).val();
119 myObj.tem02EmbeddedLink = isimb_6310_get_embedded_attributes(
120 jQuery(selector + ".isimb-6310-embedded_code_link").val()
121 );
122
123 let customCode = jQuery(
124 selector + "textarea[name='isimb-6310-custome_html']"
125 ).val();
126
127 customCode = customCode.replace(/='/g, '="');
128 customCode = customCode.replace(/'>/g, '">');
129
130 myObj.customeHtmlCode = customCode;
131 myObj.customeCssCode = jQuery(
132 selector + `textarea[name='isimb-6310-custome_css']`
133 ).val();
134 myObj.customeCodePopup = isimb_6310_get_embedded_attributes(
135 jQuery(selector + `textarea[name='isimb_6310_custom_code_popup']`).val()
136 );
137 myObj.customePopupHtml = jQuery(
138 selector + `textarea[name='isimb_6310_custom_code_popup_html']`
139 ).val();
140 myObj.customePopupCss = jQuery(
141 selector + `textarea[name='isimb_6310_custom_code_popup_css']`
142 ).val();
143
144 myObj.customIconLinkType = jQuery(
145 selector + ".isimb-6310_link_title_type:checked"
146 ).val();
147 myObj.viewMoodType = viewMoodType;
148 myObj.elementType = elementType;
149
150 if (myObj.iconType == 1) {
151 myCSS.styleCSS = `
152 .isimb-6310-drag[data-id='${window.currentPoint}'] .isimb-6310-pin-main-img{
153 color: ${myObj.selectAreaColor} !important;
154 font-size:${myObj.areaBorderSize}px !important;
155 }
156 .isimb-6310-drag[data-id='${window.currentPoint}'] .isimb-6310-pin-hover-img{
157 color: ${myObj.selectAreaHoverColor} !important;
158 font-size:${myObj.areaBorderSize}px !important;
159 }
160
161 `;
162 } else if (myObj.iconType == 2) {
163 myCSS.styleCSS = `
164 .isimb-6310-drag[data-id='${window.currentPoint}'] .isimb-6310-pin-main-img{
165 width: ${myObj.imgOrIconSize}px !important;
166 height:auto !important;
167 }
168 .isimb-6310-drag[data-id='${window.currentPoint}'] .isimb-6310-pin-hover-img{
169 width: ${myObj.imgOrIconSize}px !important;
170 height:auto !important;
171 }
172 `;
173 } else if (myObj.iconType == 3) {
174 myCSS.styleCSS = `
175 .isimb-6310-drag[data-id='${window.currentPoint}'] span{
176 font-size:${myObj.customTextSize}px !important;
177 color: ${myObj.areaBorderColor} !important;
178 background-color:${myObj.customTextBgColor} !important;
179 padding: 5px 10px;
180 }
181 `;
182 }
183
184 myObj.linkURLDirect = jQuery(
185 selector + ".isimb_6310_custom_link_url_direct"
186 ).val();
187 myObj.openNewTabDirect = jQuery(
188 selector + ".isimb-6310-open-new-tab-direct:checked"
189 ).val();
190 if (jQuery(`.isimb-6310-pol-${window.currentPoint}`).length) {
191 let json = JSON.parse(
192 jQuery(`.isimb-6310-pol-${window.currentPoint}`).attr("data-json")
193 );
194 myObj.nestedList = json.nestedList || [];
195 } else {
196 myObj.nestedList = [];
197 }
198
199 //isimb_6310_reset_fields();
200 return myObj;
201 }
202
203 function isimb_6310_set_json_data() {
204 let jsonData = jQuery(`[data-id='${window.currentPoint}']`).attr("data-json");
205 jsonData = JSON.parse(jsonData);
206 if (!jsonData || !jsonData.elementType) {
207 return;
208 }
209 isimb_6310_reset_fields();
210
211 let divWidth = jQuery(".tabbed-content-wrap:last").width();
212 let divHeight = Math.round(
213 (Number(jsonData.imageHeight) * divWidth) / Number(jsonData.imageWidth)
214 );
215 jQuery(".isimb-6310-canvas")
216 .attr("height", divHeight)
217 .attr("width", divWidth)
218 .css({
219 "background-size": `${divWidth}px ${divHeight}px`,
220 });
221 jQuery(".isimb-6310-canvas-area:last").val(jsonData.pointList);
222 // jQuery(".isimb-6310-canvas-area:last").trigger("change");
223
224 jQuery(
225 "#isimb-6310-edit-point .isimb-6310-section-view-mood-select[value='1']"
226 ).trigger("click");
227 jQuery(
228 "#isimb-6310-edit-point .isimb-6310-section-view-mood-select[value='2']"
229 ).trigger("click");
230
231 jQuery(
232 "#isimb-6310-edit-point .isimb-6310-section-select[value='1']"
233 ).trigger("click");
234
235 jQuery(
236 "#isimb-6310-edit-point .isimb-6310-section-select[value='2']"
237 ).trigger("click");
238
239 jQuery(
240 "#isimb-6310-edit-point .isimb-6310-section-select[value='3']"
241 ).trigger("click");
242
243 jQuery(".isimb-6310-tooltip-img").removeClass("isimb-6310-active");
244 jQuery(".isimb-6310-open-new-tab").prop("selectedIndex", jsonData.openNewTab);
245 jQuery(
246 "#isimb-6310-edit-point .isimb-6310-linking-area[value='" +
247 jsonData.linkingArea +
248 "']"
249 ).prop("checked", true);
250 jQuery(".isimb-6310-open-new-tab-direct").prop(
251 "selectedIndex",
252 jsonData.openNewTabDirect
253 );
254
255 jQuery(".isimb-6310-open-popup").prop("selectedIndex", jsonData.openPopup);
256 if (Number(jsonData.openPopup) == 1) {
257 jQuery(".isimb-6310-open-popup-custom-use").addClass("isimb-6310-hide");
258 } else {
259 jQuery(".isimb-6310-open-popup-custom-use").removeClass("isimb-6310-hide");
260 }
261
262 jQuery(".isimb-6310-section-view-mood-select").prop(
263 "selectedIndex",
264 jsonData.viewMoodType
265 );
266 if (Number(jsonData.openPopupCustomUse) == 1) {
267 jQuery(".tooltip-embedded").addClass("isimb-6310-hide");
268 jQuery(".tooltip-custom-html-css").removeClass("isimb-6310-hide");
269 } else {
270 jQuery(".tooltip-embedded").removeClass("isimb-6310-hide");
271 jQuery(".tooltip-custom-html-css").addClass("isimb-6310-hide");
272 }
273 jQuery(".isimb-6310-templates").removeClass("isimb-6310-hide");
274 jQuery(".isimb-6310-active").removeClass("isimb-6310-active");
275 jQuery(
276 `.isimb-6310-templates, [data-id='${jsonData.selectedTemplate}']`
277 ).removeClass("isimb-6310-hide");
278
279 jQuery(".isimb_6310_select_area_color").val(jsonData.selectAreaColor);
280 jQuery(".isimb_6310_select_area_color")
281 .closest("div")
282 .find(".minicolors-swatch-color")
283 .css({
284 "background-color": jsonData.selectAreaColor,
285 });
286 jQuery(".isimb_6310_select_area_hover_color").val(
287 jsonData.selectAreaHoverColor
288 );
289 jQuery(".isimb_6310_modal_content").val(jsonData.selectModelContent);
290 jQuery(".isimb_6310_modal_content_font_size").val(
291 jsonData.ModalContentFontSize
292 );
293 jQuery(".isimb_6310_modal_content_color").val(jsonData.ModalContentColor);
294 jQuery(".isimb_6310_modal_content_color")
295 .closest("div")
296 .find(".minicolors-swatch-color")
297 .css({
298 "background-color": jsonData.ModalContentColor,
299 });
300 jQuery(".isimb_6310_modal_content_background_color").val(
301 jsonData.ModalContentBgColor
302 );
303 jQuery(".isimb_6310_modal_content_background_color")
304 .closest("div")
305 .find(".minicolors-swatch-color")
306 .css({
307 "background-color": jsonData.ModalContentBgColor,
308 });
309 jQuery(".isimb_6310_select_area_hover_color")
310 .closest("div")
311 .find(".minicolors-swatch-color")
312 .css({
313 "background-color": jsonData.selectAreaHoverColor,
314 });
315 jQuery(".isimb-6310_area_border_size").val(jsonData.areaBorderSize);
316 jQuery(".isimb-6310-image-edit-1").val(jsonData.customFirstImg);
317 jQuery(".isimb-6310-image-edit-2").val(jsonData.customSecondImg);
318
319 jQuery(".isimb_6310_custom_text_font_size").val(jsonData.customTextSize);
320 jQuery(".isimb_6310_area_border_color").val(jsonData.areaBorderColor);
321 jQuery(".isimb_6310_area_border_hover_color").val(
322 jsonData.areaBorderHoverColor
323 );
324
325 jQuery(".isimb_6310_area_border_color")
326 .closest("div")
327 .find(".minicolors-swatch-color")
328 .css({
329 "background-color": jsonData.areaBorderColor,
330 });
331 jQuery(".isimb_6310_area_border_hover_color")
332 .closest("div")
333 .find(".minicolors-swatch-color")
334 .css({
335 "background-color": jsonData.areaBorderHoverColor,
336 });
337 jQuery(".isimb-6310_area_shadow_width").val(jsonData.areaShadowith);
338 jQuery(".isimb_6310_area_shadow_hover_color").val(jsonData.areaShadowColor);
339 jQuery(".isimb_6310_area_shadow_hover_color")
340 .closest("div")
341 .find(".minicolors-swatch-color")
342 .css({
343 "background-color": jsonData.areaShadowColor,
344 });
345 jQuery(".isimb_6310_custom_text_font_bg_color").val(
346 jsonData.customTextBgColor
347 );
348 jQuery(".isimb_6310_custom_text_font_bg_color")
349 .closest("div")
350 .find(".minicolors-swatch-color")
351 .css({
352 "background-color": jsonData.customTextBgColor,
353 });
354
355 jQuery(`textarea[name='isimb_6310_custom_code']`).val(jsonData.customeCode);
356 jQuery(`textarea[name='isimb_6310_custom_code_popup']`).val(
357 isimb_6310_create_embedded_code(jsonData.customeCodePopup)
358 );
359 jQuery(`textarea[name='isimb_6310_custom_code_popup_html']`).val(
360 jsonData.customePopupHtml
361 );
362 jQuery(`textarea[name='isimb_6310_custom_code_popup_css']`).val(
363 jsonData.customePopupCss
364 );
365 jQuery(`textarea[name='isimb-6310-custome_html']`).val(
366 jsonData.customeHtmlCode
367 );
368 jQuery(`textarea[name='isimb-6310-custome_css']`).val(
369 jsonData.customeCssCode
370 );
371 jQuery(".isimb_6310_link_text").val(jsonData.linkText);
372 jQuery(".isimb_6310_custom_link_url").val(jsonData.linkURL);
373 jQuery(".isimb_6310_custom_link_url_direct").val(jsonData.linkURLDirect);
374 jQuery(".isimb-6310-des-img").val(jsonData.openDesImg);
375 jQuery(".isimb-6310-tooltip_discription").val(jsonData.openDescription);
376 jQuery(".isimb-6310-tooltip_discription_font_size").val(
377 jsonData.openDesFontSize
378 );
379 jQuery(".isimb-6310-tooltip_discription_font_color").val(
380 jsonData.openDesFontColor
381 );
382 jQuery(".isimb-6310-tooltip_discription_font_color")
383 .closest("div")
384 .find(".minicolors-swatch-color")
385 .css({
386 "background-color": jsonData.openDesFontColor,
387 });
388 jQuery(".tooltip_discription_font_color")
389 .closest("div")
390 .find(".minicolors-swatch-color")
391 .css({
392 "background-color": jsonData.openDesFontColor,
393 });
394 jQuery(".isimb-6310-button-text").val(jsonData.customButtonText);
395 jQuery(".isimb-6310-button-url").val(jsonData.customButtonUrl);
396 jQuery(".isimb_6310_button_text_size").val(jsonData.customButtonTextSize);
397 jQuery(".isimb_6310_button_text_color").val(jsonData.customButtonTextColor);
398 jQuery(".isimb_6310_button_text_color")
399 .closest("div")
400 .find(".minicolors-swatch-color")
401 .css({
402 "background-color": jsonData.customButtonTextColor,
403 });
404 jQuery(".isimb_6310_button_bg_color").val(jsonData.customButtonBgcolor);
405 jQuery(".isimb_6310_button_bg_color")
406 .closest("div")
407 .find(".minicolors-swatch-color")
408 .css({
409 "background-color": jsonData.customButtonBgcolor,
410 });
411 jQuery(".popup_embedded").val(jsonData.popupEmbedded);
412 jQuery(".isimb-6310-tooltip-link").removeClass("isimb-6310-hide");
413 jQuery(".isimb_6310_textarea").removeClass("isimb-6310-hide");
414
415 jQuery(".isimb-6310-form-02").removeClass("isimb-6310-hide");
416 jQuery(".isimb-6310-form-02").removeClass("isimb-6310-hide");
417
418 if (jsonData.selectedTemplate != "") {
419 //set common
420 jQuery(".isimb_6310_template_font_size").val(jsonData.tempCommonFontSize);
421 jQuery(".isimb_6310_template_font_color").val(jsonData.tempCommonFontColor);
422 jQuery(".isimb_6310_template_font_color")
423 .closest("div")
424 .find(".minicolors-swatch-color")
425 .css({
426 "background-color": jsonData.tempCommonFontColor,
427 });
428 jQuery(".isimb_6310_template_bg_color").val(jsonData.tempCommonBgColor);
429 jQuery(".isimb_6310_template_bg_color")
430 .closest("div")
431 .find(".minicolors-swatch-color")
432 .css({
433 "background-color": jsonData.tempCommonBgColor,
434 });
435
436 //Uncommon fields
437 if (jsonData.selectedTemplate == "02") {
438 jQuery(".isimb-6310-embedded_code_link").val(
439 isimb_6310_create_embedded_code(jsonData.tem02EmbeddedLink)
440 );
441 }
442
443 jQuery(`
444 #isimb-6310-edit-point .toggle-tabs li:first-child,
445 #isimb-6310-edit-point .isimb-6310_popover_type[value='${jsonData.mouseType}'],
446 #isimb-6310-edit-point .isimb-6310-section-select[value='${jsonData.elementType}'],
447 #isimb-6310-edit-point .isimb-6310-section-view-mood-select[value='${jsonData.viewMoodType}'],
448 #isimb-6310-edit-point .isimb-6310_link_title_type[value='${jsonData.customIconLinkType}'],
449 #isimb-6310-edit-point .isimb-6310-open-popup[value='${jsonData.openPopup}'],
450 #isimb-6310-edit-point .isimb-6310-open-popup-custom-use[value='${jsonData.openPopupCustomUse}'],
451 #isimb-6310-edit-point .isimb-6310-open-new-tab[value='${jsonData.openNewTab}'],
452 #isimb-6310-edit-point .isimb-6310-linking-area[value='${jsonData.linkingArea}'],
453 #isimb-6310-edit-point .isimb-6310-open-new-tab-direct[value='${jsonData.openNewTabDirect}'],
454 #isimb-6310-edit-point .isimb-6310_button_link[value='${jsonData.customButtonLinkType}']
455 `).trigger("click");
456 }
457
458 if (jsonData.elementType == 2) {
459 jQuery(
460 "#isimb-6310-edit-point .isimb-6310-tooltip-link, .isimb_6310_custom_template"
461 ).addClass("isimb-6310-hide");
462 jQuery("#isimb-6310-edit-point .isimb_6310_template_embedded").removeClass(
463 "isimb-6310-hide"
464 );
465 } else if (jsonData.elementType == 3) {
466 jQuery("#isimb-6310-edit-point .isimb_6310_custom_template").removeClass(
467 "isimb-6310-hide"
468 );
469 jQuery(
470 "#isimb-6310-edit-point .isimb-6310-tooltip-link, .isimb_6310_template_embedded, .isimb_6310_font_prop, .isimb-6310-templates"
471 ).addClass("isimb-6310-hide");
472 }
473 if (jsonData.elementType == 4) {
474 setTimeout(function () {
475 jQuery(
476 "#isimb-6310-edit-point .isimb-6310-section-select[value='2']"
477 ).trigger("click");
478 jQuery(
479 "#isimb-6310-edit-point .isimb-6310-section-select[value='4']"
480 ).trigger("click");
481 }, 600);
482 } else {
483 jQuery("#isimb-6310-edit-point .isimb-6310-tooltip-link").removeClass(
484 "isimb-6310-hide"
485 );
486 jQuery(
487 "#isimb-6310-edit-point .isimb_6310_custom_template, .isimb_6310_template_embedded"
488 ).addClass("isimb-6310-hide");
489 }
490
491 if (jsonData.viewMoodType == "01") {
492 jQuery(
493 `#isimb-6310-edit-point .isimb-6310-tooltip-img[data-id='01']`
494 ).removeClass("isimb-6310-hide");
495 }
496
497 setTimeout(function () {
498 jQuery(
499 `#isimb-6310-edit-point .isimb-6310-section-select[value='${jsonData.elementType}']`
500 ).click();
501 if (jsonData.selectedTemplate != "") {
502 jQuery(
503 `.isimb-6310-tooltip-img[data-id='${jsonData.selectedTemplate}']`
504 ).addClass("isimb-6310-active");
505 jQuery(
506 `#isimb-6310-edit-point .isimb-6310-tooltip-img[data-id='${jsonData.selectedTemplate}']`
507 ).trigger("click");
508 }
509 if (jsonData.elementType == 3) {
510 jQuery(
511 "#isimb-6310-edit-point .isimb_6310_font_prop, #isimb-6310-edit-point .isimb_6310_template_embedded, #isimb-6310-edit-point .isimb_6310_template_description"
512 ).addClass("isimb-6310-hide");
513 jQuery("#isimb-6310-edit-point .isimb_6310_custom_template").removeClass(
514 "isimb-6310-hide"
515 );
516 }
517 }, 500);
518
519 return {
520 pointList: jsonData.pointList,
521 imageWidth: jsonData.imageWidth,
522 imageHeight: jsonData.imageHeight,
523 };
524 }
525
526 function isimb_6310_reset_fields() {
527 jQuery(".isimb-isimb-6310_popover_type[value='1']").prop("checked", true);
528 jQuery(".isimb-6310-tooltip-img").removeClass("isimb-6310-active");
529 jQuery(
530 ".isimb-6310-form, .isimb-6310-tooltip-link, .isimb-6310-templates, .tooltip-embedded"
531 ).addClass("isimb-6310-hide");
532 jQuery(".isimb-6310-embedded_code_link").val("");
533 let fieldList =
534 ".icons-1, .icons-2, .isimb-6310-image-edit-1, .isimb-6310-image-edit-2, .isimb_6310_custom_text_font_size, .isimb_6310_area_border_color, .isimb_6310_area_border_hover_color, .isimb-6310_area_shadow_width, .isimb_6310_area_shadow_hover_color, .isimb_6310_custom_text_font_bg_color, .isimb_6310_select_area_color, .isimb_6310_modal_content, .isimb_6310_modal_content_font_size, .isimb_6310_modal_content_color, .isimb_6310_modal_content_background_color, .isimb_6310_select_area_hover_color, .isimb-6310_area_border_size, .isimb_6310_link_text, .isimb_6310_custom_link_url, .popup_embedded, .isimb_6310_template_font_color, .isimb_6310_template_bg_color, .isimb_6310_template_font_size, .isimb-6310-embedded_code_link, .isimb-6310-tooltip_discription, .isimb-6310-tooltip_discription_font_size, .isimb-6310-tooltip_discription_font_color, .isimb-6310-button-text, .isimb-6310-button-url, .isimb_6310_button_text_color, .isimb_6310_button_bg_color, .isimb_6310_button_text_size, .isimb-6310-custome_html, .isimb-6310-custome_css";
535 fieldList = fieldList.split(",");
536 // setTimeout(function () {
537 for (let i = 0; i < fieldList.length; i++) {
538 let selector = jQuery(fieldList[i].trim());
539 if (
540 selector.attr("data-value") !== undefined ||
541 selector.attr("data-value") !== null
542 ) {
543 selector.val(selector.attr("data-value"));
544 selector.attr("data-defaultValue", selector.attr("data-value"));
545 selector.text(selector.attr("data-value"));
546 if (selector.closest("div").find(".minicolors-swatch-color")) {
547 selector
548 .closest("div")
549 .find(".minicolors-swatch-color")
550 .css({
551 "background-color": selector.attr("data-value"),
552 });
553 }
554 }
555 }
556 // }, 100);
557 jQuery(
558 ".isimb-6310-section-select, .isimb-6310-open-new-tab, .isimb-6310-linking-area, .isimb-6310-open-new-tab-direct"
559 ).prop("selectedIndex", 0);
560
561 jQuery(".isimb_6310_textarea").addClass("isimb-6310-hide");
562
563 setTimeout(function () {
564 if (jQuery(".isimb_6310_color_picker").length) {
565 jQuery(".isimb_6310_color_picker").each(function () {
566 jQuery(this).minicolors({
567 control: jQuery(this).attr("data-control") || "hue",
568 defaultValue: jQuery(this).attr("data-defaultValue") || "",
569 format: jQuery(this).attr("data-format") || "hex",
570 keywords: jQuery(this).attr("data-keywords") || "",
571 inline: jQuery(this).attr("data-inline") === "true",
572 letterCase: jQuery(this).attr("data-letterCase") || "lowercase",
573 opacity: jQuery(this).attr("data-opacity"),
574 position: jQuery(this).attr("data-position") || "bottom left",
575 swatches: jQuery(this).attr("data-swatches")
576 ? jQuery(this).attr("data-swatches").split("|")
577 : [],
578 change: function (value, opacity) {
579 if (!value) return;
580 if (opacity) value += ", " + opacity;
581 if (typeof console === "object") {
582 }
583 },
584 theme: "bootstrap",
585 });
586 });
587 }
588 }, 500);
589 }
590
591 function isimb_6310_get_embedded_attributes(embeddedCode) {
592 if (!embeddedCode) {
593 return "";
594 }
595 jQuery("body").after(`<div class="isimb-6310-dummy">${embeddedCode}</div>`);
596 embeddedCode = jQuery(".isimb-6310-dummy iframe");
597 let attrName = "";
598 let attrValue = "";
599 if (embeddedCode.length) {
600 embeddedCode.each(function () {
601 var attributes = this.attributes;
602 var i = attributes.length;
603 while (i--) {
604 if (attrName) {
605 attrName += "XXYYXX";
606 attrValue += "XXYYXX";
607 }
608 attrName += attributes[i].name;
609 attrValue += attributes[i].value;
610 }
611 });
612 }
613 jQuery(".isimb-6310-dummy").remove();
614 return `${attrName}AABBAA${attrValue}`;
615 }
616
617 function isimb_6310_create_embedded_code(embeddedCode) {
618 if (!embeddedCode) return;
619 embeddedCode = embeddedCode.split("AABBAA");
620 let allAttrName = embeddedCode[0].split("XXYYXX");
621 let allAttrValue = embeddedCode[1].split("XXYYXX");
622
623 let htmlCode = "";
624
625 if (
626 allAttrName.length &&
627 allAttrValue.length &&
628 allAttrName.length == allAttrValue.length
629 ) {
630 for (let i = 0; i < allAttrName.length; i++) {
631 htmlCode += " " + allAttrName[i] + '="' + allAttrValue[i] + '"';
632 }
633 }
634
635 if (htmlCode) {
636 htmlCode = "<iframe" + htmlCode + "></iframe>";
637 }
638 return htmlCode;
639 }
640
641 function isimb_6310_create_area(cords, width, height, orgWidth, orgHeight) {
642 if (!cords) return "";
643 let cordsList = cords.split(",");
644 cords = "";
645
646 for (let i = 0; i < cordsList.length; i++) {
647 if (i % 2 == 0) {
648 cords += isimb_6310_absolute_position(cordsList[i], width, orgWidth);
649 cords += ",";
650 } else {
651 cords += isimb_6310_absolute_position(cordsList[i], height, orgHeight);
652 cords += " ";
653 }
654 }
655
656 return cords.trim();
657 }
658
659 function isimb_6310_absolute_position(point, distance, orgDistance) {
660 return Math.round((point * orgDistance) / distance);
661 }
662
663 function isimb_6310_default_polygon(orgWidth, orgHeight) {
664 let polygon = jQuery(".isimb-6310-pol-loaded");
665 if (polygon.length) {
666 polygon.each(function () {
667 let dataJson = jQuery(this).attr("data-json");
668 dataJson = JSON.parse(dataJson);
669 let cords = isimb_6310_create_area(
670 dataJson.pointList,
671 dataJson.imageWidth,
672 dataJson.imageHeight,
673 orgWidth,
674 orgHeight
675 );
676 jQuery(this).attr("points", cords);
677 let id = jQuery(this).attr("data-id");
678
679 //Nested List
680 let nestedList = dataJson.nestedList;
681 if (nestedList && nestedList.length) {
682 for (let i = 0; i < nestedList.length; i++) {
683 let cords = isimb_6310_create_area(
684 nestedList[i].nestedArea,
685 nestedList[i].nestedWidth,
686 nestedList[i].nestedHeight,
687 orgWidth,
688 orgHeight
689 );
690
691 jQuery(`.isimb-6310-pol-nested-${id}-${nestedList[i].nestedId}`).attr(
692 "points",
693 cords
694 );
695 }
696 }
697 });
698 }
699 }
700
701 function isimb_6310_canvas_init($ids, inputField = "isimb-6310-canvas-area") {
702 jQuery(".isimb-6310-canvas-wrapper").html("");
703 jQuery(`${$ids} .${inputField}[isimb-6310-image-url]`).canvasAreaDraw(
704 `${$ids}`
705 );
706
707 setTimeout(function () {
708 let divWidth = jQuery(`${$ids} .isimb-6310-canvas-wrapper`).width();
709 let canWidth = jQuery(".isimb-6310-builder-box .isimb-6310-main-svg").attr(
710 "width"
711 );
712 let canHeight = jQuery(".isimb-6310-builder-box .isimb-6310-main-svg").attr(
713 "height"
714 );
715 let divHeight = Math.round((canHeight * divWidth) / canWidth);
716
717 jQuery(`${$ids} canvas`)
718 .attr("height", divHeight)
719 .attr("width", divWidth)
720 .css({
721 "background-size": `${divWidth}px ${divHeight}px`,
722 });
723 }, 500);
724 }
725