var FAPImage=Backbone.Model.extend({defaults:{buttons:{check:!0},can:{save:!1,remove:!1},id:null,title:"",link:"http://www.free-images.cc",date:null,modified:null,mime:"image/jpeg",dateFormatted:null,height:null,width:null,orientation:null,filesizeInBytes:null,filesizeHumanReadable:null,size:{url:null},type:"image",icon:null,sizes:{thumbnail:{height:null,width:null,url:"http://www.free-images.cc",orientation:null},medium:{height:null,width:null,url:"http://www.free-images.cc",orientation:null},large:{height:null,width:null,url:"http://www.free-images.cc",orientation:null}}}}),FAPPage=1,subState,searchTerm,FAPSearchInterval,View=wp.media.View,mediaTrash=wp.media.view.settings.mediaTrash,l10n=wp.media.view.l10n,$=jQuery,FAPBrowser;FAPBrowser=View.extend({tagName:"div",className:"attachments-browser fap-media",initialize:function(){var a,b=this;_.defaults(this.options,{filters:!1,search:!1,date:!1,display:!1,sidebar:!0,toolbar:!0,AttachmentView:wp.media.view.Attachment.Library}),this.options.toolbar&&this.createToolbar(),this.toolbar.get("spinner").show(),this.options.sidebar&&(this.createSidebar(),this.createSidebarLogo()),this.options.sidebar&&"errors"!==this.options.sidebar||(this.$el.addClass("hide-sidebar"),"errors"===this.options.sidebar&&this.$el.addClass("sidebar-for-errors")),a=new FapCollection({page:FAPPage}),a.fetch({success:function(a){subState="fap";var c=new ImagesView({controller:b.controller,collection:a});b.views.view.$el.append('
Unfortunatly the free-images.cc importer will be shut down on 1st August 2017. We have decided to discontinue our plugin, because we do not find the time to keep it up to date and we do not want to burden you with an outdated, maybe insecure plugin.
Our website, however, will stay online and provide marvelous cc0 licenced images for you.
Thank you all for your support! :)
Okay :/
Sorry, we couldn\'t find any images with the keyword "'+searchTerm+'"
');b.hide()}});else{jQuery(".no-fap").remove();var f=new FapCollection({page:FAPPage});f.fetch({success:function(a){jQuery(".attachments.fap-images").remove(),subState="fap";var e=new ImagesView({controller:c.controller,collection:a});d.add(e),b.hide()}})}},500)}});var FAPDetails=ImageView.extend({tagName:"div",className:"attachment-details",template:wp.template("fap-image-details"),attributes:function(){return{tabIndex:0,"data-id":this.model.get("id")}},initialize:function(){var a;a=_.defaults(this.model.toJSON(),{orientation:"landscape",uploading:!1,type:"",subtype:"",icon:"",filename:"",caption:"",title:"",dateFormatted:"",width:"",height:"",compat:!1,alt:"",description:""},this.options),jQuery(".attachment-details").remove(),this.$el.html(this.template(a))}}),LHLogo=Backbone.View.extend({logoTemplate:wp.template("lh-logo"),createLogo:function(){this.$el.html(this.logoTemplate())}}),FAPUpload=wp.media.View.extend({template:wp.template("fap-image-upload"),initialize:function(){this.$el.html(this.template(""))}}),FapCollection=Backbone.Collection.extend({model:FAPImage,initialize:function(a){this.url=ajaxurl+"?action=list_images&paged="+a.page},parse:function(a){return a.data}}),FapSearchCollection=Backbone.Collection.extend({model:FAPImage,initialize:function(a){this.url=ajaxurl+"?action=list_images&s="+a.searchTerm+"&paged="+a.page},parse:function(a){return a.data}}),oldMediaFrame=wp.media.view.MediaFrame.Post,l10n=wp.media.view.l10n;wp.media.view.MediaFrame.Post=oldMediaFrame.extend({initialize:function(){oldMediaFrame.prototype.initialize.apply(this,arguments),this.states.add([new wp.media.controller.FAPController({id:"fap-action",menu:"default",content:"custom",title:wp.media.view.l10n.menuTitle,priority:60,toolbar:"fap-media-frame-toolbar",type:"link"})]),this.on("toolbar:create:fap-media-frame-toolbar",this.createCustomFrameToolbar,this),this.on("content:render:custom",this.FAPContent,this)},createCustomFrameToolbar:function(a){a.view=new wp.media.view.Toolbar.FAPToolbar({controller:this})},FAPContent:function(){this.$el.addClass("hide-router");var a=new FAPBrowser({controller:this});this.content.set(a)}});var custom_data=!1;wp.media.view.Toolbar.FAPToolbar=wp.media.view.Toolbar.extend({initialize:function(){_.defaults(this.options,{event:"custom_event",close:!1,items:{custom_event:{text:wp.media.view.l10n.addToLibrary,style:"primary",priority:80,requires:!1,click:this.customAction}}}),wp.media.view.Toolbar.prototype.initialize.apply(this,arguments)},refresh:function(){this.get("custom_event").model.set("disabled",!custom_data),wp.media.view.Toolbar.prototype.refresh.apply(this,arguments)},customAction:function(){custom_data=!1,this.controller.toolbar.get().refresh();var a=document.getElementsByClassName("attachment-details")[0].getAttribute("data-id"),b=ajaxurl+"?action=import_image&image_id="+a+"&post_id=0",c=this,d=new FAPUpload({controller:this.controller});this.controller.content.get("view").views.add(d),jQuery.get(b,function(a){jQuery(".progress-container").addClass("success"),setTimeout(function(){oldMediaFrame.prototype.open(),c.controller.states.get("insert").get("library").props.trigger("change",!0),c.controller.setState("insert")},1e3)}).fail(function(a,b,c){jQuery(".js--select-attachment").each(function(a){jQuery(this).hasClass("selected")&&jQuery(this).removeClass("selected")}),jQuery(".progress-container").remove(),alert(jQuery.parseJSON(a.responseText).msg)})},deactivateButton:function(){}}),wp.media.controller.FAPController=wp.media.controller.State.extend({initialize:function(){this.props=new Backbone.Model({custom_data:""}),this.props.on("change:custom_data",this.refresh,this)},refresh:function(){this.frame.toolbar.get().refresh()},customAction:function(){this.frame.content.mode("browse")}}),jQuery(document).ready(function(a){a("body").on("click",function(b){var c=a(b.target);c.hasClass("close_broadcast")&&a(".broadcast").addClass("closed")})});