PHP Classes

File: public/flat-admin/js/plugins/fileupload/bootstrap-fileupload.min.js

Recommend this page to a friend!
  Classes of adriano123456   Budget System   public/flat-admin/js/plugins/fileupload/bootstrap-fileupload.min.js   Download  
File: public/flat-admin/js/plugins/fileupload/bootstrap-fileupload.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Budget System
Elaborate budgets for purchases of products
Author: By
Last change:
Date: 15 days ago
Size: 4,188 bytes
 

Contents

Class file image Download
/* =========================================================== * bootstrap-fileupload.js j2 * http://jasny.github.com/bootstrap/javascript.html#fileupload * =========================================================== * Copyright 2012 Jasny BV, Netherlands. * * Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */!function(e){"use strict";var t=function(t,n){this.$element=e(t);this.type=this.$element.data("uploadtype")||(this.$element.find(".thumbnail").length>0?"image":"file");this.$input=this.$element.find(":file");if(this.$input.length===0)return;this.name=this.$input.attr("name")||n.name;this.$hidden=this.$element.find('input[type=hidden][name="'+this.name+'"]');if(this.$hidden.length===0){this.$hidden=e('<input type="hidden" />');this.$element.prepend(this.$hidden)}this.$preview=this.$element.find(".fileupload-preview");var r=this.$preview.css("height");this.$preview.css("display")!="inline"&&r!="0px"&&r!="none"&&this.$preview.css("line-height",r);this.original={exists:this.$element.hasClass("fileupload-exists"),preview:this.$preview.html(),hiddenVal:this.$hidden.val()};this.$remove=this.$element.find('[data-dismiss="fileupload"]');this.$element.find('[data-trigger="fileupload"]').on("click.fileupload",e.proxy(this.trigger,this));this.listen()};t.prototype={listen:function(){this.$input.on("change.fileupload",e.proxy(this.change,this));e(this.$input[0].form).on("reset.fileupload",e.proxy(this.reset,this));this.$remove&&this.$remove.on("click.fileupload",e.proxy(this.clear,this))},change:function(e,t){if(t==="clear")return;var n=e.target.files!==undefined?e.target.files[0]:e.target.value?{name:e.target.value.replace(/^.+\\/,"")}:null;if(!n){this.clear();return}this.$hidden.val("");this.$hidden.attr("name","");this.$input.attr("name",this.name);if(this.type==="image"&&this.$preview.length>0&&(typeof n.type!="undefined"?n.type.match("image.*"):n.name.match("\\.(gif|png|jpe?g)$"))&&typeof FileReader!="undefined"){var r=new FileReader,i=this.$preview,s=this.$element;r.onload=function(e){i.html('<img src="'+e.target.result+'" '+(i.css("max-height")!="none"?'style="max-height: '+i.css("max-height")+';"':"")+" />");s.addClass("fileupload-exists").removeClass("fileupload-new")};r.readAsDataURL(n)}else{this.$preview.text(n.name);this.$element.addClass("fileupload-exists").removeClass("fileupload-new")}},clear:function(e){this.$hidden.val("");this.$hidden.attr("name",this.name);this.$input.attr("name","");if(navigator.userAgent.match(/msie/i)){var t=this.$input.clone(!0);this.$input.after(t);this.$input.remove();this.$input=t}else this.$input.val("");this.$preview.html("");this.$element.addClass("fileupload-new").removeClass("fileupload-exists");if(e){this.$input.trigger("change",["clear"]);e.preventDefault()}},reset:function(e){this.clear();this.$hidden.val(this.original.hiddenVal);this.$preview.html(this.original.preview);this.original.exists?this.$element.addClass("fileupload-exists").removeClass("fileupload-new"):this.$element.addClass("fileupload-new").removeClass("fileupload-exists")},trigger:function(e){this.$input.trigger("click");e.preventDefault()}};e.fn.fileupload=function(n){return this.each(function(){var r=e(this),i=r.data("fileupload");i||r.data("fileupload",i=new t(this,n));typeof n=="string"&&i[n]()})};e.fn.fileupload.Constructor=t;e(document).on("click.fileupload.data-api",'[data-provides="fileupload"]',function(t){var n=e(this);if(n.data("fileupload"))return;n.fileupload(n.data());var r=e(t.target).closest('[data-dismiss="fileupload"],[data-trigger="fileupload"]');if(r.length>0){r.trigger("click.fileupload");t.preventDefault()}})}(window.jQuery);