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