function numberFormat(nStr) { nStr = parseFloat(nStr).toFixed(2); var x = nStr.split('.'); var x1 = x[0]; var x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } function processPostsReport(data) { Object.keys(data).forEach(function(status) { // Update the text of elements matching the class var elements = document.querySelectorAll('.' + status + '-post-count'); elements.forEach(function(element) { element.textContent = ' (' + data[status] + ')'; }); // Handle the 'trash' status specifically if (status === 'trash' && data[status] > 0) { var wrapper = document.querySelector('.post-status-wrapper'); if (wrapper) { wrapper.innerHTML += ' | Trash (' + data[status] + ')'; } } }); } jQuery(function($){ $('.post-status-wrapper a').on('click', function(e){ e.preventDefault(); $('.post-status-wrapper a').removeAttr('data-active'); $(this).attr('data-active', 'true'); $('#post_status').val($(this).data('value')).trigger('change'); }); }); (function() { var supportsPassive = false; try { var opts = Object.defineProperty({}, 'passive', { get: function() { supportsPassive = true; } }); window.addEventListener("testPassive", null, opts); window.removeEventListener("testPassive", null, opts); } catch (e) {} if (!supportsPassive) return; var origAddEventListener = EventTarget.prototype.addEventListener; EventTarget.prototype.addEventListener = function(type, listener, options) { // Only patch touchstart and touchmove if options is not explicitly passive if ( (type === 'touchstart' || type === 'touchmove') && (options === undefined || options === false || (typeof options === 'object' && !options.passive)) ) { options = options || {}; if (typeof options === 'object') { options.passive = true; } } return origAddEventListener.call(this, type, listener, options); }; })();