Skip to content

Commit

Permalink
Fix jscs errors VisualComposer#328
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytro-kovalov committed Jul 6, 2022
1 parent e6983d6 commit f19df67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions js/control-google-fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
message: xhr.responseText
} );
} ).done( function( response ) {
var isGoogleFont = response.data.isGoogleFont;
var existsLocally = response.data.existsLocally;
if ( false === response.success ) {
wp.customize.notifications.add( 'vct_fail_to_check_font', {
type: 'warning',
message: response.data
} );
} else {
var isGoogleFont = response.data.isGoogleFont;
var existsLocally = response.data.existsLocally;
if ( isGoogleFont && existsLocally ) {

// Refresh the preview
Expand Down
10 changes: 5 additions & 5 deletions js/customize-popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
}
};

window.vctHandleOpenPopup = handleOpenPopup;

var fontSettings = [
'vct_fonts_and_style_h1_font_family',
'vct_fonts_and_style_h2_font_family',
Expand All @@ -32,6 +30,8 @@

var changedFonts = {};

window.vctHandleOpenPopup = handleOpenPopup;

wp.customize.bind( 'ready', function() {
wp.customize.bind( 'change', function( setting ) {
if ( fontSettings.includes( setting.id ) ) {
Expand All @@ -54,10 +54,10 @@
} ).fail( function( xhr ) {
window.alert( xhr.responseText );
} ).done( function( response ) {
var data = response.data;
if ( false === response.success ) {
window.alert( response.data );
window.alert( data );
} else {
var data = response.data;

// All fonts are downloaded: just save
if ( data.hasOwnProperty( 'all_fonts_exists' ) && true === data.all_fonts_exists ) {
Expand Down Expand Up @@ -102,8 +102,8 @@

// Handle click of "Revert" button
$( document ).on( 'click', '#vct-popup-cancel-button', function( e ) {
e && e.preventDefault && e.preventDefault();
var previousFonts = window.vctCurrentFonts;
e && e.preventDefault && e.preventDefault();
if ( ! $.isEmptyObject( changedFonts ) && ! $.isEmptyObject( previousFonts ) ) {
$.each( changedFonts, function( id ) {
if ( previousFonts.hasOwnProperty( id ) ) {
Expand Down

0 comments on commit f19df67

Please sign in to comment.