Вход Регистрация
Файл: CloudBox-main/CloudBox/admin_assets/js/fileinput.min.js
Строк: 446
<?php
/*!
 * @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
 * bootstrap-fileinput
 * For more JQuery Plugins visit http://plugins.krajee.com
 */
(function (e) {
    var 
"{preview}n" '<div class="input-group {class}">n' "   {caption}n" '   <div class="input-group-btn">n' "       {remove}n" "       {upload}n" "       {browse}n" "   </div>n" "</div>";
    var 
"{preview}n{remove}n{upload}n{browse}n";
    var 
'<div class="file-preview {class}">n' '   <div class="file-preview-status text-center text-success"></div>n' '   <div class="close fileinput-remove text-right">&times;</div>n' '   <div class="file-preview-thumbnails"></div>n' '   <div class="clearfix"></div>' "</div>";
    var 
'<div class="form-control file-caption {class}">n' '   <span class="glyphicon glyphicon-file"></span> <span class="file-caption-name"></span>n' "</div>";
    var 
= function (tn) {
        return 
=== null || === undefined || == [] || === "" || && e.trim(t) === ""
    
};
    var 
= function (etn) {
        return 
s(e) || s(e[t]) ? e[t]
    };
    var 
= function (et) {
        return 
typeof e !== "undefined" e.match("image.*") : t.match(/.(gif|png|jpe?g)$/i)
    };
    var 
= function (et) {
        return 
typeof e !== "undefined" e.match("text.*") : t.match(/.(txt|md|csv|htm|html|php|ini)$/i)
    };
    var 
= function () {
        return 
Math.round((new Date).getTime() + Math.random() * 100)
    };
    var 
= function (ri) {
        
this.$element e(r);
        
this.showCaption i.showCaption;
        
this.showPreview i.showPreview;
        
this.showRemove i.showRemove;
        
this.showUpload i.showUpload;
        
this.captionClass i.captionClass;
        
this.previewClass i.previewClass;
        
this.mainClass i.mainClass;
        if (
s(i.mainTemplate)) {
            
this.mainTemplate this.showCaption n
        
} else {
            
this.mainTemplate i.mainTemplate
        
}
        
this.previewTemplate i.previewTemplate;
        
this.captionTemplate i.captionTemplate;
        
this.browseLabel i.browseLabel;
        
this.browseIcon i.browseIcon;
        
this.browseClass i.browseClass;
        
this.removeLabel i.removeLabel;
        
this.removeIcon i.removeIcon;
        
this.removeClass i.removeClass;
        
this.uploadLabel i.uploadLabel;
        
this.uploadIcon i.uploadIcon;
        
this.uploadClass i.uploadClass;
        
this.uploadUrl i.uploadUrl;
        
this.msgLoading i.msgLoading;
        
this.msgProgress i.msgProgress;
        
this.msgSelected i.msgSelected;
        
this.previewFileType i.previewFileType;
        
this.wrapTextLength i.wrapTextLength;
        
this.wrapIndicator i.wrapIndicator;
        
this.isDisabled this.$element.attr("disabled") || this.$element.attr("readonly");
        if (
s(this.$element.attr("id"))) {
            
this.$element.attr("id"f())
        }
        
this.$container this.createContainer();
        
this.$captionContainer o(i"elCaptionContainer"this.$container.find(".file-caption"));
        
this.$caption o(i"elCaptionText"this.$container.find(".file-caption-name"));
        
this.$previewContainer o(i"elPreviewContainer"this.$container.find(".file-preview"));
        
this.$preview o(i"elPreviewImage"this.$container.find(".file-preview-thumbnails"));
        
this.$previewStatus o(i"elPreviewStatus"this.$container.find(".file-preview-status"));
        
this.$name this.$element.attr("name") || i.name;
        
this.$hidden this.$container.find('input[type=hidden][name="' this.$name '"]');
        if (
this.$hidden.length === 0) {
            
this.$hidden e('<input type="hidden" />');
            
this.$container.prepend(this.$hidden)
        }
        
this.original = {previewthis.$preview.html(), hiddenValthis.$hidden.val()};
        
this.listen()
    };
    
l.prototype = {constructorllisten: function () {
        var 
this;
        
t.$element.on("change"e.proxy(t.changet));
        
e(t.$element[0].form).on("reset"e.proxy(t.resett));
        
t.$container.find(".fileinput-remove").on("click"e.proxy(t.cleart))
    }, 
trigger: function (e) {
        var 
this;
        
t.$element.trigger("click");
        
e.preventDefault()
    }, 
clear: function (e) {
        var 
this;
        if (
e) {
            
e.preventDefault()
        }
        
t.$hidden.val("");
        
t.$hidden.attr("name"t.name);
        
t.$element.attr("name""");
        
t.$element.val("");
        if (
!== false) {
            
t.$element.trigger("change");
            
t.$element.trigger("fileclear")
        }
        
t.$preview.html("");
        
t.$caption.html("");
        
t.$container.removeClass("file-input-new").addClass("file-input-new")
    }, 
reset: function (e) {
        var 
this;
        
t.clear(false);
        
t.$hidden.val(t.original.hiddenVal);
        
t.$preview.html(t.original.preview);
        
t.$container.find(".fileinput-filename").text("");
        
t.$element.trigger("filereset")
    }, 
change: function (e) {
        var 
this;
        var 
t.$elementn.get(0).filesr.length 1n.val().replace(/\/g"/").replace(/.*//, ""), o = t.$preview, f = t.$previewContainer, l = t.$previewStatus, c = t.msgLoading, h = t.msgProgress, p = t.msgSelected, d, v = t.previewFileType, m = parseInt(t.wrapTextLength), g = t.wrapIndicator;
        
if (e.target.files === undefined) {
            
e.target && e.target.value ? [
                {
namee.target.value.replace(/^.+\/, "")}
            ] : []
        } else {
            
e.target.files
        
}
        if (
d.length === 0) {
            return
        }
        
o.html("");
        var 
d.lengtht;
        for (var 
0yb++) {
            (function (
e) {
                var 
e.name;
                var 
u(e.typee.name);
                var 
a(e.typee.name);
                if (
o.length && (== "any" || == "text" n) && typeof FileReader !== "undefined") {
                    var 
= new FileReader;
                    
l.html(c);
                    
f.addClass("loading");
                    
i.onload = function (e) {
                        var 
"";
                        if (
r) {
                            var 
e.target.result;
                            if (
i.length m) {
                                
g.replace("{title}"i);
                                
i.substring(01) + g
                            
}
                            
'<div class="file-preview-frame"><div class="file-preview-text" title="' '">' "</div></div>"
                        
} else {
                            
'<div class="file-preview-frame"><img src="' e.target.result '" class="file-preview-image" title="' '" alt="' '"></div>'
                        
}
                        
o.append("n" n);
                        if (
>= 1) {
                            
f.removeClass("loading");
                            
l.html("")
                        }
                    };
                    
i.onprogress = function (t) {
                        if (
t.lengthComputable) {
                            var 
parseInt(t.loaded t.total 10010);
                            var 
h.replace("{percent}"n).replace("{file}"e.name);
                            
l.html(r)
                        }
                    };
                    if (
r) {
                        
i.readAsText(e)
                    } else {
                        
i.readAsDataURL(e)
                    }
                } else {
                    
o.append("n" '<div class="file-preview-frame"><div class="file-preview-other"><h2><i class="glyphicon glyphicon-file"></i></h2>' "</div></div>")
                }
            })(
d[b])
        }
        var 
p.replace("{n}"i) : s;
        
t.$caption.html(w);
        
t.$container.removeClass("file-input-new");
        
n.trigger("fileselect", [is])
    }, 
createContainer: function () {
        var 
this;
        var 
e(document.createElement("div")).attr({"class""file-input file-input-new"}).html(t.renderMain());
        
t.$element.before(n);
        
n.find(".btn-file").append(t.$element);
        return 
n
    
}, renderMain: function () {
        var 
this;
        var 
e.previewTemplate.replace("{class}"e.previewClass);
        var 
e.isDisabled e.captionClass " file-caption-disabled" e.captionClass;
        var 
e.captionTemplate.replace("{class}"n);
        return 
e.mainTemplate.replace("{class}"e.mainClass).replace("{preview}"t).replace("{caption}"r).replace("{upload}"e.renderUpload()).replace("{remove}"e.renderRemove()).replace("{browse}"e.renderBrowse())
    }, 
renderBrowse: function () {
        var 
thise.browseClass " btn-file""";
        if (
e.isDisabled) {
            
" disabled "
        
}
        return
'<div class="' '"' "> " e.browseIcon e.browseLabel " </div>"
    
}, renderRemove: function () {
        var 
thise.removeClass " fileinput-remove fileinput-remove-button""";
        if (!
e.showRemove) {
            return
""
        
}
        if (
e.isDisabled) {
            
" disabled "
        
}
        return
'<button type="button" class="' '"' ">" e.removeIcon e.removeLabel "</button>"
    
}, renderUpload: function () {
        var 
this"""";
        if (!
e.showUpload) {
            return
""
        
}
        if (
e.isDisabled) {
            
" disabled "
        
}
        if (
s(e.uploadUrl)) {
            
'<button type="submit" class="' e.uploadClass '"' ">" e.uploadIcon e.uploadLabel "</button>"
        
} else {
            
'<a href="' e.uploadUrl '" class="' e.uploadClass '"' ">" e.uploadIcon e.uploadLabel "</a>"
        
}
        return 
t
    
}};
    
e.fn.fileinput = function (t) {
        return 
this.each(function () {
            var 
e(this), n.data("fileinput");
            if (!
r) {
                
n.data("fileinput"= new l(thist))
            }
            if (
typeof t == "string") {
                
r[t]()
            }
        })
    };
    
e.fn.fileinput = function (t) {
        var 
= Array.apply(nullarguments);
        
n.shift();
        return 
this.each(function () {
            var 
e(this), r.data("fileinput"), typeof t === "object" && t;
            if (!
i) {
                
r.data("fileinput"= new l(thise.extend({}, e.fn.fileinput.defaultsse(this).data())))
            }
            if (
typeof t === "string") {
                
i[t].apply(in)
            }
        })
    };
    
e.fn.fileinput.defaults = {showCaptiontrueshowPreviewtrueshowRemovetrueshowUploadtruecaptionClass""previewClass""mainClass""mainTemplatenullpreviewTemplatercaptionTemplateibrowseLabel"Browse &hellip;"browseIcon'<i class="glyphicon glyphicon-folder-open"></i> &nbsp;'browseClass"btn btn-primary"removeLabel"Remove"removeIcon'<i class="glyphicon glyphicon-ban-circle"></i> 'removeClass"btn btn-default"uploadLabel"Upload"uploadIcon'<i class="glyphicon glyphicon-upload"></i> 'uploadClass"btn btn-default"uploadUrlnullmsgLoading"Loading &hellip;"msgProgress"Loaded {percent}% of {file}"msgSelected"{n} files selected"previewFileType"image"wrapTextLength250wrapIndicator' <span class="wrap-indicator" title="{title}">[&hellip;]</span>'elCaptionContainernullelCaptionTextnullelPreviewContainernullelPreviewImagenullelPreviewStatusnull};
    
e(function () {
        var 
e("input.file[type=file]");
        if (
t.length 0) {
            
t.fileinput()
        }
    })
})(
window.jQuery)
?>
Онлайн: 1
Реклама