Browse Source

Fix lint errors.

pull/124/head
Ned Zimmerman 8 years ago
parent
commit
6b8008909d
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 59
      assets/scripts/catalog-admin.js
  2. 29
      assets/scripts/page-section.js

59
assets/scripts/catalog-admin.js

@ -2,12 +2,18 @@
( function ( $ ) {
$( document ).ready( function () {
$( '.wrap' ).on( 'click', '.notice-dismiss', function () {
$( this ).parent( '#message' ).fadeOut( 500, function () {
$( 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,
@ -20,22 +26,61 @@
},
success: function () {
if ( $( '#message' ).length < 1 ) {
$( '<div id="message" class="updated notice is-dismissible">' ).html( '<p><strong>'+PB_Aldine_Admin.catalog_updated+'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+PB_Aldine_Admin.dismiss_notice+'</span></button>' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 );
$( '<div id="message" class="updated notice is-dismissible">' )
.html(
'<p><strong>' +
PB_Aldine_Admin.catalog_updated +
'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' +
PB_Aldine_Admin.dismiss_notice +
'</span></button>'
)
.hide()
.insertAfter( '.wrap h1' )
.fadeIn( 500 );
} else {
$( '#message' ).fadeOut( 500, function () {
$( this ).remove();
$( '<div id="message" class="updated notice is-dismissible">' ).html( '<p><strong>'+PB_Aldine_Admin.catalog_updated+'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+PB_Aldine_Admin.dismiss_notice+'</span></button>' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 );
$( '<div id="message" class="updated notice is-dismissible">' )
.html(
'<p><strong>' +
PB_Aldine_Admin.catalog_updated +
'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' +
PB_Aldine_Admin.dismiss_notice +
'</span></button>'
)
.hide()
.insertAfter( '.wrap h1' )
.fadeIn( 500 );
} );
}
},
error: function ( jqXHR, textStatus, errorThrown ) {
if ( $( '#message' ).length < 1 ) {
$( '<div id="message" class="error notice is-dismissible">' ).html( '<p><strong>'+PB_Aldine_Admin.catalog_not_updated+'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+PB_Aldine_Admin.dismiss_notice+'</span></button>' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 );
$( '<div id="message" class="error notice is-dismissible">' )
.html(
'<p><strong>' +
PB_Aldine_Admin.catalog_not_updated +
'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' +
PB_Aldine_Admin.dismiss_notice +
'</span></button>'
)
.hide()
.insertAfter( '.wrap h1' )
.fadeIn( 500 );
} else {
$( '#message' ).fadeOut( 500, function () {
$( this ).remove();
$( '<div id="message" class="error notice is-dismissible">' ).html( '<p><strong>'+PB_Aldine_Admin.catalog_not_updated+'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+PB_Aldine_Admin.dismiss_notice+'</span></button>' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 );
$( '<div id="message" class="error notice is-dismissible">' )
.html(
'<p><strong>' +
PB_Aldine_Admin.catalog_not_updated +
'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">' +
PB_Aldine_Admin.dismiss_notice +
'</span></button>'
)
.hide()
.insertAfter( '.wrap h1' )
.fadeIn( 500 );
} );
}
},

29
assets/scripts/page-section.js

@ -19,16 +19,30 @@
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 + '"]<p>Insert your page section content here.</p>[/aldine_page_section]' );
editor.insertContent(
'[aldine_page_section title="' +
e.data.title +
'" variant="' +
e.data.variant +
'"]<p>Insert your page section content here.</p>[/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
);
} )();

Loading…
Cancel
Save