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,157 @@
<?php
/**
* Contains the function to render the advanced panel.
*/
/**
* Function to render the advanced panel.
*/
function ao_ccss_render_adv() {
// Attach required globals.
global $ao_ccss_debug;
global $ao_ccss_finclude;
global $ao_ccss_rtimelimit;
global $ao_ccss_noptimize;
global $ao_ccss_loggedin;
global $ao_ccss_forcepath;
global $ao_ccss_deferjquery;
global $ao_ccss_domain;
global $ao_ccss_unloadccss;
// In case domain is not set yet (done in cron.php).
if ( empty( $ao_ccss_domain ) ) {
$ao_ccss_domain = get_site_url();
}
// Get viewport size.
$viewport = autoptimizeCriticalCSSCore::ao_ccss_viewport();
?>
<ul id="adv-panel">
<li class="itemDetail">
<h2 class="itemTitle fleft"><?php _e( 'Advanced Settings', 'autoptimize' ); ?></h2>
<button type="button" class="toggle-btn">
<span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span>
</button>
<div class="collapsible hidden">
<table id="key" class="form-table">
<tr>
<th scope="row">
<?php _e( 'Viewport Size', 'autoptimize' ); ?>
</th>
<td>
<label for="autoptimize_ccss_vw"><?php _e( 'Width', 'autoptimize' ); ?>:</label> <input type="number" id="autoptimize_ccss_vw" name="autoptimize_ccss_viewport[w]" min="800" max="4096" placeholder="1400" value="<?php echo $viewport['w']; ?>" />&nbsp;&nbsp;
<label for="autoptimize_ccss_vh"><?php _e( 'Height', 'autoptimize' ); ?>:</label> <input type="number" id="autoptimize_ccss_vh" name="autoptimize_ccss_viewport[h]" min="600" max="2160" placeholder="1080" value="<?php echo $viewport['h']; ?>" />
<p class="notes">
<?php _e( '<a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> default viewport size is 1400x1080 pixels (width x height). You can change this size by typing a desired width and height values above. Allowed value ranges are from 800 to 4096 for width and from 600 to 2160 for height.', 'autoptimize' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Force Include CSS selectors', 'autoptimize' ); ?>
</th>
<td>
<textarea id="autoptimize_ccss_finclude" name="autoptimize_ccss_finclude" rows='3' maxlenght='500' style="width:100%;" placeholder="<?php _e( '.button-special,//#footer', 'autoptimize' ); ?>"><?php echo trim( $ao_ccss_finclude ); ?></textarea>
<p class="notes">
<?php _e( 'Force include CSS selectors can be used to style dynamic content that is not part of the HTML that is seen during the Critical CSS generation. To use this feature, add comma separated values with both simple strings and/or regular expressions to match the desired selectors. Regular expressions must be preceeded by two forward slashes. For instance: <code>.button-special,//#footer</code>. In this example <code>.button-special</code> will match <code>.button-special</code> selector only, while <code>//#footer</code> will match <code>#footer</code>, <code>#footer-address</code> and <code>#footer-phone</code> selectors in case they exist.<br />Do take into account that changing this setting will only affect new/ updated rules, so you might want to remove old rules and clear your page cache to expedite the forceIncludes becoming used.', 'autoptimize' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Queue processing time limit', 'autoptimize' ); ?>
</th>
<td>
<input type="number" id="autoptimize_ccss_rtimelimit" name="autoptimize_ccss_rtimelimit" min="0" max="240" placeholder="0" value="<?php echo $ao_ccss_rtimelimit; ?>" />
<p class="notes">
<?php _e( 'The cronned queue processing is an asynchronous process triggerd by (WordPress) cron. To avoid this process from running too long and potentially getting killed, you can set the number of seconds here, 0 means no limit.', 'autoptimize' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Fetch Original CSS', 'autoptimize' ); ?>
</th>
<td>
<input type="checkbox" id="autoptimize_ccss_noptimize" name="autoptimize_ccss_noptimize" value="1" <?php checked( 1 == $ao_ccss_noptimize ); ?>>
<p class="notes">
<?php _e( 'In some (rare) cases the generation of critical CSS works better with the original CSS instead of the Autoptimized one, this option enables that behavior.', 'autoptimize' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Add CCSS for logged in users?', 'autoptimize' ); ?>
</th>
<td>
<input type="checkbox" id="autoptimize_ccss_loggedin" name="autoptimize_ccss_loggedin" value="1" <?php checked( 1 == $ao_ccss_loggedin ); ?>>
<p class="notes">
<?php _e( 'Critical CSS is generated by criticalcss.com from your pages as seen be "anonymous visitor", disable this option if you don\'t want the "visitor" critical CSS to be used for logged on users.', 'autoptimize' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Force path-based rules to be generated for pages?', 'autoptimize' ); ?>
</th>
<td>
<input type="checkbox" id="autoptimize_ccss_forcepath" name="autoptimize_ccss_forcepath" value="1" <?php checked( 1 == $ao_ccss_forcepath ); ?>>
<p class="notes">
<?php _e( 'By default for each page a separate rule is generated. If your pages have (semi-)identical above the fold look and feel and you want to keep the rules lean, you can disable that so one rule is created to all pages.', 'autoptimize' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Defer jQuery and other non-aggregated JS-files?', 'autoptimize' ); ?>
</th>
<td>
<input type="checkbox" id="autoptimize_ccss_deferjquery" name="autoptimize_ccss_deferjquery" value="1" <?php checked( 1 == $ao_ccss_deferjquery ); ?>>
<p class="notes">
<?php _e( 'Defer all non-aggregated JS, including jQuery and inline JS to fix remaining render-blocking issues. Make sure to test your site thoroughly when activating this option!', 'autoptimize' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Unload critical CSS after page load?', 'autoptimize' ); ?>
</th>
<td>
<input type="checkbox" id="autoptimize_ccss_unloadccss" name="autoptimize_ccss_unloadccss" value="1" <?php checked( 1 == $ao_ccss_unloadccss ); ?>>
<p class="notes">
<?php _e( 'In rare cases the critical CSS needs to be removed once the full CSS loads, this option makes it so!', 'autoptimize' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Bound domain', 'autoptimize' ); ?>
</th>
<td>
<input type="text" id="autoptimize_ccss_domain" name="autoptimize_ccss_domain" style="width:100%;" placeholder="<?php _e( 'Don\'t leave this empty, put e.g. https://example.net/ or simply \'none\' to disable domain binding.', 'autoptimize' ); ?>" value="<?php echo trim( $ao_ccss_domain ); ?>">
<p class="notes">
<?php _e( 'Only requests from this domain will be sent for Critical CSS generation (pricing is per domain/ month).', 'autoptimize' ); ?>
</p>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Debug Mode', 'autoptimize' ); ?>
</th>
<td>
<input type="checkbox" id="autoptimize_ccss_debug" name="autoptimize_ccss_debug" value="1" <?php checked( 1 == $ao_ccss_debug ); ?>>
<p class="notes">
<?php
_e( '<strong>CAUTION! Only use debug mode on production/live environments for ad-hoc troubleshooting and remember to turn it back off after</strong>, as this generates a lot of log-data.<br />Check the box above to enable Autoptimize CriticalCSS Power-Up debug mode. It provides debug facilities in this screen, to the browser console and to this file: ', 'autoptimize' );
echo '<code>' . AO_CCSS_LOG . '</code>';
?>
</p>
</td>
</tr>
</table>
</div>
</li>
</ul>
<?php
}
?>

View File

@@ -0,0 +1,81 @@
<?php
/**
* Debug panel.
*/
// Attach wpdb() object.
global $wpdb;
// Query AO's options.
$ao_options = $wpdb->get_results('
SELECT option_name AS name,
option_value AS value
FROM ' . $wpdb->options . '
WHERE option_name LIKE "autoptimize_%%"
ORDER BY name
', ARRAY_A);
// Query AO's transients.
$ao_trans = $wpdb->get_results('
SELECT option_name AS name,
option_value AS value
FROM ' . $wpdb->options . '
WHERE option_name LIKE "_transient_autoptimize_%%"
OR option_name LIKE "_transient_timeout_autoptimize_%%"
', ARRAY_A);
// Render debug panel if there's something to show.
if ( $ao_options || $ao_trans ) {
?>
<!-- BEGIN: Settings Debug -->
<ul>
<li class="itemDetail">
<h2 class="itemTitle"><?php _e( 'Debug Information', 'autoptimize' ); ?></h2>
<?php
// Render options.
if ( $ao_options ) {
?>
<h4><?php _e( 'Options', 'autoptimize' ); ?>:</h4>
<table class="form-table debug">
<?php
foreach ( $ao_options as $option ) {
?>
<tr>
<th scope="row">
<?php echo $option['name']; ?>
</th>
<td>
<?php
if ( 'autoptimize_ccss_queue' == $option['name'] || 'autoptimize_ccss_rules' == $option['name'] ) {
$value = print_r( json_decode( $option['value'], true ), true );
if ( $value ) {
echo "Raw JSON:\n<pre>" . $option['value'] . "</pre>\n\nDecoded JSON:\n<pre>" . $value . '</pre>';
} else {
echo 'Empty';
}
} else {
echo $option['value'];
}
?>
</td>
</tr>
<?php
}
?>
</table>
<hr />
<?php
}
// Render WP-Cron intervals and scheduled events.
?>
<h4><?php _e( 'WP-Cron Intervals', 'autoptimize' ); ?>:</h4>
<pre><?php print_r( wp_get_schedules() ); ?></pre>
<hr />
<h4><?php _e( 'WP-Cron Scheduled Events', 'autoptimize' ); ?>:</h4>
<pre><?php print_r( _get_cron_array() ); ?></pre>
</li>
</ul>
<!-- END: Settings Debug -->
<?php
}

View File

@@ -0,0 +1,49 @@
<?php
/**
* Explain what CCSS is (visible if no API key is stored).
*/
/**
* Actual function that explains.
*/
function ao_ccss_render_explain() {
?>
<style>
.ao_settings_div {background: white;border: 1px solid #ccc;padding: 1px 15px;margin: 15px 10px 10px 0;}
.ao_settings_div .form-table th {font-weight: normal;}
</style>
<script>document.title = "Autoptimize: <?php _e( 'Critical CSS', 'autoptimize' ); ?> " + document.title;</script>
<ul id="explain-panel">
<div class="ao_settings_div">
<?php
$ccss_explanation = '';
// get the HTML with the explanation of what critical CSS is.
if ( apply_filters( 'autoptimize_settingsscreen_remotehttp', true ) ) {
$ccss_explanation = get_transient( 'ao_ccss_explain' );
if ( empty( $ccss_explanation ) ) {
$ccss_expl_resp = wp_remote_get( 'https://misc.optimizingmatters.com/autoptimize_ccss_explain_i18n.html?ao_ver=' . AUTOPTIMIZE_PLUGIN_VERSION );
if ( ! is_wp_error( $ccss_expl_resp ) ) {
if ( '200' == wp_remote_retrieve_response_code( $ccss_expl_resp ) ) {
$ccss_explanation = wp_kses_post( wp_remote_retrieve_body( $ccss_expl_resp ) );
set_transient( 'ao_ccss_explain', $ccss_explanation, WEEK_IN_SECONDS );
}
}
}
}
// placeholder text in case HTML is empty.
if ( empty( $ccss_explanation ) ) {
$ccss_explanation = __( '<h2>Fix render-blocking CSS!</h2><p>Significantly improve your first-paint times by making CSS non-render-blocking.</p><p>The next step is to sign up at <a href="https://criticalcss.com/?aff=1" target="_blank">https://criticalcss.com</a> (this is a premium service, priced 2 GBP/month for membership and 5 GBP/month per domain) <strong>and get the API key, which you can copy from <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">the API-keys page</a></strong> and paste below.</p><p>If you have any questions or need support, head on over to <a href="https://wordpress.org/support/plugin/autoptimize" target="_blank">our support forum</a> and we\'ll help you get up and running in no time!</p>', 'autoptimize' );
} else {
// we were able to fetch the explenation, so add the JS to show correct language.
$ccss_explanation .= "<script>jQuery('.ao_i18n').hide();d=document;lang=d.getElementsByTagName('html')[0].getAttribute('lang').substring(0,2);if(d.getElementById(lang)!= null){jQuery('#'+lang).show();}else{jQuery('#default').show();}</script>";
}
// and echo it.
echo $ccss_explanation;
?>
</div>
</ul>
<?php
}

View File

@@ -0,0 +1,68 @@
<?php
/**
* Javascript to import and export AO CCSS settings.
*/
?>
// Export and download settings
function exportSettings( idToEdit ) {
console.log('Exporting...');
var data = {
'action': 'ao_ccss_export',
'ao_ccss_export_nonce': '<?php echo wp_create_nonce( 'ao_ccss_export_nonce' ); ?>',
};
jQuery.post(ajaxurl, data, function(response) {
response_array=JSON.parse(response);
if (response_array['code'] == 200) {
<?php
if ( is_multisite() ) {
$blog_id = '/' . get_current_blog_id() . '/';
} else {
$blog_id = '/';
}
?>
export_url = '<?php echo content_url(); ?>/uploads/ao_ccss' + '<?php echo $blog_id; ?>' + response_array['file'];
msg = "Download export-file from: <a href=\"" + export_url + "\" target=\"_blank\">"+ export_url + "</a>";
} else {
msg = response_array['msg'];
}
jQuery("#importdialog").html(msg);
jQuery("#importdialog").dialog({
autoOpen: true,
height: 210,
width: 700,
title: "<?php _e( 'Export settings result', 'autoptimize' ); ?>",
modal: true,
buttons: {
OK: function() {
jQuery( this ).dialog( "close" );
}
}
});
});
}
// Upload and import settings
function upload(){
var fd = new FormData();
var file = jQuery(document).find('#settingsfile');
var settings_file = file[0].files[0];
fd.append('file', settings_file);
fd.append('action', 'ao_ccss_import');
fd.append('ao_ccss_import_nonce', '<?php echo wp_create_nonce( 'ao_ccss_import_nonce' ); ?>');
jQuery.ajax({
url: ajaxurl,
type: 'POST',
data: fd,
contentType: false,
processData: false,
success: function(response) {
response_array=JSON.parse(response);
if (response_array['code'] == 200) {
window.location.reload();
}
}
});
}

View File

@@ -0,0 +1,57 @@
<?php
/**
* Render key panel.
*/
/**
* Function that renders key panel.
*
* @param string $key API Key.
* @param string $status API Key status.
* @param string $status_msg Status message.
* @param string $message Message.
* @param string $color Color to highlight message in.
*/
function ao_ccss_render_key( $key, $status, $status_msg, $message, $color ) {
if ( defined( 'AUTOPTIMIZE_CRITICALCSS_API_KEY' ) ) {
$key = __( 'API key provided by your host/ WordPress administrator, no need to enter anything here. In case of problems with the API key, contact your host/ WordPress administrator.', 'autoptimize' );
}
?>
<ul id="key-panel">
<li class="itemDetail">
<h2 class="itemTitle fleft"><?php _e( 'API Key', 'autoptimize' ); ?>: <span style="color:<?php echo $color; ?>;"><?php echo $status_msg; ?></span></h2>
<button type="button" class="toggle-btn">
<?php if ( 'valid' != $status ) { ?>
<span class="toggle-indicator dashicons dashicons-arrow-up"></span>
<?php } else { ?>
<span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span>
<?php } ?>
</button>
<?php if ( 'valid' != $status ) { ?>
<div class="collapsible">
<?php } else { ?>
<div class="collapsible hidden">
<?php } ?>
<?php if ( 'valid' != $status ) { ?>
<div style="clear:both;padding:2px 10px;border-left:solid;border-left-width:5px;border-left-color:<?php echo $color; ?>;background-color:white;">
<p><?php echo $message; ?></p>
</div>
<?php } ?>
<table id="key" class="form-table">
<tr>
<th scope="row">
<?php _e( 'Your API Key', 'autoptimize' ); ?>
</th>
<td>
<textarea id="autoptimize_ccss_key" name="autoptimize_ccss_key" rows='3' style="width:100%;" placeholder="<?php _e( 'Please enter your criticalcss.com API key here.', 'autoptimize' ); ?>"><?php echo trim( $key ); ?></textarea>
<p class="notes">
<?php _e( 'Enter your <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> API key above. The key is revalidated every time a new job is sent to it.<br />To obtain your API key, go to <a href="https://criticalcss.com/account/api-keys?aff=1" target="_blank">criticalcss.com</a> > Account > API Keys.<br />Requests to generate a critical CSS via the API are priced at £5 per domain per month.<br /><strong>Not sure yet? With the <a href="https://criticalcss.com/faq/?aff=1#trial" target="_blank">30 day money back guarantee</a>, you have nothing to lose!</strong>', 'autoptimize' ); ?>
</p>
</td>
</tr>
</table>
</div>
</li>
</ul>
<?php
}

View File

@@ -0,0 +1,218 @@
<?php
/**
* JS code to manage queue.
*/
?>
// Hide object text box
var queueOriginEl = document.getElementById('ao-ccss-queue' );
if (queueOriginEl) {
queueOriginEl.style.display = 'none';
// Get queue object and call table renderer
jQuery(document).ready(function() {
// Instance and parse queue object
var aoCssQueueRaw = document.getElementById('ao-ccss-queue').value;
var aoCssQueue = aoCssQueueRaw.indexOf('{"') === 0 ?
JSON.parse(aoCssQueueRaw) :
"";
var aoCssQueueLog = aoCssQueue === "" ?
"empty" :
aoCssQueue;
<?php
if ( $ao_ccss_debug ) {
echo "console.log( 'Queue Object:', aoCssQueueLog );\n";
}
?>
// hook up "remove all jobs" button to the JS action.
jQuery("#removeAllJobs").click(function(){removeAllJobs();});
// Render queue table
drawQueueTable(aoCssQueue);
// Make queue table sortable if there are any elements
var queueBodyEl = jQuery('#queue > tr').length;
if (queueBodyEl > 0) {
jQuery('#queue-tbl').tablesorter({
sortList: [[0,0]],
headers: {6: {sorter: false}}
});
}
});
}
// Render the queue in a table
function drawQueueTable(queue) {
jQuery('#queue').empty();
rowNumber=0;
jQuery.each(queue, function(path, keys) {
// Prepare commom job values
ljid = keys.ljid;
targetArr = keys.rtarget.split('|' );
target = targetArr[1];
type = keys.ptype;
ctime = EpochToDate(keys.jctime);
rbtn = false;
dbtn = false;
hbtn = false;
// Prepare job statuses
if (keys.jqstat === 'NEW') {
// Status: NEW (N, sort order 1)
status = '<span class="hidden">1</span>N';
statusClass = 'new';
title = '<?php _e( 'New', 'autoptimize' ); ?> (' + ljid + ')';
buttons = '<?php _e( 'None', 'autoptimize' ); ?>';
} else if (keys.jqstat === 'JOB_QUEUED' || keys.jqstat === 'JOB_ONGOING') {
// Status: PENDING (P, sort order 2)
status = '<span class="hidden">2</span>P';
statusClass = 'pending';
title = '<?php _e( 'PENDING', 'autoptimize' ); ?> (' + ljid + ')';
buttons = '<?php _e( 'None', 'autoptimize' ); ?>';
} else if (keys.jqstat === 'JOB_DONE' && keys.jrstat === 'GOOD' && (keys.jvstat === 'WARN' || keys.jvstat === 'BAD')) {
// Status: REVIEW (R, sort order 5)
status = '<span class="hidden">5</span>R';
statusClass = 'review';
title = "<?php _e( 'REVIEW', 'autoptimize' ); ?> (" + ljid + ")\n<?php _e( 'Info from criticalcss.com:', 'autoptimize' ); ?>\n<?php _e( '- Job ID: ', 'autoptimize' ); ?>" + keys.jid + "\n<?php _e( '- Status: ', 'autoptimize' ); ?>" + keys.jqstat + "\n<?php _e( '- Result: ', 'autoptimize' ); ?>" + keys.jrstat + "\n<?php _e( '- Validation: ', 'autoptimize' ); ?>" + keys.jvstat;
buttons = '<span class="button-secondary" id="' + ljid + '_remove" title="<?php _e( 'Delete Job', 'autoptimize' ); ?>"><span class="dashicons dashicons-trash"></span></span>';
dbtn = true;
} else if (keys.jqstat === 'JOB_DONE') {
// Status: DONE (D, sort order 6)
status = '<span class="hidden">6</span>D';
statusClass = 'done';
title = '<?php _e( 'DONE', 'autoptimize' ); ?> (' + ljid + ')';
buttons = '<span class="button-secondary" id="' + ljid + '_remove" title="<?php _e( 'Delete Job', 'autoptimize' ); ?>"><span class="dashicons dashicons-trash"></span></span>';
dbtn = true;
} else if (keys.jqstat === 'JOB_FAILED' || keys.jqstat === 'STATUS_JOB_BAD' || keys.jqstat === 'INVALID_JWT_TOKEN' || keys.jqstat === 'NO_CSS' || keys.jqstat === 'NO_RESPONSE') {
// Status: ERROR (E, sort order 4)
status = '<span class="hidden">4</span>E';
statusClass = 'error';
title = "<?php _e( 'ERROR', 'autoptimize' ); ?> (" + ljid + ")\n<?php _e( 'Info from criticalcss.com:', 'autoptimize' ); ?>\n<?php _e( '- Job ID: ', 'autoptimize' ); ?>" + keys.jid + "\n<?php _e( '- Status: ', 'autoptimize' ); ?>" + keys.jqstat + "\n<?php _e( '- Result: ', 'autoptimize' ); ?>" + keys.jrstat + "\n<?php _e( '- Validation: ', 'autoptimize' ); ?>" + keys.jvstat;
buttons = '<span class="button-secondary" id="' + ljid + '_retry" title="<?php _e( 'Retry Job', 'autoptimize' ); ?>"><span class="dashicons dashicons-update"></span></span><span class="button-secondary to-right" id="' + ljid + '_remove" title="<?php _e( 'Delete Job', 'autoptimize' ); ?>"><span class="dashicons dashicons-trash"></span></span><span class="button-secondary to-right" id="' + ljid + '_help" title="<?php _e( 'Get Help', 'autoptimize' ); ?>"><span class="dashicons dashicons-sos"></span></span>';
rbtn = true;
dbtn = true;
hbtn = true;
} else {
// Status: UNKNOWN (U, sort order 5)
status = '<span class="hidden">5</span>U';
statusClass = 'unknown';
title = "<?php _e( 'UNKNOWN', 'autoptimize' ); ?> (" + ljid + ")\n<?php _e( 'Info from criticalcss.com:', 'autoptimize' ); ?>\n<?php _e( '- Job ID: ', 'autoptimize' ); ?>" + keys.jid + "\n<?php _e( '- Status: ', 'autoptimize' ); ?>" + keys.jqstat + "\n<?php _e( '- Result: ', 'autoptimize' ); ?>" + keys.jrstat + "\n<?php _e( '- Validation: ', 'autoptimize' ); ?>" + keys.jvstat;
buttons = '<span class="button-secondary" id="' + ljid + '_remove" title="<?php _e( 'Delete Job', 'autoptimize' ); ?>"><span class="dashicons dashicons-trash"></span></span><span class="button-secondary to-right" id="' + ljid + '_help" title="<?php _e( 'Get Help', 'autoptimize' ); ?>"><span class="dashicons dashicons-sos"></span></span>';
dbtn = true;
hbtn = true;
}
// Prepare job finish time
if (keys.jftime === null) {
ftime = '<?php _e( 'N/A', 'autoptimize' ); ?>';
} else {
ftime = EpochToDate(keys.jftime);
}
// Append job entry
jQuery("#queue").append("<tr id='" + ljid + "' class='job " + statusClass + "'><td class='status'><span class='badge " + statusClass + "' title='<?php _e( 'Job status is ', 'autoptimize' ); ?>" + title + "'>" + status + "</span></td><td>" + target.replace(/(woo_|template_|custom_post_|edd_|bp_|bbp_)/,'') + "</td><td>" + path + "</td><td>" + type.replace(/(woo_|template_|custom_post_|edd_|bp_|bbp_)/,'') + "</td><td>" + ctime + "</td><td>" + ftime + "</td><td class='btn'>" + buttons + "</td></tr>");
// Attach button actions
if (rbtn) {
jQuery('#' + ljid + '_retry').click(function(){retryJob(queue, this.id, path);});
}
if (dbtn) {
jQuery('#' + ljid + '_remove').click(function(){delJob(queue, this.id, path);});
}
if (hbtn) {
jQuery('#' + ljid + '_help').click(function(){jid=this.id.split('_' );window.open('https://criticalcss.com/faq?aoid=' + jid[0], '_blank' );});
}
});
}
// Delete a job from the queue
function delJob(queue, jid, jpath) {
jid = jid.split('_' );
jQuery('#queue-confirm-rm').dialog({
resizable: false,
height: 180,
modal: true,
buttons: {
"<?php _e( 'Delete', 'autoptimize' ); ?>": function() {
delete queue[jpath];
updateQueue(queue);
jQuery(this).dialog('close' );
},
"<?php _e( 'Cancel', 'autoptimize' ); ?>": function() {
jQuery(this).dialog('close' );
}
}
});
}
function removeAllJobs() {
jQuery( "#queue-confirm-rm-all" ).dialog({
resizable: false,
height:235,
modal: true,
buttons: {
"<?php _e( 'Delete all jobs?', 'autoptimize' ); ?>": function() {
queue=[];
updateQueue(queue);
jQuery( this ).dialog( "close" );
},
"<?php _e( 'Cancel', 'autoptimize' ); ?>": function() {
jQuery( this ).dialog( "close" );
}
}
});
}
// Retry jobs with error
function retryJob(queue, jid, jpath) {
jid = jid.split('_' );
jQuery('#queue-confirm-retry').dialog({
resizable: false,
height: 180,
modal: true,
buttons: {
"<?php _e( 'Retry', 'autoptimize' ); ?>": function() {
<?php
if ( $ao_ccss_debug ) {
echo "console.log( 'SHOULD retry job:', jid[0], jpath );\n";
}
?>
queue[jpath].jid = null;
queue[jpath].jqstat = 'NEW';
queue[jpath].jrstat = null;
queue[jpath].jvstat = null;
queue[jpath].jctime = (new Date).getTime() / 1000;
queue[jpath].jftime = null;
updateQueue(queue);
jQuery(this).dialog('close' );
},
"<?php _e( 'Cancel', 'autoptimize' ); ?>": function() {
jQuery(this).dialog('close' );
}
}
});
}
// Refresh queue
function updateQueue(queue) {
document.getElementById('ao-ccss-queue').value=JSON.stringify(queue);
drawQueueTable(queue);
jQuery('#unSavedWarning').show();
document.getElementById('ao_title_and_button').scrollIntoView();
<?php
if ( $ao_ccss_debug ) {
echo "console.log('Updated Queue Object:', queue);\n";
}
?>
}
// Convert epoch to date for job times
function EpochToDate(epoch) {
if (epoch < 10000000000)
epoch *= 1000;
var epoch = epoch + (new Date().getTimezoneOffset() * -1); //for timeZone
var sdate = new Date(epoch);
var ldate = sdate.toLocaleString();
return ldate;
}

View File

@@ -0,0 +1,92 @@
<?php
/**
* Render the queue panel.
*/
/**
* Function to render the queue panel.
*/
function ao_ccss_render_queue() {
// Attach required arrays.
global $ao_ccss_queue;
// Prepare the queue object.
if ( empty( $ao_ccss_queue ) ) {
$ao_ccss_queue = '';
} else {
$ao_ccss_queue = json_encode( $ao_ccss_queue );
}
?>
<ul id="queue-panel">
<li class="itemDetail">
<h2 class="itemTitle fleft"><?php _e( 'Job Queue', 'autoptimize' ); ?></h2>
<button type="button" class="toggle-btn">
<span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span>
</button>
<?php
if ( autoptimizeCriticalCSSSettings::ao_ccss_has_autorules() ) {
$_queue_visibility = 'hidden';
} else {
$_queue_visibility = 'visible';
}
?>
<div class="collapsible <?php echo $_queue_visibility; ?>">
<!-- BEGIN Queue dialogs -->
<!-- Retry dialog -->
<div id="queue-confirm-retry" title="<?php _e( 'Retry Job', 'autoptimize' ); ?>" class="hidden">
<p><?php _e( 'Are you sure you want to retry this job?', 'autoptimize' ); ?></p>
</div>
<!-- Remove dialog -->
<div id="queue-confirm-rm" title="<?php _e( 'Delete Job', 'autoptimize' ); ?>" class="hidden">
<p><?php _e( 'Are you sure you want to delete this job?', 'autoptimize' ); ?></p>
</div>
<!-- Remove all dialog -->
<div id="queue-confirm-rm-all" title="<?php _e( 'Delete all jobs', 'autoptimize' ); ?>" class="hidden">
<p><?php _e( 'This will delete all jobs, are you sure?', 'autoptimize' ); ?></p>
</div>
<!-- END Queue dialogs -->
<!-- BEGIN Queue UI -->
<div class="howto">
<div class="title-wrap">
<h4 class="title"><?php _e( 'How To Use Autoptimize CriticalCSS Power-Up Queue', 'autoptimize' ); ?></h4>
<p class="subtitle"><?php _e( 'Click the side arrow to toggle instructions', 'autoptimize' ); ?></p>
</div>
<button type="button" class="toggle-btn">
<span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span>
</button>
<div class="howto-wrap hidden">
<p><?php _e( 'TL;DR:<br /><strong>Queue runs every 10 minutes.</strong> Job statuses are <span class="badge new">N</span> for NEW, <span class="badge pending">P</span> for PENDING, <span class="badge error">E</span> for ERROR and <span class="badge unknown">U</span> for UNKOWN.', 'autoptimize' ); ?></p>
<ol>
<li><?php _e( 'The queue operates <strong>automatically, asynchronously and on regular intervals of 10 minutes.</strong> To view updated queue status, refresh this page.', 'autoptimize' ); ?></li>
<li><?php _e( 'When the conditions to create a job are met (i.e. user not logged in, no matching <span class="badge manual">MANUAL</span> rule or CSS files has changed for an <span class="badge auto">AUTO</span> rule), a <span class="badge new">N</span> job is created in the queue.', 'autoptimize' ); ?></li>
<li><?php _e( "Autoptimize CriticalCSS Power-Up constantly query the queue for <span class='badge new'>N</span> jobs. When it finds one, gears spins and jobs becomes <span class='badge pending'>P</span> while they are running and <a href='https://criticalcss.com/?aff=1' target='_blank'>criticalcss.com</a> doesn't return a result.", 'autoptimize' ); ?></li>
<li><?php _e( 'As soon as <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> returns a valid critical CSS file, the job is then finished and removed from the queue.', 'autoptimize' ); ?></li>
<li><?php _e( 'When things go wrong, a job is marked as <span class="badge error">E</span>. You can retry faulty jobs, delete them or get in touch with <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for assistance.', 'autoptimize' ); ?></li>
<li><?php _e( 'Sometimes an unknown condition can happen. In this case, the job status becomes <span class="badge unknown">U</span> and you may want to ask <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for help or just delete it.', 'autoptimize' ); ?></li>
<li><?php _e( 'To get more information about jobs statuses, specially the ones with <span class="badge error">E</span> and <span class="badge unknown">U</span> status, hover your mouse in the status badge of that job. This information might be crucial when contacting <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for assistance.', 'autoptimize' ); ?></li>
<li><?php _e( '<strong>A word about WordPress cron:</strong> Autoptimize CriticalCSS Power-Up watch the queue by using WordPress Cron (or WP-Cron for short.) It <a href="https://www.smashingmagazine.com/2013/10/schedule-events-using-wordpress-cron/#limitations-of-wordpress-cron-and-solutions-to-fix-em" target="_blank">could be faulty</a> on very light or very heavy loads. If your site receives just a few or thousands visits a day, it might be a good idea to <a href="https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/" target="_blank">turn WP-Cron off and use your system task scheduler</a> to fire it instead.', 'autoptimize' ); ?></li>
</ol>
</div>
</div>
<table id="queue-tbl" class="queue tablesorter" cellspacing="0">
<thead>
<tr><th class="status"><?php _e( 'Status', 'autoptimize' ); ?></th><th><?php _e( 'Target Rule', 'autoptimize' ); ?></th><th><?php _e( 'Page Path', 'autoptimize' ); ?></th><th><?php _e( 'Page Type', 'autoptimize' ); ?></th><th><?php _e( 'Creation Date', 'autoptimize' ); ?></th><th><?php _e( 'Finish Date', 'autoptimize' ); ?></th><th class="btn"><?php _e( 'Actions', 'autoptimize' ); ?></th></tr>
</thead>
<tbody id="queue"></tbody>
</table>
<input class="hidden" type="text" id="ao-ccss-queue" name="autoptimize_ccss_queue" value='<?php echo( $ao_ccss_queue ); ?>'>
<div class="submit jobs-btn">
<div class="alignright">
<span id="removeAllJobs" class="button-secondary" style="color:red;"><?php _e( 'Remove all jobs', 'autoptimize' ); ?></span>
</div>
</div>
</div>
<!-- END Queue UI -->
</li>
</ul>
<?php
}

View File

@@ -0,0 +1,378 @@
<?php
/**
* Outputs JS code for the rules panel.
*/
if ( $ao_ccss_debug ) {
echo "console.log('[WARN] Autoptimize CriticalCSS Power-Up is in DEBUG MODE!');\n";
echo "console.log('[WARN] Avoid using debug mode on production/live environments unless for ad-hoc troubleshooting purposes and make sure to disable it after!');\n";
}
?>
var rulesOriginEl = document.getElementById("critCssOrigin");
var deferInlineEl = document.getElementById("autoptimize_css_defer_inline");
var additionalEl = document.getElementById("autoptimize_ccss_additional");
if (rulesOriginEl)
rulesOriginEl.style.display = 'none';
if (deferInlineEl)
deferInlineEl.style.display = 'none';
if (additionalEl)
additionalEl.style.display = 'none';
if (rulesOriginEl) {
jQuery(document).ready(function() {
critCssArray=JSON.parse(document.getElementById("critCssOrigin").value);
<?php
if ( $ao_ccss_debug ) {
echo "console.log('Rules Object:', critCssArray);\n";
}
?>
drawTable(critCssArray);
jQuery("#addCritCssButton").click(function(){addEditRow();});
jQuery("#editDefaultButton").click(function(){editDefaultCritCss();});
jQuery("#editAdditionalButton").click(function(){editAdditionalCritCss();});
jQuery("#removeAllRules").click(function(){removeAllRules();});
});
}
function drawTable(critCssArray) {
jQuery("#rules-list").empty();
jQuery.each(critCssArray,function(k,v) {
if (k=="paths") {
kstring="<?php _e( 'Path Based Rules', 'autoptimize' ); ?>";
} else {
kstring="<?php _e( 'Conditional Tags, Custom Post Types and Page Templates Rules', 'autoptimize' ); ?>";
}
if (!(jQuery.isEmptyObject(v))) {
jQuery("#rules-list").append("<tr><td colspan='5'><h4>" + kstring + "</h4></td></tr>");
jQuery("#rules-list").append("<tr class='header "+k+"Rule'><th><?php _e( 'Type', 'autoptimize' ); ?></th><th><?php _e( 'Target', 'autoptimize' ); ?></th><th><?php _e( 'Critical CSS File', 'autoptimize' ); ?></th><th colspan='2'><?php _e( 'Actions', 'autoptimize' ); ?></th></tr>");
}
nodeNumber=0;
jQuery.each(v,function(i,nv){
nodeNumber++;
nodeId=k + "_" + nodeNumber;
hash=nv.hash;
file=nv.file;
filest=nv.file;
if (file == 0) {
file='<?php _e( 'To be fetched from criticalcss.com in the next queue run...', 'autoptimize' ); ?>';
}
if (nv.hash === 0 && filest != 0) {
type='<?php _e( 'MANUAL', 'autoptimize' ); ?>';
typeClass = 'manual';
} else {
type='<?php _e( 'AUTO', 'autoptimize' ); ?>';
typeClass = 'auto';
}
if (file && typeof file == 'string') {
rmark=file.split('_');
if (rmark[2] || rmark[2] == 'R.css') {
rmark = '<span class="badge review rule">R</span>'
} else {
rmark = '';
}
}
if ( k == "paths" ) {
target = '<a href="<?php echo AUTOPTIMIZE_WP_SITE_URL; ?>' + i + '" target="_blank">' + i + '</a>';
} else {
target = i.replace(/(woo_|template_|custom_post_|edd_|bp_|bbp_)/,'');
}
jQuery("#rules-list").append("<tr class='rule "+k+"Rule'><td class='type'><span class='badge " + typeClass + "'>" + type + "</span>" + rmark + "</td><td class='target'>" + target + "</td><td class='file'>" + file + "</td><td class='btn edit'><span class=\"button-secondary\" id=\"" + nodeId + "_edit\"><?php _e( 'Edit', 'autoptimize' ); ?></span></td><td class='btn delete'><span class=\"button-secondary\" id=\"" + nodeId + "_remove\"><?php _e( 'Remove', 'autoptimize' ); ?></span></td></tr>");
jQuery("#" + nodeId + "_edit").click(function(){addEditRow(this.id);});
jQuery("#" + nodeId + "_remove").click(function(){confirmRemove(this.id);});
})
});
}
function confirmRemove(idToRemove) {
jQuery( "#confirm-rm" ).dialog({
resizable: false,
height:235,
modal: true,
buttons: {
"<?php _e( 'Delete', 'autoptimize' ); ?>": function() {
removeRow(idToRemove);
updateAfterChange();
jQuery( this ).dialog( "close" );
},
"<?php _e( 'Cancel', 'autoptimize' ); ?>": function() {
jQuery( this ).dialog( "close" );
}
}
});
}
function removeAllRules() {
jQuery( "#confirm-rm-all" ).dialog({
resizable: false,
height:235,
modal: true,
buttons: {
"<?php _e( 'Delete All', 'autoptimize' ); ?>": function() {
critCssArray={'paths':[],'types':[]};
drawTable(critCssArray);
updateAfterChange();
removeAllCcssFilesOnServer();
jQuery( this ).dialog( "close" );
},
"<?php _e( 'Cancel', 'autoptimize' ); ?>": function() {
jQuery( this ).dialog( "close" );
}
}
});
}
function removeRow(idToRemove) {
splits=idToRemove.split(/_/);
crit_type=splits[0];
crit_item=splits[1];
crit_key=Object.keys(critCssArray[crit_type])[crit_item-1];
crit_file=critCssArray[crit_type][crit_key].file;
delete critCssArray[crit_type][crit_key];
var data = {
'action': 'rm_critcss',
'critcss_rm_nonce': '<?php echo wp_create_nonce( 'rm_critcss_nonce' ); ?>',
'cachebustingtimestamp': new Date().getTime(),
'critcssfile': crit_file
};
jQuery.ajaxSetup({
async: false
});
jQuery.post(ajaxurl, data, function(response) {
response_array=JSON.parse(response);
if (response_array["code"]!=200) {
// not displaying notice, as the end result is OK; the file isn't there
// displayNotice(response_array["string"]);
}
});
}
function removeAllCcssFilesOnServer() {
var data = {
'action': 'rm_critcss_all',
'critcss_rm_all_nonce': '<?php echo wp_create_nonce( 'rm_critcss_all_nonce' ); ?>',
'cachebustingtimestamp': new Date().getTime()
};
jQuery.ajaxSetup({
async: false
});
jQuery.post(ajaxurl, data, function(response) {
response_array=JSON.parse(response);
if (response_array["code"]!=200) {
// not displaying notice, as the end result is OK; the file isn't there
// displayNotice(response_array["string"]);
}
});
}
function addEditRow(idToEdit) {
resetForm();
if (idToEdit) {
dialogTitle="<?php _e( 'Edit Critical CSS Rule', 'autoptimize' ); ?>";
splits=idToEdit.split(/_/);
crit_type=splits[0];
crit_item=splits[1];
crit_key=Object.keys(critCssArray[crit_type])[crit_item-1];
crit_file=critCssArray[crit_type][crit_key].file;
jQuery("#critcss_addedit_id").val(idToEdit);
jQuery("#critcss_addedit_type").val(crit_type);
jQuery("#critcss_addedit_file").val(crit_file);
jQuery("#critcss_addedit_css").attr("placeholder", "<?php _e( 'Loading critical CSS...', 'autoptimize' ); ?>");
jQuery("#critcss_addedit_type").attr("disabled",true);
if (crit_type==="paths") {
jQuery("#critcss_addedit_path").val(crit_key);
jQuery("#critcss_addedit_path_wrapper").show();
jQuery("#critcss_addedit_pagetype_wrapper").hide();
} else {
jQuery("#critcss_addedit_pagetype").val(crit_key);
jQuery("#critcss_addedit_pagetype_wrapper").show();
jQuery("#critcss_addedit_path_wrapper").hide();
}
var data = {
'action': 'fetch_critcss',
'critcss_fetch_nonce': '<?php echo wp_create_nonce( 'fetch_critcss_nonce' ); ?>',
'cachebustingtimestamp': new Date().getTime(),
'critcssfile': crit_file
};
jQuery.post(ajaxurl, data, function(response) {
response_array=JSON.parse(response);
if (response_array["code"]==200) {
jQuery("#critcss_addedit_css").val(response_array["string"]);
} else {
jQuery("#critcss_addedit_css").attr("placeholder", "").focus();
}
});
} else {
dialogTitle="<?php _e( 'Add Critical CSS Rule', 'autotimize' ); ?>";
// default: paths, hide content type field
jQuery("#critcss_addedit_type").val("paths");
jQuery("#critcss_addedit_pagetype_wrapper").hide();
// event handler on type to switch display
jQuery("#critcss_addedit_type").on('change', function (e) {
if(this.value==="types") {
jQuery("#critcss_addedit_pagetype_wrapper").show();
jQuery("#critcss_addedit_path_wrapper").hide();
jQuery("#critcss_addedit_css").attr("placeholder", "<?php _e( 'For type based rules, paste your specific and minified critical CSS here and hit submit to save. If you want to create a rule to exclude from critical CSS injection, enter \"none\".', 'autoptimize' ); ?>");
} else {
jQuery("#critcss_addedit_path_wrapper").show();
jQuery("#critcss_addedit_pagetype_wrapper").hide();
jQuery("#critcss_addedit_css").attr("placeholder", "<?php _e( 'For path based rules, paste your specific and minified critical CSS here or leave this empty to fetch it from criticalcss.com and hit submit to save. If you want to create a rule to exclude from critical CSS injection, enter \"none\"', 'autoptimize' ); ?>");
}
});
}
jQuery("#addEditCritCss").dialog({
autoOpen: true,
height: 500,
width: 700,
title: dialogTitle,
modal: true,
buttons: {
"<?php _e( 'Submit', 'autoptimize' ); ?>": function() {
rpath = jQuery("#critcss_addedit_path").val();
rtype = jQuery("#critcss_addedit_pagetype option:selected").val();
rccss = jQuery("#critcss_addedit_css").val();
console.log('rpath: ' + rpath, 'rtype: ' + rtype, 'rccss: ' + rccss);
if (rpath === '' && rtype === '') {
alert('<?php _e( "RULE VALIDATION ERROR!\\n\\nBased on your rule type, you SHOULD set a path or conditional tag.", 'autoptimize' ); ?>');
} else if (rtype !== '' && rccss == '') {
alert('<?php _e( "RULE VALIDATION ERROR!\\n\\nType based rules REQUIRES a minified critical CSS.", 'autoptimize' ); ?>');
} else {
saveEditCritCss();
jQuery(this).dialog('close');
}
},
"<?php _e( 'Cancel', 'autoptimize' ); ?>": function() {
resetForm();
jQuery(this).dialog("close");
}
}
});
}
function editDefaultCritCss(){
document.getElementById("dummyDefault").value=document.getElementById("autoptimize_css_defer_inline").value;
jQuery("#default_critcss_wrapper").dialog({
autoOpen: true,
height: 505,
width: 700,
title: "<?php _e( 'Default Critical CSS', 'autoptimize' ); ?>",
modal: true,
buttons: {
"<?php _e( 'Submit', 'autoptimize' ); ?>": function() {
document.getElementById("autoptimize_css_defer_inline").value=document.getElementById("dummyDefault").value;
jQuery("#unSavedWarning").show();
jQuery("#default_critcss_wrapper").dialog( "close" );
},
"<?php _e( 'Cancel', 'autoptimize' ); ?>": function() {
jQuery("#default_critcss_wrapper").dialog( "close" );
}
}
});
}
function editAdditionalCritCss(){
document.getElementById("dummyAdditional").value=document.getElementById("autoptimize_ccss_additional").value;
jQuery("#additional_critcss_wrapper").dialog({
autoOpen: true,
height: 505,
width: 700,
title: "<?php _e( 'Additional Critical CSS', 'autoptimize' ); ?>",
modal: true,
buttons: {
"<?php _e( 'Submit', 'autoptimize' ); ?>": function() {
document.getElementById("autoptimize_ccss_additional").value=document.getElementById("dummyAdditional").value;
jQuery("#unSavedWarning").show();
jQuery("#additional_critcss_wrapper").dialog( "close" );
},
"<?php _e( 'Cancel', 'autoptimize' ); ?>": function() {
jQuery("#additional_critcss_wrapper").dialog( "close" );
}
}
});
}
function saveEditCritCss(){
critcssfile=jQuery("#critcss_addedit_file").val();
critcsscontents=jQuery("#critcss_addedit_css").val();
critcsstype=jQuery("#critcss_addedit_type").val();
critcssid=jQuery("#critcss_addedit_id").val();
if (critcssid) {
// this was an "edit" action, so remove original
// will also remove the file, but that will get rewritten anyway
removeRow(critcssid);
}
if (critcsstype==="types") {
critcsstarget=jQuery("#critcss_addedit_pagetype").val();
} else {
critcsstarget=jQuery("#critcss_addedit_path").val();
}
if (!critcssfile && !critcsscontents) {
critcssfile=0;
} else if (!critcssfile && critcsscontents) {
critcssfile="ccss_" + md5(critcsscontents+critcsstarget) + ".css";
}
// Compose the rule object
critCssArray[critcsstype][critcsstarget]={};
critCssArray[critcsstype][critcsstarget].hash=0;
critCssArray[critcsstype][critcsstarget].file=critcssfile;
<?php
if ( $ao_ccss_debug ) {
echo "console.log('[RULE PROPERTIES] Type:', critcsstype, ', Target:', critcsstarget, ', Hash:', 0, ', File:', critcssfile);";
}
?>
updateAfterChange();
var data = {
'action': 'save_critcss',
'critcss_save_nonce': '<?php echo wp_create_nonce( 'save_critcss_nonce' ); ?>',
'critcssfile': critcssfile,
'critcsscontents': critcsscontents
};
jQuery.post(ajaxurl, data, function(response) {
response_array=JSON.parse(response);
if (response_array["code"]!=200) {
displayNotice(response_array["string"]);
}
});
}
function updateAfterChange() {
document.getElementById("critCssOrigin").value=JSON.stringify(critCssArray);
drawTable(critCssArray);
jQuery("#unSavedWarning").show();
document.getElementById('ao_title_and_button').scrollIntoView();
}
function displayNotice(textIn) {
jQuery('<div class="error notice is-dismissable"><p>'+textIn+'</p></div>').insertBefore("#unSavedWarning");
}
function resetForm() {
jQuery("#critcss_addedit_css").attr("placeholder", "<?php _e( 'For path based rules, paste your specific and minified critical CSS here or leave this empty to fetch it from criticalcss.com and hit submit to save. If you want to create a rule to exclude from critical CSS injection, enter \"none\"', 'autoptimize' ); ?>");
jQuery("#critcss_addedit_type").attr("disabled",false);
jQuery("#critcss_addedit_path_wrapper").show();
jQuery("#critcss_addedit_id").val("");
jQuery("#critcss_addedit_path").val("");
jQuery("#critcss_addedit_file").val("");
jQuery("#critcss_addedit_pagetype").val("");
jQuery("#critcss_addedit_css").val("");
}

View File

@@ -0,0 +1,207 @@
<?php
/**
* Render the rules panel.
*/
/**
* Main function to render the rules panel.
*/
function ao_ccss_render_rules() {
// Attach required arrays.
global $ao_ccss_rules;
global $ao_ccss_types;
?>
<ul id="rules-panel">
<li class="itemDetail">
<h2 class="itemTitle"><?php _e( 'Rules', 'autoptimize' ); ?></h2>
<!-- BEGIN Rule dialogs -->
<!-- Unsaved dialog -->
<div id="unSavedWarning" class="hidden updated settings-error notice notice-warning is-dismissible">
<p><?php _e( "<strong>Rules or Queue changed!</strong> Don't forget to save your changes!", 'autoptimize' ); ?></p>
</div>
<!-- Create/edit rule dialog -->
<div id="addEditCritCss" class="hidden">
<table class="form-table rules">
<tr id="critcss_addedit_type_wrapper">
<th scope="row">
<?php _e( 'Rule Type', 'autoptimize' ); ?>
</th>
<td>
<select id="critcss_addedit_type" style="width:100%;">
<option value="paths"><?php _e( 'Path', 'autoptimize' ); ?></option>
<option value="types"><?php _e( 'Conditional Tag', 'autoptimize' ); ?></option>
</select>
</td>
</tr>
<tr id="critcss_addedit_path_wrapper">
<th scope="row">
<?php _e( 'String in Path', 'autoptimize' ); ?>
</th>
<td>
<input type="text" id="critcss_addedit_path" placeholder="<?php _e( "Enter a part of the URL that identifies the page(s) you're targetting.", 'autoptimize' ); ?>" style="width:100%;" value="">
</td>
</tr>
<tr id="critcss_addedit_pagetype_wrapper">
<th scope="row">
<?php _e( 'Conditional Tag, Custom Post Type or Page Template', 'autoptimize' ); ?>
</th>
<td>
<select id="critcss_addedit_pagetype" style="width:100%;">
<option value="" disabled selected><?php _e( 'Select from the list below...', 'autoptimize' ); ?></option>
<optgroup label="<?php _e( 'Standard Conditional Tags', 'autoptimize' ); ?>">
<?php
// Render grouped simple conditional tags.
foreach ( $ao_ccss_types as $ctag ) {
$optgrp = substr( $ctag, 0, 3 );
if ( substr( $ctag, 0, 3 ) === 'is_' ) {
echo '<option value="' . $ctag . '">' . $ctag . '</option>';
}
$prevgrp = substr( $ctag, 0, 3 );
}
// Render grouped custom post types, templates and specific conditional tags.
foreach ( $ao_ccss_types as $type ) {
$optgrp = substr( $type, 0, 3 );
// Option groups labels.
if ( $optgrp !== $prevgrp && 'is_' !== $optgrp ) {
?>
</optgroup>
<?php
if ( substr( $type, 0, 12 ) === 'custom_post_' ) {
?>
<optgroup label="<?php _e( 'Custom Post Types', 'autoptimize' ); ?>">
<?php
} elseif ( substr( $type, 0, 9 ) === 'template_' ) {
?>
<optgroup label="<?php _e( 'Page Templates', 'autoptimize' ); ?>">
<?php
} elseif ( substr( $type, 0, 4 ) === 'bbp_' ) {
?>
<optgroup label="<?php _e( 'BBPress Conditional Tags', 'autoptimize' ); ?>">
<?php
} elseif ( substr( $type, 0, 3 ) === 'bp_' ) {
?>
<optgroup label="<?php _e( 'BuddyPress Conditional Tags', 'autoptimize' ); ?>">
<?php
} elseif ( substr( $type, 0, 4 ) === 'edd_' ) {
?>
<optgroup label="<?php _e( 'Easy Digital Downloads Conditional Tags', 'autoptimize' ); ?>">
<?php
} elseif ( substr( $type, 0, 4 ) === 'woo_' ) {
?>
<optgroup label="<?php _e( 'WooCommerce Conditional Tags', 'autoptimize' ); ?>">
<?php
}
}
// Options.
if ( 'is_' !== $optgrp ) {
// Remove prefix from custom post types, templates and some specific conditional tags.
if ( substr( $type, 0, 12 ) === 'custom_post_' ) {
$_type = str_replace( 'custom_post_', '', $type );
} elseif ( substr( $type, 0, 9 ) === 'template_' ) {
$_type = str_replace( 'template_', '', $type );
} elseif ( 'bbp_is_bbpress' == $type ) {
$_type = str_replace( 'bbp_', '', $type );
} elseif ( 'bp_is_buddypress' == $type ) {
$_type = str_replace( 'bp_', '', $type );
} elseif ( substr( $type, 0, 4 ) === 'woo_' ) {
$_type = str_replace( 'woo_', '', $type );
} elseif ( substr( $type, 0, 4 ) === 'edd_' ) {
$_type = str_replace( 'edd_', '', $type );
} else {
$_type = $type;
}
echo '<option value="' . $type . '">' . $_type . '</option>';
$prevgrp = $optgrp;
}
}
?>
</optgroup>
</select>
</td>
</tr>
<tr>
<th scope="row">
<?php _e( 'Custom Critical CSS', 'autoptimize' ); ?>
</th>
<td>
<textarea id="critcss_addedit_css" rows="13" cols="10" style="width:100%;" placeholder="<?php _e( 'Paste your specific critical CSS here and hit submit to save.', 'autoptimize' ); ?>"></textarea>
<input type="hidden" id="critcss_addedit_file">
<input type="hidden" id="critcss_addedit_id">
</td>
</tr>
</table>
</div>
<!-- Remove dialog -->
<div id="confirm-rm" title="<?php _e( 'Delete Rule', 'autoptimize' ); ?>" class="hidden">
<p><?php _e( 'This Critical CSS rule will be deleted immediately and cannot be recovered.<br /><br /><strong>Are you sure?</strong>', 'autoptimize' ); ?></p>
</div>
<!-- Remove All dialog -->
<div id="confirm-rm-all" title="<?php _e( 'Delete all Rules and Jobs', 'autoptimize' ); ?>" class="hidden">
<p><?php _e( 'All Critical CSS rules will be deleted immediately and cannot be recovered.<br /><br /><strong>Are you sure?</strong>', 'autoptimize' ); ?></p>
</div>
<!-- Add/edit default critical CSS dialog -->
<div id="default_critcss_wrapper" class="hidden">
<textarea id="dummyDefault" rows="19" cols="10" style="width:100%;" placeholder="<?php _e( 'Paste your MINIFIED default critical CSS here and hit submit to save. This is the critical CSS to be used for every page NOT MATCHING any rule.', 'autoptimize' ); ?>"></textarea>
</div>
<!-- Add/edit additional critical CSS dialog -->
<div id="additional_critcss_wrapper" class="hidden">
<textarea id="dummyAdditional" rows="19" cols="10" style="width:100%;" placeholder="<?php _e( 'Paste your MINIFIED additional critical CSS here and hit submit to save. This is the CSS to be added AT THE END of every critical CSS provided by a matching rule, or the default one.', 'autoptimize' ); ?>"></textarea>
</div>
<!-- Wrapper for in screen notices -->
<div id="rules-notices"></div>
<!-- END Rule add/edit dialogs -->
<!-- BEGIN Rules UI -->
<div class="howto">
<div class="title-wrap">
<h4 class="title"><?php _e( 'How To Use Autoptimize CriticalCSS Power-Up Rules', 'autoptimize' ); ?></h4>
<p class="subtitle"><?php _e( 'Click the side arrow to toggle instructions', 'autoptimize' ); ?></p>
</div>
<button type="button" class="toggle-btn">
<span class="toggle-indicator dashicons dashicons-arrow-up dashicons-arrow-down"></span>
</button>
<div class="howto-wrap hidden">
<p><?php _e( "TL;DR:<br />Critical CSS files from <span class='badge auto'>AUTO</span> <strong>rules are updated automatically</strong> while from <span class='badge manual'>MANUAL</span> <strong>rules are not.</strong>", 'autoptimize' ); ?></p>
<ol>
<li><?php _e( 'When a valid <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> API key is in place, Autoptimize CriticalCSS Power-Up starts to operate <strong>automatically</strong>.', 'autoptimize' ); ?></li>
<li><?php _e( 'Upon a request to any of the frontend pages made by a <strong>not logged in user</strong>, it will <strong>asynchronously</strong> fetch and update the critical CSS from <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for conditional tags you have on your site (e.g. is_page, is_single, is_archive etc.)', 'autoptimize' ); ?></li>
<li><?php _e( 'These requests also creates an <span class="badge auto">AUTO</span> rule for you. The critical CSS files from <span class="badge auto">AUTO</span> <strong>rules are updated automatically</strong> when a CSS file in your theme or frontend plugins changes.', 'autoptimize' ); ?></li>
<li><?php _e( 'If you want to make any fine tunning in the critical CSS file of an <span class="badge auto">AUTO</span> rule, click on "Edit" button of that rule, change what you need, submit and save it. The rule you\'ve just edited becomes a <span class="badge manual">MANUAL</span> rule then.', 'autoptimize' ); ?></li>
<li><?php _e( 'You can create <span class="badge manual">MANUAL</span> rules for specific page paths (URL). Longer, more specific paths have higher priority over shorter ones, which in turn have higher priority over <span class="badge auto">AUTO</span> rules. Also, critical CSS files from <span class="badge manual">MANUAL</span> <strong>rules are NEVER updated automatically.</strong>', 'autoptimize' ); ?></li>
<li><?php _e( 'You can also create an <span class="badge auto">AUTO</span> rule for a path by leaving its critical CSS content empty. The critical CSS for that path will be automatically fetched from <a href="https://criticalcss.com/?aff=1" target="_blank">criticalcss.com</a> for you and updated whenever it changes.', 'autoptimize' ); ?></li>
<li><?php _e( "If you see an <span class='badge auto'>AUTO</span> rule with a <span class='badge review'>R</span> besides it (R is after REVIEW), it means that the fetched critical CSS for that rule is not 100% garanteed to work according to <a href='https://criticalcss.com/?aff=1' target='_blank'>criticalcss.com</a> analysis. It's advised that you edit and review that rule to make any required adjustments.", 'autoptimize' ); ?></li>
<li><?php _e( 'At any time you can delete an <span class="badge auto">AUTO</span> or <span class="badge manual">MANUAL</span> rule by cliking on "Remove" button of the desired rule and saving your changes.', 'autoptimize' ); ?></li>
</ol>
</div>
</div>
<textarea id="autoptimize_css_defer_inline" name="autoptimize_css_defer_inline" rows="19" cols="10" style="width:100%;"><?php echo get_option( 'autoptimize_css_defer_inline', '' ); ?></textarea>
<textarea id="autoptimize_ccss_additional" name="autoptimize_ccss_additional" rows="19" cols="10" style="width:100%;"><?php echo get_option( 'autoptimize_ccss_additional', '' ); ?></textarea>
<table class="rules-list" cellspacing="0"><tbody id="rules-list"></tbody></table>
<input class="hidden" type="text" id="critCssOrigin" name="autoptimize_ccss_rules" value='<?php echo ( json_encode( $ao_ccss_rules, JSON_FORCE_OBJECT ) ); ?>'>
<div class="submit rules-btn">
<div class="alignleft">
<span id="addCritCssButton" class="button-secondary"><?php _e( 'Add New Rule', 'autoptimize' ); ?></span>
<span id="editDefaultButton" class="button-secondary"><?php _e( 'Edit Default Rule CSS', 'autoptimize' ); ?></span>
<span id="editAdditionalButton" class="button-secondary"><?php _e( 'Add CSS To All Rules', 'autoptimize' ); ?></span>
</div>
<div class="alignright">
<span id="removeAllRules" class="button-secondary" style="color:red;"><?php _e( 'Remove all rules', 'autoptimize' ); ?></span>
</div>
</div>
<!-- END Rules UI -->
</li>
</ul>
<?php
}
?>

View File

@@ -0,0 +1,253 @@
/* form */
.itemTitle {
margin: 0;
}
.itemTitle.fleft {
float: left;
}
.toggle-btn {
float: right;
position: relative;
top: -10px;
width: 36px;
height: 36px;
margin: 0;
padding: 0;
border: 0;
background: 0 0;
cursor: pointer;
outline: none;
}
.toggle-indicator {
color: #72777c;
display: inline-block;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-decoration: none!important;
outline: none;
}
.itemDetail {
background: #fff;
border: 1px solid #ccc;
padding: 15px;
margin: 15px 10px 10px 0;
min-height: 15px;
word-break: break-word;
}
.collapsible {
clear: both;
}
.howto {
margin: 10px 0 0;
padding: 2px 10px;
min-height: 45px;
font-style: normal;
border-left: solid;
border-left-width: 5px;
border-left-color: #00a0d2;
background-color: white;
}
.howto .title-wrap {
float: left;
margin: 5px 0 15px;
}
.howto .title {
margin: 0;
}
.howto .subtitle {
margin: 0;
padding: 0;
font-weight: 100;
font-style: italic;
color: #72777c;
}
.howto .toggle-btn {
top: -4px;
left: 10px;
}
.howto-wrap {
clear: both;
width: 100%;
}
.form-table {
margin-top: 20px;
}
.form-table tr {
vertical-align: top;
}
.form-table p.notes,
.form-table p code {
font-size: 12px !important;
}
.form-table p.notes {
color: #666;
}
.form-table.rules {
margin-top: 0;
}
.form-table.rules th {
width: 175px;
}
.ui-dialog .form-table.rules th,
.ui-dialog .form-table.rules td {
padding: 5px 0px;
}
.rules-list {
width: 100%;
margin-bottom: 10px;
}
.rules-list tr.header th {
background-color: #f1f1f1;
}
.rules-list tbody .rule:nth-child(even) td {
background-color: #f9f9f9;
}
#rules-list,
#queue {
margin-bottom: 20px;
}
#rules-list h4 {
margin: 20px 0 10px;
font-size: 1.2em;
}
#rules-list .header th,
#rules-list .rule td {
padding: 4px;
}
#rules-list .rule td {
margin: 0;
border-bottom: 1px solid #ccc;
}
#rules-list .type {
width: 80px;
}
#rules-list .btn {
width: 55px;
}
#rules-list .rule td.btn {
width: 70px;
padding: 4px 0 4px 2px;
}
.badge {
padding: 0 5px;
color: #fff;
background-color: #00a0d2;
border-radius: 5px;
font-size: .8em;
font-weight: bold;
text-align: center;
}
.badge.manual {
background-color: #46b450;
}
#rules-list .btn span {
width: 67px;
text-align: center;
}
p.rules-btn {
margin: 20px 0 0;
padding: 0;
}
.queue {
table-layout: fixed;
border-collapse: collapse;
}
.queue .job td {
border-bottom: 1px solid #ccc;
}
.queue .status,
.queue .job td.status {
width: 45px;
}
.queue td.status {
text-align: center;
}
.queue .badge {
border-radius: 3px;
cursor: default;
}
.badge.new {
background-color: #666;
}
.badge.pending {
background-color: #00a0d2;
}
.badge.done {
background-color: #46b450;
}
.badge.review {
background-color: #ffb900;
}
.badge.review.rule {
margin-left: 2px;
}
.badge.error {
background-color: #dc3232;
}
.badge.unknown {
color: #666;
background-color: #ccc;
}
.queue .btn {
width: 86px;
}
.queue .button-secondary {
line-height: 17px;
height: 19px;
padding: 0 2px;
font-size: 8pt;
}
.queue .button-secondary.to-right {
margin-left: 2px;
}
.queue .button-secondary a {
color: #555;
text-decoration: none;
}
.queue .button-secondary a:hover {
color: #23282d;
}
.queue .button-secondary .dashicons {
position: relative;
top: 1px;
font-size: 15px;
}
p.submit.left {
float: left;
}
#importSettingsForm {
float: right;
text-align: left;
max-width: 100%;
margin-top: 20px;
padding-top: 10px;
position: relative;
overflow: hidden;
}
#settingsfile {
padding: 0 2px;
}
#settingsfile {
padding: 0 2px;
}
/* debug block */
#debug {
clear: both;
}
#debug .debug th,
#debug .debug td {
padding: 5px 10px;
font-size: 13px;
}
#debug pre {
margin: 0 0 1em;
font-size: 12px;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
white-space: pre-wrap;
}
#explain-panel p {
font-size:120%
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

