Categorize, sort, and filter a responsive grid of items.

@param {Element} element An element which is the parent container for the grid items.
@param {Object} [options=Shuffle.options] Options object.
@constructor
483614
function( element, options ) {
  options = options || {};
  $.extend( this, Shuffle.options, options, Shuffle.settings );

  this.$el = $(element);
  this.element = element;
  this.unique = 'shuffle_' + id++;

  this._fire( Shuffle.EventType.LOADING );
  this._init();

  // Dispatch the done event asynchronously so that people can bind to it after
  // Shuffle has been initialized.
  defer(function() {
    this.initialized = true;
    this._fire( Shuffle.EventType.DONE );
  }, this, 16);
}
537698
function(container, options) {
        container = $(container);

        options = this.setOptions(options, container);
        this.items = container.find(this.options.lazyClass);

        if (container.css('overflow') === 'auto') {
            this.container = container;
        }

        var callback = $.throttle(this.load.bind(this), options.throttle);

        // Set events
        this.addEvents([
            ['scroll', 'container', callback],
            ['resize', 'window', callback],
            ['ready', 'document', 'onReady']
        ]);

        this.initialize();
    }
1166185
function Wookmark(container, options) {
    options = options || {};

    if (typeof container === 'string') {
      container = document.querySelector(container);
    }

    // Instance variables.
    this.container = container;
    this.columns = this.resizeTimer = null;
    this.activeItemCount = 0;
    this.placeholders = [];
    this.itemHeightsInitialized = false;
    this.itemHeightsDirty = false;
    this.elementTag = 'div';

    // Bind instance methods
    this.initItems = __bind(this.initItems, this);
    this.updateOptions = __bind(this.updateOptions, this);
    this.onResize = __bind(this.onResize, this);
    this.onRefresh = __bind(this.onRefresh, this);
    this.getItemWidth = __bind(this.getItemWidth, this);
    this.layout = __bind(this.layout, this);
    this.layoutFull = __bind(this.layoutFull, this);
    this.layoutColumns = __bind(this.layoutColumns, this);
    this.filter = __bind(this.filter, this);
    this.clear = __bind(this.clear, this);
    this.getActiveItems = __bind(this.getActiveItems, this);
    this.refreshPlaceholders = __bind(this.refreshPlaceholders, this);
    this.sortElements = __bind(this.sortElements, this);
    this.updateFilterClasses = __bind(this.updateFilterClasses, this);

    // Initialize children of the container
    this.initItems();

    // Initial update and layout
    this.container.style.display = 'block';
    this.updateOptions(options);

    // Collect filter classes after items have been initialized
    this.updateFilterClasses();

    // Listen to resize event of the browser if enabled
    if (this.autoResize) {
      addEventListener(window, 'resize', this.onResize);
    }

    // Listen to external refresh event
    addEventListener(this.container, 'refreshWookmark', this.onRefresh);
  }
706019
function TagsMaterialize(element, options)
    {
        this.itemsArray = [];

        this.$element = $(element);
        this.$element.hide();

        this.objectItems    = options && options.itemValue;
        this.placeholderText = element.hasAttribute('placeholder') ? this.$element.attr('placeholder') : '';
        this.inputSize      = Math.max(1, this.placeholderText.length);

        this.$container = $('<div class="materialize-tags"></div>');
        this.$input    = $('<input type="text" class="n-tag"  placeholder="' + this.placeholderText + '"/>').appendTo(this.$container);
        this.$label    = this.$element.parent().find('label');

        this.$element.before(this.$container);
        this.build(options);

        this.$label.on('click', function ()
        {
            $(this).addClass('active');
            $(this).addClass('infocus');
            $(this).next('.materialize-tags').find('input.n-tag').focus();
        });

        this.$input.on('focus', function ()
        {
            var label = $(this).parents('.materialize-tags').parent().find('label');
            $(this).parents('.materialize-tags').addClass('active');
 +            !label.hasClass('infocus') && label.addClass('infocus');

            if (!label.hasClass('active'))
            {
                label.addClass('active');
            }
        }).on('focusout', function ()
        {
            var parentContainer = $(this).parents('.materialize-tags'),
                tags            = parentContainer.find('span.chip');
            parentContainer.removeClass('active');
 +          parentContainer.parent().find('label').removeClass('infocus');
            // Verify if is empty and remove "active" class from label
            if (tags.length == 0 && $(this).val().length == 0)
            {
                parentContainer.parent().find('label').removeClass('active');
            }
        });
    }
