installed plugin W3 Total Cache
version 2.3.2
This commit is contained in:
7
wp-content/plugins/w3-total-cache/pub/js/chartjs.min.js
vendored
Normal file
7
wp-content/plugins/w3-total-cache/pub/js/chartjs.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
36
wp-content/plugins/w3-total-cache/pub/js/feature-counter.js
Normal file
36
wp-content/plugins/w3-total-cache/pub/js/feature-counter.js
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* File: feature-counter.js
|
||||
*
|
||||
* JavaScript for feature counters.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*
|
||||
* @global W3TCFeatureShowcaseData
|
||||
*/
|
||||
|
||||
jQuery(function() {
|
||||
var $adminmenuTopItem = jQuery( '#wp-admin-bar-w3tc > a' ),
|
||||
$adminmenuItem = jQuery ( '#wp-admin-bar-w3tc_feature_showcase a' ),
|
||||
$menuItem = jQuery( '#toplevel_page_w3tc_dashboard.wp-not-current-submenu a[href="admin.php?page=w3tc_dashboard"] .wp-menu-name' ),
|
||||
$submenuItem = jQuery( '#toplevel_page_w3tc_dashboard a[href="admin.php?page=w3tc_feature_showcase"]' ),
|
||||
markup = ' <span class="awaiting-mod count-' +
|
||||
W3TCFeatureShowcaseData.unseenCount +
|
||||
'"><span class="feature-count">' +
|
||||
W3TCFeatureShowcaseData.unseenCount +
|
||||
'</span></span>';
|
||||
|
||||
if ( W3TCFeatureShowcaseData.unseenCount > 0 ) {
|
||||
if ( $adminmenuItem.length ) {
|
||||
$adminmenuTopItem.append( markup );
|
||||
$adminmenuItem.append( markup );
|
||||
}
|
||||
|
||||
if ( $menuItem.length ) {
|
||||
$menuItem.append( markup );
|
||||
}
|
||||
|
||||
if ( $submenuItem.length ) {
|
||||
$submenuItem.append( markup );
|
||||
}
|
||||
}
|
||||
});
|
0
wp-content/plugins/w3-total-cache/pub/js/index.html
Normal file
0
wp-content/plugins/w3-total-cache/pub/js/index.html
Normal file
10
wp-content/plugins/w3-total-cache/pub/js/jquery.masonry.min.js
vendored
Normal file
10
wp-content/plugins/w3-total-cache/pub/js/jquery.masonry.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wp-content/plugins/w3-total-cache/pub/js/lazyload.min.js
vendored
Normal file
1
wp-content/plugins/w3-total-cache/pub/js/lazyload.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@
|
||||
lazyload version 12.2.0
|
||||
author
|
||||
https://www.andreaverlicchi.eu/lazyload/
|
||||
https://github.com/verlok/lazyload
|
521
wp-content/plugins/w3-total-cache/pub/js/lightbox.js
Normal file
521
wp-content/plugins/w3-total-cache/pub/js/lightbox.js
Normal file
@ -0,0 +1,521 @@
|
||||
var W3tc_Lightbox = {
|
||||
window: jQuery(window),
|
||||
container: null,
|
||||
options: null,
|
||||
|
||||
create: function() {
|
||||
var me = this;
|
||||
|
||||
this.container = jQuery('<div class="' + this.options.id + '"><div class="lightbox-close">' + this.options.close + '</div><div id="w3tc_lightbox_content" class="lightbox-content"></div></div>').css({
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
position: 'fixed',
|
||||
'z-index': 9991,
|
||||
display: 'none'
|
||||
});
|
||||
|
||||
jQuery('body').append(this.container);
|
||||
me.resize();
|
||||
this.window.resize(function() {
|
||||
me.resize();
|
||||
});
|
||||
|
||||
this.window.scroll(function() {
|
||||
me.resize();
|
||||
});
|
||||
|
||||
this.container.find('.lightbox-close').on( 'click', function() {
|
||||
me.close();
|
||||
});
|
||||
|
||||
jQuery(document).keyup(function(e) {
|
||||
if (e.keyCode == 27) { me.close(); } // esc
|
||||
});
|
||||
},
|
||||
|
||||
open: function(options) {
|
||||
this.options = jQuery.extend({
|
||||
id: 'lightbox',
|
||||
close: 'Close window',
|
||||
width: 0,
|
||||
height: 0,
|
||||
maxWidth: 0,
|
||||
maxHeight: 0,
|
||||
minWidth: 0,
|
||||
minHeight: 0,
|
||||
widthPercent: 0.6,
|
||||
heightPercent: 0.8,
|
||||
content: null,
|
||||
url: null,
|
||||
callback: null
|
||||
}, options);
|
||||
|
||||
this.create();
|
||||
this.resize();
|
||||
|
||||
if (this.options.content) {
|
||||
this.content(this.options.content);
|
||||
} else if (this.options.url) {
|
||||
this.load(this.options.url, this.options.callback);
|
||||
|
||||
if (typeof ga != 'undefined') {
|
||||
var w3tc_action = this.options.url.match(/w3tc_action=([^&]+)/);
|
||||
if (window.w3tc_ga) {
|
||||
if (w3tc_action && w3tc_action[1])
|
||||
w3tc_ga('send', 'pageview', 'overlays/' + w3tc_action[1]);
|
||||
else {
|
||||
var w3tc_action = this.options.url.match(/&(w3tc_[^&]+)&/);
|
||||
if (w3tc_action && w3tc_action[1])
|
||||
w3tc_ga('send', 'pageview', 'overlays/' + w3tc_action[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
W3tc_Overlay.show();
|
||||
this.container.show();
|
||||
},
|
||||
|
||||
close: function() {
|
||||
if (this.options.onClose)
|
||||
this.options.onClose();
|
||||
|
||||
this.container.remove();
|
||||
W3tc_Overlay.hide();
|
||||
},
|
||||
|
||||
resize: function() {
|
||||
var width = (this.options.width ? this.options.width : this.window.width() * this.options.widthPercent);
|
||||
var height = (this.options.height ? this.options.height : this.window.height() * this.options.heightPercent);
|
||||
|
||||
if (!this.options.maxWidth)
|
||||
this.options.maxWidth = this.window.width();
|
||||
if (!this.options.maxHeight)
|
||||
this.options.maxHeight = this.window.height();
|
||||
|
||||
if (this.options.maxWidth && width > this.options.maxWidth) {
|
||||
width = this.options.maxWidth;
|
||||
} else if (width < this.options.minWidth) {
|
||||
width = this.options.minWidth;
|
||||
}
|
||||
|
||||
if (this.options.maxHeight && height > this.options.maxHeight) {
|
||||
height = this.options.maxHeight;
|
||||
} else if (height < this.options.minHeight) {
|
||||
height = this.options.minHeight;
|
||||
}
|
||||
|
||||
this.container.css({
|
||||
width: width,
|
||||
height: height
|
||||
});
|
||||
|
||||
this.container.css({
|
||||
top: (this.window.height() / 2 - this.container.outerHeight() / 2)>=0 ? this.window.height() / 2 - this.container.outerHeight() / 2 : 0,
|
||||
left: (this.window.width() / 2 - this.container.outerWidth() / 2)>=0 ? this.window.width() / 2 - this.container.outerWidth() / 2 : 0
|
||||
});
|
||||
|
||||
jQuery('.lightbox-content', this.container).css({
|
||||
width: width,
|
||||
height: height
|
||||
});
|
||||
},
|
||||
|
||||
load: function(url, callback) {
|
||||
this.content('');
|
||||
this.loading(true);
|
||||
var me = this;
|
||||
jQuery.get(url, {}, function(content) {
|
||||
me.loading(false);
|
||||
if (content.substr(0, 9) === 'Location ') {
|
||||
w3tc_beforeupload_unbind();
|
||||
window.location = content.substr(9);
|
||||
return;
|
||||
}
|
||||
|
||||
me.content(content);
|
||||
if (callback) {
|
||||
callback.call(this, me);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* adds all controls of the form to the url
|
||||
*/
|
||||
load_form: function(url, form_selector, callback) {
|
||||
data = {}
|
||||
var v = jQuery(form_selector).find('input').each(function(i) {
|
||||
var name = jQuery(this).attr('name');
|
||||
var type = jQuery(this).attr('type');
|
||||
if (type == 'radio' || type == 'checkbox' ) {
|
||||
if (!jQuery(this).prop('checked'))
|
||||
return;
|
||||
}
|
||||
|
||||
if (name)
|
||||
data[name] = jQuery(this).val();
|
||||
});
|
||||
|
||||
this.content('');
|
||||
this.loading(true);
|
||||
var me = this;
|
||||
jQuery.post(url, data, function(content) {
|
||||
me.loading(false);
|
||||
if (content.substr(0, 9) === 'Location ') {
|
||||
w3tc_beforeupload_unbind();
|
||||
window.location = content.substr(9);
|
||||
return;
|
||||
}
|
||||
|
||||
me.content(content);
|
||||
if (callback) {
|
||||
callback.call(this, me);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
content: function(content) {
|
||||
return this.container.find('.lightbox-content').html(content);
|
||||
},
|
||||
|
||||
width: function(width) {
|
||||
if (width === undefined) {
|
||||
return this.container.width();
|
||||
} else {
|
||||
this.container.css('width', width);
|
||||
return this.resize();
|
||||
}
|
||||
},
|
||||
|
||||
height: function(height) {
|
||||
if (height === undefined) {
|
||||
return this.container.height();
|
||||
} else {
|
||||
this.container.css('height', height);
|
||||
return this.resize();
|
||||
}
|
||||
},
|
||||
|
||||
loading: function(loading) {
|
||||
if (loading)
|
||||
this.container.find('.lightbox-content').addClass('lightbox-loader');
|
||||
else
|
||||
this.container.find('.lightbox-content').removeClass('lightbox-loader');
|
||||
}
|
||||
};
|
||||
|
||||
var W3tc_Overlay = {
|
||||
window: jQuery(window),
|
||||
container: null,
|
||||
|
||||
create: function() {
|
||||
var me = this;
|
||||
|
||||
this.container = jQuery('<div id="overlay" />').css({
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
position: 'fixed',
|
||||
'z-index': 9990,
|
||||
display: 'none',
|
||||
opacity: 0.6
|
||||
});
|
||||
|
||||
jQuery('#w3tc').append(this.container);
|
||||
|
||||
this.window.resize(function() {
|
||||
me.resize();
|
||||
});
|
||||
|
||||
this.window.scroll(function() {
|
||||
me.resize();
|
||||
});
|
||||
},
|
||||
|
||||
show: function() {
|
||||
this.create();
|
||||
this.resize();
|
||||
this.container.show();
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.container.remove();
|
||||
},
|
||||
|
||||
resize: function() {
|
||||
this.container.css({
|
||||
width: this.window.width(),
|
||||
height: this.window.height()
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
var w3tc_minify_recommendations_checked = {};
|
||||
|
||||
function w3tc_lightbox_minify_recommendations(nonce) {
|
||||
W3tc_Lightbox.open({
|
||||
width: 1000,
|
||||
url: 'admin.php?page=w3tc_minify&w3tc_test_minify_recommendations&_wpnonce=' + nonce,
|
||||
callback: function(lightbox) {
|
||||
var theme = jQuery('#recom_theme').val();
|
||||
|
||||
if (jQuery.ui && jQuery.ui.sortable) {
|
||||
jQuery("#recom_js_files,#recom_css_files").sortable({
|
||||
axis: 'y',
|
||||
stop: function() {
|
||||
jQuery(this).find('li').each(function(index) {
|
||||
jQuery(this).find('td:eq(1)').html((index + 1) + '.');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (w3tc_minify_recommendations_checked[theme] !== undefined) {
|
||||
jQuery('#recom_js_files :text,#recom_css_files :text').each(function() {
|
||||
var hash = jQuery(this).parents('li').find('[name=recom_js_template]').val() + ':' + jQuery(this).val();
|
||||
|
||||
if (w3tc_minify_recommendations_checked[theme][hash] !== undefined) {
|
||||
var checkbox = jQuery(this).parents('li').find(':checkbox');
|
||||
|
||||
if (w3tc_minify_recommendations_checked[theme][hash]) {
|
||||
checkbox.attr('checked', 'checked');
|
||||
} else {
|
||||
checkbox.removeAttr('checked');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery('#recom_theme').change(function() {
|
||||
jQuery('#recom_js_files :checkbox,#recom_css_files :checkbox').each(function() {
|
||||
var li = jQuery(this).parents('li');
|
||||
var hash = li.find('[name=recom_js_template]').val() + ':' + li.find(':text').val();
|
||||
|
||||
if (w3tc_minify_recommendations_checked[theme] === undefined) {
|
||||
w3tc_minify_recommendations_checked[theme] = {};
|
||||
}
|
||||
|
||||
w3tc_minify_recommendations_checked[theme][hash] = jQuery(this).is(':checked');
|
||||
});
|
||||
|
||||
lightbox.load('admin.php?page=w3tc_minify&w3tc_test_minify_recommendations&theme_key=' + jQuery(this).val() + '&_wpnonce=' + nonce, lightbox.options.callback);
|
||||
});
|
||||
|
||||
jQuery('#recom_js_check').on( 'click', function() {
|
||||
if (jQuery('#recom_js_files :checkbox:checked').length) {
|
||||
jQuery('#recom_js_files :checkbox').removeAttr('checked');
|
||||
} else {
|
||||
jQuery('#recom_js_files :checkbox').attr('checked', 'checked');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('#recom_css_check').on( 'click', function() {
|
||||
if (jQuery('#recom_css_files :checkbox:checked').length) {
|
||||
jQuery('#recom_css_files :checkbox').removeAttr('checked');
|
||||
} else {
|
||||
jQuery('#recom_css_files :checkbox').attr('checked', 'checked');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('.recom_apply', lightbox.container).on( 'click', function() {
|
||||
var theme = jQuery('#recom_theme').val();
|
||||
|
||||
jQuery('#js_files li').each(function() {
|
||||
if (jQuery(this).find(':text').attr('name').indexOf('js_files[' + theme + ']') != -1) {
|
||||
jQuery(this).remove();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('#css_files li').each(function() {
|
||||
if (jQuery(this).find(':text').attr('name').indexOf('css_files[' + theme + ']') != -1) {
|
||||
jQuery(this).remove();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('#recom_js_files li').each(function() {
|
||||
if (jQuery(this).find(':checkbox:checked').length) {
|
||||
w3tc_minify_js_file_add(theme, jQuery(this).find('[name=recom_js_template]').val(), jQuery(this).find('[name=recom_js_location]').val(), jQuery(this).find('[name=recom_js_file]').val());
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('#recom_css_files li').each(function() {
|
||||
if (jQuery(this).find(':checkbox:checked').length) {
|
||||
w3tc_minify_css_file_add(theme, jQuery(this).find('[name=recom_css_template]').val(), jQuery(this).find('[name=recom_css_file]').val());
|
||||
}
|
||||
});
|
||||
|
||||
w3tc_minify_js_theme(theme);
|
||||
w3tc_minify_css_theme(theme);
|
||||
|
||||
w3tc_input_enable('.js_enabled', jQuery('#minify_js_enable:checked').length);
|
||||
w3tc_input_enable('.css_enabled', jQuery('#minify_css_enable:checked').length);
|
||||
|
||||
lightbox.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function w3tc_lightbox_self_test(nonce) {
|
||||
W3tc_Lightbox.open({
|
||||
width: 800,
|
||||
minHeight: 300,
|
||||
url: 'admin.php?page=w3tc_dashboard&w3tc_test_self&_wpnonce=' + w3tc_nonce,
|
||||
callback: function(lightbox) {
|
||||
jQuery('.button-primary', lightbox.container).on( 'click', function() {
|
||||
lightbox.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function w3tc_lightbox_upgrade(nonce, data_src, renew_key) {
|
||||
var client_id = '';
|
||||
if (window.w3tc_ga) {
|
||||
w3tc_ga(function(tracker) {
|
||||
client_id = tracker.get('clientId');
|
||||
});
|
||||
}
|
||||
|
||||
W3tc_Lightbox.open({
|
||||
id: 'w3tc-overlay',
|
||||
close: '',
|
||||
width: 800,
|
||||
height: 350,
|
||||
url: 'admin.php?page=w3tc_dashboard&w3tc_licensing_upgrade&_wpnonce=' +
|
||||
encodeURIComponent(nonce) + '&data_src=' + encodeURIComponent(data_src) +
|
||||
(renew_key ? '&renew_key=' + encodeURIComponent(renew_key) : '') +
|
||||
(client_id ? '&client_id=' + encodeURIComponent(client_id) : ''),
|
||||
callback: function(lightbox) {
|
||||
lightbox.options.height = jQuery('#w3tc-upgrade').outerHeight();
|
||||
|
||||
jQuery('.button-primary', lightbox.container).on( 'click', function() {
|
||||
lightbox.close();
|
||||
});
|
||||
jQuery('#w3tc-purchase', lightbox.container).on( 'click', function() {
|
||||
lightbox.close();
|
||||
w3tc_lightbox_buy_plugin(nonce, data_src, renew_key, client_id);
|
||||
});
|
||||
jQuery('#w3tc-purchase-link', lightbox.container).on( 'click', function() {
|
||||
lightbox.close();
|
||||
|
||||
jQuery([document.documentElement, document.body]).animate({
|
||||
scrollTop: jQuery("#licensing").offset().top
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
// Allow for customizations of the "upgrade" overlay specifically.
|
||||
jQuery( '.w3tc-overlay' ).addClass( 'w3tc-overlay-upgrade' );
|
||||
|
||||
lightbox.resize();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function w3tc_lightbox_buy_plugin(nonce, data_src, renew_key, client_id) {
|
||||
W3tc_Lightbox.open({
|
||||
width: 800,
|
||||
minHeight: 350,
|
||||
maxWidth: jQuery(window).width() - 40,
|
||||
maxHeight: jQuery(window).height() - 40,
|
||||
url: 'admin.php?page=w3tc_dashboard&w3tc_licensing_buy_plugin' +
|
||||
'&_wpnonce=' + encodeURIComponent(nonce) +
|
||||
'&data_src=' + encodeURIComponent(data_src) +
|
||||
(renew_key ? '&renew_key=' + encodeURIComponent(renew_key) : '') +
|
||||
(client_id ? '&client_id=' + encodeURIComponent(client_id) : ''),
|
||||
callback: function(lightbox) {
|
||||
var w3tc_license_listener = function(event) {
|
||||
if (event.origin.substr(event.origin.length - 12) !== ".w3-edge.com")
|
||||
return;
|
||||
|
||||
var data = event.data.split(' ');
|
||||
if (data[0] === 'license') {
|
||||
// legacy purchase
|
||||
w3tc_lightbox_save_licence_key(function() {
|
||||
lightbox.close();
|
||||
});
|
||||
} else if (data[0] === 'v2_license') {
|
||||
// reset default timeout
|
||||
var iframe = document.getElementById('buy_frame');
|
||||
if (iframe.contentWindow && iframe.contentWindow.postMessage)
|
||||
iframe.contentWindow.postMessage('v2_license_accepted', '*');
|
||||
|
||||
lightbox.options.onClose = function() {
|
||||
window.location = window.location + '&refresh';
|
||||
}
|
||||
|
||||
w3tc_lightbox_save_licence_key(data[1], nonce, function() {
|
||||
jQuery('#buy_frame').attr('src', data[3]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (window.addEventListener) {
|
||||
addEventListener("message", w3tc_license_listener, false)
|
||||
} else if (attachEvent) {
|
||||
attachEvent("onmessage", w3tc_license_listener);
|
||||
}
|
||||
|
||||
jQuery('.button-primary', lightbox.container).on( 'click', function() {
|
||||
lightbox.close();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function w3tc_lightbox_save_licence_key(license_key, nonce, callback) {
|
||||
jQuery('#plugin_license_key').val(license_key);
|
||||
var params = {
|
||||
w3tc_default_save_licence_key: 1,
|
||||
license_key: license_key,
|
||||
_wpnonce: nonce
|
||||
};
|
||||
|
||||
jQuery.post('admin.php?page=w3tc_dashboard', params, function(data) {
|
||||
callback();
|
||||
}, 'json').fail(callback);
|
||||
}
|
||||
|
||||
jQuery(function() {
|
||||
jQuery('.button-minify-recommendations').on( 'click', function() {
|
||||
var nonce = jQuery(this).metadata().nonce;
|
||||
w3tc_lightbox_minify_recommendations(nonce);
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('.button-self-test').on( 'click', function() {
|
||||
var nonce = jQuery(this).metadata().nonce;
|
||||
w3tc_lightbox_self_test(nonce);
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('.button-buy-plugin').on( 'click', function() {
|
||||
var data_src = jQuery(this).data('src');
|
||||
var nonce = jQuery(this).data('nonce');
|
||||
if (!nonce) {
|
||||
nonce = w3tc_nonce;
|
||||
}
|
||||
var renew_key = jQuery(this).data('renew-key');
|
||||
|
||||
w3tc_lightbox_upgrade(nonce, data_src, renew_key);
|
||||
jQuery('#w3tc-license-instruction').show();
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('body').on('click', '.w3tc_lightbox_close', function() {
|
||||
W3tc_Lightbox.close();
|
||||
});
|
||||
});
|
140
wp-content/plugins/w3-total-cache/pub/js/metadata.js
Normal file
140
wp-content/plugins/w3-total-cache/pub/js/metadata.js
Normal file
@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Metadata - jQuery plugin for parsing metadata from elements
|
||||
*
|
||||
* Copyright (c) 2006 John Resig, Yehuda Katz, J<>örn Zaefferer, Paul McLanahan
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id: jquery.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
|
||||
* in the JSON will become a property of the element itself.
|
||||
*
|
||||
* There are four supported types of metadata storage:
|
||||
*
|
||||
* attr: Inside an attribute. The name parameter indicates *which* attribute.
|
||||
*
|
||||
* class: Inside the class attribute, wrapped in curly braces: { }
|
||||
*
|
||||
* elem: Inside a child element (e.g. a script tag). The
|
||||
* name parameter indicates *which* element.
|
||||
* html5: Values are stored in data-* attributes.
|
||||
*
|
||||
* The metadata for an element is loaded the first time the element is accessed via jQuery.
|
||||
*
|
||||
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
|
||||
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
|
||||
*
|
||||
* @name $.metadata.setType
|
||||
*
|
||||
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||
* @before $.metadata.setType("class")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from the class attribute
|
||||
*
|
||||
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||
* @before $.metadata.setType("attr", "data")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from a "data" attribute
|
||||
*
|
||||
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
|
||||
* @before $.metadata.setType("elem", "script")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from a nested script element
|
||||
*
|
||||
* @example <p id="one" class="some_class" data-item_id="1" data-item_label="Label">This is a p</p>
|
||||
* @before $.metadata.setType("html5")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from a series of data-* attributes
|
||||
*
|
||||
* @param String type The encoding type
|
||||
* @param String name The name of the attribute to be used to get metadata (optional)
|
||||
* @cat Plugins/Metadata
|
||||
* @descr Sets the type of encoding to be used when loading metadata for the first time
|
||||
* @type undefined
|
||||
* @see metadata()
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.extend({
|
||||
metadata : {
|
||||
defaults : {
|
||||
type: 'class',
|
||||
name: 'metadata',
|
||||
cre: /({.*})/,
|
||||
single: 'metadata'
|
||||
},
|
||||
setType: function( type, name ){
|
||||
this.defaults.type = type;
|
||||
this.defaults.name = name;
|
||||
},
|
||||
get: function( elem, opts ){
|
||||
var settings = $.extend({},this.defaults,opts);
|
||||
// check for empty string in single property
|
||||
if ( !settings.single.length ) settings.single = 'metadata';
|
||||
|
||||
var data = $.data(elem, settings.single);
|
||||
// returned cached data if it already exists
|
||||
if ( data ) return data;
|
||||
|
||||
data = "{}";
|
||||
|
||||
var getObject = function(data) {
|
||||
if(typeof data != "string") return data;
|
||||
|
||||
data = eval("(" + data + ")");
|
||||
return data;
|
||||
};
|
||||
|
||||
if ( settings.type == "html5" ) {
|
||||
var object = {};
|
||||
$( elem.attributes ).each(function() {
|
||||
var name = this.nodeName;
|
||||
if(name.match(/^data-/)) name = name.replace(/^data-/, '');
|
||||
else return true;
|
||||
object[name] = getObject(this.nodeValue);
|
||||
});
|
||||
} else {
|
||||
if ( settings.type == "class" ) {
|
||||
var m = settings.cre.exec( elem.className );
|
||||
if ( m )
|
||||
data = m[1];
|
||||
} else if ( settings.type == "elem" ) {
|
||||
if( !elem.getElementsByTagName ) return;
|
||||
var e = elem.getElementsByTagName(settings.name);
|
||||
if ( e.length )
|
||||
data = $.trim(e[0].innerHTML);
|
||||
} else if ( elem.getAttribute != undefined ) {
|
||||
var attr = elem.getAttribute( settings.name );
|
||||
if ( attr )
|
||||
data = attr;
|
||||
}
|
||||
object = getObject(data.indexOf("{") < 0 ? "{" + data + "}" : data);
|
||||
}
|
||||
|
||||
$.data( elem, settings.single, object );
|
||||
return object;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the metadata object for the first member of the jQuery object.
|
||||
*
|
||||
* @name metadata
|
||||
* @descr Returns element's metadata object
|
||||
* @param Object opts An object contianing settings to override the defaults
|
||||
* @type jQuery
|
||||
* @cat Plugins/Metadata
|
||||
*/
|
||||
$.fn.metadata = function( opts ){
|
||||
return $.metadata.get( this[0], opts );
|
||||
};
|
||||
|
||||
})(jQuery);
|
@ -0,0 +1,22 @@
|
||||
jQuery(document).ready(function() {
|
||||
jQuery('textarea[w3tc-data-validator="regexps"]').change(function() {
|
||||
var v = jQuery(this).val();
|
||||
var items = v.split("\n");
|
||||
|
||||
for (var n = 0; n < items.length; n++) {
|
||||
var regexp = items[n].trim();
|
||||
if (regexp.length > 0) {
|
||||
try {
|
||||
new RegExp(regexp);
|
||||
} catch(e) {
|
||||
var error = 'Contains invalid regexp ' + regexp +', please fix';
|
||||
console.log(error);
|
||||
jQuery(this)[0].setCustomValidity(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(this)[0].setCustomValidity('');
|
||||
});
|
||||
});
|
1356
wp-content/plugins/w3-total-cache/pub/js/options.js
Normal file
1356
wp-content/plugins/w3-total-cache/pub/js/options.js
Normal file
File diff suppressed because it is too large
Load Diff
771
wp-content/plugins/w3-total-cache/pub/js/popup.js
Normal file
771
wp-content/plugins/w3-total-cache/pub/js/popup.js
Normal file
@ -0,0 +1,771 @@
|
||||
function w3tc_seconds_to_string(seconds) {
|
||||
var string = '', days, hours, minutes;
|
||||
days = Math.floor(seconds / 86400);
|
||||
if (days) {
|
||||
seconds -= days * 86400;
|
||||
string += days + 'd ';
|
||||
}
|
||||
hours = Math.floor(seconds / 3600);
|
||||
if (hours) {
|
||||
seconds -= hours * 3600;
|
||||
string += hours + 'h ';
|
||||
}
|
||||
minutes = Math.floor(seconds / 60);
|
||||
if (minutes) {
|
||||
seconds -= minutes * 60;
|
||||
string += minutes + 'm ';
|
||||
}
|
||||
|
||||
if (seconds) {
|
||||
string += seconds + 's';
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
var W3tc_Popup_Cdn_Export_File = {
|
||||
paused: 0,
|
||||
limit: 25,
|
||||
retry_seconds: 10,
|
||||
seconds_elapsed: 0,
|
||||
timer: null,
|
||||
nonce: '',
|
||||
files: [],
|
||||
initialized: false,
|
||||
upload_files: [],
|
||||
|
||||
set_progress: function(percent) {
|
||||
jQuery('#cdn_export_file_progress .bar').width(percent + '%');
|
||||
jQuery('#cdn_export_file_progress .percent').html(percent + '%');
|
||||
},
|
||||
|
||||
set_status: function(status) {
|
||||
jQuery('#cdn_export_file_status').html(status);
|
||||
},
|
||||
|
||||
set_processed: function(processed) {
|
||||
jQuery('#cdn_export_file_processed').html(processed);
|
||||
},
|
||||
|
||||
set_button_text: function(text) {
|
||||
jQuery('#cdn_export_file_start').val(text);
|
||||
},
|
||||
|
||||
set_last_response: function() {
|
||||
var date = new Date();
|
||||
jQuery('#cdn_export_file_last_response').html(date.toLocaleTimeString() + ' ' + date.toLocaleDateString());
|
||||
},
|
||||
|
||||
set_elapsed: function(text) {
|
||||
jQuery('#cdn_export_file_elapsed').html(text);
|
||||
},
|
||||
|
||||
add_log: function(path, result, error) {
|
||||
jQuery('#cdn_export_file_log').prepend('<div class="log-' + (result == 1 ? 'success' : 'error') + '">' + path + ' <strong>' + error + '</strong></div>');
|
||||
},
|
||||
|
||||
clear_log: function() {
|
||||
jQuery('#cdn_export_file_log').html('');
|
||||
},
|
||||
|
||||
process: function() {
|
||||
if (this.paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.initialized) {
|
||||
this.upload_files = this.files.slice(0);
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
to_upload = this.upload_files.slice(0, this.limit);
|
||||
|
||||
var me = this;
|
||||
if (to_upload.length) {
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: 'admin.php?page=w3tc_cdn',
|
||||
data: {
|
||||
w3tc_cdn_export_process: 1,
|
||||
'files[]': to_upload,
|
||||
_wpnonce: this.nonce
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
me.set_last_response();
|
||||
me.process_callback(data);
|
||||
},
|
||||
error: function() {
|
||||
me.set_last_response();
|
||||
me.retry(me.retry_seconds);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
retry: function(seconds) {
|
||||
if (this.paused) {
|
||||
return;
|
||||
}
|
||||
this.set_status('request failed (retry in ' + seconds + 's)');
|
||||
if (seconds) {
|
||||
var me = this;
|
||||
setTimeout(function() {
|
||||
me.retry(--seconds);
|
||||
}, 1000);
|
||||
} else {
|
||||
this.set_status('processing');
|
||||
this.process();
|
||||
}
|
||||
},
|
||||
|
||||
process_callback: function(data) {
|
||||
var failed = false;
|
||||
for (var i = 0; i < data.results.length; i++) {
|
||||
var remote_path = data.results[i].file;
|
||||
for (var n = 0; n < this.upload_files.length; n++) {
|
||||
if (this.upload_files[n] == remote_path) {
|
||||
this.upload_files.splice(n, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.add_log(remote_path, data.results[i].result, data.results[i].error);
|
||||
if (data.results[i].result == -1) {
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
this.set_progress(0);
|
||||
this.set_processed(1);
|
||||
this.set_status('failed');
|
||||
this.set_button_text('Start');
|
||||
clearInterval(this.timer);
|
||||
} else {
|
||||
var count_processed = this.files.length - this.upload_files.length;
|
||||
this.set_progress((count_processed * 100 / this.files.length).toFixed(0));
|
||||
this.set_processed(count_processed);
|
||||
|
||||
if (this.upload_files.length) {
|
||||
this.process();
|
||||
} else {
|
||||
this.set_status('done');
|
||||
this.set_button_text('Start');
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
timer_callback: function() {
|
||||
this.seconds_elapsed++;
|
||||
this.set_elapsed(w3tc_seconds_to_string(this.seconds_elapsed));
|
||||
},
|
||||
|
||||
init: function() {
|
||||
var me = this;
|
||||
jQuery('#cdn_export_file_start').click(function() {
|
||||
if (this.value == 'Pause') {
|
||||
me.paused = 1;
|
||||
me.set_button_text('Resume');
|
||||
me.set_status('paused');
|
||||
clearInterval(me.timer);
|
||||
} else {
|
||||
if (this.value == 'Start') {
|
||||
me.seconds_elapsed = 0;
|
||||
me.initialized = false;
|
||||
me.clear_log();
|
||||
me.set_progress(0);
|
||||
me.set_processed(0);
|
||||
me.set_elapsed('-');
|
||||
}
|
||||
me.paused = 0;
|
||||
me.set_button_text('Pause');
|
||||
me.set_status('processing');
|
||||
me.timer = setInterval(function() {
|
||||
me.timer_callback();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
me.process();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var W3tc_Popup_Cdn_Export_Library = {
|
||||
paused: 0,
|
||||
limit: 25,
|
||||
offset: 0,
|
||||
retry_seconds: 10,
|
||||
seconds_elapsed: 0,
|
||||
timer: null,
|
||||
nonce: '',
|
||||
|
||||
set_progress: function(percent) {
|
||||
jQuery('#cdn_export_library_progress .bar').width(percent + '%');
|
||||
jQuery('#cdn_export_library_progress .percent').html(percent + '%');
|
||||
},
|
||||
|
||||
set_status: function(status) {
|
||||
jQuery('#cdn_export_library_status').html(status);
|
||||
},
|
||||
|
||||
set_processed: function(processed) {
|
||||
jQuery('#cdn_export_library_processed').html(processed);
|
||||
},
|
||||
|
||||
set_total: function(total) {
|
||||
jQuery('#cdn_export_library_total').html(total);
|
||||
},
|
||||
|
||||
set_button_text: function(text) {
|
||||
jQuery('#cdn_export_library_start').val(text);
|
||||
},
|
||||
|
||||
set_last_response: function() {
|
||||
var date = new Date();
|
||||
jQuery('#cdn_export_library_last_response').html(date.toLocaleTimeString() + ' ' + date.toLocaleDateString());
|
||||
},
|
||||
|
||||
set_elapsed: function(text) {
|
||||
jQuery('#cdn_export_library_elapsed').html(text);
|
||||
},
|
||||
|
||||
add_log: function(path, result, error) {
|
||||
jQuery('#cdn_export_library_log').prepend('<div class="log-' + (result == 1 ? 'success' : 'error') + '">' + path + ' <strong>' + error + '</strong></div>');
|
||||
},
|
||||
|
||||
clear_log: function() {
|
||||
jQuery('#cdn_export_library_log').html('');
|
||||
},
|
||||
|
||||
process: function() {
|
||||
if (this.paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: 'admin.php?page=w3tc_cdn',
|
||||
data: {
|
||||
w3tc_cdn_export_library_process: 1,
|
||||
limit: this.limit,
|
||||
offset: this.offset,
|
||||
_wpnonce: this.nonce
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
me.set_last_response();
|
||||
me.process_callback(data);
|
||||
},
|
||||
error: function() {
|
||||
me.set_last_response();
|
||||
me.retry(me.retry_seconds);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
retry: function(seconds) {
|
||||
if (this.paused) {
|
||||
return;
|
||||
}
|
||||
this.set_status('request failed (retry in ' + seconds + 's)');
|
||||
if (seconds) {
|
||||
var me = this;
|
||||
setTimeout(function() {
|
||||
me.retry(--seconds);
|
||||
}, 1000);
|
||||
} else {
|
||||
this.set_status('processing');
|
||||
this.process();
|
||||
}
|
||||
},
|
||||
|
||||
process_callback: function(data, status) {
|
||||
this.offset += data.count;
|
||||
|
||||
this.set_total(data.total);
|
||||
this.set_processed(this.offset);
|
||||
this.set_progress((this.offset * 100 / data.total).toFixed(0));
|
||||
|
||||
var failed = false;
|
||||
for (var i = 0; i < data.results.length; i++) {
|
||||
this.add_log(data.results[i].remote_path, data.results[i].result, data.results[i].error);
|
||||
if (data.results[i].result == -1) {
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
this.set_progress(0);
|
||||
this.set_processed(1);
|
||||
this.set_status('failed');
|
||||
this.set_button_text('Start');
|
||||
clearInterval(this.timer);
|
||||
} else {
|
||||
if (this.offset < data.total) {
|
||||
this.process();
|
||||
} else {
|
||||
this.set_status('done');
|
||||
this.set_button_text('Start');
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
timer_callback: function() {
|
||||
this.seconds_elapsed++;
|
||||
this.set_elapsed(w3tc_seconds_to_string(this.seconds_elapsed));
|
||||
},
|
||||
|
||||
init: function() {
|
||||
var me = this;
|
||||
jQuery('#cdn_export_library_start').click(function() {
|
||||
if (this.value == 'Pause') {
|
||||
me.paused = 1;
|
||||
me.set_status('paused');
|
||||
me.set_button_text('Resume');
|
||||
clearInterval(me.timer);
|
||||
} else {
|
||||
if (this.value == 'Start') {
|
||||
me.offset = 0;
|
||||
me.seconds_elapsed = 0;
|
||||
me.clear_log();
|
||||
me.set_progress(0);
|
||||
me.set_elapsed('-');
|
||||
}
|
||||
me.paused = 0;
|
||||
me.set_status('processing');
|
||||
me.set_button_text('Pause');
|
||||
me.timer = setInterval(function() {
|
||||
me.timer_callback();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
me.process();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var W3tc_Popup_Cdn_Import_Library = {
|
||||
paused: 0,
|
||||
limit: 5,
|
||||
offset: 0,
|
||||
retry_seconds: 10,
|
||||
seconds_elapsed: 0,
|
||||
timer: null,
|
||||
nonce: '',
|
||||
cdn_host: '',
|
||||
|
||||
set_progress: function(percent) {
|
||||
jQuery('#cdn_import_library_progress .bar').width(percent + '%');
|
||||
jQuery('#cdn_import_library_progress .percent').html(percent + '%');
|
||||
},
|
||||
|
||||
set_status: function(status) {
|
||||
jQuery('#cdn_import_library_status').html(status);
|
||||
},
|
||||
|
||||
set_processed: function(processed) {
|
||||
jQuery('#cdn_import_library_processed').html(processed);
|
||||
},
|
||||
|
||||
set_total: function(total) {
|
||||
jQuery('#cdn_import_library_total').html(total);
|
||||
},
|
||||
|
||||
set_button_text: function(text) {
|
||||
jQuery('#cdn_import_library_start').val(text);
|
||||
},
|
||||
|
||||
set_last_response: function() {
|
||||
var date = new Date();
|
||||
jQuery('#cdn_import_library_last_response').html(date.toLocaleTimeString() + ' ' + date.toLocaleDateString());
|
||||
},
|
||||
|
||||
set_elapsed: function(text) {
|
||||
jQuery('#cdn_import_library_elapsed').html(text);
|
||||
},
|
||||
|
||||
is_redirect_permanent: function() {
|
||||
return (jQuery('#cdn_import_library_redirect_permanent:checked').length > 0);
|
||||
},
|
||||
|
||||
is_redirect_cdn: function() {
|
||||
return (jQuery('#cdn_import_library_redirect_cdn:checked').length > 0);
|
||||
},
|
||||
|
||||
add_log: function(path, result, error) {
|
||||
jQuery('#cdn_import_library_log').prepend('<div class="log-' + (result == 1 ? 'success' : 'error') + '">' + path + ' <strong>' + error + '</strong></div>');
|
||||
},
|
||||
|
||||
clear_log: function() {
|
||||
jQuery('#cdn_import_library_log').html('');
|
||||
},
|
||||
|
||||
add_rule: function(src, dst) {
|
||||
if (/^https?:\/\//.test(src)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.is_redirect_cdn()) {
|
||||
dst = 'http://' + (this.cdn_host.length > 0 ? this.cdn_host : document.location.host) + '/' + dst;
|
||||
} else {
|
||||
dst = '/' + dst;
|
||||
}
|
||||
|
||||
if (src.indexOf('/') != 0) {
|
||||
src = '/' + src;
|
||||
}
|
||||
|
||||
var rules = jQuery('#cdn_import_library_rules');
|
||||
rules.val(rules.val() + 'Redirect ' + (this.is_redirect_permanent() ? '302 ' : '') + src + ' ' + dst + '\r\n');
|
||||
},
|
||||
|
||||
clear_rules: function() {
|
||||
jQuery('#cdn_import_library_rules').val('');
|
||||
},
|
||||
|
||||
process: function() {
|
||||
if (this.paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
var cdn_import_external = jQuery("input#cdn_import_external").is(":checked");
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: 'admin.php?page=w3tc_cdn',
|
||||
data: {
|
||||
w3tc_cdn_import_library_process: 1,
|
||||
limit: this.limit,
|
||||
offset: this.offset,
|
||||
_wpnonce: this.nonce,
|
||||
cdn_import_external: cdn_import_external
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
me.set_last_response();
|
||||
me.process_callback(data);
|
||||
},
|
||||
error: function() {
|
||||
me.set_last_response();
|
||||
me.retry(me.retry_seconds);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
retry: function(seconds) {
|
||||
if (this.paused) {
|
||||
return;
|
||||
}
|
||||
this.set_status('request failed (retry in ' + seconds + 's)');
|
||||
if (seconds) {
|
||||
var me = this;
|
||||
setTimeout(function() {
|
||||
me.retry(--seconds);
|
||||
}, 1000);
|
||||
} else {
|
||||
this.set_status('processing');
|
||||
this.process();
|
||||
}
|
||||
},
|
||||
|
||||
process_callback: function(data) {
|
||||
this.offset += data.count;
|
||||
|
||||
this.set_total(data.total);
|
||||
this.set_processed(this.offset);
|
||||
this.set_progress((this.offset * 100 / data.total).toFixed(0));
|
||||
|
||||
var failed = false;
|
||||
for (var i = 0; i < data.results.length; i++) {
|
||||
this.add_log(data.results[i].src, data.results[i].result, data.results[i].error);
|
||||
if (data.results[i].result == 1) {
|
||||
this.add_rule(data.results[i].src, data.results[i].dst);
|
||||
} else if (data.results[i].result == -1) {
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
this.set_progress(0);
|
||||
this.set_processed(1);
|
||||
this.set_status('failed');
|
||||
this.set_button_text('Start');
|
||||
clearInterval(this.timer);
|
||||
} else {
|
||||
if (this.offset < data.total) {
|
||||
this.process();
|
||||
} else {
|
||||
this.set_status('done');
|
||||
this.set_button_text('Start');
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
timer_callback: function() {
|
||||
this.seconds_elapsed++;
|
||||
this.set_elapsed(w3tc_seconds_to_string(this.seconds_elapsed));
|
||||
},
|
||||
|
||||
init: function() {
|
||||
var me = this;
|
||||
jQuery('#cdn_import_library_start').click(function() {
|
||||
if (this.value == 'Pause') {
|
||||
me.paused = 1;
|
||||
me.set_button_text('Resume');
|
||||
me.set_status('paused');
|
||||
clearInterval(me.timer);
|
||||
} else {
|
||||
if (this.value == 'Start') {
|
||||
me.offset = 0;
|
||||
me.seconds_elapsed = 0;
|
||||
me.clear_log();
|
||||
me.set_progress(0);
|
||||
me.clear_rules();
|
||||
me.set_elapsed('-');
|
||||
}
|
||||
me.paused = 0;
|
||||
me.set_button_text('Pause');
|
||||
me.set_status('processing');
|
||||
me.timer = setInterval(function() {
|
||||
me.timer_callback();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
me.process();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var W3tc_Popup_Cdn_Rename_Domain = {
|
||||
paused: 0,
|
||||
limit: 25,
|
||||
offset: 0,
|
||||
retry_seconds: 10,
|
||||
seconds_elapsed: 0,
|
||||
timer: null,
|
||||
nonce: '',
|
||||
|
||||
set_progress: function(percent) {
|
||||
jQuery('#cdn_rename_domain_progress .bar').width(percent + '%');
|
||||
jQuery('#cdn_rename_domain_progress .percent').html(percent + '%');
|
||||
},
|
||||
|
||||
set_status: function(status) {
|
||||
jQuery('cdn_rename_domain_status').html(status);
|
||||
},
|
||||
|
||||
set_processed: function(processed) {
|
||||
jQuery('#cdn_rename_domain_processed').html(processed);
|
||||
},
|
||||
|
||||
set_total: function(total) {
|
||||
jQuery('#cdn_rename_domain_total').html(total);
|
||||
},
|
||||
|
||||
set_button_text: function(text) {
|
||||
jQuery('#cdn_rename_domain_start').val(text);
|
||||
},
|
||||
|
||||
set_last_response: function() {
|
||||
var date = new Date();
|
||||
jQuery('#cdn_rename_domain_last_response').html(date.toLocaleTimeString() + ' ' + date.toLocaleDateString());
|
||||
},
|
||||
|
||||
set_elapsed: function(text) {
|
||||
jQuery('#cdn_rename_domain_elapsed').html(text);
|
||||
},
|
||||
|
||||
add_log: function(path, result, error) {
|
||||
jQuery('#cdn_rename_domain_log').prepend('<div class="log-' + (result == 1 ? 'success' : 'error') + '">' + path + ' <strong>' + error + '</strong></div>');
|
||||
},
|
||||
|
||||
clear_log: function() {
|
||||
jQuery('#cdn_rename_domain_log').html('');
|
||||
},
|
||||
|
||||
get_domain_names: function() {
|
||||
return jQuery('#cdn_rename_domain_names').val();
|
||||
},
|
||||
|
||||
process: function() {
|
||||
if (this.paused) {
|
||||
return;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: 'admin.php?page=w3tc_cdn',
|
||||
data: {
|
||||
w3tc_cdn_rename_domain_process: 1,
|
||||
names: this.get_domain_names(),
|
||||
limit: this.limit,
|
||||
offset: this.offset,
|
||||
_wpnonce: this.nonce
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
me.set_last_response();
|
||||
me.process_callback(data);
|
||||
},
|
||||
error: function() {
|
||||
me.set_last_response();
|
||||
me.retry(me.retry_seconds);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
retry: function(seconds) {
|
||||
if (this.paused) {
|
||||
return;
|
||||
}
|
||||
this.set_status('request failed (retry in ' + seconds + 's)');
|
||||
if (seconds) {
|
||||
var me = this;
|
||||
setTimeout(function() {
|
||||
me.retry(--seconds);
|
||||
}, 1000);
|
||||
} else {
|
||||
this.set_status('processing');
|
||||
this.process();
|
||||
}
|
||||
},
|
||||
|
||||
process_callback: function(data) {
|
||||
this.offset += data.count;
|
||||
|
||||
this.set_total(data.total);
|
||||
this.set_processed(this.offset);
|
||||
this.set_progress((this.offset * 100 / data.total).toFixed(0));
|
||||
|
||||
var failed = false;
|
||||
for (var i = 0; i < data.results.length; i++) {
|
||||
this.add_log(data.results[i].old, data.results[i].result, data.results[i].error);
|
||||
if (data.results[i].result == -1) {
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
this.set_progress(0);
|
||||
this.set_processed(1);
|
||||
this.set_status('failed');
|
||||
this.set_button_text('Start');
|
||||
clearInterval(this.timer);
|
||||
} else {
|
||||
if (this.offset < data.total) {
|
||||
this.process();
|
||||
} else {
|
||||
this.set_status('done');
|
||||
this.set_button_text('Start');
|
||||
clearInterval(this.timer);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
timer_callback: function() {
|
||||
this.seconds_elapsed++;
|
||||
this.set_elapsed(w3tc_seconds_to_string(this.seconds_elapsed));
|
||||
},
|
||||
|
||||
init: function(cdn_host) {
|
||||
var me = this;
|
||||
this.cdn_host = cdn_host;
|
||||
jQuery('#cdn_rename_domain_start').click(function() {
|
||||
if (this.value == 'Pause') {
|
||||
me.paused = 1;
|
||||
me.set_button_text('Resume');
|
||||
me.set_status('paused');
|
||||
clearInterval(me.timer);
|
||||
} else {
|
||||
if (this.value == 'Start') {
|
||||
if (!me.get_domain_names()) {
|
||||
alert('Empty domains to rename!');
|
||||
return;
|
||||
}
|
||||
me.offset = 0;
|
||||
me.seconds_elapsed = 0;
|
||||
me.clear_log();
|
||||
me.set_progress(0);
|
||||
me.set_elapsed('-');
|
||||
}
|
||||
me.paused = 0;
|
||||
me.set_button_text('Pause');
|
||||
me.set_status('processing');
|
||||
me.timer = setInterval(function() {
|
||||
me.timer_callback();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
me.process();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function w3tc_ps_expand(expand) {
|
||||
jQuery('.ps-rule').each(function() {
|
||||
var e = jQuery(this).find('.ps-expander');
|
||||
var a = jQuery(this).find('.ps-expand a');
|
||||
|
||||
if (!expand) {
|
||||
e.hide();
|
||||
a.html('+');
|
||||
} else {
|
||||
e.show();
|
||||
a.html('-');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(function() {
|
||||
jQuery('.tab').click(function() {
|
||||
jQuery('.tab').removeClass('tab-selected');
|
||||
jQuery('.tab-content').hide();
|
||||
jQuery(this).addClass('tab-selected');
|
||||
jQuery(this.rel).show();
|
||||
});
|
||||
|
||||
jQuery('.cdn_queue_delete').click(function() {
|
||||
return confirm('Are you sure you want to remove this file from the queue?');
|
||||
});
|
||||
|
||||
jQuery('.cdn_queue_empty').click(function() {
|
||||
return confirm('Are you sure you want to empty the queue?');
|
||||
});
|
||||
|
||||
jQuery('.ps-rule').click(function() {
|
||||
var e = jQuery(this).find('.ps-expander');
|
||||
var a = jQuery(this).find('.ps-expand a');
|
||||
|
||||
if (e.is(':visible')) {
|
||||
e.hide();
|
||||
a.html('+');
|
||||
} else {
|
||||
e.show();
|
||||
a.html('-');
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('.ps-rule p a,.ps-expander').click(function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
jQuery('.ps-expand-all').click(function() {
|
||||
w3tc_ps_expand(1);
|
||||
});
|
||||
|
||||
jQuery('.ps-collapse-all').click(function() {
|
||||
w3tc_ps_expand(0);
|
||||
});
|
||||
});
|
1297
wp-content/plugins/w3-total-cache/pub/js/setup-guide.js
Normal file
1297
wp-content/plugins/w3-total-cache/pub/js/setup-guide.js
Normal file
File diff suppressed because it is too large
Load Diff
50
wp-content/plugins/w3-total-cache/pub/js/widget.js
Normal file
50
wp-content/plugins/w3-total-cache/pub/js/widget.js
Normal file
@ -0,0 +1,50 @@
|
||||
jQuery(function() {
|
||||
var ajaxurl = window.ajaxurl;
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
var forumLoading = jQuery('#w3tc_latest').find('div.inside:visible').find('.widget-loading');
|
||||
if (forumLoading.length) {
|
||||
var forumLoadingParent = forumLoading.parent();
|
||||
setTimeout(function() {
|
||||
forumLoadingParent.load(
|
||||
ajaxurl + '?action=w3tc_widget_latest_ajax&_wpnonce=' +
|
||||
jQuery(forumLoading).metadata().nonce,
|
||||
function () {
|
||||
forumLoadingParent.hide().slideDown('normal',
|
||||
function() {
|
||||
jQuery(this).css('display', '');
|
||||
});
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
var newsLoading = jQuery('#w3tc_latest_news').find('div.inside:visible').find('.widget-loading');
|
||||
if (newsLoading.length) {
|
||||
var newsLoadingParent = newsLoading.parent();
|
||||
setTimeout(function() {
|
||||
newsLoadingParent.load(
|
||||
ajaxurl + '?action=w3tc_widget_latest_news_ajax&_wpnonce=' +
|
||||
jQuery(newsLoading).metadata().nonce,
|
||||
function () {
|
||||
newsLoadingParent.hide().slideDown('normal',
|
||||
function() {
|
||||
jQuery(this).css('display', '');
|
||||
});
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
|
||||
jQuery('.w3tc_generic_widgetservice_radio').click(function () {
|
||||
var o = jQuery(this);
|
||||
|
||||
jQuery('#w3tc_generic_widgetservices_name').val(o.data('name'));
|
||||
jQuery('#w3tc_generic_widgetservices_value').val(o.data('value'));
|
||||
jQuery('#w3tc_generic_widgetservices_form_hash').val(o.data('form_hash'));
|
||||
});
|
||||
|
||||
jQuery('#buy-w3-service-cancel').on('click', function () {
|
||||
jQuery('input:radio[name=service]:checked').prop('checked', false);
|
||||
jQuery('#buy-w3-service-area').empty();
|
||||
jQuery('#buy-w3-service').attr("disabled", "disabled");
|
||||
});
|
||||
});
|
||||
});
|
121
wp-content/plugins/w3-total-cache/pub/js/wizard.js
Normal file
121
wp-content/plugins/w3-total-cache/pub/js/wizard.js
Normal file
@ -0,0 +1,121 @@
|
||||
/**
|
||||
* File: wizard.js
|
||||
*
|
||||
* JavaScript for the wizard.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
||||
jQuery(function() {
|
||||
var $container = jQuery( '#w3tc-wizard-container'),
|
||||
$skipLink = $container.find( '#w3tc-wizard-skip-link '),
|
||||
$skipButton = $container.find( '#w3tc-wizard-skip '),
|
||||
$nextButton = $container.find( '#w3tc-wizard-next '),
|
||||
$previousButton = $container.find( '#w3tc-wizard-previous ');
|
||||
|
||||
jQuery( '.button-buy-plugin' ).parent().remove();
|
||||
|
||||
$skipLink.on( 'click', skipFunction );
|
||||
$skipButton.on( 'click', skipFunction );
|
||||
|
||||
jQuery( window ).on( 'beforeunload', function() {
|
||||
return W3TC_Wizard.beforeunloadText;
|
||||
});
|
||||
|
||||
// Listen for clicks to go to the W3TC Dashboard.
|
||||
$container.find( '#w3tc-wizard-dashboard' ).on( 'click', function () {
|
||||
jQuery( window ).off( 'beforeunload' );
|
||||
document.location = W3TC_SetupGuide.dashboardUrl;
|
||||
});
|
||||
|
||||
/**
|
||||
* Process the skip action.
|
||||
*
|
||||
* Saves and option to mark the wizard completed.
|
||||
*
|
||||
* @since 2.0.0
|
||||
*/
|
||||
function skipFunction() {
|
||||
var $this = jQuery( this ),
|
||||
nodeName = $this.prop('nodeName'),
|
||||
page = location.href.replace(/^.+page=/, '' );
|
||||
|
||||
jQuery( window ).off( 'beforeunload' );
|
||||
|
||||
if ( 'BUTTON' === nodeName ) {
|
||||
$this
|
||||
.prop( 'disabled', true )
|
||||
.css( 'color', '#000' )
|
||||
.text( 'Skipping...' );
|
||||
}
|
||||
|
||||
// GA.
|
||||
if ( window.w3tc_ga ) {
|
||||
w3tc_ga( 'send', 'event', 'button', page, 'skip' );
|
||||
}
|
||||
|
||||
jQuery.ajax({
|
||||
method: 'POST',
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
_wpnonce: $container.find( '[name="_wpnonce"]' ).val(),
|
||||
action: "w3tc_wizard_skip"
|
||||
}
|
||||
})
|
||||
.done(function( response ) {
|
||||
if ( 'BUTTON' === nodeName ) {
|
||||
$this.text( 'Redirecting...' );
|
||||
}
|
||||
|
||||
window.location.replace( location.href.replace(/page=.+$/, 'page=w3tc_dashboard') );
|
||||
})
|
||||
.fail(function() {
|
||||
if ( 'BUTTON' === nodeName ) {
|
||||
$this.text( 'Error with Ajax; reloading page...' );
|
||||
}
|
||||
|
||||
location.reload();
|
||||
});
|
||||
};
|
||||
|
||||
$previousButton.on( 'click', function() {
|
||||
var $currentSlide = $container.find( '.w3tc-wizard-slides:visible' ),
|
||||
$previousSlide = $currentSlide.prev( '.w3tc-wizard-slides' );
|
||||
|
||||
if ( $previousSlide.length ) {
|
||||
$currentSlide.hide();
|
||||
$previousSlide.show();
|
||||
$nextButton.prop( 'disabled', false );
|
||||
}
|
||||
|
||||
// Hide the previous button and show the skip button on the first slide.
|
||||
if ( 0 === $previousSlide.prev( '.w3tc-wizard-slides' ).length ) {
|
||||
$previousButton.closest( 'span' ).hide();
|
||||
$skipButton.closest( 'span' ).show();
|
||||
}
|
||||
|
||||
w3tc_wizard_actions( $previousSlide );
|
||||
});
|
||||
|
||||
$nextButton.on( 'click', function() {
|
||||
var $currentSlide = $container.find( '.w3tc-wizard-slides:visible' ),
|
||||
$nextSlide = $currentSlide.next( '.w3tc-wizard-slides' );
|
||||
|
||||
if ( $skipButton.is( ':visible' ) ) {
|
||||
$skipButton.closest( 'span' ).hide();
|
||||
$previousButton.closest( 'span' ).show();
|
||||
}
|
||||
|
||||
if ( $nextSlide.length ) {
|
||||
$currentSlide.hide();
|
||||
$nextSlide.show();
|
||||
}
|
||||
|
||||
// Disable the next button on the last slide.
|
||||
if ( 0 === $nextSlide.next( '.w3tc-wizard-slides' ).length ) {
|
||||
jQuery( this ).prop( 'disabled', 'disabled' );
|
||||
}
|
||||
|
||||
w3tc_wizard_actions( $nextSlide );
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user