diff --git a/assets/scripts/call-to-action.js b/assets/scripts/call-to-action.js index a252b6a..1fcfd91 100644 --- a/assets/scripts/call-to-action.js +++ b/assets/scripts/call-to-action.js @@ -2,21 +2,21 @@ tinymce.create( 'tinymce.plugins.aldine_call_to_action', { init: function ( editor, url ) { editor.addButton( 'aldine_call_to_action', { - title: aldine.call_to_action.title, - icon: 'icon dashicons-flag', + title: aldine.call_to_action.title, + icon: 'icon dashicons-flag', onclick: function () { editor.windowManager.open( { title: aldine.call_to_action.title, - body: [ + body: [ { - type: 'textbox', - name: 'text', + type: 'textbox', + name: 'text', label: aldine.call_to_action.text, value: aldine.call_to_action.title, }, { - type: 'textbox', - name: 'link', + type: 'textbox', + name: 'link', label: aldine.call_to_action.link, value: '#', }, diff --git a/assets/scripts/catalog-admin.js b/assets/scripts/catalog-admin.js index 4d2d873..5e5b182 100644 --- a/assets/scripts/catalog-admin.js +++ b/assets/scripts/catalog-admin.js @@ -2,40 +2,85 @@ ( function ( $ ) { $( document ).ready( function () { $( '.wrap' ).on( 'click', '.notice-dismiss', function () { - $( this ).parent( '#message' ).fadeOut( 500, function () { - $( this ).remove(); - } ); + $( this ) + .parent( '#message' ) + .fadeOut( 500, function () { + $( this ).remove(); + } ); } ); $( 'input.in-catalog' ).on( 'change', function () { - let book_id = $( this ).parent( 'td' ).siblings( 'th' ).children( 'input' ).val(); + let book_id = $( this ) + .parent( 'td' ) + .siblings( 'th' ) + .children( 'input' ) + .val(); let in_catalog = $( this ).prop( 'checked' ); $.ajax( { - url: ajaxurl, + url: ajaxurl, type: 'POST', data: { - action: 'pressbooks_aldine_update_catalog', - book_id: book_id, - in_catalog: in_catalog, + action: 'pressbooks_aldine_update_catalog', + book_id: book_id, + in_catalog: in_catalog, _ajax_nonce: PB_Aldine_Admin.aldineAdminNonce, }, - success: function (){ + success: function () { if ( $( '#message' ).length < 1 ) { - $( '
'+PB_Aldine_Admin.catalog_updated+'
' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 ); + $( '' + + PB_Aldine_Admin.catalog_updated + + '
' + ) + .hide() + .insertAfter( '.wrap h1' ) + .fadeIn( 500 ); } else { $( '#message' ).fadeOut( 500, function () { $( this ).remove(); - $( ''+PB_Aldine_Admin.catalog_updated+'
' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 ); + $( '' + + PB_Aldine_Admin.catalog_updated + + '
' + ) + .hide() + .insertAfter( '.wrap h1' ) + .fadeIn( 500 ); } ); } - }, error: function ( jqXHR, textStatus, errorThrown ) { if ( $( '#message' ).length < 1 ) { - $( ''+PB_Aldine_Admin.catalog_not_updated+'
' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 ); + $( '' + + PB_Aldine_Admin.catalog_not_updated + + '
' + ) + .hide() + .insertAfter( '.wrap h1' ) + .fadeIn( 500 ); } else { $( '#message' ).fadeOut( 500, function () { $( this ).remove(); - $( ''+PB_Aldine_Admin.catalog_not_updated+'
' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 ); + $( '' + + PB_Aldine_Admin.catalog_not_updated + + '
' + ) + .hide() + .insertAfter( '.wrap h1' ) + .fadeIn( 500 ); } ); } }, diff --git a/assets/scripts/page-section.js b/assets/scripts/page-section.js index 289ea4b..3f7b83d 100644 --- a/assets/scripts/page-section.js +++ b/assets/scripts/page-section.js @@ -2,33 +2,47 @@ tinymce.create( 'tinymce.plugins.aldine_page_section', { init: function ( editor, url ) { editor.addButton( 'aldine_page_section', { - title: aldine.page_section.title, - icon: 'icon dashicons-layout', + title: aldine.page_section.title, + icon: 'icon dashicons-layout', onclick: function () { editor.windowManager.open( { title: aldine.page_section.title, - body: [ + body: [ { - type: 'textbox', - name: 'title', + type: 'textbox', + name: 'title', label: aldine.page_section.title_label, value: aldine.page_section.title, }, { - type: 'listbox', - name: 'variant', - label: 'Variant', + type: 'listbox', + name: 'variant', + label: 'Variant', values: [ - { text: aldine.page_section.standard, value: '' }, - { text: aldine.page_section.accent, value: 'accent' }, - { text: aldine.page_section.bordered, value: 'bordered' }, - { text: aldine.page_section.borderless, value: 'borderless' }, + { + text: aldine.page_section.standard, value: '', + }, + { + text: aldine.page_section.accent, value: 'accent', + }, + { + text: aldine.page_section.bordered, value: 'bordered', + }, + { + text: aldine.page_section.borderless, value: 'borderless', + }, ], value: '', // Sets the default }, ], onsubmit: function ( e ) { - editor.insertContent( '[aldine_page_section title="' + e.data.title + '" variant="' + e.data.variant + '"]Insert your page section content here.
[/aldine_page_section]' ); + editor.insertContent( + '[aldine_page_section title="' + + e.data.title + + '" variant="' + + e.data.variant + + '"]Insert your page section content here.
[/aldine_page_section]' + ); }, } ); }, @@ -38,5 +52,8 @@ return null; }, } ); - tinymce.PluginManager.add( 'aldine_page_section', tinymce.plugins.aldine_page_section ); + tinymce.PluginManager.add( + 'aldine_page_section', + tinymce.plugins.aldine_page_section + ); } )();