584639
function(element, options) {
        element = this.setElement(element).attr('role', 'complementary').conceal();
        options = this.setOptions(options, element);

        var animation = options.animation;

        // Touch devices cannot use squish
        if (Toolkit.isTouch && animation === 'squish') {
            options.animation = animation = 'push';
        }

        // Cannot have multiple non-overlayed or non-squished sidebars open
        if (animation !== 'on-top' && animation !== 'squish') {
            options.hideOthers = true;
        }

        // Setup container
        this.container = element.parent().addClass(animation);
        this.primary = element.siblings('[data-offcanvas-content]').attr('role', 'main');
        this.secondary = element.siblings('[data-offcanvas-sidebar]');

        // Determine the side
        this.side = element.data('offcanvas-sidebar') || 'left';
        this.opposite = (this.side === 'left') ? 'right' : 'left';

        // Initialize events
        this.addEvents([
            ['ready', 'document', 'onReady'],
            ['resize', 'window', 'onResize']
        ]);

        if (options.swipe) {
            if (this.side === 'left') {
                this.addEvents([
                    ['swipeleft', 'element', 'hide'],
                    ['swiperight', 'container', 'onSwipe']
                ]);
            } else {
                this.addEvents([
                    ['swipeleft', 'container', 'onSwipe'],
                    ['swiperight', 'element', 'hide']
                ]);
            }
        }

        if (options.selector) {
            this.addEvent('click', 'document', 'toggle', options.selector);
        }

        this.initialize();
    }
252578
function(element, options) {
        element = this.setElement(element);
        options = this.setOptions(options, element);

        if (options.checkbox) {
            element.find(options.checkbox).inputCheckbox(options);
        }

        if (options.radio) {
            element.find(options.radio).inputRadio(options);
        }

        if (options.select) {
            element.find(options.select).inputSelect(options);
        }

        this.initialize();
    }
915276
function(element) {
    this.$element    = $(element)
    this.carousel    = this.$element.data('bs.carousel')
    this.options     = $.extend({}, CarouselSwipe.DEFAULTS, this.carousel.options)
    this.startX      =
    this.startY      =
    this.startTime   =
    this.cycling     =
    this.$active     =
    this.$items      =
    this.$next       =
    this.$prev       =
    this.dx          = null
    this.sliding     = false

    this.$element
      .on('touchstart',        $.proxy(this.touchstart,this))
      .on('touchmove',         $.proxy(this.touchmove,this))
      .on('touchend',          $.proxy(this.touchend,this))
      .on('slide.bs.carousel', $.proxy(this.startSliding, this))
      .on('slid.bs.carousel',  $.proxy(this.stopSliding, this))
  }
204130
function Item( element, layout ) {
  if ( !element ) {
    return;
  }

  this.element = element;
  // parent layout class, i.e. Masonry, Isotope, or Packery
  this.layout = layout;
  this.position = {
    x: 0,
    y: 0
  };

  this._create();
}
156895
function(element, options) {
        element = this.setElement(element);
        options = this.setOptions(options);

        if (!options.target || !options.marker) {
            throw new Error('A marker and target is required');
        }

        if (element.css('overflow') === 'auto') {
            this.container = element;
        }

        // Initialize events
        this.addEvents([
            ['scroll', 'container', $.throttle(this.onScroll.bind(this), options.throttle)],
            ['ready', 'document', 'onScroll']
        ]);

        this.initialize();

        // Gather markets and targets
        this.refresh();
    }
