GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (1881)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

pro/js/foogallery.media-views.min.js (7 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
/*
2
* WP FooGallery - Video import component for FooGallery
3
* @version 0.0.6
4
* @link 
5
* @copyright Steven Usher & Brad Vincent 2015
6
* @license Released under the GPLv3 license.
7
*/
8
9
!function(){wp.foogallery=function(a){a=_.defaults(a||{},{frame:"select"});var b;return"select"===a.frame&&wp.foogallery.Select?(b=new wp.foogallery.Select(a),delete a.frame,wp.media.frame=b,b):"select-child"===a.frame&&wp.foogallery.media.Select?(b=new wp.foogallery.media.Select(a),delete a.frame,wp.media.frame=b,b):wp.media.apply(this,arguments)},wp.foogallery.media={},wp.foogallery.frames={},wp.foogallery.debug=!1}(),function(a){wp.foogallery.l10n={tabs:{upload:a&&_.isString(a.uploadFilesTitle)?a.uploadFilesTitle:"Upload Files",browse:a&&_.isString(a.mediaLibraryTitle)?a.mediaLibraryTitle:"Media Library",import:"Import Videos"},toolbar:{back:"Back",import:"Import",loadMore:"Load More Results"},errorTitle:"An Error Occurred",errors:{unknown:"An unknown error has occurred.",unexpectedResponse:"Unexpected response.",requestAborted:"Request aborted.",invalidAttachment:"The selected attachment does not have the required information available.",required:"Required.",pattern:"Regular expression failed.",importNoVideos:"No videos supplied for import."},compatibility:{supported:"Supported.",desktopEdgeWebM:"Progressive sources not supported.",mobileOperaWebM:"Requires codec.",desktopEdgeOgg:"Supported from 17 onward.",mobileFirefoxMP4:"Hardware acceleration not supported."},import:{cancel:"Cancel",cancelling:"Cancelling",cancelled:"Cancelled",complete:"Complete",fetching:"Fetching page {number}...",importing:"Importing {start} to {end} of {total} - {percent}%"}},wp.foogallery.format_l10n=function(a,b,c){var d=Array.prototype.slice.call(arguments);if(a=d.shift(),!_.isString(a)||0===d.length)return a;1===d.length&&(_.isArray(d[0])||_.isObject(d[0]))&&(d=d[0]);for(var e in d)d.hasOwnProperty(e)&&(a=a.replace(new RegExp("\\{"+e+"\\}","gi"),d[e]));return a}}(wp.media.view.l10n),function(a){function b(a){if(!_.isArray(a))return[];var b=_.map(a,function(a){var b=e[a];return d.types.hasOwnProperty(b)?d.types[b]:null});return _.compact(b)}function c(){var a={};return _.each(d.devices,function(b,c){a[c]={title:b.name,browsers:{}},_.each(b.browsers,function(b,d){a[c].browsers[d]={title:b,value:-1}})}),a}var d={devices:{desktop:{name:"Desktop",browsers:{ie:"Internet Explorer 9-11",edge:"Edge",chrome:"Chrome",firefox:"Firefox",opera:"Opera",safari:"Safari"}},mobile:{name:"Mobile",browsers:{chrome:"Chrome for Android",firefox:"Firefox for Android",opera:"Opera Mobile",safari:"iOS Safari",uc:"UC Browser for Android",samsung:"Samsung Internet"}}},types:{webm:{name:"WebM",aliases:["webm","video/webm"],browsers:{desktop:{ie:!1,edge:a.compatibility.desktopEdgeWebM,firefox:!0,chrome:!0,opera:!0,safari:!1},mobile:{firefox:!0,chrome:!0,opera:a.mobileOperaWebM,safari:!1,uc:!0,samsung:!0}}},ogg:{name:"Ogg",aliases:["ogg","video/ogg","ogv","video/ogv"],browsers:{desktop:{ie:!1,edge:a.compatibility.desktopEdgeOgg,firefox:!0,chrome:!0,opera:!0,safari:!1},mobile:{firefox:!0,chrome:!0,opera:!1,safari:!1,uc:!0,samsung:!0}}},mp4:{name:"MP4",aliases:["mp4","video/mp4"],browsers:{desktop:{ie:!0,edge:!0,firefox:!0,chrome:!0,opera:!0,safari:!0},mobile:{firefox:a.compatibility.mobileFirefoxMP4,chrome:!0,opera:!0,safari:!0,uc:!0,samsung:!0}}}}},e=function(a){var b={};return _.each(a,function(a,c){_.each(a.aliases,function(a){b[a]=c})}),b}(d.types);wp.foogallery.compatibility=function(d){var e=c();return _.each(b(d),function(b){_.each(b.browsers,function(c,d){_.each(e[d].browsers,function(d,e){var f=-1===d.title.indexOf("\n\n")?"\n\n":"\n",g=c[e];_.isString(g)?(g=[b.name,g].join(" - "),d.title=[d.title,g].join(f),d.value=1===d.value?1:0):!0===g&&(g=[b.name,a.compatibility.supported].join(" - "),d.title=[d.title,g].join(f),d.value=1)})})}),e}}(wp.foogallery.l10n),function(a){function b(a,b,c){if(""===b&&_.isArray(a)&&c){var d=a.length,e=d-1,f={};return d>0&&a[e]&&(_.isUndefined(a[e][c])||_.isArray(a[e][c]))?f=a[e]:a.push(f),f}return a[b]=a[b]||(isNaN(c)&&""!==c?{}:[])}function c(a,b,c){""===b?_.isArray(a)&&a.push(c):_.isUndefined(a[b])?a[b]=c:(_.isArray(a[b])||(a[b]=[a[b]]),a[b].push(c))}wp.foogallery.formJSON=function(a,d){d=_.isString(d)?d:":input:not(:button)";var e={},f=a.find(d).serializeArray();return _.each(f,function(a){if(a.name.indexOf("[")>-1)for(var d=e,f=a.name.replace(/]/gi,"").split("["),g=0,h=f.length;g<h;g++){var i=f[g],j=f[g+1];g==h-1?c(d,i,a.value):d=b(d,i,j)}else c(e,a.name,a.value)}),e}}(jQuery),function(){var a=wp.media.View.extend({initialize:function(){this.mediaFrame=!!this.options.mediaFrame&&this.options.mediaFrame,_.defaults(this.options,{region:"",mode:"default",persist:!0}),this.activated=!1,this.once("ready",this._ready,this)},remove:function(a){return this._deactivate(),this.options.persist&&!a?this:wp.media.View.prototype.remove.apply(this,arguments)},_ready:function(){this._activate(),this.controller.off(this.options.region+":activate:"+this.options.mode).off(this.options.region+":deactivate:"+this.options.mode).on(this.options.region+":activate:"+this.options.mode,this._activate,this).on(this.options.region+":deactivate:"+this.options.mode,this._deactivate,this)},_activate:function(){this.activated||(this.activated=!0,this.activate())},_deactivate:function(){this.activated&&(this.activated=!1,this.deactivate())},activate:function(){},deactivate:function(){}});wp.foogallery.media.View=a}(),function(a){var b=a.extend({initialize:function(){a.prototype.initialize.apply(this,arguments),_.defaults(this.options,{data:{}}),this.data=_.defaults(this.options.data,{timestamp:(new Date).getTime()})},prepare:function(){return this.data},compare:function(a){return!_.isObject(a)||!_.isNumber(a.timestamp)||a.timestamp<this.data.timestamp?-1:a.timestamp>this.data.timestamp?1:0}});wp.foogallery.media.DataView=b}(wp.foogallery.media.View),function(){var a=wp.media.controller.Region.extend({mode:function(a,b){return a?(b=_.isObject(b)?b:{},this.trigger("deactivate",a,b),this._mode=a,this.render(a,b),this.trigger("activate",a,b),this):this._mode},render:function(a,b){if(a&&a!==this._mode)return this.mode(a,b);b=_.isObject(b)?b:{};var c,d={view:null};return this.trigger("create",d,a,b),c=d.view,this.trigger("render",c,a,b),c&&this.set(c),this}});wp.foogallery.media.Region=a}(),function(a,b,c){var d=a.extend({regions:{},initialize:function(){!this.options.mediaFrame&&this.controller instanceof wp.foogallery.Select&&(this.options.mediaFrame=this.controller),a.prototype.initialize.apply(this,arguments),_.defaults(this.options,{defaultRegion:"content",defaultMode:"default"}),this._regions={},this._views={},this._createRegions()},_createRegions:function(){_.each(_.keys(this.regions),function(a){this[a]=new c({mediaFrame:this.mediaFrame,view:this,id:a,selector:this.regions[a]}),this._regions[a]=this._regions[a]||this.options[a]||"default"},this)},activate:function(){_.each(_.keys(this.regions),function(a){this[a].mode()!=this._regions[a]?this[a].mode(this._regions[a]):this.trigger(a+":activate:"+this._regions[a])},this),this.controller instanceof wp.media.view.Frame&&this.controller.activateMode(this.options.mode)},deactivate:function(){_.each(_.keys(this.regions),function(a){this._regions[a]=this[a].mode(),this.trigger(a+":deactivate:"+this._regions[a])},this),this.controller instanceof wp.media.view.Frame&&this.controller.deactivateMode(this.options.mode)},getMode:function(a){var b=null;return this[a]instanceof c&&(b=this[a].mode(),this._regions[a]=b),b},setMode:function(a,b,d){this[a]instanceof c&&(this[a].mode(b,d),this._regions[a]=b)},regionMode:function(a,b,d){if(_.isString(a)&&this[a]instanceof c){if(!_.isString(b))return this._regions[a]=this[a].mode();this[a].mode(b,d),this._regions[a]=b}},getView:function(d,e){_.defaults(d,{mediaFrame:this.mediaFrame,controller:this,region:this.options.defaultRegion,mode:this.options.defaultMode,data:{}});var f=d.region+"_",g=null;if(e){f+=d.mode,g=this._views[f];var h=g instanceof a,i=!(g instanceof e),j=g instanceof b&&0!=g.compare(d.data);(i||j)&&(h&&g.remove(!0),this._views[f]=g=new e(d))}else this[d.region]instanceof c&&(f+=this[d.region].mode(),g=this._views.hasOwnProperty(f)?this._views[f]:null);return g}});wp.foogallery.media.Frame=d}(wp.foogallery.media.View,wp.foogallery.media.DataView,wp.foogallery.media.Region),function(a,b){var c=a.Select.extend({initialize:function(){_.defaults(this.options,{frame:"select",multiple:!1,resetOnOpen:!0,content:"browse",persistState:!0}),a.Select.prototype.initialize.apply(this,arguments),this.on("select",this._select,this),this.on("open",this._open,this),this.on("close",this._close,this)},createStates:function(){var a=this.options;a.states||this.states.add([new wp.media.controller.Library({library:wp.media.query(a.library),multiple:a.multiple,title:a.title,priority:20,contentUserSetting:a.persistState,syncSelection:a.persistState})])},_select:function(){var a=this.state().get("selection").toJSON();this.trigger("selected",this.options.multiple?a:_.first(a))},_open:function(){var a;this.options.resetOnOpen&&(a=this.state().get("selection"))&&a.reset(),"upload"==this.content.mode()&&this.content.mode(this.options.content),this.controller&&this.controller.$el.parents(".media-modal:first").parent().hide()},_close:function(){this.controller&&(b("body").addClass("modal-open"),this.controller.$el.parents(".media-modal:first").parent().show())}});wp.foogallery.media.Select=c}(wp.media.view.MediaFrame,jQuery),function(a,b){var c=b.extend({initialize:function(){_.defaults(this.options,{frame:"select-import",persistState:!1}),b.prototype.initialize.apply(this,arguments),wp.foogallery.debug&&this.on("all",function(a){console.log("Select\t\t\t"+a,Array.prototype.slice.call(arguments))}),this.importer=new wp.foogallery.frames.Importer({controller:this}),this.on("content:render:import",this.renderImport,this)},createSelectToolbar:function(a,b){b=b||this.options.button||{},b.controller=this,a.view=new c.Toolbar(b)},browseRouter:function(b){b.set({upload:{text:a.tabs.upload,priority:20},browse:{text:a.tabs.browse,priority:40},import:{text:a.tabs.import,priority:50}})},renderImport:function(){this.content.set(this.importer)},toggleMode:function(a,b){(_.isUndefined(b)?!this.isModeActive(a):b)?this.activateMode(a):this.deactivateMode(a)}});wp.foogallery.Select=c}(wp.foogallery.l10n,wp.foogallery.media.Select),function(a,b){var c=b.extend({initialize:function(){var c=this.options;_.bindAll(this,"clickImport","clickBack"),c.items=_.defaults(c.items||{},{import:{style:"primary",text:a.toolbar.import,priority:10,click:this.clickImport,requires:{mode:"importable"}},back:{style:"secondary",text:a.toolbar.back,priority:20,click:this.clickBack,requires:{mode:"backable"}}}),b.prototype.initialize.apply(this,arguments),this.bindModes()},refresh:function(){b.prototype.refresh.apply(this,arguments);var a=this.controller;_.each(this._views,function(b){if(b.model&&b.options&&b.options.requires){var c=b.options.requires;c.mode&&b.model.set("disabled",!a.isModeActive(c.mode))}})},bindModes:function(){var a=_.map(this.options.items,function(a){return a.requires&&a.requires.mode?a.requires.mode:null});if(a=_.uniq(_.compact(a)),a.length){var b=_.map(a,function(a){return[a+":activate",a+":deactivate"]});b=_.flatten(b),this.controller.on(b.join(" "),this.refresh,this)}},clickImport:function(){this.controller.state().trigger("toolbar:button:import")},clickBack:function(){this.controller.state().trigger("toolbar:button:back")}});wp.foogallery.Select.Toolbar=c}(wp.foogallery.l10n,wp.media.view.Toolbar.Select),function(a,b,c){var d=b.extend({tagName:"div",className:"fgi",template:wp.template("fg-importer"),regions:{query:".fgi-region-query",help:".fgi-region-help",content:".fgi-region-content"},initialize:function(){_.defaults(this.options,{mediaFrame:this.controller,region:"content",mode:"import",query:"default",help:"default",content:"getting-started",mimeTypes:["video/mp4","video/webm","video/ogv"]}),b.prototype.initialize.apply(this,arguments),this._request=null,this._history=[],this._first=!1,this._content={error:d.Error,"getting-started":d.GettingStarted,"self-hosted":d.Query.SelfHosted,oembed:d.Query.oEmbed,"json-result":d.Query.JSONResult,search:d.Query.Result,single:d.Query.Result,embed:d.Query.Result,vimeo:d.Query.Vimeo,album:d.Query.Album,channel:d.Query.Channel,playlist:d.Query.Playlist,user:d.Query.User,import:d.Import,"import-result":d.Import.Result},wp.foogallery.debug&&this.on("all",function(a){console.log("Importer\t\t"+a,Array.prototype.slice.call(arguments))}),this.mediaFrame.on("toolbar:button:back",this.back,this),this.on("query:create:default",this.createQuery,this),this.on("help:create:default",this.createHelp,this),this.on("content:create",this.createContent,this),this.on("content:render",this.renderContent,this)},activate:function(){this._first&&(this._first=!1,this.mediaFrame.activateMode("help")),b.prototype.activate.apply(this,arguments)},back:function(){this._history.pop();var a=this._history.pop();this.regionMode("content",a.mode,a.data);var b;_.isObject(a.data)&&(b=this.getView({region:"query"}))&&b.set(_.isString(a.data.query)?a.data.query:"")},createQuery:function(a){a.view=this.getView({region:"query"},d.Query)},createHelp:function(a){a.view=this.getView({region:"help"},d.Help)},createContent:function(a,b,c){this._content[b]?a.view=this.getView({mode:b,data:c},this._content[b]):a.view=this.getView({mode:b,data:c},this._content["json-result"])},renderContent:function(a,b,c){if(this._history.push({mode:b,data:c}),c&&1==c.reset){var d=this._history.pop();this._history.splice(0,this._history.length),this._history.push(d);var e;(e=this.getView({region:"query"}))&&e.set(_.isString(c.query)?c.query:"")}this.mediaFrame.toggleMode("backable",this._history.length>1),this.mediaFrame.deactivateMode("importable"),this.content.set(a)},contentMode:function(a,b){return this.regionMode("content",a,b)},ajax:function(b){var d=this;return c.Deferred(function(e){b=_.defaults(b||{},{action:"fgi_query"}),b.fgi_nonce=d.$(".fgi_nonce").val(),d._request&&d._request.abort(),d.trigger("request:start",b),d._request=c.ajax({type:"POST",url:ajaxurl,data:b,success:function(b){d.trigger("request:success request:end"),b&&b.success&&b.data&&b.data.mode?"error"===b.data.mode?e.reject(b.data):(b.data.timestamp=(new Date).getTime(),e.resolve(b.data)):e.reject({mode:"error",message:a.errors.unexpectedResponse})},error:function(b,c,f){d.trigger("request:error request:end"),"abort"==c?e.reject({mode:"abort",message:a.errors.requestAborted}):e.reject({mode:"error",message:f})}})}).promise()},ajax_query:function(a){return this.ajax(_.defaults(a||{},{action:"fgi_query"}))},ajax_import:function(a){return this.ajax(_.defaults(a||{},{action:"fgi_import"}))},ajax_save:function(a){return this.ajax(_.defaults(a||{},{action:"fgi_save"}))}});wp.foogallery.frames.Importer=d}(wp.foogallery.l10n,wp.foogallery.media.Frame,jQuery),function(a,b){var c=b.extend({tagName:"div",className:"fgi-error",template:wp.template("fgi-error"),namespace:".fgi-error",sel:{ok:".fgi-ok"},initialize:function(){b.prototype.initialize.apply(this,arguments),_.defaults(this.data,{title:a.errorTitle,message:a.errors.unknown})},activate:function(){this.$(this.sel.ok).on("click"+this.namespace,_.bind(this.onOkClick,this))},deactivate:function(){this.$(this.sel.ok).off(this.namespace)},onOkClick:function(a){a.preventDefault(),this.controller.contentMode("getting-started",{reset:!0})}});wp.foogallery.frames.Importer.Error=c}(wp.foogallery.l10n,wp.foogallery.media.DataView),function(a,b){var c=a.extend({tagName:"div",className:"fgi-help",template:wp.template("fgi-help"),namespace:".fgi-help",sel:{title:".fgi-provider-title",content:".fgi-provider-content"},activate:function(){this.$(this.sel.title).on("click"+this.namespace,_.bind(this.onProviderTitleClick,this))},deactivate:function(){this.$(this.sel.title).off(this.namespace)},onProviderTitleClick:function(a){a.preventDefault(),b(a.target).next(this.sel.content).addBack().toggleClass("mode-expanded")}});wp.foogallery.frames.Importer.Help=c}(wp.foogallery.media.View,jQuery),function(a,b,c){var d=b.extend({tagName:"div",className:"fgi-getting-started",template:wp.template("fgi-getting-started"),namespace:".fgi-getting-started",sel:{help:'[href="#toggle-help"]',select:".fgi-select"},initialize:function(){b.prototype.initialize.apply(this,arguments),this._select=null},activate:function(){this.$(this.sel.help).on("click"+this.namespace,_.bind(this.onHelpClick,this)),this.$(this.sel.select).on("click"+this.namespace,_.bind(this.onSelectClick,this))},deactivate:function(){this.$(this.sel.help).off(this.namespace),this.$(this.sel.select).off(this.namespace)},onHelpClick:function(a){a.preventDefault(),this.mediaFrame.toggleMode("help")},onSelectClick:function(a){if(a.preventDefault(),this._select instanceof wp.media.view.MediaFrame.Select)return void this._select.open();var b=c(a.target).data("options");this._select=wp.foogallery({controller:this,title:b.title,button:{text:b.button},library:{type:b.type}}).on("selected",function(a){var b=this.attachmentToSelfHosted(a);this.controller.contentMode(b.mode,b)},this).open()},attachmentToSelfHosted:function(b){var c;if(_.isObject(b)&&_.isString(b.filename)&&-1!==(c=b.filename.lastIndexOf("."))){var d={mode:"self-hosted",id:b.filename.substr(0,c)||"",title:b.title||"",description:b.description||"",thumbnail:"",urls:{mp4:"",ogg:"",webm:""}};if(b.subtype&&""===d.urls[b.subtype])return d.urls[b.subtype]=b.url||d.urls[b.subtype],d}return{mode:"error",message:a.errors.invalidAttachment}}});wp.foogallery.frames.Importer.GettingStarted=d}(wp.foogallery.l10n,wp.foogallery.media.View,jQuery),function(a,b){var c=a.extend({tagName:"div",className:"fgi-query",template:wp.template("fgi-query"),namespace:".fgi-query",sel:{input:".fgi-query-input",help:'[href="#toggle-help"]'},initialize:function(){a.prototype.initialize.apply(this,arguments),this.controller.on("request:start",this.requestStart,this),this.controller.on("request:end",this.requestEnd,this)},activate:function(){this.$(this.sel.input).on("keypress"+this.namespace+" paste"+this.namespace,_.debounce(_.bind(this.onInputChange,this),500)).on("keydown"+this.namespace,_.debounce(_.bind(this.onInputKeydown,this),500)).focus(),this.$(this.sel.help).on("click"+this.namespace,_.bind(this.onHelpClick,this))},deactivate:function(){this.$(this.sel.input).off(this.namespace),this.$(this.sel.help).off(this.namespace)},set:function(a){this.$(this.sel.input).val(a)},get:function(){return this.$(this.sel.input).val()},query:function(a){a=_.isString(a)?a:this.get();var b=this.controller;return b.ajax_query({query:a,page:1,offset:0}).then(function(a){b.contentMode(a.mode,a)},function(a){a&&"abort"===a.mode||b.contentMode(a.mode,a)})},requestStart:function(){this.$el.addClass("mode-requesting")},requestEnd:function(){this.$el.removeClass("mode-requesting")},onInputChange:function(a){this.handleChange(a.target)},onInputKeydown:function(a){var b=[8];_.contains(b,a.which)&&this.handleChange(a.target)},onHelpClick:function(a){a.preventDefault(),this.mediaFrame.toggleMode("help")},handleChange:function(a){var c=b(a),d=c.val();null!==d&&"string"==typeof d&&d.length>=3&&this.query(d)}});wp.foogallery.frames.Importer.Query=c}(wp.foogallery.media.View,jQuery),function(a,b,c){var d=b.extend({tagName:"div",className:"fgi-self-hosted",template:wp.template("fgi-self-hosted"),template_compatibility:wp.template("fgi-compatibility"),namespace:".fgi-self-hosted",sel:{form:".fgi-form",row:".fgi-row",col_input:".fgi-col-input",browse:".fgi-browse",browse_button:".fgi-browse-col-button button",browse_input:".fgi-browse-col-input input",compatibility:".fgi-video-compatibility",validate:'input[name="thumbnail"],input[name^="urls"]'},initialize:function(){b.prototype.initialize.apply(this,arguments),_.defaults(this.data,{mode:"",id:"",thumbnail:"",title:"",description:"",urls:{mp4:"",ogg:"",webm:""}}),this._select={}},render:function(){var a=b.prototype.render.apply(this,arguments);return this.compatibility(),a},activate:function(){this.mediaFrame.on("toolbar:button:import",this.import,this),this.$(this.sel.browse_button).on("click"+this.namespace,_.bind(this.onBrowseClick,this)),this.$(this.sel.validate).on("keypress"+this.namespace+" paste"+this.namespace+" change"+this.namespace,_.debounce(_.bind(this.onValidateChange,this),500)).on("keydown"+this.namespace,_.debounce(_.bind(this.onValidateKeydown,this),500))},deactivate:function(){this.mediaFrame.off("toolbar:button:import",this.import,this),this.$(this.sel.browse_button).off(this.namespace),this.$(this.sel.validate).off(this.namespace)},compatibility:function(){if(this.template_compatibility){var a=this.$('input[name^="urls["]').map(function(){var a=c(this),b=a.val(),d=a.data("type");return _.isString(b)&&""!=b?d:null}).get(),b=wp.foogallery.compatibility(a);this.$(this.sel.compatibility).html(this.template_compatibility(b))}},onBrowseClick:function(a){a.preventDefault();var b=this,d=c(a.target),e=d.data("options");if(this._select[e.type]instanceof wp.media.view.MediaFrame.Select)return void this._select[e.type].open();this._select[e.type]=wp.foogallery({frame:"select-child",mode:"browse",controller:this,title:e.title,button:{text:e.button},library:{type:e.type}}).on("selected",function(a){var c=d.parents(b.sel.browse).find(b.sel.browse_input).val(a.url);b.validateChange(c)}).open()},onValidateChange:function(a){this.validateChange(a.target)},onValidateKeydown:function(a){var b=[8];_.contains(b,a.which)&&this.validateChange(a.target)},validateChange:function(a){var b=c(a),d=this.validateInput(b,!0);return d&&b.is('[name^="urls["]')&&this.compatibility(),d&&(d=this.validateForm()),this.mediaFrame.toggleMode("importable",d),d},validateForm:function(a){for(var b=this.$(this.sel.validate),c=!0,d=0,e=b.length;d<e;d++)this.validateInput(b.eq(d),a)||(c=!1);return c},validateInput:function(a,b){var d,e=c(a),f=!0;if((d=this._validate(e)).length>0){if(f=!1,1==b){var g=c.map(d,function(a){return c("<p/>",{class:"fgi-input-error",text:a})});e.parents(this.sel.row).addClass("mode-error"),e.parents([this.sel.browse,this.sel.col_input].join(",")).first().find(".fgi-input-error").remove().end().append(g)}}else e.parents(this.sel.row).removeClass("mode-error"),e.parents([this.sel.browse,this.sel.col_input].join(",")).first().find(".fgi-input-error").remove();return f},_validate:function(b){var d=c(b),e=d.val(),f=d.data("required"),g=_.isString(e)&&""!==e,h=this._regex(d.data("pattern")),i=d.data("messages")||{},j=[];if(f&&!g){var k;if(_.isString(f)&&(k=this.$(f).not(d)).length>0){for(var l,m=!1,n=0,o=k.length;n<o;n++)l=k.eq(n).val(),_.isString(l)&&""!==l&&(m=!0);m||j.push(_.isString(i.required)?i.required:a.errors.required)}else j.push(_.isString(i.required)?i.required:a.errors.required)}return h&&g&&!h.test(e)&&j.push(_.isString(i.pattern)?i.pattern:a.errors.pattern),j},_regex:function(a){if(!_.isString(a)||""===a)return null;try{return new RegExp(a,"i")}catch(a){return null}},import:function(){if(this.validateForm(!0)){var a=wp.foogallery.formJSON(this.$(this.sel.form));this.controller.contentMode("import",{mode:"self-hosted",total:1,videos:[a]})}}});wp.foogallery.frames.Importer.Query.SelfHosted=d}(wp.foogallery.l10n,wp.foogallery.media.DataView,jQuery),function(a,b){var c=a.extend({tagName:"div",className:"fgi-json-result",render:function(){if(this.template)return a.prototype.render.apply(this,arguments);var c=this.prepare();return this.views.detach(),this.$el.html(b("<pre/>",{text:JSON.stringify(c,null,2)})),this.views.render(),this}});wp.foogallery.frames.Importer.Query.JSONResult=c}(wp.foogallery.media.DataView,jQuery),function(a,b){var c=a.extend({tagName:"div",className:"fgi-query-result",template:wp.template("fgi-query-result"),template_notification:wp.template("fgi-query-result-notification"),template_items:wp.template("fgi-query-result-items"),template_status:wp.template("fgi-query-result-status"),namespace:".fgi-query-result",sel:{notification:".fgi-query-result-notification",list:".fgi-query-result-list",status:".fgi-query-result-status",check:".fgi-query-result-video-check",thumbnail:".fgi-query-result-video-thumbnail",paged:".fgi-query-result-paged",loadMore:'[href="#load-more"]',tryAgain:'[href="#try-again"]',offset:".fgi-query-result-offset",total:".fgi-query-result-total"},initialize:function(){a.prototype.initialize.apply(this,arguments),_.defaults(this.data,{total:1,page:1,nextPage:0,offset:0,videos:[]})},render:function(){var a;return this.prepare&&(a=this.prepare()),this.views.detach(),this.template&&(a=a||{},this.trigger("prepare",a),this.$el.html(this.template(a)).toggleClass("mode-single",this.data.total<=1),this.template_notification&&this.$(this.sel.notification).html(this.template_notification(a)),this.template_items&&this.$(this.sel.list).html(this.template_items(a)),this.template_status&&this.$(this.sel.status).html(this.template_status(a))),this.views.render(),this},activate:function(){this.mediaFrame.toggleMode("importable",this.hasSelection()),this.mediaFrame.on("toolbar:button:import",this.import,this),this.$(this.sel.list).on("click"+this.namespace,this.sel.check,_.bind(this.onCheckClick,this)).on("click"+this.namespace,this.sel.thumbnail,_.bind(this.onThumbnailClick,this)),this.$el.on("click"+this.namespace,this.sel.loadMore,_.bind(this.onLoadMoreClick,this)),this.$el.on("click"+this.namespace,this.sel.tryAgain,_.bind(this.onLoadMoreClick,this))},deactivate:function(){this.mediaFrame.off("toolbar:button:import",this.onImportClick,this),this.$(this.sel.list).off(this.namespace),this.$el.off(this.namespace)},onThumbnailClick:function(a){a.preventDefault(),this.$(this.sel.list).children(".mode-current").removeClass("mode-current"),b(a.target).parents("li:first").addClass("mode-selected mode-current"),this.mediaFrame.toggleMode("importable",this.hasSelection())},onCheckClick:function(a){a.preventDefault(),a.stopPropagation(),b(a.target).parents("li:first").removeClass("mode-selected mode-current"),this.mediaFrame.toggleMode("importable",this.hasSelection())},hasSelection:function(){return this.$(this.sel.list).children(".mode-selected").length>0},selection:function(){var a=this;return this.$(this.sel.list).children(".mode-selected").map(function(c,d){return _.find(a.data.videos,function(a){return a.id==b(d).attr("data-id")})}).get()},loadMore:function(){var a=this.data,b=this,c=b.$(b.sel.status).removeClass("mode-error").addClass("mode-loading");return this.controller.ajax_query({query:a.query,page:a.nextPage,offset:a.offset}).then(function(a){var d=b.template_items(a);b.$(b.sel.list).append(d),a.videos=b.data.videos.concat(a.videos),b.data=b.options.data=a,d=b.template_status(a),c.removeClass("mode-loading mode-error").html(d)},function(){c.removeClass("mode-loading").addClass("mode-error")})},onLoadMoreClick:function(a){a.preventDefault(),this.loadMore()},import:function(){var a=this.selection();this.controller.contentMode("import",{mode:"selection",total:a.length,videos:a})}});wp.foogallery.frames.Importer.Query.Result=c}(wp.foogallery.media.DataView,jQuery),function(a){var b=a.extend({template_notification:wp.template("fgi-album-notification"),namespace:".fgi-album",activate:function(){this.$('[href="#import-album"]').on("click"+this.namespace,_.bind(this.onImportAlbumClick,this)),a.prototype.activate.apply(this,arguments)},deactivate:function(){this.$('[href="#import-album"]').off(this.namespace),a.prototype.deactivate.apply(this,arguments)},onImportAlbumClick:function(a){a.preventDefault(),this.controller.contentMode("import",this.data)}});wp.foogallery.frames.Importer.Query.Album=b}(wp.foogallery.frames.Importer.Query.Result),function(a){var b=a.extend({template_notification:wp.template("fgi-channel-notification"),namespace:".fgi-channel",activate:function(){this.$('[href="#import-channel"]').on("click"+this.namespace,_.bind(this.onImportChannelClick,this)),a.prototype.activate.apply(this,arguments)},deactivate:function(){this.$('[href="#import-channel"]').off(this.namespace),a.prototype.deactivate.apply(this,arguments)},onImportChannelClick:function(a){a.preventDefault(),this.controller.contentMode("import",this.data)}});wp.foogallery.frames.Importer.Query.Channel=b}(wp.foogallery.frames.Importer.Query.Result),function(a){var b=a.extend({template_notification:wp.template("fgi-playlist-notification"),namespace:".fgi-playlist",activate:function(){this.$('[href="#import-playlist"]').on("click"+this.namespace,_.bind(this.onImportPlaylistClick,this)),a.prototype.activate.apply(this,arguments)},deactivate:function(){this.$('[href="#import-playlist"]').off(this.namespace),a.prototype.deactivate.apply(this,arguments)},onImportPlaylistClick:function(a){a.preventDefault(),this.controller.contentMode("import",this.data)}});wp.foogallery.frames.Importer.Query.Playlist=b}(wp.foogallery.frames.Importer.Query.Result),function(a){var b=a.extend({template_notification:wp.template("fgi-user-notification"),namespace:".fgi-user",activate:function(){this.$('[href="#import-user"]').on("click"+this.namespace,_.bind(this.onImportUserClick,this)),a.prototype.activate.apply(this,arguments)},deactivate:function(){this.$('[href="#import-user"]').off(this.namespace),a.prototype.deactivate.apply(this,arguments)},onImportUserClick:function(a){a.preventDefault(),this.controller.contentMode("import",this.data)}});wp.foogallery.frames.Importer.Query.User=b}(wp.foogallery.frames.Importer.Query.Result),function(a,b,c){var d=b.extend({tagName:"div",className:"fgi-oembed",template:wp.template("fgi-oembed"),namespace:".fgi-oembed",sel:{form:".fgi-form",row:".fgi-row",col_input:".fgi-col-input",browse:".fgi-browse",browse_button:".fgi-browse-col-button button",browse_input:".fgi-browse-col-input input",compatibility:".fgi-video-compatibility",validate:'input[name="thumbnail"]'},initialize:function(){b.prototype.initialize.apply(this,arguments),_.defaults(this.data,{mode:"",id:"",provider:"",thumbnail:"",title:"",description:""}),this._select={}},activate:function(){this.mediaFrame.on("toolbar:button:import",this.import,this),this.$(this.sel.browse_button).on("click"+this.namespace,_.bind(this.onBrowseClick,this)),this.$(this.sel.validate).on("keypress"+this.namespace+" paste"+this.namespace+" change"+this.namespace,_.debounce(_.bind(this.onValidateChange,this),500)).on("keydown"+this.namespace,_.debounce(_.bind(this.onValidateKeydown,this),500))},deactivate:function(){this.mediaFrame.off("toolbar:button:import",this.import,this),this.$(this.sel.browse_button).off(this.namespace),this.$(this.sel.validate).off(this.namespace)},onBrowseClick:function(a){a.preventDefault();var b=this,d=c(a.target),e=d.data("options");if(this._select[e.type]instanceof wp.media.view.MediaFrame.Select)return void this._select[e.type].open();this._select[e.type]=wp.foogallery({frame:"select-child",mode:"browse",controller:this,title:e.title,button:{text:e.button},library:{type:e.type}}).on("selected",function(a){var c=d.parents(b.sel.browse).find(b.sel.browse_input).val(a.url);b.validateChange(c)}).open()},onValidateChange:function(a){this.validateChange(a.target)},onValidateKeydown:function(a){var b=[8];_.contains(b,a.which)&&this.validateChange(a.target)},validateChange:function(a){var b=c(a),d=this.validateInput(b,!0);return d&&(d=this.validateForm()),this.mediaFrame.toggleMode("importable",d),d},validateForm:function(a){for(var b=this.$(this.sel.validate),c=!0,d=0,e=b.length;d<e;d++)this.validateInput(b.eq(d),a)||(c=!1);return c},validateInput:function(a,b){var d,e=c(a),f=!0;if((d=this._validate(e)).length>0){if(f=!1,1==b){var g=c.map(d,function(a){return c("<p/>",{class:"fgi-input-error",text:a})});e.parents(this.sel.row).addClass("mode-error"),e.parents([this.sel.browse,this.sel.col_input].join(",")).first().find(".fgi-input-error").remove().end().append(g)}}else e.parents(this.sel.row).removeClass("mode-error"),e.parents([this.sel.browse,this.sel.col_input].join(",")).first().find(".fgi-input-error").remove();return f},_validate:function(b){
0 ignored issues
show
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
The usage of ! looks confusing here.

The following shows a case which JSHint considers confusing and its respective non-confusing counterpart:

! (str.indexOf(i) > -1) // Bad
str.indexOf(i) === -1 // Good
Loading history...
Did you mean to return a conditional instead of an assignment?

This error is thrown if you assign to a variable in your return statement:

function someFunction(x) {
    return x = 1;
}

// Instead you maybe ment

function someFunction(x) {
    return x === 1;
}
Loading history...
Expected an identifier and instead saw '==='.
Loading history...
The constructor invocation misses ().

This requirement purely is a coding style requirement and is not required to run on JavaScript engines:

new Date; // Bad
new Date(); // Good
Loading history...
There were too many errors found in this file; checking aborted after 90%.

If JSHint finds too many errors in a file, it aborts checking altogether because it suspects a configuration issue.

Further Reading:

Loading history...
10
var d=c(b),e=d.val(),f=d.data("required"),g=_.isString(e)&&""!==e,h=this._regex(d.data("pattern")),i=d.data("messages")||{},j=[];if(f&&!g){var k;if(_.isString(f)&&(k=this.$(f).not(d)).length>0){for(var l,m=!1,n=0,o=k.length;n<o;n++)l=k.eq(n).val(),_.isString(l)&&""!==l&&(m=!0);m||j.push(_.isString(i.required)?i.required:a.errors.required)}else j.push(_.isString(i.required)?i.required:a.errors.required)}return h&&g&&!h.test(e)&&j.push(_.isString(i.pattern)?i.pattern:a.errors.pattern),j},_regex:function(a){if(!_.isString(a)||""===a)return null;try{return new RegExp(a,"i")}catch(a){return null}},import:function(){if(this.validateForm(!0)){var a=wp.foogallery.formJSON(this.$(this.sel.form));this.controller.contentMode("import",{mode:"embed",total:1,videos:[a]})}}});wp.foogallery.frames.Importer.Query.oEmbed=d}(wp.foogallery.l10n,wp.foogallery.media.DataView,jQuery),function(a,b,c){var d=b.extend({tagName:"div",className:"fgi-vimeo",template:wp.template("fgi-vimeo"),namespace:".fgi-vimeo",sel:{access_token:"input[name='access_token']",save:".fgi-save",help:'[href="#toggle-help"]',container:".button-hero-container",error:".fgi-vimeo-error-message"},cls:{error:"fgi-vimeo-error"},initialize:function(){b.prototype.initialize.apply(this,arguments),_.defaults(this.data,{mode:"",access_token:"",query:""})},activate:function(){this.$(this.sel.help).on("click"+this.namespace,_.bind(this.onHelpClick,this)),this.$(this.sel.save).on("click"+this.namespace,_.bind(this.onSaveClick,this)),this.$(this.sel.access_token).on("keypress"+this.namespace+" paste"+this.namespace+" change"+this.namespace,_.debounce(_.bind(this.onValidateChange,this),500)).on("keydown"+this.namespace,_.debounce(_.bind(this.onValidateKeydown,this),500))},deactivate:function(){this.$(this.sel.save).off(this.namespace),this.$(this.sel.access_token).off(this.namespace)},onValidateChange:function(a){this.validateChange(a.target)},onValidateKeydown:function(a){var b=[8];_.contains(b,a.which)&&this.validateChange(a.target)},validateChange:function(a){var b=c(a),d=b.val(),e=_.isString(d)&&d.length>=30;return this.$(this.sel.save).attr("disabled",!e),this.$(this.sel.container).removeClass(this.cls.error),this.$(this.sel.error).empty(),e},onHelpClick:function(a){a.preventDefault(),this.mediaFrame.toggleMode("help")},onSaveClick:function(a){a.preventDefault(),this.save()},save:function(){var a=this.$(this.sel.access_token).val();if(_.isString(a)&&a.length>=30){var b=this,c=this.controller;return b.$(b.sel.save).attr("disabled",!0),c.ajax_save({access_token:a}).then(function(){var a=c.getView({region:"query"});a instanceof wp.foogallery.frames.Importer.Query&&a.query(b.data.query)},function(a){a&&"abort"===a.mode||(b.$(b.sel.error).html(a.message),b.$(b.sel.container).addClass(b.cls.error))})}}});wp.foogallery.frames.Importer.Query.Vimeo=d}(wp.foogallery.l10n,wp.foogallery.media.DataView,jQuery),function(a,b,c){var d=b.extend({tagName:"div",className:"fgi-import",template:wp.template("fgi-import"),namespace:".fgi-import",sel:{yes:".fgi-import-yes",back:".fgi-import-back",cancel:".fgi-import-cancel",progress_value:".fgi-import-progress-value",progress_text:".fgi-import-progress-text"},initialize:function(){b.prototype.initialize.apply(this,arguments),_.defaults(this.data,{total:0,videos:[]}),this.max=10,this.cancelling=!1,this._result={imported:[],failed:[],errors:[],cancelled:[]},this._start=-1,this._end=-1,this.once("ready",this.onceReady,this)},onceReady:function(){this.skipConfirm()&&this.do_import().then(_.bind(this.checkResult,this),function(a){console.log(a)})},remove:function(a){return this.$el.removeClass("mode-importing"),b.prototype.remove.apply(this,arguments)},activate:function(){this.$(this.sel.yes).on("click"+this.namespace,_.bind(this.onYesClick,this)),this.$(this.sel.back).on("click"+this.namespace,_.bind(this.onBackClick,this)),this.$(this.sel.cancel).on("click"+this.namespace,_.bind(this.onCancelClick,this))},deactivate:function(){this.$(this.sel.yes).off(this.namespace),this.$(this.sel.back).off(this.namespace),this.$(this.sel.cancel).off(this.namespace)},onBackClick:function(a){a.preventDefault(),this.controller.back()},onYesClick:function(a){a.preventDefault(),this.do_import().then(_.bind(this.checkResult,this),function(a){console.log(a)})},onCancelClick:function(a){a.preventDefault(),this.setCancelling(!0)},setCancelling:function(b){this.cancelling=b,b?this.$(this.sel.cancel).attr("disabled","disabled").text(a.import.cancelling):this.$(this.sel.cancel).removeAttr("disabled").text(a.import.cancel)},skipConfirm:function(){return _.isNumber(this.data.total)&&this.data.total<=this.max},hasNextPage:function(){return _.isNumber(this.data.nextPage)&&this.data.nextPage>1},isPaged:function(){return _.isNumber(this.data.page)&&(this.data.page>1||1==this.data.page&&0!=this.data.nextPage)},do_import:function(b){var d=this,e=this.data,f=[];if(_.isArray(e.videos)&&e.videos.length>0){d.$el.addClass("mode-importing"),d.mediaFrame.deactivateMode("backable");var g=e.videos.length;if(b?(d._start=d._end+1,d._end+=g):(d._start=1,d._end=g),e.videos.length>d.max){var h=[],i=0;_.each(e.videos,function(a){++i>d.max&&(f.push(h),i=1,h=[]),h.push(a)}),h.length>0&&f.push(h)}else f=_.map(e.videos,function(a){return[a]});var j=f.length,k=[],l=[],m=[],n=[],o=c.Deferred(),p=o.promise();return _.each(f,function(a,b){p=p.then(function(){return d.cancelling?void Array.prototype.push.apply(n,a):d.controller.ajax_import({videos:a}).then(function(a){Array.prototype.push.apply(k,a.imported),Array.prototype.push.apply(l,a.failed),Array.prototype.push.apply(m,a.errors),d.progressed(b+1,j)})})}),p=p.then(function(){var a=l.length>0?"mixed":"completed";return 0===k.length&&(a="failed"),d.cancelling&&(a="cancelled"),d.setCancelling(!1),{state:a,imported:k,failed:l,errors:m,cancelled:n}}),d.progressed(0,j),o.resolve(),p}return c.Deferred().reject({mode:"error",message:a.errors.importNoVideos}).promise()},checkResult:function(b){switch(Array.prototype.push.apply(this._result.imported,b.imported),Array.prototype.push.apply(this._result.failed,b.failed),Array.prototype.push.apply(this._result.errors,b.errors),Array.prototype.push.apply(this._result.cancelled,b.cancelled),b.state){case"cancelled":this.setProgress(0,a.import.cancelled),this.cancelled(this._result),this._result={imported:[],failed:[],errors:[],cancelled:[]};break;default:if(this.hasNextPage()){var c=this,d=wp.foogallery.format_l10n(a.import.fetching,{number:this.data.nextPage});this.setProgress(0,d),this.controller.ajax_query({query:this.data.query,page:this.data.nextPage,offset:this.data.offset}).then(function(a){c.data=a,c.do_import(!0).then(_.bind(c.checkResult,c),function(a){console.log(a)})})}else this.completed(this._result),this._result={imported:[],failed:[],errors:[],cancelled:[]}}},setProgress:function(a,b){_.isString(b)||(b=a+"%"),this.$(this.sel.progress_text).text(b),this.$(this.sel.progress_value).css("width",a+"%")},progressed:function(b,c){wp.foogallery.debug&&console.log("progressed",b,c);var d,e=Math.round(b/c*100*100)/100,f=this.data;100===e?d=a.import.complete:this.isPaged()&&(d=wp.foogallery.format_l10n(a.import.importing,{start:this._start,end:this._end,total:f.total,percent:e})),this.setProgress(e,d)},completed:function(a){_.defaults(a,{reset:!0}),wp.foogallery.debug&&console.log("completed",a),this.$el.removeClass("mode-importing"),this.controller.contentMode("import-result",a),"import"!==this.mediaFrame.content.mode()&&this.mediaFrame.content.mode("import")},cancelled:function(a){_.defaults(a,{reset:!0}),wp.foogallery.debug&&console.log("cancelled",a),this.$el.removeClass("mode-importing"),this.controller.contentMode("import-result",a),"import"!==this.mediaFrame.content.mode()&&this.mediaFrame.content.mode("import")}});wp.foogallery.frames.Importer.Import=d}(wp.foogallery.l10n,wp.foogallery.media.DataView,jQuery),function(a){var b=a.extend({tagName:"div",className:"fgi-import-result",template:wp.template("fgi-import-result"),namespace:".fgi-import-result",sel:{toggle_failed:'[href="#toggle-failed"]',toggle_cancelled:'[href="#toggle-cancelled"]',try_again_failed:'[href="#try-again-failed"]',import_cancelled:'[href="#import-cancelled"]',failed_list:".fgi-import-failed",cancelled_list:".fgi-import-cancelled",more_videos:".fgi-import-more-videos",add_videos:".fgi-import-add-videos",media_library:'[href="#media-library"]'},initialize:function(){if(a.prototype.initialize.apply(this,arguments),_.defaults(this.data,{imported:[],failed:[],errors:[],cancelled:[]}),this.data.imported.length>0){var b=this.mediaFrame.state(),c=b.get("library"),d=b.get("selection");c.props.set({ignore:+new Date}),this.loadMore(c,d)}},activate:function(){this.$(this.sel.toggle_failed).on("click"+this.namespace,_.bind(this.onToggleFailedClick,this)),this.$(this.sel.toggle_cancelled).on("click"+this.namespace,_.bind(this.onToggleCancelledClick,this)),this.$(this.sel.try_again_failed).on("click"+this.namespace,_.bind(this.onTryAgainFailedClick,this)),this.$(this.sel.import_cancelled).on("click"+this.namespace,_.bind(this.onImportCancelledClick,this)),this.$(this.sel.more_videos).on("click"+this.namespace,_.bind(this.onImportMoreVideosClick,this)),this.$(this.sel.add_videos).on("click"+this.namespace,_.bind(this.onImportAddVideosClick,this)),this.$(this.sel.media_library).on("click"+this.namespace,_.bind(this.onMediaLibraryClick,this))},deactivate:function(){this.$(this.sel.toggle_failed).off(this.namespace),this.$(this.sel.toggle_cancelled).off(this.namespace),this.$(this.sel.try_again_failed).off(this.namespace),this.$(this.sel.import_cancelled).off(this.namespace),this.$(this.sel.more_videos).off(this.namespace),this.$(this.sel.add_videos).off(this.namespace),this.$(this.sel.media_library).off(this.namespace)},loadMore:function(a,b){var c=this;a.more().then(function(){if(a.models.length<c.data.imported.length)c.loadMore(a,b);else{var d=_.filter(a.models,function(a){var b=a.get("id");return-1!=_.indexOf(c.data.imported,b)});d.length>0&&b.add(d)}})},onToggleFailedClick:function(a){a.preventDefault(),this.$(this.sel.failed_list).toggleClass("mode-expanded")},onToggleCancelledClick:function(a){a.preventDefault(),this.$(this.sel.cancelled_list).toggleClass("mode-expanded")},onTryAgainFailedClick:function(a){a.preventDefault(),this.controller.contentMode("import",{mode:"retry",total:this.data.failed.length,videos:this.data.failed})},onImportCancelledClick:function(a){a.preventDefault(),this.controller.contentMode("import",{mode:"retry",total:this.data.cancelled.length,videos:this.data.cancelled})},onImportMoreVideosClick:function(a){a.preventDefault(),this.controller.contentMode("getting-started",{reset:!0})},onImportAddVideosClick:function(a){a.preventDefault(),this.controller.contentMode("getting-started",{reset:!0}),this.mediaFrame.content.mode("browse"),this.mediaFrame.$(".media-button-select").click()},onMediaLibraryClick:function(a){a.preventDefault(),this.mediaFrame.content.mode("browse")}});wp.foogallery.frames.Importer.Import.Result=b}(wp.foogallery.media.DataView);