PageSourceSearch

https://theroguepharmacist.com/wp-content/plugins/dropfunnels-mult…/assets/js/common.js?t=8778890&ver=6.8.3

js theroguepharmacist.com collected 2026-09-28 02:10:39 UTC 27,427 bytes, 669 lines download raw bytes

1var capitalize_letter = function(str) {
2  str = str.split(" ");
3
4  str1 = str;
5  if(str1[0] == ""){
6    str=[];
7    str.push(str1[1]);
8  }
9  for (var i = 0, x = str.length; i < x; i++) {
10    if(str[i] != "")
11      str[i] = str[i][0].toUpperCase() + str[i].substr(1);
12  }
13
14  return str.join(" ");
15}
16
17var format_date = function(date, format = 'mm-dd-yyyy', separator = '/') {
18  var date = new Date(date),
19    month = date.getMonth()+1,
20    dt = date.getDate(),
21    year = date.getFullYear(),
22    format_dt = null;
23
24    switch (format) {
25      case 'mm-dd-yyyy':
26        format_dt = month + separator + dt + separator + year
27        break;
28      default:
29        break;
30    }
31
32  return format_dt;
33}
34
35var is_test_site = function(domain = null) {
36  if (!domain) domain = location.host;
37
38  var allowed_hosts = ['jordanmederich.com','nstestsignup.dropfunnelsapp.com','nadtestgateway.dropfunnels.com'];
39  if (allowed_hosts.includes(domain)) return true;
40
41  return false;
42}
43
44function copyToClipboard(elementId) {
45    const text = document.getElementById(elementId).innerText;
46    navigator.clipboard.writeText(text).then(() => {
47        const button = document.querySelector(`button[onclick="copyToClipboard('${elementId}')"]`);
48        if (button) {
49            // Change button style to indicate successful copy
50            button.classList.add('copied');
51            // Revert style after 1 second
52            setTimeout(() => {
53                button.classList.remove('copied');
54            }, 1000);
55        }
56    }).catch(err => {
57        console.error("Error copying text: ", err);
58    });
59}
60
61jQuery(document).ready(function($) {
62
63    if (typeof autofill_fields !== 'undefined') {
64        // Mapping between autofill object keys and form field names
65        const fieldMapping = {
66            "first_name": "fl_builder_first_name",
67            "last_name": "fl_builder_last_name",
68            "email": "fl_builder_email",
69            "phone": "fl_builder_phone",
70            "billing.address": "billing_address",
71            "billing.city": "billing_city",
72            "billing.state": "billing_state",
73            "billing.country": "billing_country",
74            "billing.zip": "billing_zipcode",
75            "shipping.address": "shipping_address",
76            "shipping.city": "shipping_city",
77            "shipping.state": "shipping_state",
78            "shipping.country": "shipping_country",
79            "shipping.zip": "shipping_zipcode"
80        };
81
82        // Function to set the value of a form field based on autofill data
83        function setFieldValue(fieldPath, fieldName) {
84            // Retrieve the value from autofill_fields using the field path
85            const fieldValue = fieldPath.split('.').reduce((o, i) => (o ? o[i] : undefined), autofill_fields);
86            if (fieldValue !== undefined) {
87                const element = document.getElementsByName(fieldName)[0];
88                if (element) {
89                    if (element.tagName === "SELECT") {
90                        // Interval function to continuously check and set the SELECT field value
91                        const intervalId = setInterval(() => {
92                            // If the current value doesn't match the desired value, update it
93                            if (element.value !== fieldValue) {
94                                // Clear any previous selection
95                                element.selectedIndex = -1;
96
97                                // Loop through options to find and select the correct value
98                                Array.from(element.options).forEach(option => {
99                                    if (option.value === fieldValue) {
100                                        option.selected = true;
101                                        element.dispatchEvent(new Event('change')); // Trigger change event
102                                    }
103                                });
104                            } else {
105                                // If the correct value is set, clear the interval to stop checking
106                                clearInterval(intervalId);
107                            }
108                        }, 100); // Check every 100 ms
109                    } else {
110                        // For non-select fields, set the value directly
111                        element.value = fieldValue;
112                    }
113                }
114            }
115        }
116
117        // Loop over each field in the fieldMapping to apply autofill data
118        for (const [key, name] of Object.entries(fieldMapping)) {
119            setFieldValue(key, name);
120        }
121    }
122
123    $(document).on('change', 'input[name="test_mode"]', function() {
124        var $paymentIntegration = $(this).closest('.funnel-payment-integration');
125        var $autofillInput = $paymentIntegration.length
126            ? $paymentIntegration.find('.autofill-data-input')
127            : $('.autofill-data-input');
128
129        if($(this).is(':checked')) {
130            $autofillInput.show();
131        } else {
132            $autofillInput.hide();
133        }
134    });
135
136    $(document).on('change', 'input[name="autofill_form"]', function() {
137        var $autofillInput = $(this).closest('.autofill-data-input');
138        var $testFormInputs = $autofillInput.length
139            ? $autofillInput.find('.test-form-inputs')
140            : $('.test-form-inputs');
141
142        if($(this).is(':checked')) {
143            $testFormInputs.show();
144        } else {
145            $testFormInputs.hide();
146        }
147    });
148
149    // Click on the "Edit" button to show the input field
150    $('.edit-link-btn').on('click', function() {
151        var $parent = $(this).closest('.fpage-link');
152        $parent.find('.edit-link-input').show(); // Show the input field
153        $(this).hide(); // Hide the "Edit" button
154        $parent.find('.save-link-btn').show(); // Show the "Save" button
155    });
156
157    // Global object to store timers for each input
158    let ajaxTimers = {};
159
160    $(document).on('input', '.variation-percent', function () {
161        const $input = $(this);
162        const page_id = $input.data('page');
163        const type = $input.data('page-type');
164        const tab = $input.closest('.fpage-settings');
165        const inputKey = `${page_id}-${type}`; // Unique key for each input based on page and type
166
167        // Calculate the total sum of all variation-percent inputs within the same fpage-settings container
168        const calculateSum = () => {
169            let sum = 0;
170            tab.find('.variation-percent').each(function () {
171                const value = parseFloat($(this).val()) || 0;
172                sum += value;
173            });
174            return sum;
175        };
176
177        // Handle input changes
178        const handleInput = () => {
179            const currentValue = parseFloat($input.val()) || 0;
180            const totalSum = calculateSum();
181
182            // If the total sum exceeds 100, reset the input and prevent further processing
183            if (totalSum > 100) {
184                $input.val(100 - (totalSum - currentValue));
185            }
186
187            // Clear existing timer for this input to prevent immediate AJAX calls
188            if (ajaxTimers[inputKey]) {
189                clearTimeout(ajaxTimers[inputKey]);
190            }
191
192            // Set a new timer for the delayed AJAX call
193            ajaxTimers[inputKey] = setTimeout(() => {
194                $.ajax({
195                    url: ajaxurl,
196                    type: 'POST',
197                    data: {
198                        action: 'update_chance_percent_variation',
199                        page_id: page_id,
200                        type: type,
201                        value: $input.val()
202                    },
203                    success: function () {
204                        console.log('AJAX request successful');
205                    },
206                    error: function () {
207                        console.error('AJAX request failed');
208                    }
209                });
210                // Clear the timer after AJAX execution
211                delete ajaxTimers[inputKey];
212            }, 3000); // 3 seconds delay
213        };
214
215        handleInput();
216    });
217
218    $(document).on('click', '.restore-membership-step', function() {
219        var step_id = $(this).data('step-id');
220        var membership_id = $(this).data('membership-id');
221        var module_id = $(this).closest('tr').find('select').val();
222
223        if(module_id.length > 0) {
224            $(this).html('Restore <span class="spinner is-active"></span>');
225
226            $.ajax({
227                url: ajaxurl,
228                type: 'POST',
229                data: {
230                    action: 'restore_membership_page',
231                    step_id: step_id,
232                    membership_id: membership_id,
233                    module_id: module_id
234                },
235                success: function() {
236                    location.reload();
237                }
238            });
239        } else {
240            alert('Please, select module - where this page should be restored');
241        }
242    });
243
244    $(document).on('click', '.restore-funnel-step', function() {
245        var funnel_id = $(this).data('funnel-id');
246        var step_id = $(this).data('step-id');
247
248        $(this).html('Restore <span class="spinner is-active"></span>');
249
250        $.ajax({
251            url: ajaxurl,
252            type: 'POST',
253            data: {
254                action: 'restore_funnel_step',
255                funnel_id: funnel_id,
256                step_id: step_id
257            },
258            success: function() {
259                location.reload();
260            }
261        });
262    });
263
264    // Click on the "Save" button to save the changes
265    $('.save-link-btn').on('click', function() {
266        var postId = $(this).data('id'); // Get post ID
267        var newSlug = $(this).siblings('.edit-link-input').val(); // Get the new slug value
268        var $parent = $(this).closest('.fpage-link');
269        var button = $(this);
270
271        $(this).html('Processing...<i class="fa fa-spinner fa-spin">');
272
273        $.ajax({
274            url: ajaxurl, // WordPress AJAX URL
275            type: 'POST',
276            data: {
277                action: 'save_new_course_link', // Action name for WordPress AJAX
278                post_id: postId,
279                new_url: newSlug,
280            },
281            success: function(response) {
282                if (response.success) {
283                    // Update the URLs on the page with the new slug
284                    $parent.find('a').attr('href', response.data.url).text(response.data.url).show(); // Update link text and href
285                    $parent.find('.edit-link-input').hide(); // Hide input field
286                    $parent.find('.edit-link-btn').show(); // Show the "Edit" button
287                    $parent.find('.save-link-btn').hide(); // Hide the "Save" button
288
289                    // Also update the "View" and "Edit" buttons
290                    var actionParent = $parent.siblings('.tab-action-btn');
291                    actionParent.find('a:first').attr('href', response.data.url); // Update "View" button
292                    actionParent.find('a:last').attr('href', response.data.url + '?fl_builder'); // Update "Edit" button with ?fl_builder
293                } else {
294                    alert('Error: ' + response.data); // Show error if AJAX fails
295                }
296
297                button.text('Save');
298            }
299        });
300    });
301});
302
303jQuery(document).ready(function($) {
304
305  var url_string = window.location.href,
306      url = new URL(url_string),
307      utm_id = url.searchParams.get("utm_id"),
308      utm_source = url.searchParams.get("utm_source"),
309      utm_medium = url.searchParams.get("utm_medium"),
310      utm_campaign = url.searchParams.get("utm_campaign");
311
312  if (typeof(Storage) !== "undefined" && utm_id && utm_source) {
313    localStorage.setItem("utm_id", utm_id);
314    localStorage.setItem("utm_source", utm_source);
315    localStorage.setItem("utm_medium", utm_medium);
316    localStorage.setItem("utm_campaign", utm_campaign);
317  } else {
318    utm_id = localStorage.getItem("utm_id");
319    utm_source = localStorage.getItem("utm_source");
320    utm_medium = localStorage.getItem("utm_medium");
321    utm_campaign = localStorage.getItem("utm_campaign");
322  }
323
324  if ($('#pk-checkout').length > 0 && utm_id && utm_source) {
325    var iframe_src = $('#pk-checkout').attr('src'),
326        separator = iframe_src.indexOf('?') == -1 ? '?' : '&';
327
328    $('#pk-checkout').attr('src', iframe_src + separator + 'utm_id=' + utm_id + '&utm_source=' + utm_source + '&utm_medium=' + utm_medium + '&utm_campaign=' + utm_campaign);
329  }
330
331  if ($('#pk-booster').length > 0) {
332    var email = getParameterByName('email');
333    var res = email.replace(" ", "%2B");
334    var iframe_src = $('#pk-booster').attr('src');
335    $('#pk-booster').attr('src', iframe_src + '?email=' + res);
336
337  }
338  $(document).on('click', '#builderWarning .fl-builder-button', function() {
339    $('#builderWarning').hide();
340  });
341
342  if(jQuery('#export-largedata-email').find('#export-email-btn').length > 0){
343    jQuery('#export-largedata-email').find('#export-email-btn').click(function(){
344      var obj = jQuery(this);
345      var objtext = obj.text();
346      obj.text('Processing...').attr('disabled','disabled');
347      jQuery('.export-error').text("");
348      if(jQuery('#export-largedata-email').find('input[name="export_email"]').val() == ''){
349        jQuery('.export-error').text("Email address required");
350        obj.text(objtext).removeAttr('disabled');
351        return false;
352      }
353      var export_email = jQuery('#export-largedata-email').find('input[name="export_email"]').val()
354      var filterdata = jQuery('#export-largedata-email').find('input[name="filterdata"]').val()
355      var params = $.extend({}, doAjax_params_default);
356      params['data'] = {
357        action: 'export_data_saveto_db',
358        export_email: export_email,
359        filterdata:filterdata,
360      };
361      params['successCallback'] = function(data) {
362        obj.text(objtext);
363        jQuery('#sales-timeout-notifications').find('.modal-body').append('<p class="succss-msg" style="color: green;">Your filtered data and email address stored sucessfully. Export data will send you on email.</p>')
364          //jQuery('#export-largedata-email').modal('hide');
365      };
366      doAjax(params);
367
368    });
369  }
370  // DropFunnels Categories to Templates Categories.
371  if(jQuery('#fl-builder-template-categorydiv').length > 0){
372    var nadcat = jQuery('#fl-builder-template-categorydiv').find('.hndle').html();
373    if(nadcat == '<span>DropFunnels Categories</span>'){
374        jQuery('#fl-builder-template-categorydiv').find('.hndle').html('<span>Template Categories</span>');
375     }
376  }
377  if(jQuery('.settings_page_uabb-builder-settings').find('.fl-settings-network-admin').length > 0){
378    var nadsetting = jQuery('.fl-settings-network-admin').find('.fl-settings-heading').html();
379    if(nadsetting.trim() == '<span>DropFunnels Pro Settings</span>'){
380        jQuery('.fl-settings-network-admin').find('.fl-settings-heading').html('<span>Additional Settings</span>');
381     }
382  }
383  if(jQuery('.settings_page_uabb-builder-settings').find('.fl-settings-network-admin').find('.uabb-api-info-msg').length > 0){
384   jQuery('.fl-settings-network-admin').find('.uabb-api-info-msg').html('<span class="dashicons dashicons-warning"></span>Google now requires an active billing account associated with your API Key.');
385  }
386  if(jQuery('.ms-delete-site-php').find('#wpbody-content').find('.wrap h1').length > 0){
387    jQuery('.ms-delete-site-php').find('#wpbody-content').find('.wrap h1').addClass('wp-heading-inline');
388  }
389  if(jQuery('.fl-builder-admin').find('.fl-builder-admin-ui').find('a').length > 0){
390    setTimeout(function() {
391      jQuery('.fl-builder-admin').find('.fl-builder-admin-ui').find('a').off("
391click");
392      jQuery('.fl-builder-admin').find('.fl-builder-admin-ui').find('a').attr('target', '_blank');
393    }, 500);
394  }
395
396  if(jQuery('#fl-builder-user-template-buttons').find('.fl-launch-builder').length > 0){
397    setTimeout(function() {
398      // jQuery('#fl-builder-user-template-buttons').find('.fl-launch-builder').off("click");
399      jQuery('#fl-builder-user-template-buttons').find('.fl-launch-builder').attr('target', '_blank');
400    }, 500);
401  }
402
403  if(jQuery('.type-fl-builder-template').find('.has-row-actions .row-actions .fl-builder a').length > 0){
404    setTimeout(function() {
405      jQuery('.type-fl-builder-template').find('.has-row-actions .row-actions .fl-builder a').off("click");
406      jQuery('.type-fl-builder-template').find('.has-row-actions .row-actions .fl-builder a').attr('target', '_blank');
407    }, 500);
408  }
409
410  if(jQuery('.type-page').find('.has-row-actions .row-actions .fl-builder a').length > 0){
411    setTimeout(function() {
412      jQuery('.type-page').find('.has-row-actions .row-actions .fl-builder a').off("click");
413      jQuery('.type-page').find('.has-row-actions .row-actions .fl-builder a').attr('target', '_blank');
414    }, 500);
415  }
416
417  if(jQuery('.type-post').find('.has-row-actions .row-actions .fl-builder a').length > 0){
418    setTimeout(function() {
419      jQuery('.type-post').find('.has-row-actions .row-actions .fl-builder a').off("click");
420      jQuery('.type-post').find('.has-row-actions .row-actions .fl-builder a').attr('target', '_blank');
421    }, 500);
422  }
423
424  // Toggle(collapse & expand) BB editor modules sections
425  jQuery(document).on("click", "#fl-builder-blocks-sales-modules, #fl-builder-blocks-courses-modules, #fl-builder-blocks-basic-modules, #fl-builder-blocks-design-modules, #fl-builder-blocks-business-modules, #fl-builder-blocks-advanced-modules, #fl-builder-blocks-layouts", function() {
426    var module_container = $(this).find(".fl-builder-blocks-section-content");
427    var css_display = module_container.css("display");
428    if (css_display == "grid") {
429      module_container.css('display','none');
430    } else if (css_display == "none") {
431      module_container.css('display','grid');
432    }
433  });
434
435  //check if builder is editable
436  window.addEventListener('error', function(e) {
437    var primary_post_id = jQuery(document).find('.fl-builder-content-primary');
438    if( primary_post_id.length > 0 && e.type == "error" ){
439      var root_node = primary_post_id[0];
440      if( root_node != undefined ){
441        dfpage_id = jQuery(root_node).data('post-id');
442        var errorlinkid = jQuery(e.target).attr('id');
443        var targetd_id = "fl-builder-layout-"+dfpage_id+"-css";
444        if( errorlinkid == targetd_id ){
445          if( document.location.hostname == 'jordanmederich.com' ){
446            FLBuilder.confirm({
447              message: "<b style='font-size: 16px;'>IMPORTANT:</b> <span style='font-size: 16px;'>Let's take a minute to save a draft of your work! Click OK to save.</span>",
448              ok: function() {
449                var saveBtn = $('.fl-builder-settings:visible .fl-builder-settings-save');
450                saveBtn.removeClass('fl-builder-settings-error');
451                saveBtn.off('click', FLBuilder._showCodeFieldError);
452                saveBtn.trigger('click');
453                refreshId = setInterval(function() {
454                  if ($('.fl-lightbox-content').has('form').length == 0) {
455                    location.reload(true);
456                    clearInterval(refreshId);
457                  }
458                }, 500);
459              },
460              cancel: function() {
461                var saveBtn = $('.fl-builder-settings:visible .fl-builder-settings-save');
462                saveBtn.removeClass('fl-builder-settings-error');
463                saveBtn.off('click', FLBuilder._showCodeFieldError);
464                saveBtn.trigger('click');
465                refreshId = setInterval(function() {
466                  if ($('.fl-lightbox-content').has('form').length == 0) {
467                    location.reload(true);
468                    clearInterval(refreshId);
469                  }
470                }, 500);
471              },
472            });
473
474            var bb_alert_msg = $('.fl-lightbox-message').text();
475            if (bb_alert_msg.includes("IMPORTANT: Let's take a minute to save a draft of your work! Click OK to save.")) {
476              $('.fl-builder-confirm-cancel').hide();
477            }
478          }else{
479            FLBuilder.alert('<b style="font-size: 16px;">IMPORTANT:</b> <span style="font-size: 16px;">Please take a moment to save your work. Press "Publish" or "Save Draft".</span>');
480          }
481        }
482      }
483    }
484  }, true);
485
486  $('.custom_copy_class').hover(function(e) {
487    $(this).append('<input type="button" class="copy_button" value="Copy Settings"/>');
488    $(".copy_button").hover(function(){
489        $(this).css({"background-color":"#00a2de", "color" : "white" });
490    });
491  }, function() {
492    $(this).find('.copy_button').remove();
493  });
494
495});
496
497function getParameterByName(name, url = window.location.href) {
498    name = name.replace(/[\[\]]/g, '\\$&');
499    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
500        results = regex.exec(url);
501    if (!results) return null;
502    if (!results[2]) return '';
503    return decodeURIComponent(results[2].replace(/\+/g, ' '));
504}
505
506 // Code for copy to clipboard
507jQuery(document).on('click',".copy_button", function(){
508  copytoclipboard(jQuery(this));
509  jQuery(this).prop("value", "Copied");
510});
511
512function copytoclipboard(button_id)
513{
514    var module_parent_node = button_id.closest('.custom_copy_class').attr('data-node');
515    var final_post_id = jQuery('.fl-builder-content-primary').attr('data-post-id');
516
517    var data = {
518        action: 'copy_module_settings_function',
519        path: {module_parent_node : module_parent_node, final_post_id : final_post_id}
520    };
521
522    jQuery.post(df_ajax.ajaxurl, data, function(response) {
523
524        navigator.clipboard.writeText(response);
525    });
526}
527
528//Code for share post and page shareable
529jQuery(document).on('click', '.share_post', function(){ 
530  var copy_url = jQuery(this).children(".share_post_link").data("value");
531
532    document.addEventListener('copy', function(e) {
533      e.clipboardData.setData('text/plain', copy_url);
534      e.preventDefault();
535  }, true);
536
537  document.execCommand('copy');  
538  console.log('copied text : ', copy_url);
539  
540  jQuery(this).children(".share_post_link").hide();
541  jQuery(this).children().closest(".copied_msg").text("Copies share link to clipboard").show().fadeOut(2000);
542  jQuery(this).children(".share_post_link").delay(2000).fadeIn();
543});
544
545jQuery(document).on('change', '.email-membership-change-status', function(){
546    if(jQuery(this).is(':checked')) {
547        jQuery(this).closest('.form-row').next().show();
548    } else {
549        jQuery(this).closest('.form-row').next().hide();
550    }
551});
552
553// Code restrict reload page when enter
554jQuery(document).on('keypress', '#seopress_google_suggest_kw_meta', function(e){
555  if (e.keyCode == 13) { 
556    return false;  
557  }  
558});
559
560// Code for post page 404 error handling.
561// jQuery(window).on("load", function (e) {
562//   if (jQuery('#title').length) {
563//     var post_title = jQuery("#title").val();
564//     if(post_title.length > 0){
565//       jQuery('.fl-launch-builder').attr("disabled", false);
566//       jQuery(".fl-launch-builder").css('cursor','pointer').attr('title', '');
567//     }
568//     else{
569//       jQuery('.fl-launch-builder').attr("disabled", true);
570//       jQuery(".fl-launch-builder").css('cursor','not-allowed').attr('title', 'Please Add Title');
571//     }
572//   }  
573// });
574
575// jQuery(document).on('keyup', '#title', function(e){
576//   var post_title_val = jQuery(this).val();
577//   if(post_title_val.length > 0){
578//     jQuery('.fl-launch-builder').attr('disabled', false);
579//     jQuery(".fl-launch-builder").css('cursor','pointer').attr('title', '');
580//   }else{
581//     jQuery('.fl-launch-builder').attr("disabled", true);
582//     jQuery(".fl-launch-builder").css('cursor','not-allowed').attr('title', 'Please Add Title');
583//   }
584// });
585
586// jQuery(document).ready(function(){
587//   if( jQuery('body').hasClass('post-type-post') || jQuery('body').hasClass('post-type-page')){
588//     jQuery(document).find('.fl-launch-builder').attr("href", "javascript:void(0);");
589//     jQuery(document).find('.fl-launch-builder').removeAttr('target');   
590//   }   
591// });
592
593// jQuery(document).on('click', '.fl-launch-builder', function(event){  
594//   if( jQuery('body').hasClass('post-type-post') || jQuery('body').hasClass('post-type-page')){
595//     var post_title_val = jQuery('#title').val();
596//     event.preventDefault();
597//     if( post_title_val.length > 0 ){
598//       setTimeout(function() {
599//         jQuery('.fl-launch-builder').attr("disabled", false);
600//         jQuery(".fl-launch-builder").css('cursor','pointer');
601//         var post_id = jQuery(document).find('input[name=post_ID]').val();
602//         if( jQuery('body').hasClass('post-type-post') ){
603//           var yyu = '/?p='+post_id+'&fl_builder';
604//         }  
605//         if( jQuery('body').hasClass('post-type-page') ){
606//           yyu = '/?page_id='+post_id+'&fl_builder';
607//         }
608//         window.open(yyu, '_blank');
609//       }, 2000);
610//     }
611//   }  
612// });
613
614jQuery(document).on('click', '.fl-launch-builder', function(event){
615  if( jQuery('body').hasClass('post-type-post') || jQuery('body').hasClass('post-type-page')){
616    var post_id = jQuery('#post_ID').val();
617    var post_status = jQuery('#original_post_status').val();
618
619    if(post_status !== 'publish'){
620    
621      event.preventDefault();
622      jQuery.ajax({
623        url: df_ajax.ajaxurl,
624        method: 'POST',
625        data: {
626          action: 'update_post_status',
627          post_id: post_id
628        },
629        success: function(response) {
630          if (response.status === 'true') {
631            // Open the link in a new tab after the AJAX call is successful
632            window.open(jQuery('.fl-launch-builder').attr('href'), '_blank');
633          }
634        },
635
636      });
637    }
638   
639  }
640});
641
642 jQuery(document).ready(function($) {
643     jQuery(document).on('change','select[name=field_type]',function() {
644      if(jQuery(this).val() != 'df_checkbox' && jQuery(this).val() != 'df_multichoice'){
645          jQuery(this).parents('.fl-builder-settings').find('select[name=ar_additional_tag]').val('no').trigger('change');
646        }
647    });
648    jQuery(document).on('change','select[name=ar_additional_tag]',function() {
649      var ar_add_tags = jQuery(this).val();
650      if(ar_add_tags == 'yes'){
651        var field_type = jQuery(this).parents('.fl-form-table').find('select[name=field_type]').val();
652        if(field_type == 'df_checkbox' || 'df_multichoice'){
653          if(field_type == 'df_checkbox'){
654           var options_checklist = jQuery(this).parents('.fl-form-table').find('#fl-field-checklist_opts tr[data-field="checklist_opts"]').length;
655          }else{
656            var options_checklist = jQuery(this).parents('.fl-form-table').find('#fl-field-multichoice_opts tr[data-field="multichoice_opts"]').length;
657          }
658          var tags_field_length = jQuery(this).parents('.fl-form-table').find('#fl-field-custom_field_ar_option_tags tr[data-field="custom_field_ar_option_tags"]').length;
659          
660          if(options_checklist > tags_field_length){
661            var more_tags_need = options_checklist - tags_field_length;
662            for (var i = 1; i <= more_tags_need; i++) {
663                jQuery(this).parents('.fl-form-table').find('#fl-field-custom_field_ar_option_tags a[data-field="custom_field_ar_option_tags"]').trigger('click'); 
664            }
665          }
666        }
667      }
668    });
669});

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.