/** * File attachment wrapper. * * @author Htmlstream * @version 1.0 * */ ; (function($) { 'use strict'; $.HSCore.components.HSFileAttachment = { /** * * * @var Object _baseConfig */ _baseConfig: { changeInput: '
\
\
\
\ \
\
\
\

Upload Your Files

\

Drag your files here or click upload button and browse from your computer.

\
\
\
', showThumbs: true, templates: { box: '
\

Manage Media

\
\
\
', item: '
\
\

{{fi-name}}

\

{{fi-size2}}

\
{{fi-image}}
\
{{fi-progressBar}}
\
\
', itemAppend: '
\
\

{{fi-name}}

\

{{fi-size2}}

\
{{fi-image}}
\
{{fi-progressBar}}
\
{{fi-icon}}
\
\
\
', progressBar: '', _selectors: { list: '.js-result-list', item: '.js-result-list__item', progressBar: '.u-progress-bar-v1', remove: '.js-result-list-item-remove' }, itemAppendToEnd: false, removeConfirmation: true }, uploadFile: { url: '../../../html/assets/include/php/file-upload/upload.php', data: {}, type: 'POST', enctype: 'multipart/form-data', beforeSend: function() {}, success: function(data, element) { var parent = element.find(".u-progress-bar-v1").parent(); element.find(".u-progress-bar-v1").fadeOut("slow", function() { $("
Success
").hide().appendTo(parent).fadeIn("slow"); }); }, error: function(element) { var parent = element.find(".u-progress-bar-v1").parent(); element.find(".u-progress-bar-v1").fadeOut("slow", function() { $("
Error
").hide().appendTo(parent).fadeIn("slow"); }); } } }, /** * * * @var jQuery pageCollection */ pageCollection: $(), /** * Initialization of File attachment wrapper. * * @param String selector (optional) * @param Object config (optional) * * @return jQuery pageCollection - collection of initialized items. */ init: function(selector, config) { if (!selector) return; var $collection = $(selector); if (!$collection.length) return; config = config && $.isPlainObject(config) ? $.extend(true, {}, this._baseConfig, config) : this._baseConfig; this.initFileAttachment(selector, config); }, initFileAttachment: function(el, conf) { //Variables var $el = $(el); //Actions $el.each(function() { var $this = $(this); $this.filer($.extend(true, {}, conf, { dragDrop: {} })); }); } }; })(jQuery);