// Script that disables url/homepage changes from settings -> general.
jQuery(document).ready(function ()
{
    if(window.location.href.includes("wp-admin/options-general.php"))
    {
    //grab jQuery references
        let url_input = jQuery('#siteurl');
        let home_input = jQuery("#home");

    //make fields read-only
        url_input.prop('readonly', true);
        home_input.prop('readonly', true);

    //add notice for dev sites
        var devIndicators = ["iodemosite", "dev.rental.software"];
        if (devIndicators.some(function(domain) {
            return url_input.val().includes(domain) || home_input.val().includes(domain);
        }))
        {
            jQuery("#home-description").text("If you're looking to launch your website, please contact the Inflatable Office support team.");
        }

    //grab page load field values
        const original_site_value = url_input.val();
        const original_home_value = home_input.val();

    //revert changed values to page load values
        setInterval(function ()
        {
            if (jQuery('#siteurl').val() !== original_site_value)
            {
                jQuery('#siteurl').val(original_site_value);
            }
            if (jQuery('#home').val() !== original_home_value)
            {
                jQuery('#home').val(original_home_value);
            }
        }, 100);
    }
});