HEX
Server: LiteSpeed
System: Linux sinope.sitehostingserver.com 5.14.0-611.49.2.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 30 09:05:08 EDT 2026 x86_64
User: aprilnet (1155)
PHP: 8.2.33
Disabled: popen,imap_mail,exec,passthru,system,shell_exec,proc_open,pcntl_exec,eval,allow_url_fopen,allow_url_include,mail,proc_get_status,get_cfg_var,disk_free_space,disk_total_space,diskfreespace,getmygid,getmyinode,getmypid,geymyuid,proc_nice,proc_terminate,proc_close,apache_child_terminate,chown,lchgrp,lchown,link,readlink,highlight_file,show_source,php_strip_whitespace,get_meta_tags,dl,leak,pfsockopen,event_new,pcntl_signal,pcntl_alarm,register_tick_function,apache_setenv,define_syslog_variables,escapeshellarg,escapeshellcmd,ini_alter,ini_restore,inject_code,openlog,syslog,xmlrpc_entity_decode,phpAds_remoteInfo,phpAds_XmlRpc,phpAds_xmlrpcDecode,phpAds_xmlrpcEncode,chgrp,php_eval,safe_dir,root,ftok,egy_perl,symlink,wscript
Upload Files
File: /home/aprilnet/public_html/meadcarney.com/wp-content/themes/malina/js/malina-ajaxsearch.js
(function($){    
    $.MalinaAjaxSearch  =  function(options)
    {
       var defaults = {
            delay: 300,                //delay in ms until the user stops typing.
            minChars: 3,               //dont start searching before we got at least that much characters
            scope: 'body'

        }

        this.options = $.extend({}, defaults, options);
        this.scope   = $(this.options.scope);
        this.timer   = false;
        this.lastVal = "";

        this.bind_events();
    }
    $.MalinaAjaxSearch.prototype =
    {
        bind_events: function()
        {   
            this.scope.on('keyup', '#header-s' , $.proxy( this.try_search, this));
        },

        try_search: function(e)
        {
            clearTimeout(this.timer);

            //only execute search if chars are at least "minChars" and search differs from last one
            if(e.currentTarget.value.length >= this.options.minChars && this.lastVal != $.trim(e.currentTarget.value))
            {
                //wait at least "delay" miliseconds to execute ajax. if user types again during that time dont execute
                this.timer = setTimeout($.proxy( this.do_search, this, e), this.options.delay);
            }
        },
        destory_results: function(e){
            var results = $('#header #search-list');
            results.remove();
        },
        do_search: function(e)
        {
            var obj          = this,
                currentField = $(e.currentTarget).attr( "autocomplete", "off" ),
                form         = currentField.parents('form:eq(0)'),
                results      = form.parent().find('#search-list'),
                loading      = $('<div id="ajax_load"><div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div></div>'),
                action       = form.attr('action'),
                values       = form.serialize();
                values      += '&action=malina_ajax_search';

            //check if the form got get parameters applied and also apply them
            if(action.indexOf('?') != -1)
            {
                action  = action.split('?');
                values += "&" + action[1];
            }

            if(e.currentTarget.value.length <= this.options.minChars){
                results.remove();
            }
            if(!$('#search-list').length){
                results = $('<div id="search-list"></div>').appendTo(form.parent());
            }

            //return if we already hit a no result and user is still typing
            if(results.find('.ajax_not_found').length && e.currentTarget.value.indexOf(this.lastVal) != -1) return;

            this.lastVal = e.currentTarget.value;

            $.ajax({
                url: malinaAjaxSearch.ajaxurl,
                type: "POST",
                data:values,
                beforeSend: function()
                {
                    if(!$('#ajax_load').length){
                        loading.appendTo(results);
                    }
                },
                success: function(response)
                {
                    if(response == 0) {
                        response = "";
                    }
                    results.html(response);
                },
                complete: function()
                {
                    loading.remove();
                }
            });
        }
    }
    $(document).ready(function(){
        new $.MalinaAjaxSearch({scope:'#header'});
        $(document).click(function() {
            $('#header #search-list').remove();
        });
    });
})(jQuery);