/**
* This file is enqueued from admin/class-plugin-notes-plus-admin.php
* on the update-core.php page only.
*/
(function($) {
$(document).ready(function () {
$('#update-plugins-table thead tr, #update-plugins-table tfoot tr').append( '
'+ labels.col_title +' | ' );
var notes_for_plugin_updates = $.parseJSON(updates);
var i = 0;
$('#update-plugins-table .plugins tr').each(function() {
var plugin_notes = notes_for_plugin_updates[i];
if (plugin_notes === undefined || plugin_notes.length === 0) {
$(this).append( ''+ labels.no_note +' | ' );
} else {
var values = Object.values(plugin_notes);
var noteMarkup = '';
for (const value of values) {
// Convert time to readable format
var d = new Date(value.time * 1000);
var month = ("0" + (d.getMonth() + 1)).slice(-2);
var date = ("0" + d.getDate()).slice(-2);
var year = d.getFullYear();
var formattedDate = year + '-' + month + '-' + date;
noteMarkup += '
';
noteMarkup += '
';
noteMarkup += value.note;
noteMarkup += '
'+ value.user +' | '+ formattedDate +'
';
noteMarkup += '
';
}
noteMarkup += '
';
$(this).append( ''+ noteMarkup +' | ' );
}
i++;
});
// Add target="_blank" to all links
$('.pnp-plugin-note a').each(function(){
$(this).attr( 'target', '_blank' );
});
});
})(jQuery);