jQuery(document).ready(function($) {

    // Adds a search icon.
    var searchIcon = '<svg id="icon-search" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><path d="M21 21l-4.35-4.35"></path></svg>';

    $('.search-form input[type="submit"], .wp-block-search__button').replaceWith(function() {
        return '<button type="submit" class="' + $(this).attr('class') + '" aria-label="Search">' + searchIcon + '</button>';
    });
    
    // Sets scroll to top.
    var scroll    = $(window).scrollTop();  
    var scrollup  = $('.to-top');  

    $(window).scroll(function() {
        if ($(this).scrollTop() > 1) {
            scrollup.css({bottom:"25px"});
        } 
        else {
            scrollup.css({bottom:"-100px"});
        }
    });

    scrollup.click(function() {
        $('html, body').animate({scrollTop: '0px'}, 800);
        return false;
    });
    
});