784120
function(element, options) {
        var that       = this;
        var $element   = that.$ = $(element);
        that.name      = NAME;
        that.uuid      = $.zui.uuid();
        that.id        = 'zui-datagrid-' + that.uuid;
        options        = $.extend({}, DataGrid.DEFAULTS, that.$.data(), options);

        var lang   = options.lang || 'zh_cn';
        that.lang  = $.isPlainObject(lang) ? ($.extend(true, {}, LANG[lang.lang || $.zui.clientLang()], lang)) : LANG[lang];

        options.valueOperator    = $.extend({}, DEFAULT_VALUE_OPERATOR, options.valueOperator);
        options.rowDefaultHeight = options.rowDefaultHeight || 30;
        options.headerHeight     = options.headerHeight || options.rowDefaultHeight || 30;
        that.options             = options;
        if (typeof options.borderWidth !== 'number') {
            options.borderWidth = 1;
        }

        // Initialize
        if ($element.is('table')) {
            options.dataSource = $.extend(loadDataSourceFromTable(that.$), options.dataSource);
            $element.hide();
            $element = $('<div class="datagrid" id="datagrid-' + that.uuid + '" />').insertAfter(that.$);
        }

        var $container = $element.find('.datagrid-container:first');
        if (!$container.length) {
            $container = $('<div class="datagrid-container" />').appendTo($element);
        }
        $container.css({
            width:       options.width,
            borderWidth: options.borderWidth
        });
        var $document = $(document);
        var createScrollbar = function(direction) {
            var $scrollbar = $container.find('.datagrid-scrollbar-' + direction);
            if (!$scrollbar.length) {
                $scrollbar = $('<div class="datagrid-scrollbar datagrid-scrollbar-' + direction + '"><div class="bar"></div></div>').appendTo($container);
            }
            var isMouseDown = false;
            var lastPos = null;
            var eventSuffix = '.scrollbar' + direction + '.' + NAME + '.' + that.uuid;
            var startPagePos, startPageOffset, isClickBar, startScrollOffset;
            var handleMousePosition = function(e) {
                if (!isMouseDown) return;
                var pos = e[direction === 'h' ? 'pageX' : 'pageY'];
                if (lastPos === pos) {
                    return;
                }
                lastPos = pos;
                pos = (pos - startPagePos) + startPageOffset;
                var scroll = that.layout[direction + 'Scroll'];
                var offset;
                if (isClickBar) {
                    offset = (lastPos - startPagePos) + startScrollOffset;
                } else {
                    offset = Math.max(0, Math.min(scroll.space, pos - Math.round(scroll.barSize/2)));
                }
                if (direction === 'h') {
                    that.setScrollbarOffset(offset);
                } else {
                    that.setScrollbarOffset(null, offset);
                }
            };
            $scrollbar.on('mousedown', function(e) {
                e.preventDefault();
                isMouseDown = true;
                var scroll = that.layout[direction + 'Scroll'];
                var degree = direction === 'h' ? 'X' : 'Y';
                startPageOffset = e['offset' + degree];
                startPagePos = e['page' + degree];
                isClickBar = $(e.target).is('.bar');
                startScrollOffset = scroll.offset;
                if (isClickBar) {
                    startPageOffset += startScrollOffset;
                }
                handleMousePosition(e);
                $scrollbar.addClass('scrolling');
                $document.on('mouseup' + eventSuffix, function(e) {
                    isMouseDown = false;
                    handleMousePosition(e);
                    $document.off(eventSuffix);
                    $scrollbar.removeClass('scrolling');
                }).on('mousemove' + eventSuffix, handleMousePosition);
            });
            that['$' + direction + 'Scroll'] = $scrollbar;
            that['$' + direction + 'Scrollbar'] = $scrollbar.find('.bar');
        };
        createScrollbar('h');
        createScrollbar('v');
        var mouseWheelFactor = options.mouseWheelFactor;
        var isWindows = window.navigator.userAgent.match(/Win/i);
        if (isWindows) mouseWheelFactor *= 20;
        $container.on('mousewheel', function(event) {
            that.scroll(that.layout.scrollLeft - Math.round(event.deltaX * mouseWheelFactor), that.layout.scrollTop - Math.round(event.deltaY * mouseWheelFactor));
            event.preventDefault();
        });

        that.$container = $container;

        var $cells = $element.find('.datagrid-cells:first');
        if (!$cells.length) {
            $cells = $('<div class="datagrid-cells" />').appendTo($container);
        }
        $cells.toggleClass('datagrid-hover-cell', !!options.hoverCell)
              .toggleClass('datagrid-hover-row', !!options.hoverRow)
              .toggleClass('datagrid-hover-col', !!options.hoverCol)
              .toggleClass('datagrid-hover-shadow', !!options.hoverCol);
        that.$cells = $cells;

        // configs is an object
        that.isFuncConfigs = $.isFunction(options.configs);
        that.configs = that.isFuncConfigs ? options.configs : $.extend({}, DEFAULT_CONFIGS, options.configs);

        that.layout       = {scrollLeft: 0, scrollTop: 0};
        that.configsCache = {};
        that.userConfigs  = {};

        // states is 2D arrays
        that.states    = $.extend(true, {}, DEFAULT_STATES, options.states);
        that.cells     = [];
        that.setPager(that.states.pager);

        that.setDataSource(options.dataSource);

        if (options.responsive) {
            var lastContainerWidth = $container.width();
            $container.on('resize', function() {
                that.layout.cols = null;
                that.render();
            });
        }

        if (options.hoverCol) {
            $cells.on('mouseenter', '.datagrid-cell-head', function() {
                var $headCol = $(this);
                var colIndex = $headCol.data('col');
                that.$cells.find('.datagrid-cell.hover').removeClass('hover');
                that.$cells.find('.datagrid-cell[data-col="' + colIndex + '"]').addClass('hover');
            }).on('mouseleave', '.datagrid-cell-head.hover', function() {
                that.$cells.find('.datagrid-cell.hover').removeClass('hover');
            });
        }

        if (options.sortable) {
            $cells.on('click', '.datagrid-col-sortable', function() {
                var colIndex = $(this).data('col');
                var col = that.getColConfig(colIndex);
                var sortBy = that.states.sortBy;
                var order = that.states.order;
                if (sortBy !== col.name) {
                    sortBy = col.name;
                    order = 'desc';
                } else if (order === 'desc') {
                    order = 'asc';
                } else if (order === 'asc') {
                    sortBy = '';
                }
                that.sortBy(sortBy, order);
            });
        }

        if (options.checkable) {
            if (options.selectable && $.fn.selectable) {
                that.selectable = $cells.selectable($.extend({
                    selector: '.datagrid-row-cell',
                    // selectClass: false,
                    trigger: options.checkByClickRow ? null : '.datagrid-row-cell .datagrid-has-checkbox',
                    clickBehavior: 'multi',
                    select: function(data) {
                        that.checkRow(data.id, true);
                    },
                    unselect: function(data) {
                        that.checkRow(data.id, false);
                    }
                }, $.isPlainObject(options.selectable) ? options.selectable : null)).data('zui.selectable');
                $cells.on('click', '.datagrid-cell-head.datagrid-has-checkbox', function() {
                    that.checkRow($(this).data('row'));
                    that.selectable.syncSelectionsFromClass();
                });
            } else {
                $cells.on('click', options.checkByClickRow ? '.datagrid-row' : '.datagrid-has-checkbox', function(e) {
                    var rowIndex = $(this).data('row');
                    if (rowIndex || $(e.target).closest('.datagrid-has-checkbox').length) {
                        that.checkRow(rowIndex);
                    }
                });
            }
        }

        // Init pager
        if ($.fn.pager) {
            var $pager = that.$.find('.pager');
            if ($pager.length) {
                that.pagerObj = $pager.pager($.extend({}, that.pager, {
                    onPageChange: function(pageInfo) {
                        that.setPager(pageInfo).render();
                    }
                })).data('zui.pager');
            }
        }

        // Init searchbox
        if ($.fn.searchBox) {
            var $searchBox = that.$.find('.search-box');
            if($searchBox)  {
                that.searchbox = $searchBox.searchBox({
                    onSearchChange: function (searchString) {
                        that.search(searchString);
                    }
                });
            }
        }

        that.render();
    }
