PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / vendor / wp-media / plugin-family / src / assets / js / index.js

index.js in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF trunk, at vendor/wp-media/plugin-family/src/assets/js/index.js

1 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{"use strict";const e=window.wp.hooks,i=window.wp.compose,n=window.wp.element,t=window.wp.blockEditor,o=window.wp.components,a=window.wp.i18n,r=window.wp.primitives,s=window.ReactJSXRuntime,l=(0,s.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24",children:(0,s.jsx)(r.Path,{d:"M10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6zM10 1c-5 0-9 4-9 9s4 9 9 9 9-4 9-9-4-9-9-9zm0 16c-3.9 0-7-3.1-7-7s3.1-7 7-7 7 3.1 7 7-3.1 7-7 7zm1-11H9v3H6v2h3v3h2v-3h3V9h-3V6z"})}),c=(0,s.jsx)(r.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,s.jsx)(r.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})}),m=(0,i.createHigherOrderComponent)(e=>i=>{const[r,m]=(0,n.useState)(!1),[d,w]=(0,n.useState)(!1),[p,g]=(0,n.useState)(!0);return"core/image"===i.name&&p?(0,s.jsxs)(n.Fragment,{children:[(0,s.jsx)(e,{...i}),(0,s.jsxs)(t.InspectorControls,{children:[(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",fontWeight:"bold",marginBottom:"8px"},children:[(0,s.jsx)(o.Icon,{icon:l,style:{marginRight:8,marginLeft:8}}),(0,s.jsx)("span",{style:{flex:1},children:(0,a.__)("Optimize Your Images","%domain%")}),(0,s.jsx)(o.Button,{onClick:async()=>{try{await fetch(wpmedia_pluginfamily.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams({action:"dismiss_promote_imagify",_ajax_nonce:wpmedia_pluginfamily.nonce}).toString()})}catch(e){console.error("AJAX error: ",e)}g(!1)},size:"compact",icon:c,iconPosition:"right"})]}),(0,s.jsxs)(o.PanelBody,{title:"",initialOpen:!0,children:[(0,s.jsx)("p",{style:{marginLeft:16},children:wpmedia_pluginfamily.notice_text}),d?(0,s.jsx)("a",{href:wpmedia_pluginfamily.plugins_page_url,target:"_blank",rel:"noopener noreferrer",style:{marginLeft:16,color:"green",fontWeight:"bold",display:"block"},children:(0,a.__)("Imagify installed! Click here to start using it.","%domain%")}):(0,s.jsx)(o.Button,{style:{marginLeft:16},isSecondary:!0,isBusy:r,disabled:r,onClick:async()=>{m(!0);try{const e=await fetch(wpmedia_pluginfamily.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:new URLSearchParams({action:"install_imagify",_ajax_nonce:wpmedia_pluginfamily.nonce}).toString()});(await e.json()).success&&(w(!0),window.open(wpmedia_pluginfamily.plugins_page_url,"_blank"))}catch(e){console.error("AJAX error: ",e)}m(!1)},children:(0,a.__)("Install Imagify Now","%domain%")})]})]})]}):(0,s.jsx)(e,{...i})},"promoteImagifyButton");(0,e.addFilter)("editor.BlockEdit","wpmedia-plugin-family/promote-imagify",m)})();