(function ( $ ) { 'use strict'; /** * Custom post status */ $( window ).load( function() { var html = ''; var label = false; var $odinMeta = document.querySelectorAll( 'meta.odin-custom-status-meta' ); Array.prototype.forEach.call( $odinMeta, function( item ) { var $meta = $( item ); var args = $.parseJSON( $meta.attr( 'value' ) ); if( $( document.body ).hasClass( 'post-php' ) || $( document.body ).hasClass( 'post-new-php' ) ) { var select = ''; if( args.select ) { select = 'selected="selected"'; label = ' ' + $.trim( args.appliedLabel ) + ''; } html += ''; } if( $( document.body ).hasClass( 'edit-php' ) ) { html += ''; } }); if( $( document.body ).hasClass( 'post-php' ) || $( document.body ).hasClass( 'post-new-php' ) ) { $( '#post_status ').append( html ); if( label ) { $( 'label[for="post_status"]' ).append( label ); } } if( $( document.body ).hasClass( 'edit-php' ) ) { var $inlineStatus = document.querySelectorAll( '.inline-edit-status select' ); Array.prototype.forEach.call( $inlineStatus, function( item ) { $( item ).append( html ); }); } }); }( jQuery ));