jQuery(function($){ // This is the part where we move the panels box into a tab of the content editor var displayPageBuilderModal = function(){ var modal = $('#siteorigin-panels-install-modal'); if(modal.length === 0) { var modelCode = '
' + '
' + '
' + '
' + '' + panelsLiteTeaser.buttons.install + '' + '' + panelsLiteTeaser.buttons.cancel + '' + '
' + '
' + '
'; modal = $(modelCode).appendTo('body'); $.get( panelsLiteTeaser.contentUrl, function(html){ modal.removeClass('panels-loading').find('#siteorigin-panels-install-window').html(html); modal.find('.button-cancel, #siteorigin-panels-install-overlay').click(function(e){ e.preventDefault(); modal.hide(); $('body').css('overflow', 'auto'); }); modal.find('a[href="#install"]').attr({ 'href': panelsLiteTeaser.installUrl, 'target' : '_blank' }).click(function(){ displayPageBuilderMessage(); modal.hide(); $('body').css('overflow', 'auto'); }); } ); } $('body').css('overflow', 'hidden'); modal.show(); }; var displayPageBuilderMessage = function(){ $('form[name=post]').before('

' + panelsLiteTeaser.message + '

'); }; $( '#wp-content-editor-tools .wp-editor-tabs' ) .append( $( '' ) .html( panelsLiteTeaser.tab ) .attr( 'href', panelsLiteTeaser.installUrl ) .css( 'text-decoration', 'none' ) .click( function (e) { e.preventDefault(); displayPageBuilderModal(); } ) ); });