芝麻web文件管理V1.00
编辑当前文件:/www/wwwroot/fashionmodelquicktrack.com/wp-content/themes/flatsome/inc/admin/panel/panel.js
jQuery(function ($) { var errorMessage = window.flatsomePanelOptions.errorMessage $('.flatsome-registration-form').each(function (i, el) { var $code = $('.flatsome-registration-form__code', el) var $selector = $('.flatsome-token-migrator__select', el) var $errors = $('.flatsome-token-migrator__errors', el) var $spinner = $('.spinner') var isFetched = false $selector.on('click', function () { if (isFetched) return $spinner.addClass('is-active') $.getJSON(window.ajaxurl, { action: 'flatsome_purchase_codes' }) .then(function (res) { if (Array.isArray(res.available)) { $errors.empty() $selector.append( res.available.map(function (data) { var purchasedAt = wp.date.date('F j, Y', data.purchasedAt) return $('
' + data.code + ' (' + purchasedAt + ')
') }) ) $selector.append($('
Enter another purchase code
')) } else { $errors.html( '
' + (res.message || errorMessage) + '
' ) } isFetched = Array.isArray(res.available) $spinner.removeClass('is-active') }) .catch(function (err) { console.error(err) $errors.html( '
' + (err.message || errorMessage) + '
' ) isFetched = false $spinner.removeClass('is-active') }) }) $selector.on('change', function (event) { if (event.target.value) { $code.slideUp(250) } else { $code.slideDown(250, function () { $code.find('input').trigger('focus') }) } }) }) })