Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
File Manager
/
post-date
/
wp-content
/
plugins
/
kirki
/
kirki-packages
/
control-image
/
dist
:
control.js.map
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
{"mappings":"AAAAA,GAAGC,UAAUC,mBAAmB,eAAiBF,GAAGC,UAAUE,oBAAoBC,OAAQ,CAEzFC,iBAAkB,SAAUC,GAC3B,IAAIC,EAAOC,EAAQC,EAASC,EAAcC,EAAcC,EAExDL,GADAD,EAAgBA,GAAWO,MACHC,QAAQC,OAChCP,EAAoBQ,EAAEC,YAAaX,EAAQY,OAAOC,UAAeH,EAAEC,YAAaX,EAAQY,OAAOC,QAAQC,SAA+C,MAAjCd,EAAQY,OAAOC,QAAQC,QAC5IX,EAAgBH,EAAQe,UAAUC,KAAM,4BACxCZ,EAAkB,UAAYF,EAAWD,EAAMgB,IAAMhB,EACrDI,EAAgBL,EAAQe,UAAUC,KAAM,+BACxCV,EAAgBN,EAAQe,UAAUC,KAAM,yBAGxCf,EAAU,UAAYC,GAAUQ,EAAEQ,SAAUjB,GAAY,CAAEgB,IAAKhB,GAAUA,EAGlE,OAASC,GAAU,OAASA,GAAY,KAAOD,GACrDP,GAAGyB,MAAMC,WAAYnB,GAAQoB,QAAQC,MAAM,WAC1CC,YAAY,WACX,IAAIN,EAAMvB,GAAGyB,MAAMC,WAAYnB,GAAQuB,IAAK,OAC5CrB,EAAQsB,cAAcC,SAAU,6BAA8BC,KAAM,aAAeV,EAAM,iBACvF,SAKE,QAAUf,GAAU,KAAOD,GAAa,UAAYC,IAAYQ,EAAEC,YAAaV,EAAMgB,MAAS,KAAOhB,EAAMgB,MACjHjB,EAAQe,UAAUC,KAAM,wBAAyBY,QAI3C,QAAU1B,GAAU,KAAOD,GAAa,UAAYC,IAAYQ,EAAEC,YAAaV,EAAMgB,MAAS,KAAOhB,EAAMgB,OACjHZ,EAAauB,OAIT3B,IAAUD,EAAQY,OAAO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CV,EAAgBN,EAAQe,UAAUC,KAAM,yBAEnCb,EAAQ4C,QACZ5C,EAAQsB,cAAcC,SAAU,eAAgBC,KAAMjC,GAAGwD,KAAKC,GAAI,oBAAqB,UAEnF9C,EAAa0C,SACjB1C,EAAauB,OACRwB,OAAQ9C,GAAgB+C,SAAU,WACtC/C,EAAc0C,WAKjBhD,EAAQe,UAAUe,GAAI,QAAS,yBAAyB,SAAUC,GACjEA,EAAEkB,iBAEFjD,EAAQQ,QAAQmC,IAAK3C,EAAQY,OAAOiB,SAEpC1B,EAAgBH,EAAQe,UAAUC,KAAM,4BACxCX,EAAgBL,EAAQe,UAAUC,KAAM,+BACxCV,EAAgBN,EAAQe,UAAUC,KAAM,yBAEnCb,EAAQ4C,QACZ5C,EAAQsB,cAAcC,SAAU,6BAA8BC,KAAM,aAAe3B,EAAQY,OAAOiB,QAAU,eAExGxB,EAAa0C,SACjB1C,EAAa2C,OACb1C,EAAcsB","sources":["src/control.js"],"sourcesContent":["wp.customize.controlConstructor['kirki-image'] = wp.customize.kirkiDynamicControl.extend( {\n\n\tinitKirkiControl: function( control ) {\n\t\tvar value, saveAs, preview, previewImage, removeButton, defaultButton;\n\t\tcontrol = control || this;\n\t\tvalue = control.setting._value;\n\t\tsaveAs = ( ! _.isUndefined( control.params.choices ) && ! _.isUndefined( control.params.choices.save_as ) ) ? control.params.choices.save_as : 'url';\n\t\tpreview = control.container.find( '.placeholder, .thumbnail' );\n\t\tpreviewImage = ( 'array' === saveAs ) ? value.url : value;\n\t\tremoveButton = control.container.find( '.image-upload-remove-button' );\n\t\tdefaultButton = control.container.find( '.image-default-button' );\n\n\t\t// Make sure value is properly formatted.\n\t\tvalue = ( 'array' === saveAs && _.isString( value ) ) ? { url: value } : value;\n\n\t\t// Tweaks for save_as = id.\n\t\tif ( ( 'id' === saveAs || 'ID' === saveAs ) && '' !== value ) {\n\t\t\twp.media.attachment( value ).fetch().then( function() {\n\t\t\t\tsetTimeout( function() {\n\t\t\t\t\tvar url = wp.media.attachment( value ).get( 'url' );\n\t\t\t\t\tpreview.removeClass().addClass( 'thumbnail thumbnail-image' ).html( '<img src=\"' + url + '\" alt=\"\" />' );\n\t\t\t\t}, 700 );\n\t\t\t} );\n\t\t}\n\n\t\t// If value is not empty, hide the \"default\" button.\n\t\tif ( ( 'url' === saveAs && '' !== value ) || ( 'array' === saveAs && ! _.isUndefined( value.url ) && '' !== value.url ) ) {\n\t\t\tcontrol.container.find( 'image-default-button' ).hide();\n\t\t}\n\n\t\t// If value is empty, hide the \"remove\" button.\n\t\tif ( ( 'url' === saveAs && '' === value ) || ( 'array' === saveAs && ( _.isUndefined( value.url ) || '' === value.url ) ) ) {\n\t\t\tremoveButton.hide();\n\t\t}\n\n\t\t// If value is default, hide the default button.\n\t\tif ( value === control.params.default ) {\n\t\t\tcontrol.container.find( 'image-default-button' ).hide();\n\t\t}\n\n\t\tif ( '' !== previewImage ) {\n\t\t\tpreview.removeClass().addClass( 'thumbnail thumbnail-image' ).html( '<img src=\"' + previewImage + '\" alt=\"\" />' );\n\t\t}\n\n\t\tcontrol.container.on( 'click', '.image-upload-button', function( e ) {\n\t\t\tvar image = wp.media( { multiple: false } ).open().on( 'select', function() {\n\n\t\t\t\t// This will return the selected image from the Media Uploader, the result is an object.\n\t\t\t\tvar uploadedImage = image.state().get( 'selection' ).first(),\n\t\t\t\t\tjsonImg = uploadedImage.toJSON();\n\n\t\t\t\tpreviewImage = jsonImg.url;\n\n\t\t\t\tif ( ! _.isUndefined( jsonImg.sizes ) ) {\n\t\t\t\t\tpreviewImage = jsonImg.sizes.full.url;\n\t\t\t\t\tif ( ! _.isUndefined( jsonImg.sizes.medium ) ) {\n\t\t\t\t\t\tpreviewImage = jsonImg.sizes.medium.url;\n\t\t\t\t\t} else if ( ! _.isUndefined( jsonImg.sizes.thumbnail ) ) {\n\t\t\t\t\t\tpreviewImage = jsonImg.sizes.thumbnail.url;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( 'array' === saveAs ) {\n\t\t\t\t\tcontrol.setting.set( {\n\t\t\t\t\t\tid: jsonImg.id,\n\t\t\t\t\t\turl: !_.isUndefined(jsonImg.sizes)\n\t\t\t\t\t\t\t? jsonImg.sizes.full.url\n\t\t\t\t\t\t\t: jsonImg.url,\n\t\t\t\t\t\twidth: jsonImg.width,\n\t\t\t\t\t\theight: jsonImg.height,\n\t\t\t\t\t} );\n\t\t\t\t} else if ( 'id' === saveAs ) {\n\t\t\t\t\tcontrol.setting.set( jsonImg.id );\n\t\t\t\t} else {\n\t\t\t\t\tcontrol.setting.set( ( ! _.isUndefined( jsonImg.sizes ) ) ? jsonImg.sizes.full.url : jsonImg.url );\n\t\t\t\t}\n\n\t\t\t\tif ( preview.length ) {\n\t\t\t\t\tpreview.removeClass().addClass( 'thumbnail thumbnail-image' ).html( '<img src=\"' + previewImage + '\" alt=\"\" />' );\n\t\t\t\t}\n\t\t\t\tif ( removeButton.length ) {\n\t\t\t\t\tremoveButton.show();\n\t\t\t\t\tdefaultButton.hide();\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\te.preventDefault();\n\t\t} );\n\n\t\tcontrol.container.on( 'click', '.image-upload-remove-button', function( e ) {\n\t\t\te.preventDefault();\n\n\t\t\tcontrol.setting.set( '' );\n\n\t\t\tpreview = control.container.find( '.placeholder, .thumbnail' );\n\t\t\tremoveButton = control.container.find( '.image-upload-remove-button' );\n\t\t\tdefaultButton = control.container.find( '.image-default-button' );\n\n\t\t\tif ( preview.length ) {\n\t\t\t\tpreview.removeClass().addClass( 'placeholder' ).html( wp.i18n.__( 'No image selected', 'kirki' ) );\n\t\t\t}\n\t\t\tif ( removeButton.length ) {\n\t\t\t\tremoveButton.hide();\n\t\t\t\tif ( jQuery( defaultButton ).hasClass( 'button' ) ) {\n\t\t\t\t\tdefaultButton.show();\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\n\t\tcontrol.container.on( 'click', '.image-default-button', function( e ) {\n\t\t\te.preventDefault();\n\n\t\t\tcontrol.setting.set( control.params.default );\n\n\t\t\tpreview = control.container.find( '.placeholder, .thumbnail' );\n\t\t\tremoveButton = control.container.find( '.image-upload-remove-button' );\n\t\t\tdefaultButton = control.container.find( '.image-default-button' );\n\n\t\t\tif ( preview.length ) {\n\t\t\t\tpreview.removeClass().addClass( 'thumbnail thumbnail-image' ).html( '<img src=\"' + control.params.default + '\" alt=\"\" />' );\n\t\t\t}\n\t\t\tif ( removeButton.length ) {\n\t\t\t\tremoveButton.show();\n\t\t\t\tdefaultButton.hide();\n\t\t\t}\n\t\t} );\n\t}\n} );\n"],"names":["wp","customize","controlConstructor","kirkiDynamicControl","extend","initKirkiControl","control","value","saveAs","preview","previewImage","removeButton","defaultButton","this","setting","_value","_","isUndefined","params","choices","save_as","container","find","url","isString","media","attachment","fetch","then","setTimeout","get","removeClass","addClass","html","hide","default","on","e","image","multiple","open","jsonImg","state","first","toJSON","sizes","full","medium","thumbnail","set","id","width","height","length","show","preventDefault","i18n","__","jQuery","hasClass"],"version":3,"file":"control.js.map"}