View File

@@ -0,0 +1,40 @@
/* tables */
table.tablesorter {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
margin: 30px 0 5px;
font-size: 8pt;
width: 100%;
text-align: left;
}
table.tablesorter thead tr th,
table.tablesorter tfoot tr th {
background-color: #f1f1f1;
font-size: 8pt;
padding: 2px;
}
table.tablesorter thead tr .header {
background-image: url(bg.gif);
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
table.tablesorter tbody td {
color: #444;
padding: 4px;
background-color: #fff;
vertical-align: middle;
}
table.tablesorter tbody tr.even td,
table.tablesorter tbody tr:nth-child(even) td {
background-color: #f9f9f9;
}
table.tablesorter thead tr .headerSortUp {
background-image: url(asc.gif);
}
table.tablesorter thead tr .headerSortDown {
background-image: url(desc.gif);
}
table.tablesorter thead tr .headerSortDown,
table.tablesorter thead tr .headerSortUp {
background-color: #ccc;
}

View File

@@ -0,0 +1,11 @@
// Toggle button control for collapsible elements
jQuery(".toggle-btn").click(function () {
$header = jQuery(this);
$content = $header.next();
$content.slideToggle(250, "swing", function () {
jQuery("span.toggle-indicator", $header).toggleClass('dashicons-arrow-down');
});
});
// Attach an event to export buttons
jQuery("#exportSettings").click(function(){exportSettings();});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
!function(n){"use strict";function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(n,t){return n<<t|n>>>32-t}function e(n,e,o,u,c,f){return t(r(t(t(e,n),t(u,f)),c),o)}function o(n,t,r,o,u,c,f){return e(t&r|~t&o,n,t,u,c,f)}function u(n,t,r,o,u,c,f){return e(t&o|r&~o,n,t,u,c,f)}function c(n,t,r,o,u,c,f){return e(t^r^o,n,t,u,c,f)}function f(n,t,r,o,u,c,f){return e(r^(t|~o),n,t,u,c,f)}function i(n,r){n[r>>5]|=128<<r%32,n[14+(r+64>>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e<n.length;e+=16)i=l,a=g,d=v,h=m,g=f(g=f(g=f(g=f(g=c(g=c(g=c(g=c(g=u(g=u(g=u(g=u(g=o(g=o(g=o(g=o(g,v=o(v,m=o(m,l=o(l,g,v,m,n[e],7,-680876936),g,v,n[e+1],12,-389564586),l,g,n[e+2],17,606105819),m,l,n[e+3],22,-1044525330),v=o(v,m=o(m,l=o(l,g,v,m,n[e+4],7,-176418897),g,v,n[e+5],12,1200080426),l,g,n[e+6],17,-1473231341),m,l,n[e+7],22,-45705983),v=o(v,m=o(m,l=o(l,g,v,m,n[e+8],7,1770035416),g,v,n[e+9],12,-1958414417),l,g,n[e+10],17,-42063),m,l,n[e+11],22,-1990404162),v=o(v,m=o(m,l=o(l,g,v,m,n[e+12],7,1804603682),g,v,n[e+13],12,-40341101),l,g,n[e+14],17,-1502002290),m,l,n[e+15],22,1236535329),v=u(v,m=u(m,l=u(l,g,v,m,n[e+1],5,-165796510),g,v,n[e+6],9,-1069501632),l,g,n[e+11],14,643717713),m,l,n[e],20,-373897302),v=u(v,m=u(m,l=u(l,g,v,m,n[e+5],5,-701558691),g,v,n[e+10],9,38016083),l,g,n[e+15],14,-660478335),m,l,n[e+4],20,-405537848),v=u(v,m=u(m,l=u(l,g,v,m,n[e+9],5,568446438),g,v,n[e+14],9,-1019803690),l,g,n[e+3],14,-187363961),m,l,n[e+8],20,1163531501),v=u(v,m=u(m,l=u(l,g,v,m,n[e+13],5,-1444681467),g,v,n[e+2],9,-51403784),l,g,n[e+7],14,1735328473),m,l,n[e+12],20,-1926607734),v=c(v,m=c(m,l=c(l,g,v,m,n[e+5],4,-378558),g,v,n[e+8],11,-2022574463),l,g,n[e+11],16,1839030562),m,l,n[e+14],23,-35309556),v=c(v,m=c(m,l=c(l,g,v,m,n[e+1],4,-1530992060),g,v,n[e+4],11,1272893353),l,g,n[e+7],16,-155497632),m,l,n[e+10],23,-1094730640),v=c(v,m=c(m,l=c(l,g,v,m,n[e+13],4,681279174),g,v,n[e],11,-358537222),l,g,n[e+3],16,-722521979),m,l,n[e+6],23,76029189),v=c(v,m=c(m,l=c(l,g,v,m,n[e+9],4,-640364487),g,v,n[e+12],11,-421815835),l,g,n[e+15],16,530742520),m,l,n[e+2],23,-995338651),v=f(v,m=f(m,l=f(l,g,v,m,n[e],6,-198630844),g,v,n[e+7],10,1126891415),l,g,n[e+14],15,-1416354905),m,l,n[e+5],21,-57434055),v=f(v,m=f(m,l=f(l,g,v,m,n[e+12],6,1700485571),g,v,n[e+3],10,-1894986606),l,g,n[e+10],15,-1051523),m,l,n[e+1],21,-2054922799),v=f(v,m=f(m,l=f(l,g,v,m,n[e+8],6,1873313359),g,v,n[e+15],10,-30611744),l,g,n[e+6],15,-1560198380),m,l,n[e+13],21,1309151649),v=f(v,m=f(m,l=f(l,g,v,m,n[e+4],6,-145523070),g,v,n[e+11],10,-1120210379),l,g,n[e+2],15,718787259),m,l,n[e+9],21,-343485551),l=t(l,i),g=t(g,a),v=t(v,d),m=t(m,h);return[l,g,v,m]}function a(n){var t,r="",e=32*n.length;for(t=0;t<e;t+=8)r+=String.fromCharCode(n[t>>5]>>>t%32&255);return r}function d(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var e=8*n.length;for(t=0;t<e;t+=8)r[t>>5]|=(255&n.charCodeAt(t/8))<<t%32;return r}function h(n){return a(i(d(n),8*n.length))}function l(n,t){var r,e,o=d(n),u=[],c=[];for(u[15]=c[15]=void 0,o.length>16&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(d(t)),512+8*t.length),a(i(c.concat(e),640))}function g(n){var t,r,e="";for(r=0;r<n.length;r+=1)t=n.charCodeAt(r),e+="0123456789abcdef".charAt(t>>>4&15)+"0123456789abcdef".charAt(15&t);return e}function v(n){return unescape(encodeURIComponent(n))}function m(n){return h(v(n))}function p(n){return g(m(n))}function s(n,t){return l(v(n),v(t))}function C(n,t){return g(s(n,t))}function A(n,t,r){return t?r?s(t,n):C(t,n):r?m(n):p(n)}"function"==typeof define&&define.amd?define(function(){return A}):"object"==typeof module&&module.exports?module.exports=A:n.md5=A}(this);
//# sourceMappingURL=md5.min.js.map