Skip to content

Commit

Permalink
Fix jshint 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 9b4f50c commit e6983d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
14 changes: 7 additions & 7 deletions js/control-google-fonts.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(function( $, wp, document, window ) {
wp.customize.controlConstructor['google-fonts'] = wp.customize.Control.extend({
ready: function() {
const control = this;
const setting = this.setting;
var control = this;
var setting = this.setting;

let message = $( control.container.find( '#_customize-message-' + control.id ) );
var message = $( control.container.find( '#_customize-message-' + control.id ) );

// Fonts from Google CDN should be hosted locally to comply with GDPR.
// Check whether it is required to show a message with download link for the user.
Expand All @@ -13,7 +13,7 @@
'action': 'vct_check_font',
'security': window.googleFontControlData.nonce,
'font': value
} ).fail( function( xhr, status, error ) {
} ).fail( function( xhr ) {
wp.customize.notifications.add( 'vct_check_font_ajax', {
type: 'error',
message: xhr.responseText
Expand All @@ -25,8 +25,8 @@
message: response.data
} );
} else {
let isGoogleFont = response.data.isGoogleFont;
let existsLocally = response.data.existsLocally;
var isGoogleFont = response.data.isGoogleFont;
var existsLocally = response.data.existsLocally;
if ( isGoogleFont && existsLocally ) {

// Refresh the preview
Expand All @@ -51,7 +51,7 @@
'action': 'vct_download_font',
'security': window.googleFontControlData.nonce,
'font': setting.get()
} ).fail( function( xhr, status, error ) {
} ).fail( function( xhr ) {
wp.customize.notifications.add( 'vct_download_font_ajax', {
type: 'error',
message: xhr.responseText
Expand Down
30 changes: 15 additions & 15 deletions js/customize-popup.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
( function( $, document, window, wp ) {
let popupElement = null;
var popupElement = null;

const handlePopupClose = ( e ) => {
var handlePopupClose = function( e ) {
e && e.preventDefault && e.preventDefault();
closePopup();
};

const closePopup = () => {
var closePopup = function() {
popupElement.style = 'display: none;';
};

const handleOpenPopup = ( id ) => {
var handleOpenPopup = function( id ) {
popupElement = document.getElementById( id );
if ( popupElement ) {
popupElement.style = 'display: flex;';
Expand All @@ -19,7 +19,7 @@

window.vctHandleOpenPopup = handleOpenPopup;

const fontSettings = [
var fontSettings = [
'vct_fonts_and_style_h1_font_family',
'vct_fonts_and_style_h2_font_family',
'vct_fonts_and_style_h3_font_family',
Expand All @@ -30,7 +30,7 @@
'vct_fonts_and_style_buttons_font_family'
];

let changedFonts = {};
var changedFonts = {};

wp.customize.bind( 'ready', function() {
wp.customize.bind( 'change', function( setting ) {
Expand All @@ -51,13 +51,13 @@
'action': 'vct_check_fonts',
'security': window.googleFontControlData.nonce,
'fonts': changedFonts
} ).fail( function( xhr, status, error ) {
alert( xhr.responseText );
} ).fail( function( xhr ) {
window.alert( xhr.responseText );
} ).done( function( response ) {
if ( false === response.success ) {
alert( response.data );
window.alert( response.data );
} else {
let data = response.data;
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 @@ -85,11 +85,11 @@
'action': 'vct_download_fonts',
'security': window.googleFontControlData.nonce,
'fonts': changedFonts
} ).fail( function( xhr, status, error ) {
alert( xhr.responseText );
} ).fail( function( xhr ) {
window.alert( xhr.responseText );
} ).done( function( response ) {
if ( false === response.success ) {
alert( response.data );
window.alert( response.data );
} else {
closePopup();
wp.customize.previewer.save();
Expand All @@ -103,9 +103,9 @@
// Handle click of "Revert" button
$( document ).on( 'click', '#vct-popup-cancel-button', function( e ) {
e && e.preventDefault && e.preventDefault();
let previousFonts = window.vctCurrentFonts;
var previousFonts = window.vctCurrentFonts;
if ( ! $.isEmptyObject( changedFonts ) && ! $.isEmptyObject( previousFonts ) ) {
$.each( changedFonts, function( id, value ) {
$.each( changedFonts, function( id ) {
if ( previousFonts.hasOwnProperty( id ) ) {
wp.customize( id, function( setting ) {
setting.set( previousFonts[id] );
Expand Down

0 comments on commit e6983d6

Please sign in to comment.