app/assets/javascripts/plugins/media_manager.min.js in wysiwyg-rails-1.1.6 vs app/assets/javascripts/plugins/media_manager.min.js in wysiwyg-rails-1.1.7

- old
+ new

@@ -1,5 +1,5 @@ /*! - * froala_editor v1.1.6 (http://editor.froala.com) + * froala_editor v1.1.7 (http://editor.froala.com) * Copyright 2014-2014 Froala */ $.Editable.DEFAULTS=$.extend($.Editable.DEFAULTS,{mediaManager:!0}),$.Editable.prototype.showMediaManager=function(){this.$image_modal.show(),this.$overlay.show(),this.loadImages(),$("body").css("overflow","hidden")},$.Editable.prototype.hideMediaManager=function(){this.$image_modal.hide(),this.$overlay.hide(),$("body").css("overflow","")},$.Editable.prototype.mediaModalHTML=function(){var a='<div class="froala-modal"><div class="f-modal-wrapper"><h4><span data-text="true">Manage images</span><i title="Cancel" class="fa fa-times" id="f-modal-close-'+this._id+'"></i></h4>';return a+='<img class="f-preloader" id="f-preloader-'+this._id+'" alt="Loading..." src="'+this.options.preloaderSrc+'" style="display: none;">',a+=WYSIWYGModernizr.touch?'<div class="f-image-list f-touch" id="f-image-list-'+this._id+'"></div>':'<div class="f-image-list" id="f-image-list-'+this._id+'"></div>',a+="</div></div>"},$.Editable.prototype.buildMediaManager=function(){this.$image_modal=$(this.mediaModalHTML()).appendTo("body"),this.$preloader=this.$image_modal.find("#f-preloader-"+this._id),this.$media_images=this.$image_modal.find("#f-image-list-"+this._id),this.$overlay=$('<div class="froala-overlay">').appendTo("body"),this.$image_modal.find("i#f-modal-close-"+this._id).click($.proxy(function(){this.hideMediaManager()},this)),this.$media_images.on("click touch","img",$.proxy(function(a){a.stopPropagation();var b=a.currentTarget;this.writeImage($(b).attr("src")),this.hideMediaManager()},this)),this.$media_images.on("click touchend",".f-delete-img",$.proxy(function(a){a.stopPropagation();var b=$(a.currentTarget).prev(),c="Are you sure? Image will be deleted.";$.Editable.LANGS[this.options.language]&&(c=$.Editable.LANGS[this.options.language].translation[c]),confirm(c)&&this.callback("beforeDeleteImage",[$(b)],!1)!==!1&&($(b).parent().addClass("f-img-deleting"),this.deleteImage($(b)))},this));this.options.mediaManager&&(this.$image_wrapper.on("click","#f-browser-"+this._id,$.proxy(function(){this.showMediaManager()},this)).on("click","#f-browser-"+this._id+" i",$.proxy(function(){this.showMediaManager()},this)),this.$image_wrapper.find("#f-browser-"+this._id).show()),this.hideMediaManager()},$.Editable.prototype.processLoadedImages=function(a){try{var b=a;this.$media_images.empty();for(var c=0;c<b.length;c++)b[c].src?this.loadImage(b[c].src,b[c].info):this.loadImage(b[c])}catch(d){this.throwImageError(4)}},$.Editable.prototype.loadImages=function(){this.$preloader.show(),this.$media_images.empty(),this.options.imagesLoadURL?($.support.cors=!0,$.getJSON(this.options.imagesLoadURL,this.options.imagesLoadParams,$.proxy(function(a){this.callback("imagesLoaded",[a],!1),this.processLoadedImages(a),this.$preloader.hide()},this)).fail($.proxy(function(){this.callback("imagesLoadError",["Load request failed."],!1),this.$preloader.hide()},this))):(this.callback("imagesLoadError",["Missing imagesLoadURL option."],!1),this.$preloader.hide())},$.Editable.prototype.loadImage=function(a,b){var c=new Image,d=$("<div>").addClass("f-empty");c.onload=$.proxy(function(){var c="Delete";$.Editable.LANGS[this.options.language]&&(c=$.Editable.LANGS[this.options.language].translation[c]);var e=$('<img src="'+a+'"/>');for(var f in b)e.attr("data-"+f,b[f]);d.append(e).append('<a class="f-delete-img"><span data-text="true">'+c+"</span></a>"),d.removeClass("f-empty"),this.$media_images.hide(),this.$media_images.show(),this.callback("imageLoaded",[a],!1)},this),c.onerror=$.proxy(function(){d.remove(),this.throwImageError(1)},this),c.src=a,this.$media_images.append(d)}; \ No newline at end of file