jQuery( document ).ready( function( $ ) {
	"use strict";

	$.ajax( {
		type: 'post',
		url: roxima_NavMenus.ajaxurl,
		data: {
			action: 'roxima_ajax_nav_menus_widgets_links'
		},
		dataType: 'text',
		success : function( response ) {
			// The element's parent is different in nav-menus.php and customize.php
			$( '#menu-item-url-wrap' ).parent().append( response );
		}
	} );

	$( 'body' ).on( 'click', '.roxima-frontpage-widget-links a', function( e ) {
		e.preventDefault();
		$( '#custom-menu-item-url' ).val( $( this ).attr( 'href' ) );
		$( '#custom-menu-item-name' ).val( $( this ).data( 'title' ) );
		$( '.customlinkdiv' ).find( '.submit-add-to-menu' ).trigger( 'click' );
	} );

} );
