diff --git a/dist/js/feeds.js b/dist/js/feeds.js index 481762a..090e37a 100644 --- a/dist/js/feeds.js +++ b/dist/js/feeds.js @@ -2,7 +2,7 @@ var Feeds = (function () { 'use strict'; // Regex to get the image size - const REG_EXP = /s\d{2}(-w\d{3}-h\d{3})?-c?(-n)/; + const REG_EXP = /s\d{2}(-w\d{3}-h\d{3})?(?:-c(?:-n)?)/; // Get the first image from the content function getFirstImage(code) { diff --git a/dist/js/feeds.min.js b/dist/js/feeds.min.js index 3df5875..5fb2352 100644 --- a/dist/js/feeds.min.js +++ b/dist/js/feeds.min.js @@ -1 +1 @@ -var Feeds=function(){"use strict";const e=/s\d{2}(-w\d{3}-h\d{3})?-c?(-n)/;function n(e){for(const n of e)if("alternate"===n.rel)return n.href}const t={url:window.location.origin+"/",max:5,direction:"column",image:"https://i.imgur.com/snnjdGS.png",imageSize:"w300-h240-c",thumbnailSize:"s80-c",title:"#212121",category:"#212121",categorybg:"#f1f1f1",border:"#e6e6e6",background:"#ffffff",label:"",styles:!0};function r(e){return null!=e&&"string"==typeof e&&e.includes("img.youtube.com")}function i(n,t){return r(n)?n.replace("default",t):n.replace(e,t)}function o(e,t){const o=e.content?e.content.$t:e.summary.$t,d=null!==e.category&&e.category,a=e.media$thumbnail?e.media$thumbnail.url:function(e){const n=document.createElement("div");n.innerHTML=e;const t=n.querySelector("img");return t?t.src:""}(o)||t.image;return{url:n(e.link),title:e.title.$t,image:i(a,r(a)?"mqdefault":t.imageSize),thumbnail:i(a,r(a)?"mqdefault":t.thumbnailSize),category:d?d[0].term:"no category"}}function d(e){const n={...t,...e},r=`
\n \n {{title}}\n \n
\n {{category}}\n {{title}}\n
\n
`,i=document.querySelector(".widget-feeds"),d=n.label;!function(e){const n=document.createElement("script");n.src=e,document.body.appendChild(n).parentNode.removeChild(n)}(`${n.url}feeds/posts/default${d?`/-/${d}`:""}?alt=json-in-script&callback=ifeeds&max-results=${n.max}`),window.ifeeds=function(e){e.feed.entry&&i&&(n.styles&&function(e){const n=document.getElementById("widget-feeds");n&&n.remove(),e=(e=(e=e.replace(/\s+/g," ")).replace(/\s*([:;{},])\s*/g,"$1")).trim();const t=document.createElement("style");t.id="widget-feeds",t.textContent=e,document.head.appendChild(t)}(`\n .widget-feeds {\n --feeds-margin: 1rem;\n --feeds-gap: 1.25rem;\n --feeds-border: ${n.border};\n padding: var(--feeds-gap);\n display: flex;\n max-width: 100%;\n border: 1px solid var(--feeds-border);\n border-radius: .5rem;\n background: var(--feeds-background, ${n.background});\n }\n\n .widget-feeds,\n .widget-feeds * {\n box-sizing: border-box;\n }\n\n .feeds-item {\n display: flex;\n align-items: flex-start;\n }\n\n .feeds-column,\n .feeds-row .feeds-item {\n flex-direction: column;\n }\n\n .feeds-column .feeds-header {\n margin-right: var(--feeds-margin);\n width: 80px;\n }\n\n .feeds-row .feeds-header {\n margin-bottom: var(--feeds-margin);\n width: 100%;\n --feeds-ratio-y: 9;\n --feeds-ratio-x: 16;\n }\n\n .feeds-header {\n flex: none;\n position: relative;\n overflow: hidden;\n border-radius: 0.5rem;\n }\n \n .feeds-header::before {\n content: "";\n display: block;\n padding-top: calc(var(--feeds-ratio-y, 1)/ var(--feeds-ratio-x, 1) * 100%);\n }\n \n .feeds-link {\n text-decoration: none;\n color: var(--feeds-title-color, ${n.title});\n font-weight: 500;\n font-size: 1rem;\n margin-top: .5rem;\n display: block;\n }\n\n .feeds-category {\n text-transform: capitalize;\n text-decoration: none;\n display: inline-block;\n border-radius: 5rem;\n padding: .25rem .875rem;\n background-color: var(--feeds-category-bg, ${n.categorybg});\n color: var(--feeds-category-color, ${n.category});\n font-size: .875rem;\n font-weight: 400;\n }\n\n .feeds-image {\n object-fit: cover;\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100%;\n min-height: 100%;\n transform: translate(-50%, -50%);\n }\n\n .feeds-column .feeds-item + * {\n margin-top: var(--feeds-gap);\n padding-top: var(--feeds-gap);\n border-top: 1px solid var(--feeds-border);\n }\n\n .feeds-row .feeds-item + * {\n margin-left: var(--feeds-gap);\n }\n\n .feeds-row {\n overflow-x: auto;\n }\n\n .feeds-row .feeds-item {\n flex: 1 1 100%;\n min-width: 250px;\n }\n\n .feeds-row .feeds-content {\n text-align: center;\n width: 100%;\n }`),i.className=`widget-feeds feeds-${n.direction}`,i.innerHTML="",e.feed.entry.forEach((e=>{const t=o(e,n);i.innerHTML+=function(e,n){return e.replace(/\{\{(.*?)\}\}/g,((e,t)=>n[t]))}(r,t)})))}}const a=document.getElementById("dev-results"),s=document.getElementById("dev-customizer"),c=(e,n)=>{e&&(e.classList.add("copied"),e.innerText=n.action,e.timeoutId&&clearTimeout(e.timeoutId),e.timeoutId=setTimeout((function(){e.classList.remove("copied"),e.innerText=n.original,e.timeoutId=null}),2e3))};return{initPlugin:d,initCustomizer:function(e){const n={...t,...e};if(!s||!a)return;const r=a.querySelector("textarea"),i=a.querySelector("button"),o=i.innerText;function l(e,n){e.value=`
\n