294140
function(elements, comparator) {

            var $elements = $(elements);
            var placements = $elements.map(function() {

                var sortElement = this;
                var parentNode = sortElement.parentNode;
                // Since the element itself will change position, we have
                // to have some way of storing it's original position in
                // the DOM. The easiest way is to have a 'flag' node:
                var nextSibling = parentNode.insertBefore(document.createTextNode(''), sortElement.nextSibling);

                return function() {

                    if (parentNode === this) {
                        throw new Error('You can\'t sort elements if any one is a descendant of another.');
                    }

                    // Insert before flag:
                    parentNode.insertBefore(this, nextSibling);
                    // Remove flag:
                    parentNode.removeChild(nextSibling);
                };
            });

            return Array.prototype.sort.call($elements, comparator).each(function(i) {
                placements[i].call(this);
            });
        }
857896
function(element, options) {
        this.name = name;
        this.$ = $(element);
        this.isTable = (this.$[0].tagName === 'TABLE');
        this.firstShow = true;
        if(this.isTable) {
            this.$table = this.$;
            this.id = 'datatable-' + (this.$.attr('id') || $.zui.uuid());
        } else {
            this.$datatable = this.$.addClass('datatable');
            if(this.$.attr('id')) {
                this.id = this.$.attr('id');
            } else {
                this.id = 'datatable-' + $.zui.uuid();
                this.$.attr('id', this.id);
            }
        }
        this.getOptions(options);
        this.load();

        this.callEvent('ready');
    }
