<?php
add_filter( 'wp_enqueue_scripts', 'my_add_freemium_indicator' );
function my_add_freemium_indicator() {
	if ( !is_user_logged_in() )
		return;
		
	?>
		<script>
		// START JAVASCRIPT
		document.addEventListener("DOMContentLoaded", function(event) {				
			jQuery(document).on( 'nfFormReady', function( e, layoutView ) {
				add_freemium_indicator();
				nfRadio.channel( 'nfMP' ).on('change:part', function() {					
					add_freemium_indicator();	
				});				
			});
		});
			
		function add_freemium_indicator() {
			console.log('adding indicator...');
			let ninja_page_id = jQuery('#ninja-page-id')[0].value;
			if( ninja_page_id == -1 ) {
				let textContent = jQuery('#nf-label-class-field-101-0')[0].textContent;
				jQuery('#nf-label-class-field-101-0')[0].textContent = textContent + ' (Premium)';
				let textContent2 = jQuery('#nf-label-class-field-101-1')[0].textContent;
				jQuery('#nf-label-class-field-101-1')[0].textContent = textContent2 + ' (Free/Premium)';
			}
		}
		// END JAVASCRIPT
		</script>
	<?php
}