Server IP : 85.214.239.14 / Your IP : 3.135.249.76 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 : /proc/2/cwd/proc/2/cwd/proc/3/root/srv/modoboa/instance/sitestatic/js/ |
Upload File : |
(function($) { /** * Return an instance of Sortable. * * @constructor * @param {Object} element - * @param {Object} options - instance options */ var Sortable = function(element, options) { this.initialize(element, options); }; Sortable.prototype = { constructor: Sortable, initialize: function(element, options) { this.$element = $(element); this.options = $.extend({}, $.fn.sortable.defaults, options); this.$element.addClass('sort-header'); this.listen(); }, listen: function() { this.$element.click($.proxy(this.sort, this)); }, change_sort_order: function(e, new_sort_order) { if (new_sort_order != this.$element.attr('data-sort_order')) { this.$element.removeClass('sort-header-desc sort-header-asc'); } }, sort: function(e) { e.preventDefault(); var dir = this.select(); if (this.options.onSortOrderChange) { this.options.onSortOrderChange(this.$element.attr('data-sort_order'), dir); } }, /** * Mark a column as the one used to sort content. * * @this Sortable * @param {string} dir - optional sort direction (up or down) * @return {string} - new sort direction */ select: function(dir) { $("span.sort-selection").remove(); if (dir !== undefined) { this.$element.removeClass("sort-header-" + ((dir == "asc") ? "desc" : "asc")); this.$element.addClass("sort-header-" + dir); } else { if (this.$element.hasClass("sort-header-desc")) { this.$element .removeClass("sort-header-desc") .addClass("sort-header-asc"); dir = "asc"; } else { this.$element .removeClass("sort-header-asc") .addClass("sort-header-desc"); dir = "desc"; } } this.$element.append($("<span/>", { "class": "sort-selection fa fa-chevron-" + ((dir == 'asc') ? 'up' : 'down') })); return dir; } }; $.fn.sortable = function(method) { var args = arguments; return this.each(function() { var $this = $(this), data = $this.data('sortable'), options = typeof method === "object" && method; if (!data) { $this.data('sortable', new Sortable(this, options)); data = $this.data('sortable'); } if (typeof method === "string") { data[method].apply(data, Array.prototype.slice.call(args, 1)); } }); }; $.fn.sortable.defaults = { onSortOrderChange: null }; })(jQuery);