972672
public function sortable($element, $options=array()) {
		if (count($options)>0) {
			$sort_options=array ();
			foreach ( $options as $k => $v ) {
				$sort_options[]="\n\t\t".$k.': '.$v."";
			}
			$sort_options=implode(",", $sort_options);
		} else {
			$sort_options='';
		}

		return "$(".Javascript::prep_element($element).").sortable({".$sort_options."\n\t});";
	}
1804
function (elements) {
      for (var a = 0; a < elements.length; a++) {
        var el = elements[a];

        if (el.tagName.toLowerCase() === 'input') {
          var parent = el.parentNode;

          // If input already have parent just pass through
          if (parent.tagName.toLowerCase() === 'i' && parent.className.indexOf('waves-effect') !== -1) {
            continue;
          }

          // Put element class and style to the specified parent
          var wrapper = document.createElement('i');
          wrapper.className = el.className + ' waves-input-wrapper';

          var elementStyle = el.getAttribute('style');

          if (!elementStyle) {
            elementStyle = '';
          }

          wrapper.setAttribute('style', elementStyle);

          el.className = 'waves-button-input';
          el.removeAttribute('style');

          // Put element as child
          parent.replaceChild(wrapper, el);
          wrapper.appendChild(el);
        }
      }
    }
220109
function(element, options) {
        var that = this;
        that.name = NAME;
        that.$ = $(element).addClass('uploader');
        options = that.getOptions(options);

        // Init lang
        var lang = $.isPlainObject(options.lang) ? ($.extend(true, {}, Uploader.LANG[lang.lang || $.zui.clientLang()], options.lang)) : Uploader.LANG[options.lang];
        that.lang = lang;

        // Init file list element
        var $this = that.$;
        var fileList = options.fileList;
        var $list;
        if(!fileList || fileList == 'large' || fileList == 'grid') {
            $list = $this.find('.file-list,.uploader-files');
        } else if(fileList.indexOf('>') === 0) $list = $this.find(fileList.substr(1));
        else $list = $(fileList);
        if(!$list || !$list.length) $list = $('<div class="uploader-files file-list"></div>');
        if(!$list.parent().length) $this.append($list);
        if(fileList == 'large') $list.addClass('file-list-lg');
        else if(fileList == 'grid') $list.addClass('file-list-grid');
        $list.children('.file').addClass('file-static');
        that.$list = $list;

        if(options.browseByClickList || $list.hasClass('uploader-btn-browse')) {
            $list.addClass('uploader-btn-browse').on('click', '.file-wrapper > .actions,.file-renaming .file-name', function(e) {
                e.stopPropagation();
            });
        }

        // Init file template
        var template = options.fileTemplate;
        if(!template) {
            var $template = $list.find('.template');
            if($template.length) {
                template = $template.first().clone().removeClass('template');
                $template.remove();
            }
            if(!template) template = FILE_TEMPLATE;
        }
        if(typeof template === 'string') {
            template = $(template);
            if(template.parent()) template = template.clone().removeClass('template');
        }
        that.template = template;

        // Init browse button element
        var browseBtn = options.browse_button;
        var $btn = null;
        if(browseBtn) {
            if(browseBtn.indexOf('>') === 0) $btn = $this.find(browseBtn.substr(1));
            else if(browseBtn !== 'hidden') $btn = $(browseBtn);
        }
        if(!$btn || !$btn.length) {
            $btn = $('<div class="uploader-btn-browse uploader-btn-hidden"></div>').appendTo($this);
        }
        that.$button = $btn.first();

        // Init drop element
        var dropElement = options.drop_element;
        var $dropElement = (dropElement == 'fileList' ? that.$list : (dropElement == 'self' ? that.$ : $(dropElement))).first().addClass('file-drag-area');
        if (!notSupportDnd) {
            var dropPlaceholder = options.dropPlaceholder;
            if(dropPlaceholder === true) dropPlaceholder = lang.dropPlaceholder;
            if(dropPlaceholder) $dropElement.attr('data-drop-placeholder', dropPlaceholder);
        } else {
            $dropElement.attr('data-drop-placeholder', '');
        }
        that.$dropElement = $dropElement;

        // Init message
        that.$message = $this.find('.uploader-message').on('click', '.close', function() {
            that.hideMessage();
        });
        that.$status = $this.find('.uploader-status');

        // Init actions
        $this.toggleClass('uploader-rename', !!options.rename);

        // Init plupload
        that.initPlupload();

        // Bind events
        $this.on('click.' + NAME, '.uploader-btn-start', function(e) {
            that.start();
        }).on('click.' + NAME, '.uploader-btn-browse', function(e) {
            if($(this).is(that.$button)) return;
            that.$button.trigger('click');
        }).on('click.' + NAME, '.uploader-btn-stop', function(e) {
            that.stop();
        });

        $('body').on('dragleave.' + NAME + ' drop.' + NAME, function(e) {
            $this.removeClass('file-dragable');

            // Below two lines for firefox, open a new tab after drop file
            e.preventDefault();
            e.stopPropagation();
        }).on('dragover.' + NAME + ' dragenter.' + NAME, function(e) {
            $this.addClass('file-dragable');
        });
        $dropElement.on('dragleave.' + NAME + ' drop.' + NAME, function(e) {
            $this.removeClass('file-drag-enter');
        }).on('dragover.' + NAME + ' dragenter.' + NAME, function(e) {
            $this.addClass('file-drag-enter');
        });

        $list.on('click.' + NAME, '.btn-delete-file', function() {
            var $file = $(this).closest('.file');
            var file = $file.data('file');
            var deleteActionOnDoneOption = options.deleteActionOnDone;
            var doneActionAble = file.status === Plupload.DONE && $.isFunction(deleteActionOnDoneOption);
            if(file.status === Plupload.QUEUED || file.status === Plupload.FAILED || doneActionAble) {
                var doRemoveFile = function() {
                    that.removeFile(file);
                };
                var removeFile = function() {
                    if(doneActionAble) {
                        var result = deleteActionOnDoneOption.call(that, file, doRemoveFile);
                        if(result === true) {
                            doRemoveFile();
                        }
                    } else {
                        doRemoveFile();
                    }
                };
                var deleteConfirmOption = options.deleteConfirm;
                if(deleteConfirmOption) {
                    var confirmMessage = $.isFunction(deleteConfirmOption) ? deleteConfirmOption(file) : (deleteConfirmOption === true ? lang.deleteConfirm : deleteConfirmOption);
                    confirmMessage = confirmMessage.format(file);
                    if(window.bootbox) {
                        window.bootbox.confirm(confirmMessage, function(result) {
                            if(result) removeFile();
                        });
                    } else {
                        if(window.confirm(confirmMessage)) removeFile();
                    }
                } else {
                    removeFile();
                }
            }
        }).on('click.' + NAME, '.btn-reset-file', function() {
            var $file = $(this).closest('.file');
            var file = that.plupload.getFile($file.data('id')) || $file.data('file');
            if(file.status === Plupload.FAILED) {
                file.status = Plupload.QUEUED;
                that.showFile(file);
                if(options.autoUpload) that.start();
            }
        });
        if(options.rename) {
            $list.toggleClass('file-rename-by-click', !!options.renameByClick)
                 .toggleClass('file-show-rename-action-on-done', !!options.renameActionOnDone);
            $list.on('click.' + NAME, '.btn-rename-file' + (options.renameByClick ? ',.file-name' : ''), function() {
                var $file = $(this).closest('.file');
                if($file.hasClass('file-renaming')) return;
                var file = that.plupload.getFile($file.data('id')) || $file.data('file');
                var renameActionOnDoneOption = options.renameActionOnDone;
                var renameActionAble = file.status === Plupload.DONE && $.isFunction(renameActionOnDoneOption);
                if(renameActionAble || file.status === Plupload.QUEUED) {
                    var $filename = $file.find('.file-name').first();
                    $file.addClass('file-renaming');
                    that.showFile(file);
                    if(!options.renameExtension && file.ext) {
                        $filename.text(file.name.substr(0, file.name.length - file.ext.length - 1));
                    }
                    $filename.attr('contenteditable', 'true').one('blur', function() {
                        var filename = $.trim($filename.text());
                        var renameFile = function() {
                            if(filename !== undefined && filename !== null && filename !== '') {
                                var ext = file.ext;
                                if(ext.length && !options.renameExtension && filename.lastIndexOf('.' + ext) !== (filename.length - ext.length - 1)) {
                                    filename += '.' + ext;
                                }
                                file.name = filename;
                            }
                            that.showFile(file);
                        };
                        if(renameActionAble) {
                            var result = renameActionOnDoneOption.call(that, file, filename, renameFile);
                            if(result === true) {
                                renameFile();
                            } else if(result === false) {
                                that.showFile(file);
                            }
                        } else {
                            renameFile();
                        }
                        $file.removeClass('file-renaming');
                        $filename.off('keydown.' + NAME).attr('contenteditable', null);
                    }).on('keydown.' + NAME, function(e) {
                        if(e.keyCode === 13) {
                            $filename.blur();
                            e.preventDefault();
                        }
                    }).focus();
                }
            });
        }

        $list.toggleClass('file-show-delete-action-on-done', !!options.deleteActionOnDone);

        // Init static files
        that.staticFilesSize = 0;
        that.staticFilesCount = 0;
        if(options.staticFiles) {
            $.each(options.staticFiles, function(idx, file) {
                file = $.extend({status: Plupload.DONE}, file);
                file.static = true;
                if(!file.id) file.id = $.zui.uuid();
                that.showFile(file);
                if (file.size) {
                    that.staticFilesSize += file.size;
                    that.staticFilesCount++;
                }
            });
        }

        that.callEvent('onInit');
    }
978453
function Plugin(element, options) {
    this.element = element;
    this.settings = $.extend({}, defaults, options);
    this.periodOptions = {
      title: this.settings.periodTitle,
      backgroundColor: this.settings.periodBackgroundColor,
      borderColor: this.settings.periodBorderColor,
      textColor: this.settings.periodTextColor
    };
    this.init();
  }
562915
function (sortableElement) {
        var opts = addData(sortableElement, 'opts') || {};
        var items = _filter(sortableElement.children, opts.items);
        var handles = _getHandles(items, opts.handle);
        // remove event handlers & data from sortable
        removeEventListener(sortableElement, 'dragover');
        removeEventListener(sortableElement, 'dragenter');
        removeEventListener(sortableElement, 'drop');
        // remove event data from sortable
        _removeSortableData(sortableElement);
        // remove event handlers & data from items
        removeEventListener(handles, 'mousedown');
        _removeItemEvents(items);
        _removeItemData(items);
    }