diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..9a874b5 Binary files /dev/null and b/.DS_Store differ diff --git a/build/custom-links/block.json b/build/custom-links/block.json deleted file mode 100644 index 6a6e007..0000000 --- a/build/custom-links/block.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "$schema": "https://schemas.wp.org/trunk/block.json", - "apiVersion": 2, - "name": "carkeek-blocks/custom-link-list", - "version": "0.1.0", - "title": "Custom Link List", - "category": "widgets", - "icon": "smiley", - "description": "Example block scaffolded with Create Block tool.", - "supports": { - "html": false, - "anchor": true - }, - "keywords": [ - "link", - "list", - "accordion" - ], - "textdomain": "carkeek-blocks", - "editorScript": "file:./index.js", - "style": "file:./style-index.css", - "attributes": { - "sortBy": { - "type": "string", - "default": "title" - }, - "order": { - "type": "string", - "default": "ASC" - }, - "groupByChild": { - "type": "boolean", - "default": true - }, - "makeCollapsible": { - "type": "boolean", - "default": true - }, - "makeTitlesCollapsible": { - "type": "boolean", - "default": false - }, - "listSelected": { - "type": "string" - }, - "hideIfEmpty": { - "type": "boolean", - "default": true - }, - "emptyMessage": { - "type": "string" - }, - "headline": { - "type": "string" - }, - "headlineLevel": { - "type": "number", - "default": 2 - }, - "primaryContent": { - "type": "string", - "default": "links" - } - } -} \ No newline at end of file diff --git a/build/custom-links/index.js b/build/custom-links/index.js deleted file mode 100644 index 54e9b7d..0000000 --- a/build/custom-links/index.js +++ /dev/null @@ -1 +0,0 @@ -!function(){"use strict";var e,t={926:function(e,t,l){var n=window.wp.blocks,a=window.wp.element;const r={};r.linkList=(0,a.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100",height:"100",x:"0",y:"0",enableBackground:"new 0 0 60 60",viewBox:"0 0 60 60"},(0,a.createElement)("path",{d:"M23.429 17H47a1 1 0 100-2H23.429a1 1 0 100 2zM23.429 32H47a1 1 0 100-2H23.429a1 1 0 100 2zM23.429 47H47a1 1 0 100-2H23.429a1 1 0 100 2z"}),(0,a.createElement)("path",{d:"M59 0H1a1 1 0 00-1 1v58a1 1 0 001 1h58a1 1 0 001-1V1a1 1 0 00-1-1zm-1 58H2V2h56v56z"}),(0,a.createElement)("path",{d:"M12.501 18.474L14.929 17.197 17.357 18.474 16.894 15.77 18.858 13.854 16.143 13.46 14.929 11 13.715 13.46 11 13.854 12.965 15.77z"}),(0,a.createElement)("path",{d:"M12.501 33.557L14.929 32.28 17.357 33.557 16.894 30.853 18.858 28.938 16.143 28.543 14.929 26.083 13.715 28.543 11 28.938 12.965 30.853z"}),(0,a.createElement)("path",{d:"M12.501 49L14.929 47.723 17.357 49 16.894 46.296 18.858 44.381 16.143 43.986 14.929 41.526 13.715 43.986 11 44.381 12.965 46.296z"}));var o=r,i=window.wp.data,s=window.wp.i18n,c=window.wp.components,d=window.wp.blockEditor,p=window.wp.serverSideRender,u=l.n(p),m=(0,i.withSelect)(((e,t)=>{const l="link_list",{attributes:n}=t,{getEntityRecords:a}=e("core"),{listSelected:r,order:o,sortBy:i}=n,s=a("taxonomy",l,{per_page:-1,parent:0,orderby:"name",order:"asc"});let c={per_page:-1,order:o.toLowerCase(),orderby:i},d="";return r&&(c[l]=r,d=a("postType","custom_link",c)),{lists:s,listSelected:Array.isArray(s)&&1==s.length?s[0]:r,posts:Array.isArray(d)?d.map((e=>e)):d}}))((function(e){const{lists:t,attributes:l,setAttributes:n,name:r}=e,{listSelected:i,headline:p,headlineLevel:m,sortBy:k,order:h,makeCollapsible:b,makeTitlesCollapsible:v,primaryContent:f}=l,y="h"+m;let _=[];if(t&&(_=t.map((e=>({value:e.id,label:e.name})))),!i){const e={value:null,label:"Select a List"};_.unshift(e)}const g=(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.SelectControl,{label:(0,s.__)("Select List","carkeek-blocks"),onChange:e=>n({listSelected:e}),options:_,value:i})),C=(0,a.createElement)(d.InspectorControls,null,(0,a.createElement)(c.PanelBody,{title:(0,s.__)("List Settings Settings","carkeek-blocks")},g,(0,a.createElement)(c.SelectControl,{label:(0,s.__)("Sort Links By","carkeek-blocks"),onChange:e=>n({sortBy:e}),options:[{label:(0,s.__)("Title (alpha)"),value:"title"},{label:(0,s.__)("Menu Order"),value:"menu_order"}],value:k}),(0,a.createElement)(c.RadioControl,{label:(0,s.__)("Order"),selected:h,options:[{label:(0,s.__)("ASC"),value:"ASC"},{label:(0,s.__)("DESC"),value:"DESC"}],onChange:e=>n({order:e})})),(0,a.createElement)(c.PanelBody,{title:(0,s.__)("Layout","carkeek-blocks")},(0,a.createElement)(c.RangeControl,{label:(0,s.__)("Heading Size","carkeek-blocks"),value:m,onChange:e=>n({headlineLevel:e}),min:2,max:6}),(0,a.createElement)(c.RadioControl,{label:(0,s.__)("Primary Content"),selected:f,help:"Content lists add a little more space between each item.",options:[{label:(0,s.__)("Links"),value:"links"},{label:(0,s.__)("List Content"),value:"content"}],onChange:e=>n({primaryContent:e})}),(0,a.createElement)(c.__experimentalText,{variant:"label"},"Expand and Collapse"),(0,a.createElement)(c.ToggleControl,{label:(0,s.__)("Make sub-topics expand and collapse","carkeek-blocks"),checked:b,onChange:e=>n({makeCollapsible:e})}),(0,a.createElement)(c.ToggleControl,{label:(0,s.__)("Make item titles expand and collapse","carkeek-blocks"),help:(0,s.__)("Can be used with content lists, will only be applied if the item is not linked to anything","carkeek-blocks"),checked:v,onChange:e=>n({makeTitlesCollapsible:e})}))),w=(0,d.useBlockProps)();if(i)return(0,a.createElement)("div",w,C,(0,a.createElement)(d.RichText,{tagName:y,className:"cll-headline-edit",value:p,onChange:e=>n({headline:e}),placeholder:(0,s.__)("Heading..."),formattingControls:[]}),(0,a.createElement)("div",{className:"server-side-render"},(0,a.createElement)("div",{className:"server-side-render__overlay"}),(0,a.createElement)(u(),{block:r,attributes:{sortBy:k,listSelected:i,headline:p,order:h,makeCollapsible:b,headlineLevel:m}}),(0,a.createElement)("div",{className:"notes"},"List preview. To edit the content visit Custom Links in the admin dashboard.")));{const e=(0,s.__)("Select a List Type from the Block Settings");return(0,a.createElement)("div",w,C,(0,a.createElement)(d.RichText,{tagName:y,value:p,onChange:e=>n({headline:e}),placeholder:(0,s.__)("Heading..."),formattingControls:[]}),(0,a.createElement)(c.Placeholder,{icon:o.linkList,label:p||(0,s.__)("Link List")},(0,a.createElement)(c.Spinner,null)," ",e))}})),k=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"carkeek-blocks/custom-link-list","version":"0.1.0","title":"Custom Link List","category":"widgets","icon":"smiley","description":"Example block scaffolded with Create Block tool.","supports":{"html":false,"anchor":true},"keywords":["link","list","accordion"],"textdomain":"carkeek-blocks","editorScript":"file:./index.js","style":"file:./style-index.css","attributes":{"sortBy":{"type":"string","default":"title"},"order":{"type":"string","default":"ASC"},"groupByChild":{"type":"boolean","default":true},"makeCollapsible":{"type":"boolean","default":true},"makeTitlesCollapsible":{"type":"boolean","default":false},"listSelected":{"type":"string"},"hideIfEmpty":{"type":"boolean","default":true},"emptyMessage":{"type":"string"},"headline":{"type":"string"},"headlineLevel":{"type":"number","default":2},"primaryContent":{"type":"string","default":"links"}}}');(0,n.registerBlockType)(k,{icon:{src:o.linkList},edit:m})}},l={};function n(e){var a=l[e];if(void 0!==a)return a.exports;var r=l[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.m=t,e=[],n.O=function(t,l,a,r){if(!l){var o=1/0;for(d=0;d=r)&&Object.keys(n.O).every((function(e){return n.O[e](l[s])}))?l.splice(s--,1):(i=!1,r0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[l,a,r]},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var l in t)n.o(t,l)&&!n.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={662:0,842:0};n.O.j=function(t){return 0===e[t]};var t=function(t,l){var a,r,o=l[0],i=l[1],s=l[2],c=0;if(o.some((function(t){return 0!==e[t]}))){for(a in i)n.o(i,a)&&(n.m[a]=i[a]);if(s)var d=s(n)}for(t&&t(l);c array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => 'f08c1cb2fc39ace359c9'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '3d7c8ccd42b1c4ace6e5'); diff --git a/build/yt-embed/index.css b/build/yt-embed/index.css new file mode 100644 index 0000000..68efee2 --- /dev/null +++ b/build/yt-embed/index.css @@ -0,0 +1 @@ +.wp-block-carkeek-blocks-youtube-embed{background-color:#dedede;padding:1rem}.wp-block-carkeek-blocks-youtube-embed .yt-embed:before{content:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTAwcHQiIGhlaWdodD0iMTAwcHQiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8cGF0aCBkPSJtMzMuNjI1IDMyLjM2N2MtNC4xODc1IDAtNy41NTg2IDMuMzcxMS03LjU1ODYgNy41NTg2djIwLjE1MmMwIDQuMTg3NSAzLjM3MTEgNy41NTg2IDcuNTU4NiA3LjU1ODZoMzIuNzQ2YzQuMTg3NSAwIDcuNTU4Ni0zLjM3MTEgNy41NTg2LTcuNTU4NnYtMjAuMTUyYzAtNC4xODc1LTMuMzcxMS03LjU1ODYtNy41NTg2LTcuNTU4NnptMTAuNzA3IDkuNDQ1MyAxNS4xMTMgOC4xODc1LTE1LjExMyA4LjE4NzV6Ii8+Cjwvc3ZnPgo=);height:100px;width:100px}.wp-block-carkeek-blocks-youtube-embed .block-preview--notes{font-style:italic;margin-top:10px} diff --git a/build/yt-embed/index.js b/build/yt-embed/index.js new file mode 100644 index 0000000..478e500 --- /dev/null +++ b/build/yt-embed/index.js @@ -0,0 +1 @@ +!function(){"use strict";var e,t={218:function(e,t,l){var n=window.wp.blocks,o=window.wp.element;const r={};r.video=(0,o.createElement)("svg",{width:"100pt",height:"100pt",version:"1.1",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg"},(0,o.createElement)("path",{d:"m33.625 32.367c-4.1875 0-7.5586 3.3711-7.5586 7.5586v20.152c0 4.1875 3.3711 7.5586 7.5586 7.5586h32.746c4.1875 0 7.5586-3.3711 7.5586-7.5586v-20.152c0-4.1875-3.3711-7.5586-7.5586-7.5586zm10.707 9.4453 15.113 8.1875-15.113 8.1875z"}));var a=r,i=window.wp.data,s=window.wp.i18n,c=window.wp.components,u=window.wp.blockEditor,d=window.wp.serverSideRender,m=l.n(d),b=(0,i.withSelect)(((e,t)=>{const{attributes:l}=t,{getEntityRecords:n}=e("core"),{taxTermsSelected:o,order:r,sortBy:a}=l,i=n("taxonomy","embed_cat",{per_page:-1,parent:0,orderby:"name",order:"asc"});return{lists:i,taxTermsSelected:Array.isArray(i)&&1==i.length?i[0]:o}}))((function(e){const{lists:t,attributes:l,setAttributes:n,name:r}=e,{taxTermsSelected:i,sortBy:d,order:b,displayAs:p,columns:y,columnsTablet:f,columnsMobile:k,autoPlay:v,autoPlaySpeed:g}=l;let _=[];if(t){if(_=t.map((e=>({value:e.id,label:e.name}))),!i){const e={value:null,label:"Select a Category"};_.unshift(e)}}else _=[{value:0,label:"Loading..."}];const h=(0,o.createElement)(o.Fragment,null,(0,o.createElement)(c.SelectControl,{label:(0,s.__)("Select Category","carkeek-blocks"),onChange:e=>n({taxTermsSelected:e}),options:_,value:i})),w=(0,o.createElement)(u.InspectorControls,null,(0,o.createElement)(c.PanelBody,{title:(0,s.__)("List Settings","carkeek-blocks")},h,(0,o.createElement)(c.SelectControl,{label:(0,s.__)("Sort Links By","carkeek-blocks"),onChange:e=>n({sortBy:e}),options:[{label:(0,s.__)("Title (alpha)"),value:"title"},{label:(0,s.__)("Menu Order"),value:"menu_order"}],value:d}),(0,o.createElement)(c.RadioControl,{label:(0,s.__)("Order"),selected:b,options:[{label:(0,s.__)("ASC"),value:"ASC"},{label:(0,s.__)("DESC"),value:"DESC"}],onChange:e=>n({order:e})})),(0,o.createElement)(c.PanelBody,{title:(0,s.__)("Layout","carkeek-blocks")},(0,o.createElement)(c.RadioControl,{label:(0,s.__)("Display As","carkeek-blocks"),selected:p,options:[{label:(0,s.__)("Grid"),value:"grid"},{label:(0,s.__)("Carousel"),value:"carousel"}],onChange:e=>n({displayAs:e})}),(0,o.createElement)(c.RangeControl,{label:(0,s.__)("Columns","carkeek-blocks"),value:y,onChange:e=>n({columns:e}),min:1,max:6}),(0,o.createElement)(c.RangeControl,{label:(0,s.__)("Columns Mobile","carkeek-blocks"),value:k,onChange:e=>n({columnsMobile:e}),min:1,max:6}),(0,o.createElement)(c.RangeControl,{label:(0,s.__)("Columns Tablet","carkeek-blocks"),value:f,onChange:e=>n({columnsTablet:e}),min:1,max:6})),"carousel"===p&&(0,o.createElement)(c.PanelBody,{title:(0,s.__)("Carousel Settings","carkeek-blocks")},(0,o.createElement)(c.ToggleControl,{label:"Auto Play Carousel",checked:v,onChange:e=>n({autoPlay:e})}),v&&(0,o.createElement)(c.RangeControl,{label:(0,s.__)("Time on each Slide (in ms)","carkeek-blocks"),value:g,onChange:e=>n({autoPlaySpeed:e}),min:1e3,max:1e4}))),C=(0,u.useBlockProps)();if(i)return l.context="edit",(0,o.createElement)("div",C,w,(0,o.createElement)(m(),{block:r,attributes:l}),(0,o.createElement)("div",{className:"block-preview--notes"},"List preview. To edit the content visit Youtube Embeds in the admin dashboard."));{const e=(0,s.__)("Select a Category from the Block Settings");return(0,o.createElement)("div",C,w,(0,o.createElement)(c.Placeholder,{icon:a.linkList,label:(0,s.__)("YouTube Embed List")},(0,o.createElement)(c.Spinner,null)," ",e))}})),p=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"carkeek-blocks/youtube-embed","version":"0.1.0","title":"Youtube Embeds","category":"widgets","icon":"smiley","description":"Display a List of Youtube Videos.","supports":{"html":false,"anchor":true},"keywords":["youtube","carousel","videos"],"textdomain":"carkeek-blocks","editorScript":"file:./index.js","editorStyle":"file:./index.css","style":"file:./style-index.css","render":"file:./render.php","viewScript":"file:./script.js","attributes":{"taxTermsSelected":{"type":"string","default":""},"taxQueryType":{"type":"string","default":"AND"},"displayAs":{"type":"string","default":"grid"},"sortBy":{"type":"string","default":"title"},"order":{"type":"string","default":"ASC"},"columns":{"type":"number","default":3},"columnsMobile":{"type":"number","default":1},"columnsTablet":{"type":"number","default":3},"autoPlay":{"type":"boolean","default":true},"autoPlaySpeed":{"type":"number","default":3000},"context":{"type":"string","default":"view"}}}');(0,n.registerBlockType)(p,{icon:{src:a.video},edit:b})}},l={};function n(e){var o=l[e];if(void 0!==o)return o.exports;var r=l[e]={exports:{}};return t[e](r,r.exports,n),r.exports}n.m=t,e=[],n.O=function(t,l,o,r){if(!l){var a=1/0;for(u=0;u=r)&&Object.keys(n.O).every((function(e){return n.O[e](l[s])}))?l.splice(s--,1):(i=!1,r0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[l,o,r]},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var l in t)n.o(t,l)&&!n.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){var e={169:0,447:0};n.O.j=function(t){return 0===e[t]};var t=function(t,l){var o,r,a=l[0],i=l[1],s=l[2],c=0;if(a.some((function(t){return 0!==e[t]}))){for(o in i)n.o(i,o)&&(n.m[o]=i[o]);if(s)var u=s(n)}for(t&&t(l);c $number, + 'post_type' => 'yt_embed', + 'order' => $attributes['order'], + 'post_status' => 'publish', + 'orderby' => $attributes['sortBy'], +); + +if ( ! empty( $attributes['taxTermsSelected'] ) ) { + $args['tax_query'] = array( + 'relation' => 'AND', + array( + 'taxonomy' => 'embed_cat', + 'field' => 'term_id', + 'terms' => explode( ',', $attributes['taxTermsSelected'] ), + ), + ); +} + +$embeds = get_posts( $args ); +$data_attrs = ''; +if ( $attributes['displayAs'] == 'grid' || $attributes['context'] == 'edit') { + $wrapper_classes = 'ck-columns-grid has-' . $attributes['columns'] . '-columns has-' . $attributes['columnsTablet'] . '-columns-tablet has-' . $attributes['columnsMobile'] . '-columns-mobile'; +} else { + $wrapper_classes = 'slider-carousel'; + $data_attrs = 'data-slick=\'{ "slidesToShow": ' . $attributes['columns'] . ', "slidesToScroll": ' . $attributes['columns'] . ', "responsive": [ { "breakpoint": 1024, "settings": { "slidesToShow": ' . $attributes['columnsTablet'] . ', "slidesToScroll": ' . $attributes['columnsTablet'] . ' } }, { "breakpoint": 600, "settings": { "slidesToShow": ' . $attributes['columnsMobile'] . ', "slidesToScroll": ' . $attributes['columnsMobile'] . ' } } ] }\''; +} + +?> +
$wrapper_classes ) ); ?> > + ID, false ); + $yt_id = ''; + if ( strpos( $yt, 'youtu.be' ) !== false ) { + $yt = explode( '/', $yt ); + $yt_id = end( $yt ); + } else { + $yt = explode( 'v=', $yt ); + $yt_id = $yt[1]; + } + $description = get_field( 'yt_embed_description', $embed->ID ); + if ( ! empty( $description ) ) { + $description = '
' . $description . '
'; + } + + if ( ! empty( $yt_id ) ) { + + echo '
+

' . $embed->post_title . '

' . $description . ' +
'; + + + } + } + ?> +
diff --git a/build/yt-embed/script.asset.php b/build/yt-embed/script.asset.php new file mode 100644 index 0000000..7c188d3 --- /dev/null +++ b/build/yt-embed/script.asset.php @@ -0,0 +1 @@ + array('jquery'), 'version' => 'e7fefeb72aedcf88f778'); diff --git a/build/yt-embed/script.js b/build/yt-embed/script.js new file mode 100644 index 0000000..6b79463 --- /dev/null +++ b/build/yt-embed/script.js @@ -0,0 +1 @@ +!function(){var e={154:function(e,i,t){var o,s,n;!function(r){"use strict";s=[t(567)],o=function(e){var i,t=window.Slick||{};(i=0,t=function(t,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:e(t),appendDots:e(t),arrows:!0,asNavFor:null,prevArrow:'',nextArrow:'',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(i,t){return e('\n \n ',this.domRefFrame=e.querySelector("#frame"),this.domRefImg={fallback:e.querySelector("#fallbackPlaceholder"),webp:e.querySelector("#webpPlaceholder"),jpeg:e.querySelector("#jpegPlaceholder")},this.domRefPlayButton=e.querySelector("#playButton")}setupComponent(){this.initImagePlaceholder(),this.domRefPlayButton.setAttribute("aria-label",`${this.videoPlay}: ${this.videoTitle}`),this.setAttribute("title",`${this.videoPlay}: ${this.videoTitle}`),(this.autoLoad||this.isYouTubeShort())&&this.initIntersectionObserver()}attributeChangedCallback(e,i,t){switch(e){case"videoid":case"playlistid":case"videoTitle":case"videoPlay":i!==t&&(this.setupComponent(),this.domRefFrame.classList.contains("activated")&&(this.domRefFrame.classList.remove("activated"),this.shadowRoot.querySelector("iframe").remove(),this.isIframeLoaded=!1))}}addIframe(e=!1){if(!this.isIframeLoaded){let i=e?0:1;const t=this.noCookie?"-nocookie":"";let o;o=this.playlistId?`?listType=playlist&list=${this.playlistId}&`:`${this.videoId}?`,this.isYouTubeShort()&&(this.params=`loop=1&mute=1&modestbranding=1&playsinline=1&rel=0&enablejsapi=1&playlist=${this.videoId}`,i=1);const s=`\n`;this.domRefFrame.insertAdjacentHTML("beforeend",s),this.domRefFrame.classList.add("activated"),this.isIframeLoaded=!0,this.attemptShortAutoPlay(),this.dispatchEvent(new CustomEvent("liteYoutubeIframeLoaded",{detail:{videoId:this.videoId},bubbles:!0,cancelable:!0}))}}initImagePlaceholder(){e.addPrefetch("preconnect","https://i.ytimg.com/");const i=`https://i.ytimg.com/vi_webp/${this.videoId}/${this.posterQuality}.webp`,t=`https://i.ytimg.com/vi/${this.videoId}/${this.posterQuality}.jpg`;this.domRefImg.fallback.loading=this.posterLoading,this.domRefImg.webp.srcset=i,this.domRefImg.jpeg.srcset=t,this.domRefImg.fallback.src=t,this.domRefImg.fallback.setAttribute("aria-label",`${this.videoPlay}: ${this.videoTitle}`),this.domRefImg?.fallback?.setAttribute("alt",`${this.videoPlay}: ${this.videoTitle}`)}initIntersectionObserver(){new IntersectionObserver(((i,t)=>{i.forEach((i=>{i.isIntersecting&&!this.isIframeLoaded&&(e.warmConnections(),this.addIframe(!0),t.unobserve(this))}))}),{root:null,rootMargin:"0px",threshold:0}).observe(this)}attemptShortAutoPlay(){this.isYouTubeShort()&&setTimeout((()=>{this.shadowRoot.querySelector("iframe")?.contentWindow?.postMessage('{"event":"command","func":"playVideo","args":""}',"*")}),2e3)}isYouTubeShort(){return""===this.getAttribute("short")&&window.matchMedia("(max-width: 40em)").matches}static addPrefetch(e,i){const t=document.createElement("link");t.rel=e,t.href=i,t.crossOrigin="true",document.head.append(t)}static warmConnections(){e.isPreconnected||(e.addPrefetch("preconnect","https://s.ytimg.com"),e.addPrefetch("preconnect","https://www.youtube.com"),e.addPrefetch("preconnect","https://www.google.com"),e.addPrefetch("preconnect","https://googleads.g.doubleclick.net"),e.addPrefetch("preconnect","https://static.doubleclick.net"),e.isPreconnected=!0)}}e.isPreconnected=!1,customElements.define("lite-youtube",e),t(154),jQuery(".slider-carousel.wp-block-carkeek-blocks-youtube-embed").slick()}()}(); \ No newline at end of file diff --git a/build/yt-embed/style-index.css b/build/yt-embed/style-index.css new file mode 100644 index 0000000..a8ee585 --- /dev/null +++ b/build/yt-embed/style-index.css @@ -0,0 +1 @@ +.ck-columns-grid{display:grid;gap:var(--ck-column-gap-vert) var(--ck-column-gap)}@media screen and (max-width:599px){.ck-columns.ck-columns-layout-grid.has-1-columns-mobile{grid-template-columns:1fr}.ck-columns.ck-columns-layout-grid.has-2-columns-mobile{grid-template-columns:1fr 1fr}.ck-columns.ck-columns-layout-grid.has-3-columns-mobile{grid-template-columns:1fr 1fr 1fr}.ck-columns.ck-columns-layout-grid.has-4-columns-mobile{grid-template-columns:1fr 1fr 1fr 1fr}.ck-columns.ck-columns-layout-grid.has-5-columns-mobile{grid-template-columns:1fr 1fr 1fr 1fr 1fr}.ck-columns.ck-columns-layout-grid.has-6-columns-mobile{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr}}@media screen and (min-width:600px)and (max-width:1023px){.ck-columns-grid.has-1-columns-tablet{grid-template-columns:1fr}.ck-columns-grid.has-2-columns-tablet{grid-template-columns:1fr 1fr}.ck-columns-grid.has-3-columns-tablet{grid-template-columns:1fr 1fr 1fr}.ck-columns-grid.has-4-columns-tablet{grid-template-columns:1fr 1fr 1fr 1fr}.ck-columns-grid.has-5-columns-tablet{grid-template-columns:1fr 1fr 1fr 1fr 1fr}.ck-columns-grid.has-6-columns-tablet{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr}}@media screen and (min-width:1024px){.ck-columns-grid.has-1-columns{grid-template-columns:1fr}.ck-columns-grid.has-2-columns{grid-template-columns:1fr 1fr}.ck-columns-grid.has-3-columns{grid-template-columns:1fr 1fr 1fr}.ck-columns-grid.has-4-columns{grid-template-columns:1fr 1fr 1fr 1fr}.ck-columns-grid.has-5-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr}.ck-columns-grid.has-6-columns{grid-template-columns:1fr 1fr 1fr 1fr 1fr 1fr}}.wp-block-carkeek-blocks-youtube-embed.slider-carousel{--slick-arrow-pos:0}.wp-block-carkeek-blocks-youtube-embed.slider-carousel.slick-initialized .slick-track{gap:1rem}.wp-block-carkeek-blocks-youtube-embed.slider-carousel.slick-initialized .slick-track .slick-slide>div{width:100%}.wp-block-carkeek-blocks-youtube-embed .embed-description,.wp-block-carkeek-blocks-youtube-embed .embed-title{font-size:var(--wp--preset--font-size--small)}.wp-block-carkeek-blocks-youtube-embed .embed-title{font-weight:600;margin-bottom:.5rem;margin-top:.5rem} diff --git a/includes/class-carkeekblocks-cl-custompost.php b/includes/class-carkeekblocks-yt-custompost.php similarity index 61% rename from includes/class-carkeekblocks-cl-custompost.php rename to includes/class-carkeekblocks-yt-custompost.php index 23b1a51..87586e3 100644 --- a/includes/class-carkeekblocks-cl-custompost.php +++ b/includes/class-carkeekblocks-yt-custompost.php @@ -4,7 +4,7 @@ * * @package CarkeekSiteBlocks * @author Patty O'Hara - * @link https://carkeekstudios.com + * @Embed https://carkeekstudios.com * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License */ @@ -18,13 +18,13 @@ * * @since 1.0.0 */ -class CarkeekBlocksCL_CustomPost { +class CarkeekBlocksYT_CustomPost { /** * This plugin's instance. * - * @var CarkeekBlocksCL_CustomPost + * @var CarkeekBlocksYT_CustomPost */ private static $instance; @@ -33,7 +33,7 @@ class CarkeekBlocksCL_CustomPost { */ public static function register() { if ( null === self::$instance ) { - self::$instance = new CarkeekBlocksCL_CustomPost(); + self::$instance = new CarkeekBlocksYT_CustomPost(); } } @@ -66,31 +66,31 @@ public static function register() { * The Constructor. */ private function __construct() { - add_action( 'init', array( $this, 'carkeek_blocks_register_customlinks' ) ); + add_action( 'init', array( $this, 'carkeek_blocks_register_customEmbeds' ) ); add_filter( 'acf/settings/load_json', array( $this, 'json_load_point' ) ); } /** * Register post type - TODO Admin Screen whether to activate or not */ - public function carkeek_blocks_register_customlinks() { - if ( ! post_type_exists( 'custom_link' ) ) { + public function carkeek_blocks_register_customEmbeds() { + if ( ! post_type_exists( 'yt_embed' ) ) { $labels = array( - 'name' => _x( 'Custom Links', 'Post Type General Name', 'text_domain' ), - 'singular_name' => _x( 'Custom Link', 'Post Type Singular Name', 'text_domain' ), - 'menu_name' => __( 'Custom Link', 'text_domain' ), - 'name_admin_bar' => __( 'Custom Link', 'text_domain' ), - 'archives' => __( 'Link Archives', 'text_domain' ), - 'attributes' => __( 'Link Attributes', 'text_domain' ), - 'parent_item_colon' => __( 'Parent Link:', 'text_domain' ), - 'all_items' => __( 'All Links', 'text_domain' ), - 'add_new_item' => __( 'Add New Link', 'text_domain' ), + 'name' => _x( 'YouTube Embeds', 'Post Type General Name', 'text_domain' ), + 'singular_name' => _x( 'YouTube Embed', 'Post Type Singular Name', 'text_domain' ), + 'menu_name' => __( 'YouTube Embed', 'text_domain' ), + 'name_admin_bar' => __( 'YouTube Embed', 'text_domain' ), + 'archives' => __( 'Embed Archives', 'text_domain' ), + 'attributes' => __( 'Embed Attributes', 'text_domain' ), + 'parent_item_colon' => __( 'Parent Embed:', 'text_domain' ), + 'all_items' => __( 'All Embeds', 'text_domain' ), + 'add_new_item' => __( 'Add New Embed', 'text_domain' ), 'add_new' => __( 'Add New', 'text_domain' ), - 'new_item' => __( 'New Link', 'text_domain' ), - 'edit_item' => __( 'Edit Link', 'text_domain' ), - 'update_item' => __( 'Update Link', 'text_domain' ), - 'view_item' => __( 'View Link', 'text_domain' ), - 'view_items' => __( 'View Links', 'text_domain' ), - 'search_items' => __( 'Search Link', 'text_domain' ), + 'new_item' => __( 'New Embed', 'text_domain' ), + 'edit_item' => __( 'Edit Embed', 'text_domain' ), + 'update_item' => __( 'Update Embed', 'text_domain' ), + 'view_item' => __( 'View Embed', 'text_domain' ), + 'view_items' => __( 'View Embeds', 'text_domain' ), + 'search_items' => __( 'Search Embed', 'text_domain' ), 'not_found' => __( 'Not found', 'text_domain' ), 'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ), 'featured_image' => __( 'Featured Image', 'text_domain' ), @@ -99,14 +99,14 @@ public function carkeek_blocks_register_customlinks() { 'use_featured_image' => __( 'Use as featured image', 'text_domain' ), 'insert_into_item' => __( 'Insert into item', 'text_domain' ), 'uploaded_to_this_item' => __( 'Uploaded to this item', 'text_domain' ), - 'items_list' => __( 'Links list', 'text_domain' ), - 'items_list_navigation' => __( 'Links list navigation', 'text_domain' ), + 'items_list' => __( 'Embeds list', 'text_domain' ), + 'items_list_navigation' => __( 'Embeds list navigation', 'text_domain' ), 'filter_items_list' => __( 'Filter items list', 'text_domain' ), ); $args = array( - 'label' => __( 'Custom Link', 'wp-rig' ), - 'description' => __( 'Add Custom Links to create dynamic lists of links', 'wp-rig' ), + 'label' => __( 'YouTube Embed', 'wp-rig' ), + 'description' => __( 'Add YouTube Embeds to create dynamic lists of Embeds', 'wp-rig' ), 'labels' => $labels, 'supports' => array( 'title', 'page-attributes' ), 'hierarchical' => false, @@ -114,7 +114,7 @@ public function carkeek_blocks_register_customlinks() { 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 10, - 'menu_icon' => 'dashicons-admin-links', + 'menu_icon' => 'dashicons-video-alt3', 'show_in_admin_bar' => false, 'show_in_nav_menus' => false, 'can_export' => true, @@ -122,15 +122,15 @@ public function carkeek_blocks_register_customlinks() { 'exclude_from_search' => true, 'publicly_queryable' => false, 'show_in_rest' => true, - 'rest_base' => 'custom-links', + 'rest_base' => 'yt-embeds', ); - $post_type = register_post_type( 'custom_link', $args ); + $post_type = register_post_type( 'yt_embed', $args ); } $labels = array( - 'name' => _x( 'Link List Categories', 'Taxonomy General Name', 'wp-rig' ), - 'singular_name' => _x( 'Link List Category', 'Taxonomy Singular Name', 'wp-rig' ), - 'menu_name' => __( 'Link List Categories', 'wp-rig' ), + 'name' => _x( 'Embed Categories', 'Taxonomy General Name', 'wp-rig' ), + 'singular_name' => _x( 'Embed Category', 'Taxonomy Singular Name', 'wp-rig' ), + 'menu_name' => __( 'Embed Categories', 'wp-rig' ), ); $args = array( 'labels' => $labels, @@ -142,17 +142,16 @@ public function carkeek_blocks_register_customlinks() { 'show_tagcloud' => true, 'show_in_rest' => true, ); - register_taxonomy( 'link_list', array( 'custom_link' ), $args ); + register_taxonomy( 'embed_cat', array( 'yt_embed' ), $args ); } - /** load our acf-json for the custom links */ + /** load our acf-json for the YouTube Embeds */ function json_load_point( $paths ) { // append path $paths[] = plugin_dir_path( __DIR__ ) . 'acf-json'; - error_log(print_r($paths, true)); // return return $paths; @@ -173,34 +172,34 @@ public static function make_accordion_panel( $header, $content ) { } /** - * Buildt the custom link + * Buildt the YouTube Embed * - * @param object $link link post type object. + * @param object $Embed Embed post type object. * @param boolean $collapse_title whether the title is collapsible. */ - public static function make_custom_link( $link, $collapse_title = false ) { + public static function make_custom_Embed( $Embed, $collapse_title = false ) { - $href = get_field( 'cl_external_link', $link->ID ); - $notes = get_field( 'cl_notes', $link->ID ); + $href = get_field( 'cl_external_Embed', $Embed->ID ); + $notes = get_field( 'cl_notes', $Embed->ID ); if ( ! empty( $href ) ) { - $link_type = 'external'; + $Embed_type = 'external'; } else { - $href = get_field( 'cl_pdf_link', $link->ID ); + $href = get_field( 'cl_pdf_Embed', $Embed->ID ); if ( ! empty( $href ) ) { - $link_type = 'pdf'; + $Embed_type = 'pdf'; } else { - $href = get_field( 'cl_page_link', $link->ID ); - $link_type = 'page'; + $href = get_field( 'cl_page_Embed', $Embed->ID ); + $Embed_type = 'page'; } } - $target = ( 'external' === $link_type || 'pdf' === $link_type ) ? 'target="_blank"' : ''; + $target = ( 'external' === $Embed_type || 'pdf' === $Embed_type ) ? 'target="_blank"' : ''; if ( empty( $href ) && true == $collapse_title ) { - $item = self::make_accordion_panel( $link->post_title, $notes ); + $item = self::make_accordion_panel( $Embed->post_title, $notes ); } else { if ( empty( $href ) ) { - $item = '
' . $link->post_title . '
'; + $item = '
' . $Embed->post_title . '
'; } else { - $item = '' . $link->post_title . ''; + $item = '' . $Embed->post_title . ''; } if ( ! empty( $notes ) ) { $item .= '
' . $notes . '
'; @@ -211,17 +210,17 @@ public static function make_custom_link( $link, $collapse_title = false ) { } /** - * Render Custom Link Lists + * Render YouTube Embed Lists * * @param array $attributes Attributes passed from the block. */ - public static function carkeek_blocks_render_custom_linklist( $attributes ) { + public static function carkeek_blocks_render_custom_Embedlist( $attributes ) { if ( empty( $attributes['listSelected'] ) ) { return; } $args = array( 'numberposts' => -1, - 'post_type' => 'custom_link', + 'post_type' => 'custom_Embed', 'order' => $attributes['order'], 'post_status' => 'publish', 'orderby' => $attributes['sortBy'], @@ -230,23 +229,23 @@ public static function carkeek_blocks_render_custom_linklist( $attributes ) { // first get all posts with no sub cat selected. - $subcats = get_term_children( $attributes['listSelected'], 'link_list' ); + $subcats = get_term_children( $attributes['listSelected'], 'Embed_list' ); $args['tax_query'] = array( 'relation' => 'AND', array( - 'taxonomy' => 'link_list', + 'taxonomy' => 'Embed_list', 'field' => 'term_id', 'terms' => explode( ',', $attributes['listSelected'] ), ), array( - 'taxonomy' => 'link_list', + 'taxonomy' => 'Embed_list', 'field' => 'term_id', 'terms' => $subcats, 'operator' => 'NOT IN', ), ); - $links = get_posts( $args ); + $Embeds = get_posts( $args ); $list_style = ''; $data_atts = array( 'accordion' => '', @@ -266,39 +265,39 @@ public static function carkeek_blocks_render_custom_linklist( $attributes ) { $list_style .= ' is-style-content'; } - $block_content = '