(function($) { // Turn of all hrefs which point to another page $('body').on('click', 'a', function(event) { const href = $(this).attr('href'); const start = typeof href !== 'undefined' ? href.substr(0, 1) : ''; event.preventDefault(); // Stop the link if it points to another URL if (start !== '#') { // Display notification $('.link-disabled').addClass('active'); } }); // Prompt closing mechanism $('body').on('click', '.et_pb_prompt_proceed', () => { $('.link-disabled').removeClass('active'); }); // Build preview screen const ET_PageBuilder_Preview = function(e) { // Create form on the fly const $form = $(''); let value; let { data } = e; const msie = document.documentMode; // Origins should be matched if (e.origin !== et_preview_params.preview_origin) { $('.et-pb-preview-loading').replaceWith($('

', { style: 'text-align: center;' }).html(et_preview_params.alert_origin_not_matched)); return; } // IE9 below fix. They have postMessage, but it has to be in string if (typeof msie !== 'undefined' && msie < 10) { data = JSON.parse(data); } // Ignore messages not coming from the builder. if (! data || ! data.et_pb_preview_nonce) { return; } // Loop postMessage data and append it to $form for (const name in data) { const $textarea = $('