first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,502 @@
var otgs_wp_installer = {
sanitize: function (s) {
if (typeof s === 'string' || s instanceof String) {
return s.replace(/<script[^>]*?>.*?<\/script>/gi, '').replace(/<[\/\!]*?[^<>]*?>/gi, '').replace(/<style[^>]*?>.*?<\/style>/gi, '').replace(/<![\s\S]*?--[ \t\n\r]*>/gi, '').replace(/&nbsp;/g, '');
}
return s;
},
plugins_update_XHR: {},
init: function () {
jQuery('.otgs_wp_installer_table').on('click', '.enter_site_key_js', otgs_wp_installer.show_site_key_form);
jQuery('.otgs_wp_installer_table').on('click', '.cancel_site_key_js', otgs_wp_installer.hide_site_key_form);
jQuery('.otgs_wp_installer_table').on('click', '.remove_site_key_js', otgs_wp_installer.remove_site_key);
jQuery('.otgs_wp_installer_table').on('click', '.update_site_key_js', otgs_wp_installer.update_site_key);
jQuery('.otgs_wp_installer_table').on('submit', '.otgsi_site_key_form', otgs_wp_installer.save_site_key);
jQuery('.otgs_wp_installer_table').on('submit', '.otgsi_downloads_form', otgs_wp_installer.download_downloads);
jQuery('.otgs_wp_installer_table').on('change', '.otgsi_downloads_form :checkbox[name="downloads[]"]', otgs_wp_installer.update_downloads_form);
jQuery('.otgs_wp_installer_table').on('click', '.installer_expand_button', otgs_wp_installer.toggle_subpackages);
otgs_wp_installer.scroll_to_repository();
otgs_wp_installer.maybe_register();
if (typeof pagenow != 'undefined' && pagenow == 'plugins') {
jQuery(document).ajaxSuccess(function (event, xhr, settings) {
var data = otgs_wp_installer.getQueryParameters(settings.data);
if (typeof data.action != 'undefined' && data.action == 'update-plugin') {
response = xhr.responseJSON.data;
if (typeof response.error != 'undefined') {
var default_error = jQuery('#' + response.slug + '-update .update-message').html();
jQuery('#' + response.slug + '-update .update-message').html(default_error + ' &raquo;<span class="installer-red-text"> ' + response.error + '</span>');
}
}
return false;
});
}
if (typeof pagenow != 'undefined' && pagenow == 'plugin-install') {
jQuery('.plugin-install-tab-commercial .search-plugins').remove();
}
jQuery('.installer-table-wrap').on('click', '.js-release-notes', otgs_wp_installer.toggle_release_notes);
},
getQueryParameters: function (str) {
return (str || otgs_wp_installer.sanitize(window.location.search)).replace(/(^\?)/, '').split("&").map(function (n) {
return n = n.split("="), this[n[0]] = n[1], this
}.bind({}))[0];
},
reset_errors: function () {
jQuery('.installer-error-box').html('').hide();
},
show_error: function (repo, text) {
jQuery('#installer_repo_' + repo).find('.installer-error-box').html(text).show();
},
show_site_key_form: function () {
var button = jQuery(this);
if (button.attr('disabled')) {
alert(button.attr('title'));
return false;
}
otgs_wp_installer.reset_errors();
var form = button.closest('td').find('form.otgsi_site_key_form');
button.closest('.enter_site_key_wrap_js').hide();
form.show();
form.find('input[name^=site_key_]').focus().val('');
form.find('input').removeAttr('disabled');
form.closest('.otgsi_register_product_wrap').addClass('otgsi_insert_key');
return false;
},
hide_site_key_form: function () {
var button = jQuery(this);
var form = button.closest('td').find('form');
form.hide();
form.closest('.otgsi_register_product_wrap').removeClass('otgsi_insert_key').find('.enter_site_key_wrap_js').show();
otgs_wp_installer.reset_errors();
return false;
},
save_site_key: function () {
var thisf = jQuery(this);
var data = jQuery(this).serialize();
jQuery(this).find('input').attr('disabled', 'disabled');
var spinner = jQuery('<span class="spinner"></span>');
spinner.css({display: 'inline-block', float: 'right', visibility: 'visible'}).prependTo(jQuery(this));
otgs_wp_installer.reset_errors();
jQuery.ajax({
url: ajaxurl, type: 'POST', dataType: 'json', data: data, success:
function (ret) {
if (!ret.data.error) {
otgs_wp_installer.saved_site_key();
} else {
otgs_wp_installer.show_error(thisf.find('[name=repository_id]').val(), ret.data.error);
thisf.find('input').removeAttr('disabled');
}
if (typeof ret.data.debug != 'undefined') {
thisf.append('<textarea style="width:100%" rows="20">' + ret.data.debug + '</textarea>');
}
spinner.remove();
}
});
return false;
},
saved_site_key: function () {
location.reload();
},
remove_site_key: function () {
if (jQuery(this).attr('disabled') == 'disabled') {
alert(jQuery(this).attr('title'));
return false;
} else {
if (confirm(jQuery(this).data('confirmation'))) {
jQuery('<span class="spinner"></span>').css({
visibility: 'visible',
float: 'none'
}).prependTo(jQuery(this).parent());
data = {
action: 'remove_site_key',
repository_id: jQuery(this).data('repository'),
nonce: jQuery(this).data('nonce')
}
jQuery.ajax({url: ajaxurl, type: 'POST', data: data, success: otgs_wp_installer.removed_site_key});
}
}
return false;
},
removed_site_key: function () {
location.reload();
},
update_site_key: function () {
var error_wrap = jQuery(this).closest('.otgsi_register_product_wrap').find('.installer-error-box');
error_wrap.html('');
var spinner = jQuery('<span class="spinner"></span>');
spinner.css({visibility: 'visible', float: 'none'}).insertAfter(jQuery(this));
data = {
action: 'update_site_key',
repository_id: jQuery(this).data('repository'),
nonce: jQuery(this).data('nonce')
}
jQuery.ajax({
url: ajaxurl,
type: 'POST',
data: data,
dataType: 'json',
complete: function (event, xhr, settings) {
var error = '';
if (xhr == 'success') {
var ret = event.responseJSON;
if (ret.data.error) {
error = ret.data.error;
} else {
otgs_wp_installer.updated_site_key(ret);
}
} else {
error = '<p>Error processing request (' + xhr + '). Please try again!</p>';
}
if (error) {
error_wrap.html(error).show();
spinner.remove();
}
}
});
return false;
},
updated_site_key: function (ret) {
location.reload();
},
update_downloads_form: function () {
var checked = jQuery('.otgsi_downloads_form :checkbox:checked[name="downloads[]"]').length;
if (checked) {
jQuery(this).closest('form').find(':submit, :checkbox[name=activate]').removeAttr('disabled');
} else {
jQuery(this).closest('form').find(':submit, :checkbox[name=activate]').attr('disabled', 'disabled');
}
},
download_downloads: function () {
var activate = jQuery(this).find(":checkbox:checked[name=activate]").val(),
action_button = jQuery(this).find('input[type="submit"]'),
activate_checkbox = jQuery(this).find(":checkbox[name=activate]"),
downloads_form = jQuery(this),
idx = 0,
checkboxes = [];
jQuery(this).find(':checkbox:checked[name="downloads[]"]').each(function () {
if (jQuery(this).attr('disabled')) return;
checkboxes[idx] = jQuery(this);
idx++;
jQuery(this).attr('disabled', 'disabled');
});
idx = 0;
if (typeof checkboxes[idx] != 'undefined') {
download_and_activate(checkboxes[idx]);
action_button.attr('disabled', 'disabled');
activate_checkbox.attr('disabled', 'disabled');
}
function download_and_activate(elem) {
var this_tr = elem.closest('tr');
var is_update = this_tr.find('.installer-red-text').length;
if (is_update) {
var installing = this_tr.find('.installer-status-updating');
var installed = this_tr.find('.installer-status-updated');
} else {
var installing = this_tr.find('.installer-status-installing');
var installed = this_tr.find('.installer-status-installed');
}
if (activate) {
var activating = this_tr.find('.installer-status-activating');
var activated = this_tr.find('.installer-status-activated');
}
if (this_tr.find('.for_spinner_js .spinner').length > 0) {
var spinner = this_tr.find('.for_spinner_js .spinner');
} else {
var spinner = this_tr.find('.installer-status-downloading');
}
otgs_wp_installer.reset_errors();
downloads_form.find('div.installer-status-success').hide();
spinner.css('visibility', 'visible');
installing.show();
var plugin_name = this_tr.find('.installer_plugin_name').html();
if (is_update) {
otgs_wp_installer.show_download_progress_status(downloads_form, installer_strings.updating.replace('%s', plugin_name));
} else {
otgs_wp_installer.show_download_progress_status(downloads_form, installer_strings.installing.replace('%s', plugin_name));
}
data = {
action: 'installer_download_plugin',
data: elem.val(),
activate: activate,
reset_to_channel: downloads_form.find('input[name="reset-to-channel"]').val()
}
otgs_wp_installer.plugins_update_XHR = jQuery.ajax({
url: ajaxurl,
type: 'POST',
dataType: 'json',
data: data,
success: function (ret) {
installing.hide();
if (!ret.success) {
installed.addClass('installer-status-error');
installed.html(
installed.data('fail') +
'<a class="error-details" href="#" title="' + ret.message + '"></a>'
);
if (ret.message) {
installed.closest('.otgs_wp_installer_table')
.find('.installer-error-box')
.html('<p>' + ret.message + '</p>')
.show();
} else {
installed.closest('.otgs_wp_installer_table')
.find('.installer-error-box')
.html('<p>' + downloads_form.find('.installer-revalidate-message').html() + '</p>')
.show();
}
downloads_form.trigger('installer-update-fail');
}
installed.show();
spinner.fadeOut();
if (ret.version) {
var updated_version = '<span class="installer-green-text">' + ret.version + '</span>';
if (ret.non_stable) {
updated_version += ' (' + ret.non_stable + ')';
}
this_tr.find('.installer_version_installed').html(updated_version);
}
if (ret.success && activate) {
otgs_wp_installer.show_download_progress_status(downloads_form, installer_strings.activating.replace('%s', plugin_name));
activating.show();
spinner.show();
this_tr.find('.installer-red-text').removeClass('installer-red-text').addClass('installer-green-text').html(ret.version);
jQuery.ajax({
url: ajaxurl,
type: 'POST',
dataType: 'json',
data: {action: 'installer_activate_plugin', plugin_id: ret.plugin_id, nonce: ret.nonce},
success: function (ret) {
activating.hide();
if (!ret.error) {
activated.show();
}
spinner.fadeOut();
idx++;
if (typeof checkboxes[idx] != 'undefined') {
download_and_activate(checkboxes[idx]);
} else {
otgs_wp_installer.hide_download_progress_status(downloads_form);
downloads_form.find('div.installer-status-success').show();
var availableToDownloadCount = jQuery(this).find(':checkbox[name="downloads[]"]:not(:disabled)').length;
if (availableToDownloadCount !== 0) {
action_button.removeAttr('disabled');
activate_checkbox.removeAttr('disabled');
}
downloads_form.trigger('installer-update-complete');
}
}
});
} else {
idx++;
if (typeof checkboxes[idx] != 'undefined') {
download_and_activate(checkboxes[idx]);
} else {
otgs_wp_installer.hide_download_progress_status(downloads_form);
downloads_form.find('div.installer-status-success').show();
action_button.removeAttr('disabled');
downloads_form.trigger('installer-update-complete');
}
}
}
});
};
return false;
},
show_download_progress_status: function (downloads_form, text) {
downloads_form.find('.installer-download-progress-status').html(text).fadeIn();
},
hide_download_progress_status: function (downloads_form) {
downloads_form.find('.installer-download-progress-status').html('').fadeOut();
},
toggle_subpackages: function () {
var list = jQuery(this).closest('td').find('.otgs_wp_installer_subtable');
if (list.is(':visible')) {
list.slideUp('fast');
} else {
list.slideDown('fast');
}
return false;
},
scroll_to_repository: function () {
var ref = otgs_wp_installer.sanitize(window.location.hash).replace('#', '');
if (ref) {
var split = ref.split('/');
var repo = split[0];
if (typeof split[1] != 'undefined') {
var package = split[1];
var repo_element = jQuery('#repository-' + repo);
if (repo_element.length) {
jQuery('html, body').animate({
scrollTop: repo_element.offset().top
}, 1000);
var package_element = jQuery('#repository-' + repo + '_' + package);
if (package_element.length && !package_element.is(':visible')) {
package_element.parents('.otgs_wp_installer_subtable').slideDown();
package_element.addClass('installer_highlight_package');
}
package_element.find('.button-secondary').removeClass('button-secondary').addClass('button-primary');
}
}
}
},
toggle_release_notes: function () {
var handle = jQuery(this);
var tr = handle.closest('tr');
if (tr.next('.installer-release-notes').is(':visible')) {
handle.removeClass('extended');
} else {
handle.addClass('extended');
}
tr.next('.installer-release-notes').fadeToggle();
return false;
},
maybe_register: function () {
var getQueryStringValue = function (key) {
return decodeURIComponent(otgs_wp_installer.sanitize(window.location.search).replace(new RegExp("^(?:.*[&\\?]" + encodeURIComponent(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
};
if (getQueryStringValue('action') === 'register') {
var repo = getQueryStringValue('repository'),
sitekey = getQueryStringValue('sitekey'),
repoElement = jQuery('#installer_repo_' + repo);
repoElement.find('.enter_site_key_js').trigger('click');
jQuery('html, body').animate({
scrollTop: repoElement.offset().top
}, 1000);
if (sitekey) {
repoElement.find('input[name="site_key_' + repo + '"]').val(sitekey).focus();
}
}
},
check_account: function (data, onFound, onError) {
jQuery.ajax(
{
url: ajaxurl,
type: 'POST',
dataType: 'json',
data: data,
success: onFound,
error: onError
}
);
}
}
jQuery(document).ready(otgs_wp_installer.init);

View File

@@ -0,0 +1,261 @@
(function($){
var updateErrors = [];
var channelUpdateInProgress = false;
function channelSelectorInit(){
$('.otgs_wp_installer_table')
.on('focus', '.installer-channel-selector', saveCurrentValue)
.on('change', '.installer-channel-selector', maybeShowPrompt);
$('.otgs_wp_installer_table')
.on('click', '.installer-channel-retry', retryChannelSwitch);
$('.installer-switch-confirmation')
.on('click', '.js-cancel', cancelSwitch)
.on('click', '.js-proceed', changeChannel);
$('.otgsi_downloads_form').on('installer-update-complete', maybeShowWarn);
$('.otgsi_downloads_form').on('installer-update-complete', hideUpdateProgress);
$('.otgsi_downloads_form').on('installer-update-complete', showConfirmationMessage);
$('.otgsi_downloads_form').on('installer-update-fail', logUpdateError);
}
function saveCurrentValue(){
$(this).data('previous-value', $(this).val());
}
function maybeShowPrompt(){
var selectorContainer = $(this).closest('.installer-channel-selector-wrap');
var prompt = selectorContainer.find('.installer-switch-confirmation:hidden');
if(prompt.length){
prompt.show();
selectorContainer.find('select').prop('disabled', true);
var warnText = selectorContainer.find('.installer-warn-text');
warnText.hide();
}else{
changeChannel(selectorContainer);
}
}
function changeChannel(selectorContainer){
if(selectorContainer.type == 'click'){
var selectorContainer = $(this).closest('.installer-channel-selector-wrap');
}
var select = selectorContainer.find('select');
select.prop('disabled', true);
hideConfirmationMessage(select);
showUpdateProgress(select);
selectorContainer.find('.installer-switch-confirmation').hide();
var data = {
action: 'installer_set_channel',
repository_id: select.data('repository-id'),
channel: select.val(),
nonce: select.parent().find('.nonce').val(),
noprompt: selectorContainer.find('.js-remember').length ?
selectorContainer.find('.js-remember').prop('checked') : 0
};
resetUpdateErrors();
otgs_wp_installer.reset_errors();
channelUpdateInProgress = true;
// save selection
jQuery.ajax({
url: ajaxurl,
type: 'POST',
dataType: 'json',
data: data,
success: function (ret) {
if( ret.status == 'OK'){
var tableSelector = '#installer_repo_' + select.data('repository-id') + ' .installer-table-wrap';
$(tableSelector).load( otgs_wp_installer.sanitize(location.href) + ' ' + tableSelector + ' table.widefat', function(){
var upgradesCount = $(tableSelector).find('tr .installer-red-text').length
|| select.val() == 1 && $(tableSelector).find('td.installer_version_installed .unstable').length;
if( upgradesCount > 0){
automaticUpgrade(tableSelector);
}else{
$('#installer_repo_' + select.data('repository-id') + ' .otgsi_downloads_form')
.trigger('installer-update-complete');
}
select.prop('disabled', false);
} );
}
}
});
}
function retryChannelSwitch(){
var selectorContainer = $(this).closest('.installer-channel-selector-wrap');
changeChannel(selectorContainer);
return false;
}
function cancelSwitch(){
$(this).closest('.installer-switch-confirmation').hide();
var select = $(this).closest('.installer-switch-confirmation').prev().find('.installer-channel-selector');
var previousValue = select.data('previous-value');
select.val(previousValue).prop('disabled', false);
if( select.val() > 1){
var selectorContainer = $(this).closest('.installer-channel-selector-wrap');
var warnText = selectorContainer.find('.installer-warn-text');
warnText.show();
}
}
function automaticUpgrade(downloadsTable){
$(downloadsTable + ' tr').each(
function () {
var needsUpgrade = $(this).find(
'td.installer_version_installed .installer-red-text, ' +
'td.installer_version_installed .unstable'
).length > 0;
if (needsUpgrade) {
$(this).find('td :checkbox').prop('disabled', false).prop('checked', true);
}
}
);
$(downloadsTable)
.closest('form')
.append('<input type="hidden" name="reset-to-channel" value="1">')
.submit();
}
function maybeShowWarn(){
var select = $(this)
.closest('.otgs_wp_installer_table')
.find('.installer-channel-selector');
if(select.val() > 1 && !hasUpdateErrors()){
var warnText = select
.closest('.installer-channel-selector-wrap')
.find('.installer-warn-text');
warnText.show();
}
}
function showUpdateProgress(select){
var spinner = select
.closest('.installer-channel-selector-wrap')
.find('.spinner-with-text');
spinner.addClass('is-active').show();
}
function hideUpdateProgress(){
var spinner = $(this)
.closest('.otgs_wp_installer_table')
.find('.installer-channel-selector-wrap')
.find('.spinner-with-text');
spinner.removeClass('is-active').hide();
}
function showConfirmationMessage(){
if( ! channelUpdateInProgress ) return false;
var selectWrap = $(this)
.closest('.otgs_wp_installer_table')
.find('.installer-channel-selector-wrap');
var select = $(this)
.closest('.otgs_wp_installer_table')
.find('.installer-channel-selector');
var channelName = select.find('option:selected').text();
if( hasUpdateErrors() ) {
var message = selectWrap.find('.installer-channel-update-fail');
// suppress default errors
$(this).closest('.otgs_wp_installer_table').find('.installer-error-box').hide();
var channelType = select.val() == 1 ? 'stable' : 'unstable';
message.html(message.data('text-' + channelType).replace(/%CHANNEL%/, channelName));
}else{
var message = selectWrap.find('.installer-channel-update-ok');
message.html(message.data('text').replace(/%CHANNEL%/, channelName));
}
message.show();
channelUpdateInProgress = false;
}
function hideConfirmationMessage(select){
var selectWrap = select.closest('.installer-channel-selector-wrap');
if( hasUpdateErrors() ){
var message = selectWrap.find('.installer-channel-update-fail');
}else{
var message = selectWrap.find('.installer-channel-update-ok');
}
message.hide();
}
/*
function showFailureMessage(download_form){
var message = download_form
.closest('.otgs_wp_installer_table')
.find('.installer-channel-selector-wrap')
.find('.installer-channel-update-fail');
var channelName = $(this)
.closest('.otgs_wp_installer_table')
.find('.installer-channel-selector option:selected')
.text();
message.html( message.data('text').replace(/%CHANNEL%/, channelName) );
message.show();
}
*/
function logUpdateError(){
updateErrors.push(1);
}
function resetUpdateErrors(){
updateErrors = [];
}
function hasUpdateErrors() {
return updateErrors.length;
}
$(document).ready( channelSelectorInit );
})(jQuery);

View File

@@ -0,0 +1,31 @@
var otgs_wp_installer_dismiss_nag = {
init: function () {
jQuery('.installer-dismiss-nag').click(otgs_wp_installer_dismiss_nag.dismiss_nag);
},
dismiss_nag: function () {
var element = jQuery(this);
var data = {
action: 'installer_dismiss_nag',
repository: element.data('repository'),
noticeType: element.data('noticeType'),
noticePluginSlug: element.data('noticePluginSlug') !== 'undefined' ? element.data('noticePluginSlug') : null,
};
jQuery.ajax({
url: ajaxurl,
type: 'POST',
dataType: 'json',
data: data,
success:
function () {
element.closest('.otgs-is-dismissible').remove();
}
});
return false;
}
};
jQuery(document).ready(otgs_wp_installer_dismiss_nag.init);

View File

@@ -0,0 +1,58 @@
var otgs_wp_installer_recommended_plugin = {
init: function () {
jQuery('.js-install-recommended').click(otgs_wp_installer_recommended_plugin.install_and_activate);
},
install_and_activate: function () {
var pluginElement = jQuery(this).parent();
var activate = 1;
var data = {
action: 'installer_download_plugin',
data: jQuery(this).val(),
activate: activate
};
var spinner = pluginElement.find('.spinner');
spinner.css('visibility', 'visible');
jQuery.ajax({
url: ajaxurl,
type: 'POST',
dataType: 'json',
data: data,
success: function (ret) {
jQuery.ajax({
url: ajaxurl,
type: 'POST',
dataType: 'json',
data: {
action: 'installer_activate_plugin',
plugin_id: ret.plugin_id,
nonce: ret.nonce
},
success: function (ret) {
jQuery.ajax({
url: ajaxurl,
type: 'POST',
dataType: 'json',
data: {
action: 'installer_recommendation_success',
pluginData: pluginElement.find('#originalPluginData').val(),
nonce: pluginElement.find('#recommendation_success_nonce').val()
},
success:
function () {
location.reload();
}
});
}
});
}
});
return false;
}
};
jQuery(document).ready(otgs_wp_installer_recommended_plugin.init);

View File

@@ -0,0 +1,97 @@
jQuery( document ).ready( function( $ ) {
/** Append OTGS Theme tab */
var js_array= installer_theme_install_localize.js_array_installer;
if (!($.isEmptyObject(js_array))) {
//Unempty
for(var key in js_array) {
//Dont append if we are on commercial plugins tab page and if there are no themes
if ((!(js_array[key]['is_commercial_plugin_tab'])) && (!(installer_theme_install_localize.no_associated_themes))) {
$('div.wp-filter ul.filter-links').append('<li><a data-sort="'+key+'" href="#">'+ js_array[key]['the_hyperlink_text'] +'</a></li>');
}
}
}
/** Page load event tab selected identifier */
var loaded_browsing_tab=installer_theme_extended_object.getParameterByName('browse');
if (loaded_browsing_tab.length > 0) {
var frontend_tab_selected_tab = loaded_browsing_tab;
} else if (0 == loaded_browsing_tab.length){
//WordPress defaults to 'Featured' when theme install is loaded without the browse parameter
var frontend_tab_selected_tab = 'featured';
}
/** Prepare data on page load event for AJAX */
var data = {
action: 'installer_theme_frontend_selected_tab',
installer_theme_frontend_selected_tab_nonce: installer_theme_install_localize.installer_theme_frontend_selected_tab_nonce,
frontend_tab_selected :frontend_tab_selected_tab
};
//Call AJAX
installer_theme_extended_object.doAJAX(data,frontend_tab_selected_tab,js_array);
/** When user clicks on any tab */
$(document).on('click','.filter-links li > a',function () {
//Get data_sort
var data_sort =$(this).attr('data-sort');
if (data_sort) {
//data_sort is set, prepare data
var data = {
action: 'installer_theme_frontend_selected_tab',
installer_theme_frontend_selected_tab_nonce: installer_theme_install_localize.installer_theme_frontend_selected_tab_nonce,
frontend_tab_selected : data_sort
};
//Call AJAX
installer_theme_extended_object.doAJAX(data,data_sort,js_array);
}
});
var fullhash = otgs_wp_installer.sanitize(window.location.hash);
if (fullhash.length > 0) {
var product_selector=fullhash+' '+'.enter_site_key_js';
if ($(product_selector).length ) {
$(product_selector).click();
}
}
});
//Installer theme extended JS object for methods
var installer_theme_extended_object = {
getParameterByName: function(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(otgs_wp_installer.sanitize( location.search ));
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
},
doAJAX: function(data,data_sort,js_array) {
//We only want to post to AJAX if its an OTGS tab
jQuery.post(installer_theme_install_localize.ajaxurl, data, function(response) {
//AJAX response
var myObject = jQuery.parseJSON(response);
if (typeof myObject != "undefined") {
if(myObject.hasOwnProperty("output")){
var tab_selected= myObject.output;
if (data_sort in js_array) {
if (!(installer_theme_install_localize.js_array_installer[tab_selected]['registration_status'])) {
//Not registered, no theme response
var unregistered_message= myObject.unregistered_messages;
jQuery('.no-themes').html(OTGS.purify(unregistered_message));
}
}
}
}
});
}
};

View File

@@ -0,0 +1,9 @@
function styleInlineStatusesLikeParent() {
jQuery('.js-otgs-plugin-tr').each(function () {
if (jQuery(this).prev().addClass('update').hasClass('active')) {
jQuery(this).addClass('active');
}
})
}
jQuery(document).ready(styleInlineStatusesLikeParent);

View File

@@ -0,0 +1,29 @@
jQuery(document).ready(function () {
var container = jQuery('.otgs-installer-component-setting');
container.find('.js-otgs-components-report-user-choice').click(function () {
var spinner = container.find('.spinner');
spinner.addClass('is-active');
var element = jQuery(this);
var agree = element.is(':checked') ? 1 : 0;
if (element.is(':radio')) {
agree = element.val();
}
jQuery.ajax({
url: ajaxurl,
type: 'POST',
data: {
action: element.data('nonce-action'),
nonce: element.data('nonce-value'),
agree: agree,
repo: element.data('repo'),
},
success: function () {
spinner.removeClass('is-active');
},
});
});
});