File "index.js"

Full Path: /home/elegucvf/public_html/video/wp-content/plugins/post-views-counter/blocks/most-viewed-posts/build/index.js
File size: 3.76 KB
MIME-type: text/plain
Charset: utf-8

(()=>{"use strict";var e={n:o=>{var t=o&&o.__esModule?()=>o.default:()=>o;return e.d(t,{a:t}),t},d:(o,t)=>{for(var s in t)e.o(t,s)&&!e.o(o,s)&&Object.defineProperty(o,s,{enumerable:!0,get:t[s]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)};const o=window.wp.blocks,t=window.React,s=window.wp.components,n=window.wp.i18n,r=window.wp.blockEditor,a=window.wp.serverSideRender;var i=e.n(a);const l=window.ReactJSXRuntime;(0,o.registerBlockType)("post-views-counter/most-viewed-posts",{edit:function({attributes:e,setAttributes:o}){const{title:a,postTypes:c,period:p,numberOfPosts:d,noPostsMessage:_,order:u,listType:w,displayPostViews:h,displayPostExcerpt:v,displayPostAuthor:b,displayPostThumbnail:x,thumbnailSize:g}=e,[m,C]=(0,t.useState)(c||pvcBlockEditorData.postTypesKeys);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.InspectorControls,{children:(0,l.jsxs)(s.PanelBody,{title:(0,n.__)("Settings","post-views-counter"),children:[(0,l.jsx)(s.TextControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Title","post-views-counter"),value:a,onChange:e=>o({title:e}),help:(0,n.__)("Enter empty text to hide title.","post-views-counter")}),(0,l.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Post types","post-views-counter"),children:Object.keys(pvcBlockEditorData.postTypes).map((e=>(0,l.jsx)(s.CheckboxControl,{label:pvcBlockEditorData.postTypes[e],checked:m[e],onChange:t=>{let s={...c};s[e]=t,C((o=>({...o,[e]:!o[e]}))),o({postTypes:s})}},e)))}),(0,l.jsx)(s.SelectControl,{__nextHasNoMarginBottom:!0,disabled:1===pvcBlockEditorData.periods.length,label:(0,n.__)("Views period","post-views-counter"),value:p,options:pvcBlockEditorData.periods,onChange:e=>o({period:e})}),(0,l.jsx)(s.TextControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Number of posts to show","post-views-counter"),value:d,onChange:e=>o({numberOfPosts:Number(e)})}),(0,l.jsx)(s.TextControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("No posts message","post-views-counter"),value:_,onChange:e=>o({noPostsMessage:e})}),(0,l.jsx)(s.RadioControl,{label:(0,n.__)("Order","post-views-counter"),selected:u,options:[{label:(0,n.__)("Ascending","post-views-counter"),value:"asc"},{label:(0,n.__)("Descending","post-views-counter"),value:"desc"}],onChange:e=>o({order:e})}),(0,l.jsx)(s.RadioControl,{label:(0,n.__)("Display style","post-views-counter"),selected:w,options:[{label:(0,n.__)("Unordered list","post-views-counter"),value:"unordered"},{label:(0,n.__)("Ordered list","post-views-counter"),value:"ordered"}],onChange:e=>o({listType:e})}),(0,l.jsxs)(s.BaseControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Display Data","post-views-counter"),children:[(0,l.jsx)(s.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Post views","post-views-counter"),checked:h,onChange:e=>o({displayPostViews:e})}),(0,l.jsx)(s.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Post excerpt","post-views-counter"),checked:v,onChange:e=>o({displayPostExcerpt:e})}),(0,l.jsx)(s.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Post author","post-views-counter"),checked:b,onChange:e=>o({displayPostAuthor:e})}),(0,l.jsx)(s.CheckboxControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Post thumbnail","post-views-counter"),checked:x,onChange:e=>o({displayPostThumbnail:e})}),x&&(0,l.jsx)(s.SelectControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Thumbnail size","post-views-counter"),value:g,options:pvcBlockEditorData.imageSizes,onChange:e=>o({thumbnailSize:e})})]})]})}),(0,l.jsx)("div",{...(0,r.useBlockProps)(),children:(0,l.jsx)(i(),{httpMethod:"POST",block:"post-views-counter/most-viewed-posts",attributes:e,LoadingResponsePlaceholder:()=>(0,l.jsx)(s.Spinner,{}),ErrorResponsePlaceholder:e=>(0,l.jsx)(s.Notice,{status:"error",children:(0,n.__)("Something went wrong. Try again or refresh the page.","post-views-counter")})})})]})}})})();