Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
178
wp-content/plugins/wp-mail-smtp/assets/js/connect.js
Normal file
178
wp-content/plugins/wp-mail-smtp/assets/js/connect.js
Normal file
@@ -0,0 +1,178 @@
|
||||
/* globals wp_mail_smtp_connect */
|
||||
|
||||
/**
|
||||
* Connect functionality - Upgrade plugin from Lite to Pro version.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var WPMailSMTPConnect = window.WPMailSMTPConnect || ( function( document, window, $ ) {
|
||||
|
||||
/**
|
||||
* Elements reference.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var el = {
|
||||
$connectBtn: $( '#wp-mail-smtp-setting-upgrade-license-button' ),
|
||||
$connectKey: $( '#wp-mail-smtp-setting-upgrade-license-key' )
|
||||
};
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Start the engine.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
init: function() {
|
||||
|
||||
$( app.ready );
|
||||
},
|
||||
|
||||
/**
|
||||
* Document ready.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
ready: function() {
|
||||
|
||||
app.events();
|
||||
},
|
||||
|
||||
/**
|
||||
* Register JS events.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
events: function() {
|
||||
|
||||
app.connectBtnClick();
|
||||
},
|
||||
|
||||
/**
|
||||
* Register connect button event.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
connectBtnClick: function() {
|
||||
|
||||
el.$connectBtn.on( 'click', function() {
|
||||
app.gotoUpgradeUrl();
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the alert arguments in case of Pro already installed.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @param {object} res Ajax query result object.
|
||||
*
|
||||
* @returns {object} Alert arguments.
|
||||
*/
|
||||
proAlreadyInstalled: function( res ) {
|
||||
|
||||
return {
|
||||
title: wp_mail_smtp_connect.text.almost_done,
|
||||
content: res.data.message,
|
||||
icon: '"></i><img src="' + wp_mail_smtp_connect.plugin_url + '/assets/images/font-awesome/check-circle-solid-green.svg" style="width: 40px; height: 40px;"><i class="',
|
||||
type: 'green',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: wp_mail_smtp_connect.text.plugin_activate_btn,
|
||||
btnClass: 'btn-confirm',
|
||||
keys: [ 'enter' ],
|
||||
action: function() {
|
||||
window.location.reload();
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Go to upgrade url.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*/
|
||||
gotoUpgradeUrl: function() {
|
||||
|
||||
var data = {
|
||||
action: 'wp_mail_smtp_connect_url',
|
||||
key: el.$connectKey.val(),
|
||||
nonce: wp_mail_smtp_connect.nonce,
|
||||
};
|
||||
|
||||
$.post( wp_mail_smtp_connect.ajax_url, data )
|
||||
.done( function( res ) {
|
||||
if ( res.success ) {
|
||||
if ( res.data.reload ) {
|
||||
$.alert( app.proAlreadyInstalled( res ) );
|
||||
return;
|
||||
}
|
||||
window.location.href = res.data.url;
|
||||
return;
|
||||
}
|
||||
$.alert( {
|
||||
title: wp_mail_smtp_connect.text.oops,
|
||||
content: res.data.message,
|
||||
icon: '"></i><img src="' + wp_mail_smtp_connect.plugin_url + '/assets/images/font-awesome/exclamation-circle-solid-orange.svg" style="width: 40px; height: 40px;"><i class="',
|
||||
type: 'orange',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: wp_mail_smtp_connect.text.ok,
|
||||
btnClass: 'btn-confirm',
|
||||
keys: [ 'enter' ],
|
||||
},
|
||||
},
|
||||
} );
|
||||
} )
|
||||
.fail( function( xhr ) {
|
||||
app.failAlert( xhr );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Alert in case of server error.
|
||||
*
|
||||
* @since 2.6.0
|
||||
*
|
||||
* @param {object} xhr XHR object.
|
||||
*/
|
||||
failAlert: function( xhr ) {
|
||||
|
||||
$.alert( {
|
||||
title: wp_mail_smtp_connect.text.oops,
|
||||
content: wp_mail_smtp_connect.text.server_error + '<br>' + xhr.status + ' ' + xhr.statusText + ' ' + xhr.responseText,
|
||||
icon: '"></i><img src="' + wp_mail_smtp_connect.plugin_url + '/assets/images/font-awesome/exclamation-circle-regular-red.svg" style="width: 40px; height: 40px;"><i class="',
|
||||
type: 'red',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: wp_mail_smtp_connect.text.ok,
|
||||
btnClass: 'btn-confirm',
|
||||
keys: [ 'enter' ],
|
||||
},
|
||||
},
|
||||
} );
|
||||
},
|
||||
};
|
||||
|
||||
// Provide access to public functions/properties.
|
||||
return app;
|
||||
|
||||
}( document, window, jQuery ) );
|
||||
|
||||
// Initialize.
|
||||
WPMailSMTPConnect.init();
|
1
wp-content/plugins/wp-mail-smtp/assets/js/connect.min.js
vendored
Normal file
1
wp-content/plugins/wp-mail-smtp/assets/js/connect.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var WPMailSMTPConnect=window.WPMailSMTPConnect||function(n,e){var c={$connectBtn:e("#wp-mail-smtp-setting-upgrade-license-button"),$connectKey:e("#wp-mail-smtp-setting-upgrade-license-key")},o={init:function(){e(o.ready)},ready:function(){o.events()},events:function(){o.connectBtnClick()},connectBtnClick:function(){c.$connectBtn.on("click",function(){o.gotoUpgradeUrl()})},proAlreadyInstalled:function(t){return{title:wp_mail_smtp_connect.text.almost_done,content:t.data.message,icon:'"></i><img src="'+wp_mail_smtp_connect.plugin_url+'/assets/images/font-awesome/check-circle-solid-green.svg" style="width: 40px; height: 40px;"><i class="',type:"green",buttons:{confirm:{text:wp_mail_smtp_connect.text.plugin_activate_btn,btnClass:"btn-confirm",keys:["enter"],action:function(){n.location.reload()}}}}},gotoUpgradeUrl:function(){var t={action:"wp_mail_smtp_connect_url",key:c.$connectKey.val(),nonce:wp_mail_smtp_connect.nonce};e.post(wp_mail_smtp_connect.ajax_url,t).done(function(t){return t.success?t.data.reload?void e.alert(o.proAlreadyInstalled(t)):void(n.location.href=t.data.url):void e.alert({title:wp_mail_smtp_connect.text.oops,content:t.data.message,icon:'"></i><img src="'+wp_mail_smtp_connect.plugin_url+'/assets/images/font-awesome/exclamation-circle-solid-orange.svg" style="width: 40px; height: 40px;"><i class="',type:"orange",buttons:{confirm:{text:wp_mail_smtp_connect.text.ok,btnClass:"btn-confirm",keys:["enter"]}}})}).fail(function(t){o.failAlert(t)})},failAlert:function(t){e.alert({title:wp_mail_smtp_connect.text.oops,content:wp_mail_smtp_connect.text.server_error+"<br>"+t.status+" "+t.statusText+" "+t.responseText,icon:'"></i><img src="'+wp_mail_smtp_connect.plugin_url+'/assets/images/font-awesome/exclamation-circle-regular-red.svg" style="width: 40px; height: 40px;"><i class="',type:"red",buttons:{confirm:{text:wp_mail_smtp_connect.text.ok,btnClass:"btn-confirm",keys:["enter"]}}})}};return o}((document,window),jQuery);WPMailSMTPConnect.init();
|
189
wp-content/plugins/wp-mail-smtp/assets/js/smtp-about.js
Normal file
189
wp-content/plugins/wp-mail-smtp/assets/js/smtp-about.js
Normal file
@@ -0,0 +1,189 @@
|
||||
/* eslint-disable no-prototype-builtins */
|
||||
/* global wp_mail_smtp_about */
|
||||
'use strict';
|
||||
|
||||
var WPMailSMTP = window.WPMailSMTP || {};
|
||||
WPMailSMTP.Admin = WPMailSMTP.Admin || {};
|
||||
|
||||
/**
|
||||
* WP Mail SMTP Admin area About module.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
WPMailSMTP.Admin.About = WPMailSMTP.Admin.About || ( function( document, window, $ ) {
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Start the engine. DOM is not ready yet, use only to init something.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
init: function() {
|
||||
|
||||
// Do that when DOM is ready.
|
||||
$( app.ready );
|
||||
},
|
||||
|
||||
/**
|
||||
* DOM is fully loaded.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
ready: function() {
|
||||
|
||||
app.pageHolder = $( '.wp-mail-smtp-page-about' );
|
||||
|
||||
app.bindActions();
|
||||
|
||||
$( '.wp-mail-smtp-page' ).trigger( 'WPMailSMTP.Admin.About.ready' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Process all generic actions/events, mostly custom that were fired by our API.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*/
|
||||
bindActions: function() {
|
||||
|
||||
/*
|
||||
* Make plugins description the same height.
|
||||
*/
|
||||
jQuery( '.wp-mail-smtp-admin-about-plugins .plugin-item .details' ).matchHeight();
|
||||
|
||||
/*
|
||||
* Install/Active the plugins.
|
||||
*/
|
||||
$( document ).on( 'click', '.wp-mail-smtp-admin-about-plugins .plugin-item .action-button .button', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var $btn = $( this );
|
||||
|
||||
if ( $btn.hasClass( 'disabled' ) || $btn.hasClass( 'loading' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var $plugin = $btn.closest( '.plugin-item' ),
|
||||
plugin = $btn.attr( 'data-plugin' ),
|
||||
task,
|
||||
cssClass,
|
||||
statusText,
|
||||
buttonText,
|
||||
successText;
|
||||
|
||||
$btn.addClass( 'loading disabled' );
|
||||
$btn.text( wp_mail_smtp_about.plugin_processing );
|
||||
|
||||
if ( $btn.hasClass( 'status-inactive' ) ) {
|
||||
|
||||
// Activate.
|
||||
task = 'about_plugin_activate';
|
||||
cssClass = 'status-active button button-secondary disabled';
|
||||
statusText = wp_mail_smtp_about.plugin_active;
|
||||
buttonText = wp_mail_smtp_about.plugin_activated;
|
||||
|
||||
} else if ( $btn.hasClass( 'status-download' ) ) {
|
||||
|
||||
// Install & Activate.
|
||||
task = 'about_plugin_install';
|
||||
cssClass = 'status-active button disabled';
|
||||
statusText = wp_mail_smtp_about.plugin_active;
|
||||
buttonText = wp_mail_smtp_about.plugin_activated;
|
||||
|
||||
} else if ( $btn.hasClass( 'status-open' ) ) {
|
||||
|
||||
// Open site in new window.
|
||||
window.open( $btn.attr( 'href' ), '_blank' ).focus();
|
||||
$btn.removeClass( 'loading disabled' );
|
||||
$btn.text( wp_mail_smtp_about.plugin_visit );
|
||||
|
||||
return;
|
||||
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// Setup ajax POST data.
|
||||
var data = {
|
||||
action: 'wp_mail_smtp_ajax',
|
||||
task: task,
|
||||
nonce : wp_mail_smtp_about.nonce,
|
||||
plugin: plugin
|
||||
};
|
||||
|
||||
$.post( wp_mail_smtp_about.ajax_url, data, function( res ) {
|
||||
var isInstallSuccessful;
|
||||
|
||||
if ( res.success ) {
|
||||
isInstallSuccessful = true;
|
||||
if ( 'about_plugin_install' === task ) {
|
||||
$btn.attr( 'data-plugin', res.data.basename );
|
||||
successText = res.data.msg;
|
||||
if ( ! res.data.is_activated ) {
|
||||
cssClass = 'button';
|
||||
statusText = wp_mail_smtp_about.plugin_inactive;
|
||||
buttonText = wp_mail_smtp_about.plugin_activate;
|
||||
}
|
||||
} else {
|
||||
successText = res.data;
|
||||
}
|
||||
$plugin.find( '.actions' ).append( '<div class="msg success">' + successText + '</div>' );
|
||||
$plugin.find( 'span.status-label' )
|
||||
.removeClass( 'status-active status-inactive status-download' )
|
||||
.addClass( cssClass )
|
||||
.removeClass( 'button button-primary button-secondary disabled' )
|
||||
.text( statusText );
|
||||
$btn
|
||||
.removeClass( 'status-active status-inactive status-download' )
|
||||
.removeClass( 'button button-primary button-secondary disabled' )
|
||||
.addClass( cssClass ).html( buttonText );
|
||||
} else {
|
||||
isInstallSuccessful = false;
|
||||
|
||||
if (
|
||||
res.hasOwnProperty( 'data' ) &&
|
||||
res.data.hasOwnProperty( 0 ) &&
|
||||
res.data[ 0 ].hasOwnProperty( 'code' )
|
||||
) {
|
||||
|
||||
// Specific server-returned error.
|
||||
$plugin.find( '.actions' ).append( '<div class="msg error">' + wp_mail_smtp_about.plugin_install_error + '</div>' );
|
||||
} else {
|
||||
|
||||
// Generic error.
|
||||
$plugin.find( '.actions' ).append( '<div class="msg error">' + res.data + '</div>' );
|
||||
}
|
||||
|
||||
$btn.html( wp_mail_smtp_about.plugin_download_btn );
|
||||
}
|
||||
|
||||
if ( ! isInstallSuccessful ) {
|
||||
$btn.removeClass( 'disabled' );
|
||||
}
|
||||
$btn.removeClass( 'loading' );
|
||||
|
||||
// Automatically clear plugin messages after 3 seconds.
|
||||
setTimeout( function() {
|
||||
$( '.plugin-item .msg' ).remove();
|
||||
}, 3000 );
|
||||
|
||||
} ).fail( function( xhr ) {
|
||||
console.log( xhr.responseText );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
// Provide access to public functions/properties.
|
||||
return app;
|
||||
}( document, window, jQuery ) );
|
||||
|
||||
// Initialize.
|
||||
WPMailSMTP.Admin.About.init();
|
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-about.min.js
vendored
Normal file
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-about.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var WPMailSMTP=window.WPMailSMTP||{};WPMailSMTP.Admin=WPMailSMTP.Admin||{},WPMailSMTP.Admin.About=WPMailSMTP.Admin.About||function(a,t,d){var i={init:function(){d(i.ready)},ready:function(){i.pageHolder=d(".wp-mail-smtp-page-about"),i.bindActions(),d(".wp-mail-smtp-page").trigger("WPMailSMTP.Admin.About.ready")},bindActions:function(){jQuery(".wp-mail-smtp-admin-about-plugins .plugin-item .details").matchHeight(),d(a).on("click",".wp-mail-smtp-admin-about-plugins .plugin-item .action-button .button",function(a){a.preventDefault();var i=d(this);if(i.hasClass("disabled")||i.hasClass("loading"))return!1;var s,n,l,e,o,u=i.closest(".plugin-item"),a=i.attr("data-plugin");if(i.addClass("loading disabled"),i.text(wp_mail_smtp_about.plugin_processing),i.hasClass("status-inactive"))s="about_plugin_activate",n="status-active button button-secondary disabled",l=wp_mail_smtp_about.plugin_active,e=wp_mail_smtp_about.plugin_activated;else{if(!i.hasClass("status-download"))return i.hasClass("status-open")?(t.open(i.attr("href"),"_blank").focus(),i.removeClass("loading disabled"),void i.text(wp_mail_smtp_about.plugin_visit)):void 0;s="about_plugin_install",n="status-active button disabled",l=wp_mail_smtp_about.plugin_active,e=wp_mail_smtp_about.plugin_activated}a={action:"wp_mail_smtp_ajax",task:s,nonce:wp_mail_smtp_about.nonce,plugin:a};d.post(wp_mail_smtp_about.ajax_url,a,function(a){var t;a.success?(t=!0,"about_plugin_install"===s?(i.attr("data-plugin",a.data.basename),o=a.data.msg,a.data.is_activated||(n="button",l=wp_mail_smtp_about.plugin_inactive,e=wp_mail_smtp_about.plugin_activate)):o=a.data,u.find(".actions").append('<div class="msg success">'+o+"</div>"),u.find("span.status-label").removeClass("status-active status-inactive status-download").addClass(n).removeClass("button button-primary button-secondary disabled").text(l),i.removeClass("status-active status-inactive status-download").removeClass("button button-primary button-secondary disabled").addClass(n).html(e)):(t=!1,a.hasOwnProperty("data")&&a.data.hasOwnProperty(0)&&a.data[0].hasOwnProperty("code")?u.find(".actions").append('<div class="msg error">'+wp_mail_smtp_about.plugin_install_error+"</div>"):u.find(".actions").append('<div class="msg error">'+a.data+"</div>"),i.html(wp_mail_smtp_about.plugin_download_btn)),t||i.removeClass("disabled"),i.removeClass("loading"),setTimeout(function(){d(".plugin-item .msg").remove()},3e3)}).fail(function(a){console.log(a.responseText)})})}};return i}(document,window,jQuery),WPMailSMTP.Admin.About.init();
|
553
wp-content/plugins/wp-mail-smtp/assets/js/smtp-admin.js
Normal file
553
wp-content/plugins/wp-mail-smtp/assets/js/smtp-admin.js
Normal file
@@ -0,0 +1,553 @@
|
||||
/* globals wp_mail_smtp, jconfirm, ajaxurl */
|
||||
'use strict';
|
||||
|
||||
var WPMailSMTP = window.WPMailSMTP || {};
|
||||
WPMailSMTP.Admin = WPMailSMTP.Admin || {};
|
||||
|
||||
/**
|
||||
* WP Mail SMTP Admin area module.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
WPMailSMTP.Admin.Settings = WPMailSMTP.Admin.Settings || ( function( document, window, $ ) {
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* State attribute showing if one of the plugin settings
|
||||
* changed and was not yet saved.
|
||||
*
|
||||
* @since 1.9.0
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
pluginSettingsChanged: false,
|
||||
|
||||
/**
|
||||
* Start the engine. DOM is not ready yet, use only to init something.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
init: function() {
|
||||
|
||||
// Do that when DOM is ready.
|
||||
$( app.ready );
|
||||
},
|
||||
|
||||
/**
|
||||
* DOM is fully loaded.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
ready: function() {
|
||||
|
||||
app.pageHolder = $( '.wp-mail-smtp-tab-settings' );
|
||||
|
||||
app.settingsForm = $( '.wp-mail-smtp-connection-settings-form' );
|
||||
|
||||
// If there are screen options we have to move them.
|
||||
$( '#screen-meta-links, #screen-meta' ).prependTo( '#wp-mail-smtp-header-temp' ).show();
|
||||
|
||||
app.bindActions();
|
||||
|
||||
app.setJQueryConfirmDefaults();
|
||||
|
||||
// Flyout Menu.
|
||||
app.initFlyoutMenu();
|
||||
},
|
||||
|
||||
/**
|
||||
* Process all generic actions/events, mostly custom that were fired by our API.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
bindActions: function() {
|
||||
|
||||
// Mailer selection.
|
||||
$( '.wp-mail-smtp-mailer-image', app.settingsForm ).on( 'click', function() {
|
||||
$( this ).parents( '.wp-mail-smtp-mailer' ).find( 'input' ).trigger( 'click' );
|
||||
} );
|
||||
|
||||
$( '.wp-mail-smtp-mailer input', app.settingsForm ).on( 'click', function() {
|
||||
var $input = $( this );
|
||||
|
||||
if ( $input.prop( 'disabled' ) ) {
|
||||
|
||||
// Educational Popup.
|
||||
if ( $input.hasClass( 'educate' ) ) {
|
||||
app.education.upgradeMailer( $input );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Deselect the current mailer.
|
||||
$( '.wp-mail-smtp-mailer', app.settingsForm ).removeClass( 'active' );
|
||||
|
||||
// Select the correct one.
|
||||
$( this ).parents( '.wp-mail-smtp-mailer' ).addClass( 'active' );
|
||||
|
||||
// Hide all mailers options and display for a currently clicked one.
|
||||
$( '.wp-mail-smtp-mailer-option', app.settingsForm ).addClass( 'hidden' ).removeClass( 'active' );
|
||||
$( '.wp-mail-smtp-mailer-option-' + $( this ).val(), app.settingsForm ).addClass( 'active' ).removeClass( 'hidden' );
|
||||
} );
|
||||
|
||||
app.mailers.smtp.bindActions();
|
||||
|
||||
// Dismiss Pro banner at the bottom of the page.
|
||||
$( '#wp-mail-smtp-pro-banner-dismiss', app.pageHolder ).on( 'click', function() {
|
||||
$.ajax( {
|
||||
url: ajaxurl,
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'wp_mail_smtp_ajax',
|
||||
task: 'pro_banner_dismiss',
|
||||
nonce: wp_mail_smtp.nonce
|
||||
}
|
||||
} )
|
||||
.always( function() {
|
||||
$( '#wp-mail-smtp-pro-banner', app.pageHolder ).fadeOut( 'fast' );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Dissmis educational notices for certain mailers.
|
||||
$( '.js-wp-mail-smtp-mailer-notice-dismiss', app.settingsForm ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var $btn = $( this ),
|
||||
$notice = $btn.parents( '.inline-notice' );
|
||||
|
||||
if ( $btn.hasClass( 'disabled' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax( {
|
||||
url: ajaxurl,
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'wp_mail_smtp_ajax',
|
||||
nonce: wp_mail_smtp.nonce,
|
||||
task: 'notice_dismiss',
|
||||
notice: $notice.data( 'notice' ),
|
||||
mailer: $notice.data( 'mailer' )
|
||||
},
|
||||
beforeSend: function() {
|
||||
$btn.addClass( 'disabled' );
|
||||
}
|
||||
} )
|
||||
.always( function() {
|
||||
$notice.fadeOut( 'fast', function() {
|
||||
$btn.removeClass( 'disabled' );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Show/hide debug output.
|
||||
$( '#wp-mail-smtp-debug .error-log-toggle' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
$( '#wp-mail-smtp-debug .error-log' ).slideToggle();
|
||||
} );
|
||||
|
||||
// Copy debug output to clipboard.
|
||||
$( '#wp-mail-smtp-debug .error-log-copy' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var $self = $( this );
|
||||
|
||||
// Get error log.
|
||||
var $content = $( '#wp-mail-smtp-debug .error-log' );
|
||||
|
||||
// Copy to clipboard.
|
||||
if ( ! $content.is( ':visible' ) ) {
|
||||
$content.addClass( 'error-log-selection' );
|
||||
}
|
||||
var range = document.createRange();
|
||||
range.selectNode( $content[0] );
|
||||
window.getSelection().removeAllRanges();
|
||||
window.getSelection().addRange( range );
|
||||
document.execCommand( 'Copy' );
|
||||
window.getSelection().removeAllRanges();
|
||||
$content.removeClass( 'error-log-selection' );
|
||||
|
||||
$self.addClass( 'error-log-copy-copied' );
|
||||
|
||||
setTimeout(
|
||||
function() {
|
||||
$self.removeClass( 'error-log-copy-copied' );
|
||||
},
|
||||
1500
|
||||
);
|
||||
} );
|
||||
|
||||
// Remove mailer connection.
|
||||
$( '.js-wp-mail-smtp-provider-remove', app.settingsForm ).on( 'click', function() {
|
||||
return confirm( wp_mail_smtp.text_provider_remove );
|
||||
} );
|
||||
|
||||
// Copy input text to clipboard.
|
||||
$( '.wp-mail-smtp-setting-copy', app.settingsForm ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
var target = $( '#' + $( this ).data( 'source_id' ) ).get( 0 );
|
||||
|
||||
target.select();
|
||||
document.execCommand( 'Copy' );
|
||||
|
||||
var $buttonIcon = $( this ).find( '.dashicons' );
|
||||
|
||||
$buttonIcon
|
||||
.removeClass( 'dashicons-admin-page' )
|
||||
.addClass( 'wp-mail-smtp-dashicons-yes-alt-green wp-mail-smtp-success wp-mail-smtp-animate' );
|
||||
|
||||
setTimeout(
|
||||
function() {
|
||||
$buttonIcon
|
||||
.removeClass( 'wp-mail-smtp-dashicons-yes-alt-green wp-mail-smtp-success wp-mail-smtp-animate' )
|
||||
.addClass( 'dashicons-admin-page' );
|
||||
},
|
||||
1000
|
||||
);
|
||||
} );
|
||||
|
||||
// Notice bar: click on the dissmiss button.
|
||||
$( '#wp-mail-smtp-notice-bar' ).on( 'click', '.dismiss', function() {
|
||||
var $notice = $( this ).closest( '#wp-mail-smtp-notice-bar' );
|
||||
|
||||
$notice.addClass( 'out' );
|
||||
setTimeout(
|
||||
function() {
|
||||
$notice.remove();
|
||||
},
|
||||
300
|
||||
);
|
||||
|
||||
$.post(
|
||||
ajaxurl,
|
||||
{
|
||||
action: 'wp_mail_smtp_notice_bar_dismiss',
|
||||
nonce: wp_mail_smtp.nonce,
|
||||
}
|
||||
);
|
||||
} );
|
||||
|
||||
app.triggerExitNotice();
|
||||
app.beforeSaveChecks();
|
||||
|
||||
// Register change event to show/hide plugin supported settings for currently selected mailer.
|
||||
$( '.js-wp-mail-smtp-setting-mailer-radio-input', app.settingsForm ).on( 'change', this.processMailerSettingsOnChange );
|
||||
|
||||
// Disable multiple click on the Email Test tab submit button and display a loader icon.
|
||||
$( '.wp-mail-smtp-tab-tools-test #email-test-form' ).on( 'submit', function() {
|
||||
var $button = $( this ).find( '.wp-mail-smtp-btn' );
|
||||
|
||||
$button.attr( 'disabled', true );
|
||||
$button.find( 'span' ).hide();
|
||||
$button.find( '.wp-mail-smtp-loading' ).show();
|
||||
} );
|
||||
|
||||
$( '.email_test_tab_removal_notice' ).on( 'click', '.notice-dismiss', function() {
|
||||
var $button = $( this );
|
||||
|
||||
$.ajax( {
|
||||
url: ajaxurl,
|
||||
dataType: 'json',
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'wp_mail_smtp_ajax',
|
||||
nonce: wp_mail_smtp.nonce,
|
||||
task: 'email_test_tab_removal_notice_dismiss',
|
||||
},
|
||||
beforeSend: function() {
|
||||
$button.prop( 'disabled', true );
|
||||
},
|
||||
} );
|
||||
} );
|
||||
|
||||
$( '#wp-mail-smtp-setting-gmail-one_click_setup_enabled-lite' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
app.education.gmailOneClickSetupUpgrade();
|
||||
} );
|
||||
},
|
||||
|
||||
education: {
|
||||
upgradeMailer: function( $input ) {
|
||||
|
||||
var mailerName = $input.data( 'title' ).trim();
|
||||
|
||||
app.education.upgradeModal(
|
||||
wp_mail_smtp.education.upgrade_title.replace( /%name%/g, mailerName ),
|
||||
wp_mail_smtp.education.upgrade_content.replace( /%name%/g, mailerName ),
|
||||
$input.val()
|
||||
);
|
||||
},
|
||||
|
||||
gmailOneClickSetupUpgrade: function() {
|
||||
|
||||
app.education.upgradeModal(
|
||||
wp_mail_smtp.education.gmail.one_click_setup_upgrade_title,
|
||||
wp_mail_smtp.education.gmail.one_click_setup_upgrade_content,
|
||||
'gmail-one-click-setup'
|
||||
);
|
||||
},
|
||||
|
||||
upgradeModal: function( title, content, upgradeUrlUtmContent ) {
|
||||
|
||||
$.alert( {
|
||||
backgroundDismiss: true,
|
||||
escapeKey: true,
|
||||
animationBounce: 1,
|
||||
type: 'blue',
|
||||
closeIcon: true,
|
||||
title: title,
|
||||
icon: '"></i>' + wp_mail_smtp.education.upgrade_icon_lock + '<i class="',
|
||||
content: content,
|
||||
boxWidth: '550px',
|
||||
onOpenBefore: function() {
|
||||
this.$btnc.after( '<div class="discount-note">' + wp_mail_smtp.education.upgrade_bonus + wp_mail_smtp.education.upgrade_doc + '</div>' );
|
||||
this.$body.addClass( 'wp-mail-smtp-upgrade-mailer-education-modal' );
|
||||
},
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: wp_mail_smtp.education.upgrade_button,
|
||||
btnClass: 'btn-confirm',
|
||||
keys: [ 'enter' ],
|
||||
action: function() {
|
||||
var appendChar = /(\?)/.test( wp_mail_smtp.education.upgrade_url ) ? '&' : '?',
|
||||
upgradeURL = wp_mail_smtp.education.upgrade_url + appendChar + 'utm_content=' + encodeURIComponent( upgradeUrlUtmContent );
|
||||
|
||||
window.open( upgradeURL, '_blank' );
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Individual mailers specific js code.
|
||||
*
|
||||
* @since 1.6.0
|
||||
*/
|
||||
mailers: {
|
||||
smtp: {
|
||||
bindActions: function() {
|
||||
|
||||
// Hide SMTP-specific user/pass when Auth disabled.
|
||||
$( '#wp-mail-smtp-setting-smtp-auth' ).on( 'change', function() {
|
||||
$( '#wp-mail-smtp-setting-row-smtp-user, #wp-mail-smtp-setting-row-smtp-pass' ).toggleClass( 'inactive' );
|
||||
} );
|
||||
|
||||
// Port default values based on encryption type.
|
||||
$( '#wp-mail-smtp-setting-row-smtp-encryption input' ).on( 'change', function() {
|
||||
|
||||
var $input = $( this ),
|
||||
$smtpPort = $( '#wp-mail-smtp-setting-smtp-port', app.settingsForm );
|
||||
|
||||
if ( 'tls' === $input.val() ) {
|
||||
$smtpPort.val( '587' );
|
||||
$( '#wp-mail-smtp-setting-row-smtp-autotls' ).addClass( 'inactive' );
|
||||
} else if ( 'ssl' === $input.val() ) {
|
||||
$smtpPort.val( '465' );
|
||||
$( '#wp-mail-smtp-setting-row-smtp-autotls' ).removeClass( 'inactive' );
|
||||
} else {
|
||||
$smtpPort.val( '25' );
|
||||
$( '#wp-mail-smtp-setting-row-smtp-autotls' ).removeClass( 'inactive' );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Exit notice JS code when plugin settings are not saved.
|
||||
*
|
||||
* @since 1.9.0
|
||||
*/
|
||||
triggerExitNotice: function() {
|
||||
|
||||
var $settingPages = $( '.wp-mail-smtp-page-general' );
|
||||
|
||||
// Display an exit notice, if settings are not saved.
|
||||
$( window ).on( 'beforeunload', function() {
|
||||
if ( app.pluginSettingsChanged ) {
|
||||
return wp_mail_smtp.text_settings_not_saved;
|
||||
}
|
||||
} );
|
||||
|
||||
// Set settings changed attribute, if any input was changed.
|
||||
$( ':input:not( #wp-mail-smtp-setting-license-key, .wp-mail-smtp-not-form-input, #wp-mail-smtp-setting-gmail-one_click_setup_enabled )', $settingPages ).on( 'change', function() {
|
||||
app.pluginSettingsChanged = true;
|
||||
} );
|
||||
|
||||
// Clear the settings changed attribute, if the settings are about to be saved.
|
||||
$( 'form', $settingPages ).on( 'submit', function() {
|
||||
app.pluginSettingsChanged = false;
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Perform any checks before the settings are saved.
|
||||
*
|
||||
* Checks:
|
||||
* - warn users if they try to save the settings with the default (PHP) mailer selected.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
beforeSaveChecks: function() {
|
||||
|
||||
app.settingsForm.on( 'submit', function() {
|
||||
if ( $( '.wp-mail-smtp-mailer input:checked', app.settingsForm ).val() === 'mail' ) {
|
||||
var $thisForm = $( this );
|
||||
|
||||
$.alert( {
|
||||
backgroundDismiss: false,
|
||||
escapeKey: false,
|
||||
animationBounce: 1,
|
||||
type: 'orange',
|
||||
icon: '"></i><img src="' + wp_mail_smtp.plugin_url + '/assets/images/font-awesome/exclamation-circle-solid-orange.svg" style="width: 40px; height: 40px;" alt="' + wp_mail_smtp.default_mailer_notice.icon_alt + '"><i class="',
|
||||
title: wp_mail_smtp.default_mailer_notice.title,
|
||||
content: wp_mail_smtp.default_mailer_notice.content,
|
||||
boxWidth: '550px',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: wp_mail_smtp.default_mailer_notice.save_button,
|
||||
btnClass: 'btn-confirm',
|
||||
keys: [ 'enter' ],
|
||||
action: function() {
|
||||
$thisForm.off( 'submit' ).trigger( 'submit' );
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: wp_mail_smtp.default_mailer_notice.cancel_button,
|
||||
btnClass: 'btn-cancel',
|
||||
},
|
||||
}
|
||||
} );
|
||||
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* On change callback for showing/hiding plugin supported settings for currently selected mailer.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
processMailerSettingsOnChange: function() {
|
||||
|
||||
var mailerSupportedSettings = wp_mail_smtp.all_mailers_supports[ $( this ).val() ];
|
||||
|
||||
for ( var setting in mailerSupportedSettings ) {
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if ( mailerSupportedSettings.hasOwnProperty( setting ) ) {
|
||||
$( '.js-wp-mail-smtp-setting-' + setting, app.settingsForm ).toggle( mailerSupportedSettings[ setting ] );
|
||||
}
|
||||
}
|
||||
|
||||
// Special case: "from email" (group settings).
|
||||
var $mainSettingInGroup = $( '.js-wp-mail-smtp-setting-from_email' );
|
||||
|
||||
$mainSettingInGroup.toggle(
|
||||
mailerSupportedSettings['from_email'] || mailerSupportedSettings['from_email_force']
|
||||
);
|
||||
|
||||
// Special case: "from name" (group settings).
|
||||
$mainSettingInGroup = $( '.js-wp-mail-smtp-setting-from_name' );
|
||||
|
||||
$mainSettingInGroup.toggle(
|
||||
mailerSupportedSettings['from_name'] || mailerSupportedSettings['from_name_force']
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set jQuery-Confirm default options.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
setJQueryConfirmDefaults: function() {
|
||||
|
||||
jconfirm.defaults = {
|
||||
typeAnimated: false,
|
||||
draggable: false,
|
||||
animateFromElement: false,
|
||||
theme: 'modern',
|
||||
boxWidth: '400px',
|
||||
useBootstrap: false
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Flyout Menu (quick links).
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
initFlyoutMenu: function() {
|
||||
|
||||
// Flyout Menu Elements.
|
||||
var $flyoutMenu = $( '#wp-mail-smtp-flyout' );
|
||||
|
||||
if ( $flyoutMenu.length === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $head = $flyoutMenu.find( '.wp-mail-smtp-flyout-head' );
|
||||
|
||||
// Click on the menu head icon.
|
||||
$head.on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
$flyoutMenu.toggleClass( 'opened' );
|
||||
} );
|
||||
|
||||
// Page elements and other values.
|
||||
var $wpfooter = $( '#wpfooter' );
|
||||
|
||||
if ( $wpfooter.length === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $overlap = $(
|
||||
'.wp-mail-smtp-page-logs-archive, ' +
|
||||
'.wp-mail-smtp-tab-tools-action-scheduler, ' +
|
||||
'.wp-mail-smtp-page-reports, ' +
|
||||
'.wp-mail-smtp-tab-tools-debug-events, ' +
|
||||
'.wp-mail-smtp-tab-connections'
|
||||
);
|
||||
|
||||
// Hide menu if scrolled down to the bottom of the page or overlap some critical controls.
|
||||
$( window ).on( 'resize scroll', _.debounce( function() {
|
||||
|
||||
var wpfooterTop = $wpfooter.offset().top,
|
||||
wpfooterBottom = wpfooterTop + $wpfooter.height(),
|
||||
overlapBottom = $overlap.length > 0 ? $overlap.offset().top + $overlap.height() + 85 : 0,
|
||||
viewTop = $( window ).scrollTop(),
|
||||
viewBottom = viewTop + $( window ).height();
|
||||
|
||||
if ( wpfooterBottom <= viewBottom && wpfooterTop >= viewTop && overlapBottom > viewBottom ) {
|
||||
$flyoutMenu.addClass( 'out' );
|
||||
} else {
|
||||
$flyoutMenu.removeClass( 'out' );
|
||||
}
|
||||
}, 50 ) );
|
||||
|
||||
$( window ).trigger( 'scroll' );
|
||||
}
|
||||
};
|
||||
|
||||
// Provide access to public functions/properties.
|
||||
return app;
|
||||
}( document, window, jQuery ) );
|
||||
|
||||
// Initialize.
|
||||
WPMailSMTP.Admin.Settings.init();
|
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-admin.min.js
vendored
Normal file
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-admin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,312 @@
|
||||
/* global wp_mail_smtp_dashboard_widget, ajaxurl, moment, WPMailSMTPChart */
|
||||
/**
|
||||
* WP Mail SMTP Dashboard Widget function.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var WPMailSMTPDashboardWidget = window.WPMailSMTPDashboardWidget || ( function( document, window, $ ) {
|
||||
|
||||
/**
|
||||
* Elements reference.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var el = {
|
||||
$canvas : $( '#wp-mail-smtp-dash-widget-chart' ),
|
||||
$settingsBtn : $( '#wp-mail-smtp-dash-widget-settings-button' ),
|
||||
$dismissBtn : $( '.wp-mail-smtp-dash-widget-dismiss-chart-upgrade' ),
|
||||
$summaryReportEmailBlock : $( '.wp-mail-smtp-dash-widget-summary-report-email-block' ),
|
||||
$summaryReportEmailDismissBtn : $( '.wp-mail-smtp-dash-widget-summary-report-email-dismiss' ),
|
||||
$summaryReportEmailEnableInput: $( '#wp-mail-smtp-dash-widget-summary-report-email-enable' ),
|
||||
$emailAlertsDismissBtn : $( '#wp-mail-smtp-dash-widget-dismiss-email-alert-block' ),
|
||||
};
|
||||
|
||||
/**
|
||||
* Chart.js functions and properties.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var chart = {
|
||||
|
||||
/**
|
||||
* Chart.js instance.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
instance: null,
|
||||
|
||||
/**
|
||||
* Chart.js settings.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
settings: {
|
||||
type: 'line',
|
||||
data: {
|
||||
labels: [],
|
||||
datasets: [
|
||||
{
|
||||
label: '',
|
||||
data: [],
|
||||
backgroundColor: 'rgba(34, 113, 177, 0.15)',
|
||||
borderColor: 'rgba(34, 113, 177, 1)',
|
||||
borderWidth: 2,
|
||||
pointRadius: 4,
|
||||
pointBorderWidth: 1,
|
||||
pointBackgroundColor: 'rgba(255, 255, 255, 1)',
|
||||
}
|
||||
],
|
||||
},
|
||||
options: {
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
xAxes: [ {
|
||||
type: 'time',
|
||||
time: {
|
||||
unit: 'day',
|
||||
tooltipFormat: 'MMM D',
|
||||
},
|
||||
distribution: 'series',
|
||||
ticks: {
|
||||
beginAtZero: true,
|
||||
source: 'labels',
|
||||
padding: 10,
|
||||
minRotation: 25,
|
||||
maxRotation: 25,
|
||||
callback: function( value, index, values ) {
|
||||
|
||||
// Distribute the ticks equally starting from a right side of xAxis.
|
||||
var gap = Math.floor( values.length / 7 );
|
||||
|
||||
if ( gap < 1 ) {
|
||||
return value;
|
||||
}
|
||||
if ( ( values.length - index - 1 ) % gap === 0 ) {
|
||||
return value;
|
||||
}
|
||||
},
|
||||
},
|
||||
} ],
|
||||
yAxes: [ {
|
||||
ticks: {
|
||||
beginAtZero: true,
|
||||
maxTicksLimit: 6,
|
||||
padding: 20,
|
||||
callback: function( value ) {
|
||||
|
||||
// Make sure the tick value has no decimals.
|
||||
if ( Math.floor( value ) === value ) {
|
||||
return value;
|
||||
}
|
||||
},
|
||||
},
|
||||
} ],
|
||||
},
|
||||
elements: {
|
||||
line: {
|
||||
tension: 0,
|
||||
},
|
||||
},
|
||||
animation: {
|
||||
duration: 0,
|
||||
},
|
||||
hover: {
|
||||
animationDuration: 0,
|
||||
},
|
||||
legend: {
|
||||
display: false,
|
||||
},
|
||||
tooltips: {
|
||||
displayColors: false,
|
||||
},
|
||||
responsiveAnimationDuration: 0,
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Init Chart.js.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
init: function() {
|
||||
|
||||
var ctx;
|
||||
|
||||
if ( ! el.$canvas.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
ctx = el.$canvas[ 0 ].getContext( '2d' );
|
||||
|
||||
chart.instance = new WPMailSMTPChart( ctx, chart.settings );
|
||||
|
||||
chart.updateWithDummyData();
|
||||
|
||||
chart.instance.update();
|
||||
},
|
||||
|
||||
/**
|
||||
* Update Chart.js settings with dummy data.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
updateWithDummyData: function() {
|
||||
|
||||
var end = moment().startOf( 'day' ),
|
||||
days = 7,
|
||||
data = [ 55, 45, 34, 45, 32, 55, 65 ],
|
||||
date,
|
||||
i;
|
||||
|
||||
for ( i = 1; i <= days; i++ ) {
|
||||
|
||||
date = end.clone().subtract( i, 'days' );
|
||||
|
||||
chart.settings.data.labels.push( date );
|
||||
chart.settings.data.datasets[ 0 ].data.push( {
|
||||
t: date,
|
||||
y: data[ i - 1 ],
|
||||
} );
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Publicly accessible Chart.js functions and properties.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
chart: chart,
|
||||
|
||||
/**
|
||||
* Start the engine.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
init: function() {
|
||||
$( app.ready );
|
||||
},
|
||||
|
||||
/**
|
||||
* Document ready.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*/
|
||||
ready: function() {
|
||||
|
||||
el.$settingsBtn.on( 'click', function( e ) {
|
||||
$( this ).toggleClass( 'open' );
|
||||
$( this ).siblings( '.wp-mail-smtp-dash-widget-settings-menu' ).fadeToggle( 200 );
|
||||
} );
|
||||
|
||||
el.$dismissBtn.on( 'click', function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
app.saveWidgetMeta( 'hide_graph', 1 );
|
||||
$( this ).closest( '.wp-mail-smtp-dash-widget-chart-block-container' ).remove();
|
||||
$( '#wp-mail-smtp-dash-widget-upgrade-footer' ).show();
|
||||
} );
|
||||
|
||||
// Hide summary report email block on dismiss icon click.
|
||||
el.$summaryReportEmailDismissBtn.on( 'click', function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
app.saveWidgetMeta( 'hide_summary_report_email_block', 1 );
|
||||
el.$summaryReportEmailBlock.slideUp();
|
||||
} );
|
||||
|
||||
// Enable summary report email on checkbox enable.
|
||||
el.$summaryReportEmailEnableInput.on( 'change', function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
var $self = $( this ),
|
||||
$loader = $self.next( 'i' );
|
||||
|
||||
$self.hide();
|
||||
$loader.show();
|
||||
|
||||
var data = {
|
||||
_wpnonce: wp_mail_smtp_dashboard_widget.nonce,
|
||||
action : 'wp_mail_smtp_' + wp_mail_smtp_dashboard_widget.slug + '_enable_summary_report_email'
|
||||
};
|
||||
|
||||
$.post( ajaxurl, data )
|
||||
.done( function() {
|
||||
el.$summaryReportEmailBlock.find( '.wp-mail-smtp-dash-widget-summary-report-email-block-setting' )
|
||||
.addClass( 'hidden' );
|
||||
el.$summaryReportEmailBlock.find( '.wp-mail-smtp-dash-widget-summary-report-email-block-applied' )
|
||||
.removeClass( 'hidden' );
|
||||
} )
|
||||
.fail( function() {
|
||||
$self.show();
|
||||
$loader.hide();
|
||||
} );
|
||||
} );
|
||||
|
||||
// Hide email alerts banner on dismiss icon click.
|
||||
el.$emailAlertsDismissBtn.on( 'click', function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
$( '#wp-mail-smtp-dash-widget-email-alerts-education' ).remove();
|
||||
app.saveWidgetMeta( 'hide_email_alerts_banner', 1 );
|
||||
} );
|
||||
|
||||
chart.init();
|
||||
app.removeOverlay( el.$canvas );
|
||||
},
|
||||
|
||||
/**
|
||||
* Save dashboard widget meta in backend.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @param {string} meta Meta name to save.
|
||||
* @param {number} value Value to save.
|
||||
*/
|
||||
saveWidgetMeta: function( meta, value ) {
|
||||
|
||||
var data = {
|
||||
_wpnonce: wp_mail_smtp_dashboard_widget.nonce,
|
||||
action : 'wp_mail_smtp_' + wp_mail_smtp_dashboard_widget.slug + '_save_widget_meta',
|
||||
meta : meta,
|
||||
value : value,
|
||||
};
|
||||
|
||||
$.post( ajaxurl, data );
|
||||
},
|
||||
|
||||
/**
|
||||
* Remove an overlay from a widget block containing $el.
|
||||
*
|
||||
* @since 2.9.0
|
||||
*
|
||||
* @param {object} $el jQuery element inside a widget block.
|
||||
*/
|
||||
removeOverlay: function( $el ) {
|
||||
$el.siblings( '.wp-mail-smtp-dash-widget-overlay' ).remove();
|
||||
},
|
||||
};
|
||||
|
||||
// Provide access to public functions/properties.
|
||||
return app;
|
||||
|
||||
}( document, window, jQuery ) );
|
||||
|
||||
// Initialize.
|
||||
WPMailSMTPDashboardWidget.init();
|
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-dashboard-widget.min.js
vendored
Normal file
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-dashboard-widget.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var WPMailSMTPDashboardWidget=window.WPMailSMTPDashboardWidget||function(e){var s={$canvas:e("#wp-mail-smtp-dash-widget-chart"),$settingsBtn:e("#wp-mail-smtp-dash-widget-settings-button"),$dismissBtn:e(".wp-mail-smtp-dash-widget-dismiss-chart-upgrade"),$summaryReportEmailBlock:e(".wp-mail-smtp-dash-widget-summary-report-email-block"),$summaryReportEmailDismissBtn:e(".wp-mail-smtp-dash-widget-summary-report-email-dismiss"),$summaryReportEmailEnableInput:e("#wp-mail-smtp-dash-widget-summary-report-email-enable"),$emailAlertsDismissBtn:e("#wp-mail-smtp-dash-widget-dismiss-email-alert-block")},n={instance:null,settings:{type:"line",data:{labels:[],datasets:[{label:"",data:[],backgroundColor:"rgba(34, 113, 177, 0.15)",borderColor:"rgba(34, 113, 177, 1)",borderWidth:2,pointRadius:4,pointBorderWidth:1,pointBackgroundColor:"rgba(255, 255, 255, 1)"}]},options:{maintainAspectRatio:!1,scales:{xAxes:[{type:"time",time:{unit:"day",tooltipFormat:"MMM D"},distribution:"series",ticks:{beginAtZero:!0,source:"labels",padding:10,minRotation:25,maxRotation:25,callback:function(t,a,i){var e=Math.floor(i.length/7);return e<1||(i.length-a-1)%e==0?t:void 0}}}],yAxes:[{ticks:{beginAtZero:!0,maxTicksLimit:6,padding:20,callback:function(t){if(Math.floor(t)===t)return t}}}]},elements:{line:{tension:0}},animation:{duration:0},hover:{animationDuration:0},legend:{display:!1},tooltips:{displayColors:!1},responsiveAnimationDuration:0}},init:function(){var t;s.$canvas.length&&(t=s.$canvas[0].getContext("2d"),n.instance=new WPMailSMTPChart(t,n.settings),n.updateWithDummyData(),n.instance.update())},updateWithDummyData:function(){for(var t,a=moment().startOf("day"),i=[55,45,34,45,32,55,65],e=1;e<=7;e++)t=a.clone().subtract(e,"days"),n.settings.data.labels.push(t),n.settings.data.datasets[0].data.push({t:t,y:i[e-1]})}},a={chart:n,init:function(){e(a.ready)},ready:function(){s.$settingsBtn.on("click",function(t){e(this).toggleClass("open"),e(this).siblings(".wp-mail-smtp-dash-widget-settings-menu").fadeToggle(200)}),s.$dismissBtn.on("click",function(t){t.preventDefault(),a.saveWidgetMeta("hide_graph",1),e(this).closest(".wp-mail-smtp-dash-widget-chart-block-container").remove(),e("#wp-mail-smtp-dash-widget-upgrade-footer").show()}),s.$summaryReportEmailDismissBtn.on("click",function(t){t.preventDefault(),a.saveWidgetMeta("hide_summary_report_email_block",1),s.$summaryReportEmailBlock.slideUp()}),s.$summaryReportEmailEnableInput.on("change",function(t){t.preventDefault();var a=e(this),i=a.next("i");a.hide(),i.show();t={_wpnonce:wp_mail_smtp_dashboard_widget.nonce,action:"wp_mail_smtp_"+wp_mail_smtp_dashboard_widget.slug+"_enable_summary_report_email"};e.post(ajaxurl,t).done(function(){s.$summaryReportEmailBlock.find(".wp-mail-smtp-dash-widget-summary-report-email-block-setting").addClass("hidden"),s.$summaryReportEmailBlock.find(".wp-mail-smtp-dash-widget-summary-report-email-block-applied").removeClass("hidden")}).fail(function(){a.show(),i.hide()})}),s.$emailAlertsDismissBtn.on("click",function(t){t.preventDefault(),e("#wp-mail-smtp-dash-widget-email-alerts-education").remove(),a.saveWidgetMeta("hide_email_alerts_banner",1)}),n.init(),a.removeOverlay(s.$canvas)},saveWidgetMeta:function(t,a){a={_wpnonce:wp_mail_smtp_dashboard_widget.nonce,action:"wp_mail_smtp_"+wp_mail_smtp_dashboard_widget.slug+"_save_widget_meta",meta:t,value:a};e.post(ajaxurl,a)},removeOverlay:function(t){t.siblings(".wp-mail-smtp-dash-widget-overlay").remove()}};return a}((document,window,jQuery));WPMailSMTPDashboardWidget.init();
|
185
wp-content/plugins/wp-mail-smtp/assets/js/smtp-notifications.js
Normal file
185
wp-content/plugins/wp-mail-smtp/assets/js/smtp-notifications.js
Normal file
@@ -0,0 +1,185 @@
|
||||
/* global wp_mail_smtp, ajaxurl */
|
||||
|
||||
/**
|
||||
* WP Mail SMTP Admin Notifications.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var WPMailSMTPAdminNotifications = window.WPMailSMTPAdminNotifications || ( function( document, window, $ ) {
|
||||
|
||||
/**
|
||||
* Elements holder.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var el = {
|
||||
$notifications: $( '#wp-mail-smtp-notifications' ),
|
||||
$nextButton: $( '#wp-mail-smtp-notifications .navigation .next' ),
|
||||
$prevButton: $( '#wp-mail-smtp-notifications .navigation .prev' ),
|
||||
$adminBarCounter: $( '#wp-admin-bar-wp-mail-smtp-menu .wp-mail-smtp-admin-bar-menu-notification-counter' ),
|
||||
};
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Start the engine.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
init: function() {
|
||||
|
||||
$( app.ready );
|
||||
},
|
||||
|
||||
/**
|
||||
* Document ready.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
ready: function() {
|
||||
|
||||
app.updateNavigation();
|
||||
app.events();
|
||||
},
|
||||
|
||||
/**
|
||||
* Register JS events.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
events: function() {
|
||||
|
||||
el.$notifications
|
||||
.on( 'click', '.dismiss', app.dismiss )
|
||||
.on( 'click', '.next', app.navNext )
|
||||
.on( 'click', '.prev', app.navPrev );
|
||||
},
|
||||
|
||||
/**
|
||||
* Click on the Dismiss notification button.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @param {object} event Event object.
|
||||
*/
|
||||
dismiss: function( event ) {
|
||||
|
||||
if ( el.$currentMessage.length === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// AJAX call - update option.
|
||||
var data = {
|
||||
action: 'wp_mail_smtp_notification_dismiss',
|
||||
nonce: wp_mail_smtp.nonce,
|
||||
id: el.$currentMessage.data( 'message-id' ),
|
||||
};
|
||||
|
||||
$.post( ajaxurl, data, function( response ) {
|
||||
if ( ! response.success ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update counter.
|
||||
var count = parseInt( el.$adminBarCounter.text(), 10 );
|
||||
if ( count > 1 ) {
|
||||
--count;
|
||||
el.$adminBarCounter.html( '<span>' + count + '</span>' );
|
||||
} else {
|
||||
el.$adminBarCounter.remove();
|
||||
}
|
||||
|
||||
// Remove notification.
|
||||
var $nextMessage = el.$nextMessage.length < 1 ? el.$prevMessage : el.$nextMessage;
|
||||
|
||||
if ( $nextMessage.length === 0 ) {
|
||||
el.$notifications.remove();
|
||||
} else {
|
||||
el.$currentMessage.remove();
|
||||
$nextMessage.addClass( 'current' );
|
||||
app.updateNavigation();
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Click on the Next notification button.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @param {object} event Event object.
|
||||
*/
|
||||
navNext: function( event ) {
|
||||
|
||||
if ( el.$nextButton.hasClass( 'disabled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
el.$currentMessage.removeClass( 'current' );
|
||||
el.$nextMessage.addClass( 'current' );
|
||||
|
||||
app.updateNavigation();
|
||||
},
|
||||
|
||||
/**
|
||||
* Click on the Previous notification button.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @param {object} event Event object.
|
||||
*/
|
||||
navPrev: function( event ) {
|
||||
|
||||
if ( el.$prevButton.hasClass( 'disabled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
el.$currentMessage.removeClass( 'current' );
|
||||
el.$prevMessage.addClass( 'current' );
|
||||
|
||||
app.updateNavigation();
|
||||
},
|
||||
|
||||
/**
|
||||
* Update navigation buttons.
|
||||
*
|
||||
* @since 2.3.0
|
||||
*/
|
||||
updateNavigation: function() {
|
||||
|
||||
el.$currentMessage = el.$notifications.find( '.wp-mail-smtp-notifications-message.current' );
|
||||
el.$nextMessage = el.$currentMessage.next( '.wp-mail-smtp-notifications-message' );
|
||||
el.$prevMessage = el.$currentMessage.prev( '.wp-mail-smtp-notifications-message' );
|
||||
|
||||
if ( el.$nextMessage.length === 0 ) {
|
||||
el.$nextButton.addClass( 'disabled' );
|
||||
} else {
|
||||
el.$nextButton.removeClass( 'disabled' );
|
||||
}
|
||||
|
||||
if ( el.$prevMessage.length === 0 ) {
|
||||
el.$prevButton.addClass( 'disabled' );
|
||||
} else {
|
||||
el.$prevButton.removeClass( 'disabled' );
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return app;
|
||||
|
||||
}( document, window, jQuery ) );
|
||||
|
||||
// Initialize.
|
||||
WPMailSMTPAdminNotifications.init();
|
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-notifications.min.js
vendored
Normal file
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-notifications.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var WPMailSMTPAdminNotifications=window.WPMailSMTPAdminNotifications||function(t){var a={$notifications:t("#wp-mail-smtp-notifications"),$nextButton:t("#wp-mail-smtp-notifications .navigation .next"),$prevButton:t("#wp-mail-smtp-notifications .navigation .prev"),$adminBarCounter:t("#wp-admin-bar-wp-mail-smtp-menu .wp-mail-smtp-admin-bar-menu-notification-counter")},i={init:function(){t(i.ready)},ready:function(){i.updateNavigation(),i.events()},events:function(){a.$notifications.on("click",".dismiss",i.dismiss).on("click",".next",i.navNext).on("click",".prev",i.navPrev)},dismiss:function(e){var n;0!==a.$currentMessage.length&&(n={action:"wp_mail_smtp_notification_dismiss",nonce:wp_mail_smtp.nonce,id:a.$currentMessage.data("message-id")},t.post(ajaxurl,n,function(e){e.success&&(1<(e=parseInt(a.$adminBarCounter.text(),10))?a.$adminBarCounter.html("<span>"+--e+"</span>"):a.$adminBarCounter.remove(),0===(e=a.$nextMessage.length<1?a.$prevMessage:a.$nextMessage).length?a.$notifications.remove():(a.$currentMessage.remove(),e.addClass("current"),i.updateNavigation()))}))},navNext:function(e){a.$nextButton.hasClass("disabled")||(a.$currentMessage.removeClass("current"),a.$nextMessage.addClass("current"),i.updateNavigation())},navPrev:function(e){a.$prevButton.hasClass("disabled")||(a.$currentMessage.removeClass("current"),a.$prevMessage.addClass("current"),i.updateNavigation())},updateNavigation:function(){a.$currentMessage=a.$notifications.find(".wp-mail-smtp-notifications-message.current"),a.$nextMessage=a.$currentMessage.next(".wp-mail-smtp-notifications-message"),a.$prevMessage=a.$currentMessage.prev(".wp-mail-smtp-notifications-message"),0===a.$nextMessage.length?a.$nextButton.addClass("disabled"):a.$nextButton.removeClass("disabled"),0===a.$prevMessage.length?a.$prevButton.addClass("disabled"):a.$prevButton.removeClass("disabled")}};return i}((document,window,jQuery));WPMailSMTPAdminNotifications.init();
|
@@ -0,0 +1,358 @@
|
||||
/* global wp_mail_smtp_tools_debug_events, ajaxurl, flatpickr */
|
||||
/**
|
||||
* WPMailSMTP Debug Events functionality.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var WPMailSmtpDebugEvents = window.WPMailSmtpDebugEvents || ( function( document, window, $ ) {
|
||||
|
||||
/**
|
||||
* Elements.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var el = {
|
||||
$debugEventsPage: $( '.wp-mail-smtp-tab-tools-debug-events' ),
|
||||
$dateFlatpickr: $( '.wp-mail-smtp-filter-date-selector' ),
|
||||
};
|
||||
|
||||
/**
|
||||
* Public functions and properties.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
var app = {
|
||||
|
||||
/**
|
||||
* Start the engine.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
init: function() {
|
||||
|
||||
$( app.ready );
|
||||
},
|
||||
|
||||
/**
|
||||
* Document ready.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
ready: function() {
|
||||
|
||||
app.initDateRange();
|
||||
app.events();
|
||||
|
||||
// Open debug event popup from the query string.
|
||||
var searchParams = new URLSearchParams( location.search );
|
||||
|
||||
if ( searchParams.has( 'debug_event_id' ) ) {
|
||||
app.openDebugEventPopup( searchParams.get( 'debug_event_id' ) );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Register JS events.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
events: function() {
|
||||
|
||||
el.$debugEventsPage.on( 'click', '#wp-mail-smtp-reset-filter .reset', app.resetFilter );
|
||||
el.$debugEventsPage.on( 'click', '#wp-mail-smtp-delete-all-debug-events-button', app.deleteAllDebugEvents );
|
||||
el.$debugEventsPage.on( 'click', '.js-wp-mail-smtp-debug-event-preview', app.eventClicked );
|
||||
},
|
||||
|
||||
/**
|
||||
* Init Flatpickr at Date Range field.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
initDateRange: function() {
|
||||
|
||||
var langCode = wp_mail_smtp_tools_debug_events.lang_code,
|
||||
flatpickrLocale = {
|
||||
rangeSeparator: ' - ',
|
||||
};
|
||||
|
||||
if (
|
||||
flatpickr !== 'undefined' &&
|
||||
Object.prototype.hasOwnProperty.call( flatpickr, 'l10ns' ) &&
|
||||
Object.prototype.hasOwnProperty.call( flatpickr.l10ns, langCode )
|
||||
) {
|
||||
flatpickrLocale = flatpickr.l10ns[ langCode ];
|
||||
flatpickrLocale.rangeSeparator = ' - ';
|
||||
}
|
||||
|
||||
el.$dateFlatpickr.flatpickr( {
|
||||
altInput : true,
|
||||
altFormat : 'M j, Y',
|
||||
dateFormat: 'Y-m-d',
|
||||
locale : flatpickrLocale,
|
||||
mode : 'range'
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Reset filter handler.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
resetFilter: function() {
|
||||
|
||||
var $form = $( this ).parents( 'form' );
|
||||
|
||||
$form.find( $( this ).data( 'scope' ) ).find( 'input,select' ).each( function() {
|
||||
|
||||
var $this = $( this );
|
||||
if ( app.isIgnoredForResetInput( $this ) ) {
|
||||
return;
|
||||
}
|
||||
app.resetInput( $this );
|
||||
} );
|
||||
|
||||
// Submit the form.
|
||||
$form.submit();
|
||||
},
|
||||
|
||||
/**
|
||||
* Reset input.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} $input Input element.
|
||||
*/
|
||||
resetInput: function( $input ) {
|
||||
|
||||
switch ( $input.prop( 'tagName' ).toLowerCase() ) {
|
||||
case 'input':
|
||||
$input.val( '' );
|
||||
break;
|
||||
case 'select':
|
||||
$input.val( $input.find( 'option' ).first().val() );
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Input is ignored for reset.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} $input Input element.
|
||||
*
|
||||
* @returns {boolean} Is ignored.
|
||||
*/
|
||||
isIgnoredForResetInput: function( $input ) {
|
||||
|
||||
return [ 'submit', 'hidden' ].indexOf( ( $input.attr( 'type' ) || '' ).toLowerCase() ) !== -1 &&
|
||||
! $input.hasClass( 'flatpickr-input' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Process the click on the delete all debug events button.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} event jQuery event.
|
||||
*/
|
||||
deleteAllDebugEvents: function( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var $btn = $( event.target );
|
||||
|
||||
$.confirm( {
|
||||
backgroundDismiss: false,
|
||||
escapeKey: true,
|
||||
animationBounce: 1,
|
||||
closeIcon: true,
|
||||
type: 'orange',
|
||||
icon: app.getModalIcon( 'exclamation-circle-solid-orange' ),
|
||||
title: wp_mail_smtp_tools_debug_events.texts.notice_title,
|
||||
content: wp_mail_smtp_tools_debug_events.texts.delete_all_notice,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: wp_mail_smtp_tools_debug_events.texts.yes,
|
||||
btnClass: 'btn-confirm',
|
||||
keys: [ 'enter' ],
|
||||
action: function() {
|
||||
app.executeAllDebugEventsDeletion( $btn );
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: wp_mail_smtp_tools_debug_events.texts.cancel,
|
||||
btnClass: 'btn-cancel',
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Process the click on the event item.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} event jQuery event.
|
||||
*/
|
||||
eventClicked: function( event ) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
app.openDebugEventPopup( $( this ).data( 'event-id' ) );
|
||||
},
|
||||
|
||||
/**
|
||||
* Open debug event popup.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @param {int} eventId Debug event ID.
|
||||
*/
|
||||
openDebugEventPopup: function( eventId ) {
|
||||
|
||||
var data = {
|
||||
action: 'wp_mail_smtp_debug_event_preview',
|
||||
id: eventId,
|
||||
nonce: $( '#wp-mail-smtp-debug-events-nonce', el.$debugEventsPage ).val()
|
||||
};
|
||||
|
||||
var popup = $.alert( {
|
||||
backgroundDismiss: true,
|
||||
escapeKey: true,
|
||||
animationBounce: 1,
|
||||
type: 'blue',
|
||||
icon: app.getModalIcon( 'info-circle-blue' ),
|
||||
title: false,
|
||||
content: wp_mail_smtp_tools_debug_events.loader,
|
||||
boxWidth: '550px',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: wp_mail_smtp_tools_debug_events.texts.close,
|
||||
btnClass: 'btn-confirm',
|
||||
keys: [ 'enter' ]
|
||||
}
|
||||
},
|
||||
onOpenBefore: function() {
|
||||
this.$contentPane.addClass( 'no-scroll' );
|
||||
}
|
||||
} );
|
||||
|
||||
$.post( ajaxurl, data, function( response ) {
|
||||
if ( response.success ) {
|
||||
popup.setTitle( response.data.title );
|
||||
popup.setContent( response.data.content );
|
||||
} else {
|
||||
popup.setContent( response.data );
|
||||
}
|
||||
} ).fail( function() {
|
||||
popup.setContent( wp_mail_smtp_tools_debug_events.texts.error_occurred );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* AJAX call for deleting all debug events.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} $btn jQuery object of the clicked button.
|
||||
*/
|
||||
executeAllDebugEventsDeletion: function( $btn ) {
|
||||
|
||||
$btn.prop( 'disabled', true );
|
||||
|
||||
var data = {
|
||||
action: 'wp_mail_smtp_delete_all_debug_events',
|
||||
nonce: $( '#wp-mail-smtp-debug-events-nonce', el.$debugEventsPage ).val()
|
||||
};
|
||||
|
||||
$.post( ajaxurl, data, function( response ) {
|
||||
var message = response.data,
|
||||
icon,
|
||||
type,
|
||||
callback;
|
||||
|
||||
if ( response.success ) {
|
||||
icon = 'check-circle-solid-green';
|
||||
type = 'green';
|
||||
callback = function() {
|
||||
location.reload();
|
||||
return false;
|
||||
};
|
||||
} else {
|
||||
icon = 'exclamation-circle-regular-red';
|
||||
type = 'red';
|
||||
}
|
||||
|
||||
app.displayModal( message, icon, type, callback );
|
||||
$btn.prop( 'disabled', false );
|
||||
} ).fail( function() {
|
||||
app.displayModal( wp_mail_smtp_tools_debug_events.texts.error_occurred, 'exclamation-circle-regular-red', 'red' );
|
||||
$btn.prop( 'disabled', false );
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Display the modal with provided text and icon.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} message The message to be displayed in the modal.
|
||||
* @param {string} icon The icon name from /assets/images/font-awesome/ to be used in modal.
|
||||
* @param {string} type The type of the message (red, green, orange, blue, purple, dark).
|
||||
* @param {Function} actionCallback The action callback function.
|
||||
*/
|
||||
displayModal: function( message, icon, type, actionCallback ) {
|
||||
|
||||
type = type || 'default';
|
||||
actionCallback = actionCallback || function() {};
|
||||
|
||||
$.alert( {
|
||||
backgroundDismiss: true,
|
||||
escapeKey: true,
|
||||
animationBounce: 1,
|
||||
type: type,
|
||||
closeIcon: true,
|
||||
title: false,
|
||||
icon: icon ? app.getModalIcon( icon ) : '',
|
||||
content: message,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: wp_mail_smtp_tools_debug_events.texts.ok,
|
||||
btnClass: 'wp-mail-smtp-btn wp-mail-smtp-btn-md',
|
||||
keys: [ 'enter' ],
|
||||
action: actionCallback
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns prepared modal icon.
|
||||
*
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {string} icon The icon name from /assets/images/font-awesome/ to be used in modal.
|
||||
*
|
||||
* @returns {string} Modal icon HTML.
|
||||
*/
|
||||
getModalIcon: function( icon ) {
|
||||
|
||||
return '"></i><img src="' + wp_mail_smtp_tools_debug_events.plugin_url + '/assets/images/font-awesome/' + icon + '.svg" style="width: 40px; height: 40px;" alt=""><i class="';
|
||||
},
|
||||
};
|
||||
|
||||
// Provide access to public functions/properties.
|
||||
return app;
|
||||
|
||||
}( document, window, jQuery ) );
|
||||
|
||||
// Initialize.
|
||||
WPMailSmtpDebugEvents.init();
|
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-tools-debug-events.min.js
vendored
Normal file
1
wp-content/plugins/wp-mail-smtp/assets/js/smtp-tools-debug-events.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";var WPMailSmtpDebugEvents=window.WPMailSmtpDebugEvents||function(s){var n={$debugEventsPage:s(".wp-mail-smtp-tab-tools-debug-events"),$dateFlatpickr:s(".wp-mail-smtp-filter-date-selector")},i={init:function(){s(i.ready)},ready:function(){i.initDateRange(),i.events();var e=new URLSearchParams(location.search);e.has("debug_event_id")&&i.openDebugEventPopup(e.get("debug_event_id"))},events:function(){n.$debugEventsPage.on("click","#wp-mail-smtp-reset-filter .reset",i.resetFilter),n.$debugEventsPage.on("click","#wp-mail-smtp-delete-all-debug-events-button",i.deleteAllDebugEvents),n.$debugEventsPage.on("click",".js-wp-mail-smtp-debug-event-preview",i.eventClicked)},initDateRange:function(){var e=wp_mail_smtp_tools_debug_events.lang_code,t={rangeSeparator:" - "};"undefined"!==flatpickr&&Object.prototype.hasOwnProperty.call(flatpickr,"l10ns")&&Object.prototype.hasOwnProperty.call(flatpickr.l10ns,e)&&((t=flatpickr.l10ns[e]).rangeSeparator=" - "),n.$dateFlatpickr.flatpickr({altInput:!0,altFormat:"M j, Y",dateFormat:"Y-m-d",locale:t,mode:"range"})},resetFilter:function(){var e=s(this).parents("form");e.find(s(this).data("scope")).find("input,select").each(function(){var e=s(this);i.isIgnoredForResetInput(e)||i.resetInput(e)}),e.submit()},resetInput:function(e){switch(e.prop("tagName").toLowerCase()){case"input":e.val("");break;case"select":e.val(e.find("option").first().val())}},isIgnoredForResetInput:function(e){return-1!==["submit","hidden"].indexOf((e.attr("type")||"").toLowerCase())&&!e.hasClass("flatpickr-input")},deleteAllDebugEvents:function(e){e.preventDefault();var t=s(e.target);s.confirm({backgroundDismiss:!1,escapeKey:!0,animationBounce:1,closeIcon:!0,type:"orange",icon:i.getModalIcon("exclamation-circle-solid-orange"),title:wp_mail_smtp_tools_debug_events.texts.notice_title,content:wp_mail_smtp_tools_debug_events.texts.delete_all_notice,buttons:{confirm:{text:wp_mail_smtp_tools_debug_events.texts.yes,btnClass:"btn-confirm",keys:["enter"],action:function(){i.executeAllDebugEventsDeletion(t)}},cancel:{text:wp_mail_smtp_tools_debug_events.texts.cancel,btnClass:"btn-cancel"}}})},eventClicked:function(e){e.preventDefault(),i.openDebugEventPopup(s(this).data("event-id"))},openDebugEventPopup:function(e){var e={action:"wp_mail_smtp_debug_event_preview",id:e,nonce:s("#wp-mail-smtp-debug-events-nonce",n.$debugEventsPage).val()},t=s.alert({backgroundDismiss:!0,escapeKey:!0,animationBounce:1,type:"blue",icon:i.getModalIcon("info-circle-blue"),title:!1,content:wp_mail_smtp_tools_debug_events.loader,boxWidth:"550px",buttons:{confirm:{text:wp_mail_smtp_tools_debug_events.texts.close,btnClass:"btn-confirm",keys:["enter"]}},onOpenBefore:function(){this.$contentPane.addClass("no-scroll")}});s.post(ajaxurl,e,function(e){e.success?(t.setTitle(e.data.title),t.setContent(e.data.content)):t.setContent(e.data)}).fail(function(){t.setContent(wp_mail_smtp_tools_debug_events.texts.error_occurred)})},executeAllDebugEventsDeletion:function(o){o.prop("disabled",!0);var e={action:"wp_mail_smtp_delete_all_debug_events",nonce:s("#wp-mail-smtp-debug-events-nonce",n.$debugEventsPage).val()};s.post(ajaxurl,e,function(e){var t,n,a,s=e.data;e.success?(t="check-circle-solid-green",n="green",a=function(){return location.reload(),!1}):(t="exclamation-circle-regular-red",n="red"),i.displayModal(s,t,n,a),o.prop("disabled",!1)}).fail(function(){i.displayModal(wp_mail_smtp_tools_debug_events.texts.error_occurred,"exclamation-circle-regular-red","red"),o.prop("disabled",!1)})},displayModal:function(e,t,n,a){a=a||function(){},s.alert({backgroundDismiss:!0,escapeKey:!0,animationBounce:1,type:n=n||"default",closeIcon:!0,title:!1,icon:t?i.getModalIcon(t):"",content:e,buttons:{confirm:{text:wp_mail_smtp_tools_debug_events.texts.ok,btnClass:"wp-mail-smtp-btn wp-mail-smtp-btn-md",keys:["enter"],action:a}}})},getModalIcon:function(e){return'"></i><img src="'+wp_mail_smtp_tools_debug_events.plugin_url+"/assets/images/font-awesome/"+e+'.svg" style="width: 40px; height: 40px;" alt=""><i class="'}};return i}((document,window,jQuery));WPMailSmtpDebugEvents.init();
|
10
wp-content/plugins/wp-mail-smtp/assets/js/vendor/chart.min.js
vendored
Normal file
10
wp-content/plugins/wp-mail-smtp/assets/js/vendor/chart.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
wp-content/plugins/wp-mail-smtp/assets/js/vendor/flatpickr.min.js
vendored
Normal file
2
wp-content/plugins/wp-mail-smtp/assets/js/vendor/flatpickr.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
wp-content/plugins/wp-mail-smtp/assets/js/vendor/jquery-confirm.min.js
vendored
Normal file
10
wp-content/plugins/wp-mail-smtp/assets/js/vendor/jquery-confirm.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
388
wp-content/plugins/wp-mail-smtp/assets/js/vendor/jquery.matchHeight.js
vendored
Normal file
388
wp-content/plugins/wp-mail-smtp/assets/js/vendor/jquery.matchHeight.js
vendored
Normal file
@@ -0,0 +1,388 @@
|
||||
/**
|
||||
* jquery-match-height 0.7.2 by @liabru
|
||||
* http://brm.io/jquery-match-height/
|
||||
* License: MIT
|
||||
*/
|
||||
|
||||
;(function(factory) { // eslint-disable-line no-extra-semi
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof module !== 'undefined' && module.exports) {
|
||||
// CommonJS
|
||||
module.exports = factory(require('jquery'));
|
||||
} else {
|
||||
// Global
|
||||
factory(jQuery);
|
||||
}
|
||||
})(function($) {
|
||||
/*
|
||||
* internal
|
||||
*/
|
||||
|
||||
var _previousResizeWidth = -1,
|
||||
_updateTimeout = -1;
|
||||
|
||||
/*
|
||||
* _parse
|
||||
* value parse utility function
|
||||
*/
|
||||
|
||||
var _parse = function(value) {
|
||||
// parse value and convert NaN to 0
|
||||
return parseFloat(value) || 0;
|
||||
};
|
||||
|
||||
/*
|
||||
* _rows
|
||||
* utility function returns array of jQuery selections representing each row
|
||||
* (as displayed after float wrapping applied by browser)
|
||||
*/
|
||||
|
||||
var _rows = function(elements) {
|
||||
var tolerance = 1,
|
||||
$elements = $(elements),
|
||||
lastTop = null,
|
||||
rows = [];
|
||||
|
||||
// group elements by their top position
|
||||
$elements.each(function(){
|
||||
var $that = $(this),
|
||||
top = $that.offset().top - _parse($that.css('margin-top')),
|
||||
lastRow = rows.length > 0 ? rows[rows.length - 1] : null;
|
||||
|
||||
if (lastRow === null) {
|
||||
// first item on the row, so just push it
|
||||
rows.push($that);
|
||||
} else {
|
||||
// if the row top is the same, add to the row group
|
||||
if (Math.floor(Math.abs(lastTop - top)) <= tolerance) {
|
||||
rows[rows.length - 1] = lastRow.add($that);
|
||||
} else {
|
||||
// otherwise start a new row group
|
||||
rows.push($that);
|
||||
}
|
||||
}
|
||||
|
||||
// keep track of the last row top
|
||||
lastTop = top;
|
||||
});
|
||||
|
||||
return rows;
|
||||
};
|
||||
|
||||
/*
|
||||
* _parseOptions
|
||||
* handle plugin options
|
||||
*/
|
||||
|
||||
var _parseOptions = function(options) {
|
||||
var opts = {
|
||||
byRow: true,
|
||||
property: 'height',
|
||||
target: null,
|
||||
remove: false
|
||||
};
|
||||
|
||||
if (typeof options === 'object') {
|
||||
return $.extend(opts, options);
|
||||
}
|
||||
|
||||
if (typeof options === 'boolean') {
|
||||
opts.byRow = options;
|
||||
} else if (options === 'remove') {
|
||||
opts.remove = true;
|
||||
}
|
||||
|
||||
return opts;
|
||||
};
|
||||
|
||||
/*
|
||||
* matchHeight
|
||||
* plugin definition
|
||||
*/
|
||||
|
||||
var matchHeight = $.fn.matchHeight = function(options) {
|
||||
var opts = _parseOptions(options);
|
||||
|
||||
// handle remove
|
||||
if (opts.remove) {
|
||||
var that = this;
|
||||
|
||||
// remove fixed height from all selected elements
|
||||
this.css(opts.property, '');
|
||||
|
||||
// remove selected elements from all groups
|
||||
$.each(matchHeight._groups, function(key, group) {
|
||||
group.elements = group.elements.not(that);
|
||||
});
|
||||
|
||||
// TODO: cleanup empty groups
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.length <= 1 && !opts.target) {
|
||||
return this;
|
||||
}
|
||||
|
||||
// keep track of this group so we can re-apply later on load and resize events
|
||||
matchHeight._groups.push({
|
||||
elements: this,
|
||||
options: opts
|
||||
});
|
||||
|
||||
// match each element's height to the tallest element in the selection
|
||||
matchHeight._apply(this, opts);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/*
|
||||
* plugin global options
|
||||
*/
|
||||
|
||||
matchHeight.version = '0.7.2';
|
||||
matchHeight._groups = [];
|
||||
matchHeight._throttle = 80;
|
||||
matchHeight._maintainScroll = false;
|
||||
matchHeight._beforeUpdate = null;
|
||||
matchHeight._afterUpdate = null;
|
||||
matchHeight._rows = _rows;
|
||||
matchHeight._parse = _parse;
|
||||
matchHeight._parseOptions = _parseOptions;
|
||||
|
||||
/*
|
||||
* matchHeight._apply
|
||||
* apply matchHeight to given elements
|
||||
*/
|
||||
|
||||
matchHeight._apply = function(elements, options) {
|
||||
var opts = _parseOptions(options),
|
||||
$elements = $(elements),
|
||||
rows = [$elements];
|
||||
|
||||
// take note of scroll position
|
||||
var scrollTop = $(window).scrollTop(),
|
||||
htmlHeight = $('html').outerHeight(true);
|
||||
|
||||
// get hidden parents
|
||||
var $hiddenParents = $elements.parents().filter(':hidden');
|
||||
|
||||
// cache the original inline style
|
||||
$hiddenParents.each(function() {
|
||||
var $that = $(this);
|
||||
$that.data('style-cache', $that.attr('style'));
|
||||
});
|
||||
|
||||
// temporarily must force hidden parents visible
|
||||
$hiddenParents.css('display', 'block');
|
||||
|
||||
// get rows if using byRow, otherwise assume one row
|
||||
if (opts.byRow && !opts.target) {
|
||||
|
||||
// must first force an arbitrary equal height so floating elements break evenly
|
||||
$elements.each(function() {
|
||||
var $that = $(this),
|
||||
display = $that.css('display');
|
||||
|
||||
// temporarily force a usable display value
|
||||
if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
|
||||
display = 'block';
|
||||
}
|
||||
|
||||
// cache the original inline style
|
||||
$that.data('style-cache', $that.attr('style'));
|
||||
|
||||
$that.css({
|
||||
'display': display,
|
||||
'padding-top': '0',
|
||||
'padding-bottom': '0',
|
||||
'margin-top': '0',
|
||||
'margin-bottom': '0',
|
||||
'border-top-width': '0',
|
||||
'border-bottom-width': '0',
|
||||
'height': '100px',
|
||||
'overflow': 'hidden'
|
||||
});
|
||||
});
|
||||
|
||||
// get the array of rows (based on element top position)
|
||||
rows = _rows($elements);
|
||||
|
||||
// revert original inline styles
|
||||
$elements.each(function() {
|
||||
var $that = $(this);
|
||||
$that.attr('style', $that.data('style-cache') || '');
|
||||
});
|
||||
}
|
||||
|
||||
$.each(rows, function(key, row) {
|
||||
var $row = $(row),
|
||||
targetHeight = 0;
|
||||
|
||||
if (!opts.target) {
|
||||
// skip apply to rows with only one item
|
||||
if (opts.byRow && $row.length <= 1) {
|
||||
$row.css(opts.property, '');
|
||||
return;
|
||||
}
|
||||
|
||||
// iterate the row and find the max height
|
||||
$row.each(function(){
|
||||
var $that = $(this),
|
||||
style = $that.attr('style'),
|
||||
display = $that.css('display');
|
||||
|
||||
// temporarily force a usable display value
|
||||
if (display !== 'inline-block' && display !== 'flex' && display !== 'inline-flex') {
|
||||
display = 'block';
|
||||
}
|
||||
|
||||
// ensure we get the correct actual height (and not a previously set height value)
|
||||
var css = { 'display': display };
|
||||
css[opts.property] = '';
|
||||
$that.css(css);
|
||||
|
||||
// find the max height (including padding, but not margin)
|
||||
if ($that.outerHeight(false) > targetHeight) {
|
||||
targetHeight = $that.outerHeight(false);
|
||||
}
|
||||
|
||||
// revert styles
|
||||
if (style) {
|
||||
$that.attr('style', style);
|
||||
} else {
|
||||
$that.css('display', '');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// if target set, use the height of the target element
|
||||
targetHeight = opts.target.outerHeight(false);
|
||||
}
|
||||
|
||||
// iterate the row and apply the height to all elements
|
||||
$row.each(function(){
|
||||
var $that = $(this),
|
||||
verticalPadding = 0;
|
||||
|
||||
// don't apply to a target
|
||||
if (opts.target && $that.is(opts.target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// handle padding and border correctly (required when not using border-box)
|
||||
if ($that.css('box-sizing') !== 'border-box') {
|
||||
verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width'));
|
||||
verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom'));
|
||||
}
|
||||
|
||||
// set the height (accounting for padding and border)
|
||||
$that.css(opts.property, (targetHeight - verticalPadding) + 'px');
|
||||
});
|
||||
});
|
||||
|
||||
// revert hidden parents
|
||||
$hiddenParents.each(function() {
|
||||
var $that = $(this);
|
||||
$that.attr('style', $that.data('style-cache') || null);
|
||||
});
|
||||
|
||||
// restore scroll position if enabled
|
||||
if (matchHeight._maintainScroll) {
|
||||
$(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/*
|
||||
* matchHeight._applyDataApi
|
||||
* applies matchHeight to all elements with a data-match-height attribute
|
||||
*/
|
||||
|
||||
matchHeight._applyDataApi = function() {
|
||||
var groups = {};
|
||||
|
||||
// generate groups by their groupId set by elements using data-match-height
|
||||
$('[data-match-height], [data-mh]').each(function() {
|
||||
var $this = $(this),
|
||||
groupId = $this.attr('data-mh') || $this.attr('data-match-height');
|
||||
|
||||
if (groupId in groups) {
|
||||
groups[groupId] = groups[groupId].add($this);
|
||||
} else {
|
||||
groups[groupId] = $this;
|
||||
}
|
||||
});
|
||||
|
||||
// apply matchHeight to each group
|
||||
$.each(groups, function() {
|
||||
this.matchHeight(true);
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
* matchHeight._update
|
||||
* updates matchHeight on all current groups with their correct options
|
||||
*/
|
||||
|
||||
var _update = function(event) {
|
||||
if (matchHeight._beforeUpdate) {
|
||||
matchHeight._beforeUpdate(event, matchHeight._groups);
|
||||
}
|
||||
|
||||
$.each(matchHeight._groups, function() {
|
||||
matchHeight._apply(this.elements, this.options);
|
||||
});
|
||||
|
||||
if (matchHeight._afterUpdate) {
|
||||
matchHeight._afterUpdate(event, matchHeight._groups);
|
||||
}
|
||||
};
|
||||
|
||||
matchHeight._update = function(throttle, event) {
|
||||
// prevent update if fired from a resize event
|
||||
// where the viewport width hasn't actually changed
|
||||
// fixes an event looping bug in IE8
|
||||
if (event && event.type === 'resize') {
|
||||
var windowWidth = $(window).width();
|
||||
if (windowWidth === _previousResizeWidth) {
|
||||
return;
|
||||
}
|
||||
_previousResizeWidth = windowWidth;
|
||||
}
|
||||
|
||||
// throttle updates
|
||||
if (!throttle) {
|
||||
_update(event);
|
||||
} else if (_updateTimeout === -1) {
|
||||
_updateTimeout = setTimeout(function() {
|
||||
_update(event);
|
||||
_updateTimeout = -1;
|
||||
}, matchHeight._throttle);
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* bind events
|
||||
*/
|
||||
|
||||
// apply on DOM ready event
|
||||
$(matchHeight._applyDataApi);
|
||||
|
||||
// use on or bind where supported
|
||||
var on = $.fn.on ? 'on' : 'bind';
|
||||
|
||||
// update heights on load and resize events
|
||||
$(window)[on]('load', function(event) {
|
||||
matchHeight._update(false, event);
|
||||
});
|
||||
|
||||
// throttled update heights on resize events
|
||||
$(window)[on]('resize orientationchange', function(event) {
|
||||
matchHeight._update(true, event);
|
||||
});
|
||||
|
||||
});
|
1
wp-content/plugins/wp-mail-smtp/assets/js/vendor/jquery.matchHeight.min.js
vendored
Normal file
1
wp-content/plugins/wp-mail-smtp/assets/js/vendor/jquery.matchHeight.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"undefined"!=typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(l){function c(t){return parseFloat(t)||0}function h(t){var e=l(t),n=null,a=[];return e.each(function(){var t=l(this),e=t.offset().top-c(t.css("margin-top")),o=0<a.length?a[a.length-1]:null;null!==o&&Math.floor(Math.abs(n-e))<=1?a[a.length-1]=o.add(t):a.push(t),n=e}),a}function p(t){var e={byRow:!0,property:"height",target:null,remove:!1};return"object"==typeof t?l.extend(e,t):("boolean"==typeof t?e.byRow=t:"remove"===t&&(e.remove=!0),e)}var n=-1,a=-1,d=l.fn.matchHeight=function(t){var e=p(t);if(e.remove){var o=this;return this.css(e.property,""),l.each(d._groups,function(t,e){e.elements=e.elements.not(o)}),this}return this.length<=1&&!e.target||(d._groups.push({elements:this,options:e}),d._apply(this,e)),this};d.version="0.7.2",d._groups=[],d._throttle=80,d._maintainScroll=!1,d._beforeUpdate=null,d._afterUpdate=null,d._rows=h,d._parse=c,d._parseOptions=p,d._apply=function(t,e){var i=p(e),o=l(t),n=[o],a=l(window).scrollTop(),r=l("html").outerHeight(!0),s=o.parents().filter(":hidden");return s.each(function(){var t=l(this);t.data("style-cache",t.attr("style"))}),s.css("display","block"),i.byRow&&!i.target&&(o.each(function(){var t=l(this),e=t.css("display");"inline-block"!==e&&"flex"!==e&&"inline-flex"!==e&&(e="block"),t.data("style-cache",t.attr("style")),t.css({display:e,"padding-top":"0","padding-bottom":"0","margin-top":"0","margin-bottom":"0","border-top-width":"0","border-bottom-width":"0",height:"100px",overflow:"hidden"})}),n=h(o),o.each(function(){var t=l(this);t.attr("style",t.data("style-cache")||"")})),l.each(n,function(t,e){var o=l(e),a=0;if(i.target)a=i.target.outerHeight(!1);else{if(i.byRow&&o.length<=1)return void o.css(i.property,"");o.each(function(){var t=l(this),e=t.attr("style"),o=t.css("display");"inline-block"!==o&&"flex"!==o&&"inline-flex"!==o&&(o="block");var n={display:o};n[i.property]="",t.css(n),t.outerHeight(!1)>a&&(a=t.outerHeight(!1)),e?t.attr("style",e):t.css("display","")})}o.each(function(){var t=l(this),e=0;i.target&&t.is(i.target)||("border-box"!==t.css("box-sizing")&&(e+=c(t.css("border-top-width"))+c(t.css("border-bottom-width")),e+=c(t.css("padding-top"))+c(t.css("padding-bottom"))),t.css(i.property,a-e+"px"))})}),s.each(function(){var t=l(this);t.attr("style",t.data("style-cache")||null)}),d._maintainScroll&&l(window).scrollTop(a/r*l("html").outerHeight(!0)),this},d._applyDataApi=function(){var o={};l("[data-match-height], [data-mh]").each(function(){var t=l(this),e=t.attr("data-mh")||t.attr("data-match-height");o[e]=e in o?o[e].add(t):t}),l.each(o,function(){this.matchHeight(!0)})};function i(t){d._beforeUpdate&&d._beforeUpdate(t,d._groups),l.each(d._groups,function(){d._apply(this.elements,this.options)}),d._afterUpdate&&d._afterUpdate(t,d._groups)}d._update=function(t,e){if(e&&"resize"===e.type){var o=l(window).width();if(o===n)return;n=o}t?-1===a&&(a=setTimeout(function(){i(e),a=-1},d._throttle)):i(e)},l(d._applyDataApi);var t=l.fn.on?"on":"bind";l(window)[t]("load",function(t){d._update(!1,t)}),l(window)[t]("resize orientationchange",function(t){d._update(!0,t)})});
|
5
wp-content/plugins/wp-mail-smtp/assets/js/vendor/lity.min.js
vendored
Normal file
5
wp-content/plugins/wp-mail-smtp/assets/js/vendor/lity.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user