1var ddd_full_stop = 0; 2 3var json_counters_array = []; 4 5// Mark that D5 handler is loaded to prevent ddp-admin.js from also firing 6//window.ddp_d5_handler_loaded = true; 7 8// Queue for featured image imports to prevent race conditions 9window.ddp_featured_image_queue = []; 10 11jQuery(document).ready(function ($) { 12 $("#ddp-preview-window").insertAfter("body > :last-child"); 13 14 jQuery.fn.center = function () { 15 this.css("position", "absolute"); 16 this.css( 17 "top", 18 (jQuery(window).height() - this.height()) / 2 + 19 jQuery(window).scrollTop() + 20 "px", 21 ); 22 this.css( 23 "left", 24 (jQuery(window).width() - this.width()) / 2 + 25 jQuery(window).scrollLeft() + 26 "px", 27 ); 28 return this; 29 }; 30 31 $("#ddp-preview").on("click", function () { 32 jQuery("#ddp-preview-window").center(); 33 $("#ddp-preview-window").show(); 34 }); 35 36 $("#ddp-preview-close").on("click", function () { 37 $("#ddp-preview-window").hide(); 38 }); 39 // main function 40 function onIframeLoad() { 41 setTimeout(function () { 42 $("iframe#ondemanIframe").on("load", function () { 43 var frame = document.getElementById("ondemanIframe"); 44 45 // remove divi loading animation 46 $("#et_pb_loading_animation").remove(); 47 48 jQuery.ajax({ 49 type: "GET", 50 url: ajaxurl, 51 data: "action=ddp_get_option", 52 success: function (data) { 53 var ddp_sp_enable = data + ""; 54 if (ddp_sp_enable === "enabled") { 55 frame?.contentWindow?.postMessage( 56 "pro_membership_activated", 57 "*", 58 ); 59 } else { 60 frame?.contentWindow?.postMessage( 61 "pro_membership_deactivated", 62 "*", 63 ); 64 } 65 }, 66 }); 67 // function to get post id from the url parameter 'post' 68 function getUrlVars() { 69 var vars = [], 70 hash; 71 var hashes = window.location.href 72 .slice(window.location.href.indexOf("?") + 1) 73 .split("&"); 74 for (var i = 0; i < hashes.length; i++) { 75 hash = hashes[i].split("="); 76 vars.push(hash[0]); 77 vars[hash[0]] = hash[1]; 78 } 79 return vars; 80 } 81 82 var post_id = getUrlVars()["post"]; 83 84 // Create IE + others compatible event handler 85 var eventMethod = window.addEventListener 86 ? "addEventListener" 87 : "attachEvent"; 88 var eventer = window[eventMethod]; 89 var messageEvent = 90 eventMethod == "attachEvent" ? "onmessage" : "message"; 91 92 // Show featured images for sections - backend divi builder 93 if ($("ul.et_pb_saved_layouts_list").length > 0) { 94 $("ul.et_pb_saved_layouts_list li:not(.added_image)").each( 95 function () { 96 this_title = $(this).find("a").text(); 97 this_class = this_title 98 .replace(/-+/g, "") 99 .replace(/\s+/g, "-") 100 .toLowerCase(); 101 $(this).addClass(this_class); 102 $(this).addClass("added_image"); 103 jQuery.ajax({ 104 type: "POST", 105 url: ajaxurl, 106 data: 107 "action=ddp_show_featured_image&ddp_title_image=" + 108 this_title + 109 "&ddp_nonce=" + 110 ddp_wl_options_for_js.ddp_nonce, 111 success: function (data) { 112 if (data !== "") { 113 img_link = data.substring(data.indexOf("|") + 1); 114 img_post_title = data 115 .replace(img_link, "") 116 .replace("|", ""); 117 $("ul.et_pb_saved_layouts_list li:not(.with-image)").each( 118 function () { 119 this_title = $(this).find("a").text(); 120 if (this_title === img_post_title) { 121 $(this) 122 .find("a") 123 .before( 124 '<img src="' + 125 img_link + 126 '" class="ddp_preview" />', 127 ); 128 $(this).addClass("with-image"); 129 } 130 }, 131 ); 132 } 133 }, 134 error: function (data) {}, 135 }); 136 }, 137 ); 138 //$('ul.et_pb_saved_layouts_list').addClass('ddp_images_sent'); 139 } 140 141 // Show featured images for sections - visual divi builder 142 setInterval(function () { 143 if ( 144 $( 145 "div.et-fb-settings-options-tab-modules_library ul:not(.ddp_images_sent)", 146 ).length > 0 147 ) { 148 $( 149 "div.et-fb-settings-options-tab-modules_library ul li:not(.added_image):not(.with-image)", 150 ).each(function () { 151 this_title = $(this).find("span.et_module_title").text().trim(); 152 this_class = this_title 153 .replace(/-+/g, "") 154 .replace(/\s+/g, "-") 155 .toLowerCase(); 156 $(this).addClass(this_class); 157 $(this).addClass("added_image"); 158 $(this).css("min-height", "180px"); 159 jQuery.ajax({ 160 type: "POST", 161 url: ajaxurl, 162 data: 163 "action=ddp_show_featured_image&ddp_title_image=" + 164 this_title + 165 "&ddp_nonce=" + 166 ddp_wl_options_for_js.ddp_nonce, 167 success: function (data) { 168 if (data !== "") { 169 img_link = data.substring(data.indexOf("|") + 1); 170 img_post_title = data 171 .replace(img_link, "") 172 .replace("|", ""); 173 $( 174 "div.et-fb-settings-options-tab-modules_library ul li:not(.with-image)", 175 ).each(function () { 176 this_title = $(this) 177 .find("span.et_module_title") 178 .text() 179 .trim(); 180 if ( 181 this_title === img_post_title && 182 $(this).find("img.ddp_preview").length === 0 183 ) { 184 $(this) 185 .find("span.et_module_title") 186 .after( 187 '<img src="' + 188 img_link + 189 '" class="ddp_preview" />', 190 ); 191 $(this).addClass("with-image"); 192 } 193 }); 194 } 195 }, 196 error: function (data) {}, 197 }); 198 }); 199 //$('div.et-fb-settings-options-tab-modules_library ul').addClass('ddp_images_sent'); 200 } 201 }, 10); 202 var global_json_counter = 0; 203 var json_counter = 0; 204 // Listen to message from child window 205 eventer( 206 messageEvent, 207 function (e) { 208 if (e.origin === "https://ondemand.divi-den.com") { 209 var response; 210 if (jQuery.type(e.data) === "string") { 211 // check if the response is text 212 213 if (~e.data.indexOf("context")) { 214 // if the response is a divi json file 215 $("body .ddp-assistant .saving_message").show(); 216 var ddp_replace_content = "off"; 217
218 // if (jQuery('.ddp-replace-content input').attr("checked") === 'checked') { 219 // ddp_replace_content = 'on'; 220 // } 221 if ( 222 jQuery( 223 "#et_pb_main_container > .et_pb_section .et_pb_module_block", 224 ).length <= 0 225 ) { 226 ddp_replace_content = "on"; 227 } 228 229 response = jQuery.parseJSON(e.data); 230 if (response) { 231 if ( 232 !$(frame).hasClass("settingsIframe") && 233 !$(frame).hasClass("vbIframe") && 234 response.context === "et_builder" 235 ) { 236 layout = JSON.stringify(response); 237 var ddp_list = jQuery( 238 ".et-pb-all-modules-tab .et-pb-load-layouts", 239 ); 240 var ddp_li = ddp_list 241 .children("button") 242 .last() 243 .clone(true); 244 ddp_button.addClass("layout_here"); 245 ddp_button.appendTo(ddp_list); 246 jQuery(".layout_here").data("layout_id", { 247 layout: layout, 248 replace_content: ddp_replace_content, 249 }); 250 jQuery(".layout_here .et_pb_layout_button_load").click(); 251 } else if ( 252 response.context === "et_builder_layouts" || 253 $(frame).hasClass("settingsIframe") 254 ) { 255 response_data = encodeURIComponent( 256 JSON.stringify(response), 257 ); 258 //response_data = encodeURIComponent(JSON.stringify(response.data)); 259 // import to library 260 jQuery.ajax({ 261 type: "POST", 262 url: ajaxurl, 263 // processData: false, 264 data: 265 "action=ddp_import_posts&posts=" + 266 response_data + 267 "&ddp_nonce=" + 268 ddp_wl_options_for_js.ddp_nonce, 269 success: function (data) { 270 // Process featured image queue after post import 271 function processFeaturedImageQueue() { 272 if (window.ddp_featured_image_queue.length > 0) { 273 var featured_image_data = 274 window.ddp_featured_image_queue.shift(); 275 var parts = featured_image_data.split("|"); 276 277 setTimeout(function () { 278 jQuery.ajax({ 279 type: "POST", 280 url: ajaxurl, 281 data: 282 "action=ddp_import_featured_image&ddp_featured_image=" + 283 featured_image_data + 284 "&ddp_nonce=" + 285 ddp_wl_options_for_js.ddp_nonce, 286 success: function (img_data) { 287 if ( 288 img_data && 289 img_data.data && 290 img_data.data.placeholder_used 291 ) { 292 console.warn( 293 "DDP D5: Featured image failed, placeholder assigned for:", 294 parts[0], 295 "Reason:", 296 img_data.data.reason, 297 ); 298 } 299 // Process next item in queue 300 processFeaturedImageQueue(); 301 }, 302 error: function (img_data) { 303 console.error( 304 "DDP D5: Featured image AJAX error for:", 305 parts[0], 306 ); 307 // Process next item even on error 308 processFeaturedImageQueue(); 309 }, 310 }); 311 }, 500); 312 } 313 } 314 315 // Start processing queue 316 processFeaturedImageQueue(); 317 318 if ($("div.sectionSaved").length === 0) { 319 $(".ddp-tab-section, .ddp-tab-module").html( 320 '<div class="sectionSaved">\ 321 <p><strong>Success!</strong> Your section/module is being saved to your local Divi library.</p>\ 322 <h3>Choose your next step...</h3>\ 323 <p>1. Find new modules and save to your library</p>\ 324 <a href="#" class="ddp_close">Find New Pro Modules</a>\ 325 <p>2. Begin editing - Use the "Add From Library" tab to load sections/modules from local Divi Library</p>\ 326 <a href="#" class="ddp_reload">To Continue - Save and Reload Page</a>\ 327 </div>', 328 ); 329 $( 330 "body .ddp-tab-section a.ddp_reload, body .ddp-tab-module a.ddp_reload", 331 ).on("click", function (e) { 332 e.preventDefault(); 333 $("div.sectionSaved").html( 334 '<h3 class="ddp_loading_text">Reloading...</h3>', 335 ); 336 let publishButton = $( 337 "button.et-vb-page-bar-save-button:not(.et-vb-page-bar-save-button--preview)", 338 ); 339 if (publishButton.length === 0) { 340 publishButton = $( 341 ".et-vb-page-bar-tools .et-vb-page-bar-right-side-save-button .et-vb-page-bar-dropdown-button-wrapper:nth-child(3) button.et-vb-page-bar-action-button", 342 ); 343 } 344 if (publishButton.length > 0) { 345 publishButton.click(); 346 } 347 setTimeout(function () { 348 window.location.reload(); 349 }, 2000); 350 }); 351 352 var ddp_rand = Math.floor( 353 Math.random() * 1000000 + 1, 354 ); 355 if ( 356 ddp_wl_options_for_js.ddp_status === "enabled" 357 ) { 358 ddp_sections_link = 359 "https://ondemand.divi-den.com/sections-search-api-ljljdfre935/?_sft_category=divi-5-ready&uid=" + 360 ddp_rand; 361 ddp_modules_link = 362 "https://ondemand.divi-den.com/modules-search-api-fdge43y/?_sft_category=divi-5-ready&uid=" + 363 ddp_rand; 364 } else { 365 ddp_sections_link = 366 "https://ondemand.divi-den.com/sections-search-no-api-asdfv324/?_sft_category=divi-5-ready&uid=" + 367 ddp_rand; 368 ddp_modules_link = 369 "https://ondemand.divi-den.com/modules-search-no-api-33jwer3/?_sft_category=divi-5-ready&uid=" + 370 ddp_rand; 371 } 372 373 $("body .ddp-tab-section a.ddp_close").on( 374 "click", 375 function (e) { 376 e.preventDefault(); 377 $("div.sectionSaved").html( 378 '<h3 class="ddp_loading_text">Loading...</h3>', 379 ); 380 $(".ddp-tab-section").html( 381 '<iframe id="ondemanIframe" name="ondemandIframe" class="sectionsIframe" style="width: 100%;height: 100%;" src="' + 382 ddp_sections_link + 383 '"></iframe>', 384 ); 385 onIframeLoad(); 386 }, 387 ); 388 $("body .ddp-tab-module a.ddp_close").on( 389 "click", 390 function (e) { 391 e.preventDefault(); 392 $("div.sectionSaved").html( 393 '<h3 class="ddp_loading_text">Loading...</h3>', 394 ); 395 $(".ddp-tab-module").html( 396 '<iframe id="ondemanIframe" name="ondemandIframe" class="sectionsIframe" style="width: 100%;height: 100%;" src="' + 397 ddp_modules_link + 398 '"></iframe>', 399 ); 400 onIframeLoad(); 401 }, 402 ); 403 } 404 $("body .ddp-assistant .saving_message").hide(); 405 $("body .ddp-assistant .loaded_message").show(); 406 setTimeout(function () { 407 $("body .ddp-assistant .loaded_message").hide(); 408 }, 5500); 409 }, 410 error: function (data) { 411 console.log(data); 412 }, 413 }); 414 } // if(response.context == 'et_builder_layouts') 415 else if (response.context === "et_theme_builder") { 416 // console.log("Theme Builder"); 417 } 418 } // if (response) 419 } // if (~e.data.indexOf('context')) 420 else if (~e.data.indexOf(".")) { 421 // if the response is a css file 422 $("input#_et_pb_custom_css").val(e.data); 423 } else if (~e.data.indexOf(",jpg") || ~e.data.indexOf(",png")) { 424 //a featured image link 425 ddp_featured_image_url = e.data.replace(/\,/g, "."); 426 427 // Fix missing pipe delimiter between title and URL 428 // If no pipe exists, insert one before "http" 429 if (ddp_featured_image_url.indexOf("|") === -1) { 430 var httpIndex = ddp_featured_image_url.indexOf("http"); 431 if (httpIndex > 0) { 432 ddp_featured_image_url = 433 ddp_featured_image_url.substring(0, httpIndex) + 434 "|" + 435 ddp_featured_image_url.substring(httpIndex); 436 } 437 } 438 439 // Validate that we have a proper format (Title|URL) and the URL is valid 440 if ( 441 ddp_featured_image_url && 442 ddp_featured_image_url.indexOf("|") > -1 443 ) { 444 var parts = ddp_featured_image_url.split("|"); 445 if ( 446 parts.length === 2 && 447 parts[0].trim() !== "" && 448 parts[1].indexOf("http") === 0 449 ) { 450 // Queue featured image instead of immediate AJAX call 451 window.ddp_featured_image_queue.push( 452 ddp_featured_image_url, 453 ); 454 } 455 } 456 } 457 } //if jQuery.type(e.data) === 'string' 458 } //if (e.origin === 'https://ondemand.divi-den.com') { 459 }, 460 false, 461 ); // eventer(messageEvent, function(e) { 462 }); // $('iframe#ondemanIframe').on('load', function() 463 }, 200); 464 } 465 //function onIframeLoad() 466 467 $("body .ddp-assistant .loaded_message span.close").on("click", function () { 468 $("body .ddp-assistant .loaded_message").hide(); 469 }); 470 471 $("body .ddp-assistant .saving_message span.close").on("click", function () { 472 $("body .ddp-assistant .saving_message").hide(); 473 }); 474 475 if (typeof ajaxurl === "undefined") { 476 ajaxurl = ddp_wl_options_for_js.ddp_ajax_url; 477 } 478 479 if ($("body").hasClass("et-fb") || $("body").hasClass("wp-admin")) { 480 // insert Divi Den Pro Tabs to Divi builder 481 jQuery.ajax({ 482 type: "GET", 483 url: ajaxurl, 484 data: "action=ddp_get_option_wl", 485 success: function (data) { 486 var ddp_enable = data + ""; 487 if (ddp_enable === "disabled") { 488 // check if the DDD is enabled in settings 489 onIframeLoad(); // our main function 490 491 // Insert layout from library 492 $(document).on("mouseup", ".et-pb-layout-buttons-load", function () { 493 setTimeout(function () { 494 var ddp_rand = Math.floor(Math.random() * 1000000 + 1); 495 if (ddp_wl_options_for_js.ddp_status === "enabled") { 496 ddp_layouts_link = 497 "https://ondemand.divi-den.com/new-api-layouts-search-ghaser65/?_sft_category=divi-5-ready&uid=" + 498 ddp_rand; 499 } else { 500 ddp_layouts_link = 501 "https://ondemand.divi-den.com/new-no-api-layouts-search-dngfh4q2/?_sft_category=divi-5-ready&uid=" + 502 ddp_rand; 503 } 504 505 var tabbar = $(".et-pb-saved-modules-switcher"); 506 if ( 507 ddp_wl_options_for_js.ddp_plugin_setting_tab_position === "on" 508 ) { 509 if (tabbar.length) { 510 tabbar.append( 511 '<button type="button" class="ddp et-vb-modal-tab" data-open_tab="ddp-tab" data-layout_type="layout"><img height="25" src="' + 512 ddp_wl_options_for_js.ddp_wl_i_for_js + 513 '" /> <span>' + 514 ddp_wl_options_for_js.ddp_wl_pn_for_js + 515 "</span></button>", 516 ); 517 $(".et_pb_modal_settings").append( 518 '<div class="et-vb-modal-panel et-vb-modal-panel--ddp-tab ddp-tab ddp-tab-layout">\ 519 <div class="et-dlib-load-options ddp-replace-content et-fb-checkboxes-category-wrap"><p>\ 520 Important: if you\'re replacing the content, please manually clear the layout and update the page, then load the new layout.</p></div>\ 521 <iframe id="ondemanIframe" name="ondemandIframe" class="layoutsIframe" src="' + 522 ddp_layouts_link + 523 '"></iframe></div>', 524 ); 525 } 526 } else { 527 $("button.et-pb-options-tabs-links-active").removeClass( 528 "et-pb-options-tabs-links-active", 529 ); 530 $("div.active-container") 531 .removeClass("active-container") 532 .css("opacity", 0);
533 tabbar.prepend( 534 '<button type="button" class="ddp et-vb-modal-tab et-pb-options-tabs-links-active" data-open_tab="ddp-tab" data-layout_type="layout"><img height="25" src="' + 535 ddp_wl_options_for_js.ddp_wl_i_for_js + 536 '" /> <span>' + 537 ddp_wl_options_for_js.ddp_wl_pn_for_js + 538 "</span></button>", 539 ); 540 $(".et_pb_modal_settings").append( 541 '<div class="et-vb-modal-panel et-vb-modal-panel--ddp-tab ddp-tab ddp-tab-layout active-container" style="opacity: 1;">\ 542 <div class="et-dlib-load-options ddp-replace-content et-fb-checkboxes-category-wrap"><p>\ 543 Important: if you\'re replacing the content, please manually clear the layout and update the page, then load the new layout.</p></div>\ 544 <iframe id="ondemanIframe" name="ondemandIframe" class="layoutsIframe" src="' + 545 ddp_layouts_link + 546 '"></iframe></div>', 547 ); 548 } 549 }, 200); 550 551 onIframeLoad(); 552 }); 553 554 //Insert section from library 555 $(document).on("mouseup", ".et-pb-section-add-saved", function () { 556 setTimeout(function () { 557 jQuery(".et_pb_modal_settings.et_pb_modal_no_tabs").removeClass( 558 "et_pb_modal_no_tabs", 559 ); 560 561 var ddp_rand = Math.floor(Math.random() * 1000000 + 1); 562 if (ddp_wl_options_for_js.ddp_status === "enabled") { 563 ddp_sections_link = 564 "https://ondemand.divi-den.com/sections-search-api-ljljdfre935/?_sft_category=divi-5-ready&uid=" + 565 ddp_rand; 566 } else 567 ddp_sections_link = 568 "https://ondemand.divi-den.com/sections-search-no-api-asdfv324/?_sft_category=divi-5-ready&uid=" + 569 ddp_rand; 570 571 if ( 572 ddp_wl_options_for_js.ddp_plugin_setting_tab_position === "on" 573 ) { 574 jQuery(".et_pb_modal_settings_container h3").after( 575 ' \ 576 <ul class="et-pb-options-tabs-links et-pb-saved-modules-switcher"> \ 577 <button class="et-pb-saved-module et-pb-options-tabs-links-active"" data-open_tab="et-pb-saved-modules-tab" > \ 578 Add From Library \ 579 </button> \ 580 <button type="button" class="ddp et-vb-modal-tab" data-open_tab="ddp-tab" data-layout_type="section">\ 581 <img height="25" src="' + 582 ddp_wl_options_for_js.ddp_wl_i_for_js + 583 '" /> <span>' + 584 ddp_wl_options_for_js.ddp_wl_pn_for_js + 585 '</span></button> \ 586 </ul> \ 587 <div class="et-vb-modal-panel et-vb-modal-panel--ddp-tab ddp-tab ddp-tab-section" \ 588 style="display:block !important;" ><iframe id="ondemanIframe" name="ondemandIframe" class="sectionsIframe" \ 589 src="' + 590 ddp_sections_link + 591 '"></iframe></div>', 592 ); 593 } // if ddp_wl_options_for_js.ddp_plugin_setting_tab_position 594 else { 595 $("button.et-pb-options-tabs-links-active").removeClass( 596 "et-pb-options-tabs-links-active", 597 ); 598 $("div.active-container") 599 .removeClass("active-container") 600 .css("opacity", 0); 601 jQuery(".et_pb_modal_settings_container h3").after( 602 ' \ 603 <ul class="et-pb-options-tabs-links et-pb-saved-modules-switcher"> \ 604 <button type="button" class="ddp et-vb-modal-tab et-pb-options-tabs-links-active" data-open_tab="ddp-tab" data-layout_type="section" style="opacity: 1;">\ 605 <img height="25" src="' + 606 ddp_wl_options_for_js.ddp_wl_i_for_js + 607 '" /> <span>' + 608 ddp_wl_options_for_js.ddp_wl_pn_for_js + 609 '</span></button> \ 610 <button class="et-pb-saved-module" data-open_tab="et-pb-saved-modules-tab" > \ 611 Add From Library \ 612 </button> \ 613 </ul> \ 614 <div class="et-vb-modal-panel et-vb-modal-panel--ddp-tab ddp-tab ddp-tab-section active-container" \ 615 style="display:block !important; opacity: 1 !important;" ><iframe id="ondemanIframe" name="ondemandIframe" class="sectionsIframe" \ 616 src="' + 617 ddp_sections_link + 618 '"></iframe></div>', 619 ); 620 } 621 }, 200); 622 623 onIframeLoad(); 624 }); 625 626 //Insert modules from library 627 $(document).on( 628 "mouseup", 629 ".et-pb-column .et-pb-insert-module", 630 function () { 631 setTimeout(function () { 632 jQuery(".et_pb_modal_settings.et_pb_modal_no_tabs").removeClass( 633 "et_pb_modal_no_tabs", 634 ); 635 636 var ddp_rand = Math.floor(Math.random() * 1000000 + 1); 637 if (ddp_wl_options_for_js.ddp_status === "enabled") { 638 ddp_modules_link = 639 "https://ondemand.divi-den.com/modules-search-api-fdge43y/?_sft_category=divi-5-ready&uid=" + 640 ddp_rand; 641 } else 642 ddp_modules_link = 643 "https://ondemand.divi-den.com/modules-search-no-api-33jwer3/?_sft_category=divi-5-ready&uid=" + 644 ddp_rand; 645 646 $( 647 ".et-pb-options-tabs-links.et-pb-saved-modules-switcher", 648 ).remove(); 649 if ( 650 ddp_wl_options_for_js.ddp_plugin_setting_tab_position === "on" 651 ) { 652 jQuery(".et_pb_modal_settings_container h3").after( 653 ' \ 654 <ul class="et-pb-options-tabs-links et-pb-saved-modules-switcher"> \ 655 <button class="et-pb-new-module et-pb-options-tabs-links-active data-open_tab="et-pb-all-modules-tab">\
656 New Module\ 657 </button>\ 658 <button class="et-pb-saved-module" data-open_tab="et-pb-saved-modules-tab" > \ 659 Add From Library \ 660 </button> \ 661 <button type="button" class="ddp et-vb-modal-tab" data-open_tab="ddp-tab" data-layout_type="section">\ 662 <img height="25" src="' + 663 ddp_wl_options_for_js.ddp_wl_i_for_js + 664 '" /> <span>' + 665 ddp_wl_options_for_js.ddp_wl_pn_for_js + 666 '</span></button> \ 667 </ul> \ 668 <div class="et-vb-modal-panel et-vb-modal-panel--ddp-tab ddp-tab ddp-tab-module" \ 669 style="display:block !important;" ><iframe id="ondemanIframe" name="ondemandIframe" class="sectionsIframe" \ 670 src="' + 671 ddp_modules_link + 672 '"></iframe></div> \ 673 ', 674 ); 675 } else { 676 // $('.et-pb-options-tabs-links.et-pb-saved-modules-switcher').remove(); 677 $("button.et-pb-options-tabs-links-active").removeClass( 678 "et-pb-options-tabs-links-active", 679 ); 680 $("div.active-container") 681 .removeClass("active-container") 682 .css("opacity", 0); 683 jQuery(".et_pb_modal_settings_container h3").after( 684 ' \ 685 <ul class="et-pb-options-tabs-links et-pb-saved-modules-switcher"> \ 686 <button type="button" class="ddp et-vb-modal-tab et-pb-options-tabs-links-active" data-open_tab="ddp-tab" data-layout_type="section">\ 687 <img height="25" src="' + 688 ddp_wl_options_for_js.ddp_wl_i_for_js + 689 '" /> <span>' + 690 ddp_wl_options_for_js.ddp_wl_pn_for_js + 691 '</span></button> \ 692 <button class="et-pb-new-module data-open_tab="et-pb-all-modules-tab">\ 693 New Module\ 694 </button>\ 695 <button class="et-pb-saved-module" data-open_tab="et-pb-saved-modules-tab" > \ 696 Add From Library \ 697 </button> \ 698 </ul> \ 699 <div class="et-vb-modal-panel et-vb-modal-panel--ddp-tab ddp-tab ddp-tab-module active-container" \ 700 style="display:block !important; opacity: 1 !important;" ><iframe id="ondemanIframe" name="ondemandIframe" class="sectionsIframe" \ 701 src="' + 702 ddp_modules_link + 703 '"></iframe></div> \ 704 ', 705 ); 706 } 707 }, 200); 708 709 onIframeLoad(); 710 }, 711 ); 712 713 setInterval(function () { 714 var modulesSelector = 715 '[data-modal-name="divi/add-module"] .et-vb-modal-tabs button.et-vb-modal-tab:first-child'; 716 717 if ( 718 $( 719 "[data-modal-name='divi/add-module'] .et-vb-modal-tabs > button.et-vb-modal-tab:first-child", 720 ).hasClass("et-vb-modal-tab--active") 721 ) { 722 const linkedPanel = $( 723 "[data-modal-name='divi/add-module'] .et-vb-modal-body-wrap > div.et-vb-modal-panel:first-child", 724 ); 725 if (!linkedPanel.hasClass("et-vb-active")) { 726 linkedPanel.addClass("et-vb-active"); 727 } 728 } 729 730 // VISUAL BUILDER SECTIONS and MODULES 731 if ( 732 ($(modulesSelector).text() == "New Section" || 733 $(modulesSelector).text() == "New Module" || 734 $(modulesSelector).text() == "New Row") && 735 $(".ddp").length <= 0 // need to add this condition to avoid double adding the ddp tab 736 ) { 737 $('div[data-modal-name="divi/add-module"]').css( 738 "overflow", 739 "hidden", 740 ); 741 742 var ddp_rand = Math.floor(Math.random() * 1000000 + 1); 743 if (ddp_wl_options_for_js.ddp_status === "enabled") { 744 ddp_sections_link = 745 "https://ondemand.divi-den.com/sections-search-api-ljljdfre935/?_sft_category=divi-5-ready&uid=" + 746 ddp_rand; 747 ddp_modules_link = 748 "https://ondemand.divi-den.com/modules-search-api-fdge43y/?_sft_category=divi-5-ready&uid=" + 749 ddp_rand; 750 } else { 751 ddp_sections_link = 752 "https://ondemand.divi-den.com/sections-search-no-api-asdfv324/?_sft_category=divi-5-ready&uid=" + 753 ddp_rand; 754 ddp_modules_link = 755 "https://ondemand.divi-den.com/modules-search-no-api-33jwer3/?_sft_category=divi-5-ready&uid=" + 756 ddp_rand; 757 } 758 759 if ( 760 ddp_wl_options_for_js.ddp_plugin_setting_tab_position === "on" 761 ) { 762 $(modulesSelector) 763 .parents( 764 '[data-modal-name="divi/add-module"] .et-vb-modal-tabs', 765 ) 766 .append( 767 '<button type="button" class="ddp et-vb-modal-tab \ 768 " data-open_tab="ddp-tab" data-layout_type="layout">\ 769 <img width="20" style=" margin-bottom: -5px;margin-right: 5px; margin-top: -3px;" src="' + 770 ddp_wl_options_for_js.ddp_wl_i_for_js + 771 '" /> <span>' + 772 ddp_wl_options_for_js.ddp_wl_pn_for_js + 773 "</span></button>", 774 ); 775 776 $( 777 '[data-modal-name="divi/add-module"] .et-vb-modal-body > .et-vb-modal-body-wrap', 778 ).append( 779 '<div class="et-vb-modal-panel et-vb-modal-panel--ddp-tab ddp-tab ddp-tab-section">\ 780 <iframe id="ondemanIframe" name="ondemandIframe" class="layoutsIframe" \ 781 src="' + 782 ($(modulesSelector).text() == "New Section" 783 ? ddp_sections_link 784 : ddp_modules_link) + 785 '" style="width: 100%;height: 100%;"></iframe></div>', 786 ); 787 } else { 788 $(modulesSelector) 789 .parents(".et-vb-modal-tabs") 790 .prepend( 791 '<button type="button" class="ddp et-vb-modal-tab et-vb-modal-tab--active\ 792 " data-open_tab="ddp-tab" data-layout_type="layout">\ 793 <img width="20" style=" margin-bottom: -5px;margin-right: 5px; margin-top: -3px;" src="' + 794 ddp_wl_options_for_js.ddp_wl_i_for_js + 795 '" /> <span>' + 796 ddp_wl_options_for_js.ddp_wl_pn_for_js + 797 "</span></button>", 798 ); 799 800 $( 801 ".et-fb-settings-options-wrap > .et-fb-settings-options", 802 ).prepend( 803 '<div class="et-vb-modal-panel et-vb-modal-panel--ddp-tab et-vb-active ddp-tab ddp-tab-section">\ 804 <iframe id="ondemanIframe" name="ondemandIframe" class="layoutsIframe" \ 805 src="' + 806 ($(modulesSelector).text() == "New Section" 807 ? ddp_sections_link 808 : ddp_modules_link) + 809 '" style="width: 100%;height: 100%;"></iframe></div>', 810 ); 811 812 $(".ddp-tab-section") 813 .siblings("div") 814 .removeClass("et-vb-active"); 815 $(".et-vb-modal-tabs button.ddp a") 816 .parent("button") 817 .siblings() 818 .removeClass("et-vb-modal-tab--active"); 819 820 $(".et-fb-settings-options-wrap").attr( 821 "style", 822 "max-height: 100% !important; max-height: 100% !important; height: 100% !important;", 823 ); 824 825 $(".ddp") 826 .parents(".et-vb-modal-tabs") 827 .addClass("ddp-tab-parent"); 828 $(".ddp-tab-section") 829 .parents("div.et-fb-settings-options") 830 .removeClass("ddp-option-parent"); 831 $(modulesSelector) 832 .parents('div[data-modal-name="divi/add-module"]')
833 .addClass("ddp-column-parent"); 834 } 835 836 $(".et-fb-settings-options-wrap").attr( 837 "style", 838 "max-height: 100% !important; max-height: 100% !important; height: 100% !important;", 839 ); 840 841 $( 842 'div[data-modal-name="divi/add-module"] .et-vb-modal-tabs button:not(.ddp)', 843 ).on("click", function () { 844 $(".ddp-tab-section").removeClass("et-vb-active"); 845 $(this) 846 .siblings("button") 847 .removeClass("et-vb-modal-tab--active"); 848 849 $(this).addClass("et-vb-modal-tab--active"); 850 851 $(modulesSelector) 852 .parents('div[data-modal-name="divi/add-module"]') 853 .removeClass("ddp-column-parent"); 854 $(this) 855 .parents(".et-vb-modal-tabs") 856 .removeClass("ddp-tab-parent"); 857 if ($(this).text() === "Add From Library") { 858 $(this) 859 .parents('div[data-modal-name="divi/add-module"]') 860 .find(".et-vb-modal-panel--add-from-library") 861 .addClass("et-vb-active"); 862 } 863 }); 864 865 $( 866 'div[data-modal-name="divi/add-module"] .et-vb-modal-tabs button.ddp', 867 ).on("click", function (e) { 868 e.preventDefault(); 869 $(this).siblings().removeClass("et-vb-modal-tab--active"); 870 $(".ddp-tab-section") 871 .siblings("div") 872 .removeClass("et-vb-active"); 873 874 $(this).addClass("et-vb-modal-tab--active"); 875 $(".ddp-tab-section").addClass("et-vb-active"); 876 $(".ddp-tab-section") 877 .parents("div.et-fb-settings-options-wrap") 878 .addClass("ddp-option-parent"); 879 880 $(modulesSelector) 881 .parents('div[data-modal-name="divi/add-module"]') 882 .addClass("ddp-column-parent"); 883 884 $(".et-fb-settings-options-wrap").attr( 885 "style", 886 "max-height: 100% !important; height: 100% !important;", 887 ); 888 889 $(this).parents(".et-vb-modal-tabs").addClass("ddp-tab-parent"); 890 }); 891 892 onIframeLoad(); 893 } 894 895 if ( 896 $('.et-vb-modal-tabs button[data-open_tab="ddp-tab"]').length > 0 897 ) { 898 if ( 899 !$( 900 '.et-vb-modal-tabs button[data-open_tab="ddp-tab"]', 901 ).hasClass("et-vb-modal-tab--active") 902 ) { 903 $("div.ddp-tab-section").removeClass("et-vb-active"); 904 } else { 905 // has active tab 906 if ( 907 $("div.ddp-tab-section").siblings().hasClass("et-vb-active") 908 ) { 909 $("div.ddp-tab-section").removeClass("et-vb-active"); 910 $( 911 '.et-vb-modal-tabs button[data-open_tab="ddp-tab"]', 912 ).removeClass("et-vb-modal-tab--active"); 913 } else if (!$("div.ddp-tab-section").hasClass("et-vb-active")) { 914 $("div.ddp-tab-section").addClass("et-vb-active"); 915 } 916 } 917 } 918 }, 200); 919 } else onIframeLoad(); //if (ddp_enable == 'enabled') 920 }, 921 error: function (data) {}, 922 }); // ajax 923 } //if($('body').hasClass('et-fb') || $('body').hasClass('wp-admin')) 924 925 setInterval(function () { 926 if ($("iframe#ondemandIframe.settingsIframe").length) { 927 onIframeLoad(); 928 } 929 }, 1000); 930}); //jQuery(document).ready(function($)
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.