File: /home/www/web115/wordpress/wp-content/themes/osmosis/includes/js/grve-status.js
jQuery(document).ready(function($) {
"use strict";
var grveAdminStatus = {
init: function() {
$( document.body ).on( 'click', '#grve-copy-for-support', this.copyDebugReport );
$( document.body ).on( 'click', 'a.grve-debug-report', this.generateDebugReport );
},
generateDebugReport: function() {
var report = '';
$( '.grve-status-table thead, .grve-status-table tbody' ).each( function() {
if ( $( this ).is( 'thead' ) ) {
var label = $( this ).find( 'th:eq(0)' ).data( 'export-label' ) || $( this ).text();
report = report + '\n### ' + $.trim( label ) + ' ###\n\n';
} else {
$( 'tr', $( this ) ).each( function() {
var label = $( this ).find( 'td:eq(0)' ).data( 'export-label' ) || $( this ).find( 'td:eq(0)' ).text();
var the_name = $.trim( label ).replace( /(<([^>]+)>)/ig, '' );
// Find value
var $value_html = $( this ).find( 'td:eq(2)' ).clone();
$value_html.find( '.private' ).remove();
$value_html.find( '.dashicons-yes' ).replaceWith( '✔' );
$value_html.find( '.dashicons-no-alt, .dashicons-warning' ).replaceWith( '❌' );
// Format value
var the_value = $.trim( $value_html.text() );
var value_array = the_value.split( ', ' );
if ( value_array.length > 1 ) {
var temp_line ='';
$.each( value_array, function( key, line ) {
temp_line = temp_line + line + '\n';
});
the_value = temp_line;
}
report = report + '' + the_name + ': ' + the_value + '\n';
});
}
});
try {
$( '#grve-debug-report' ).slideDown();
$( '#grve-debug-textarea' ).val( report ).focus().select();
$( this ).fadeOut();
return false;
} catch ( e ) {
console.log( e );
}
},
copyDebugReport: function() {
var debugTextarea = document.getElementById( 'grve-debug-textarea' );
$( debugTextarea ).select();
document.execCommand( 'Copy', false, null );
}
};
grveAdminStatus.init();
});