From 0f77ac80038ea43cb5e2d4577d03e8ad171b49f3 Mon Sep 17 00:00:00 2001 From: "Patryk Rzucidlo (PTKDev)" Date: Mon, 4 May 2020 11:23:04 +0200 Subject: [PATCH] [Release] v2.5.0 --- dist/lib/en/instagram-widget.js | 25 ++++++++++++++++++++++--- dist/lib/en/instagram-widget.min.js | 2 +- dist/lib/it/instagram-widget.js | 25 ++++++++++++++++++++++--- dist/lib/it/instagram-widget.min.js | 2 +- dist/lib/pl/instagram-widget.js | 25 ++++++++++++++++++++++--- dist/lib/pl/instagram-widget.min.js | 2 +- webcomponent/js/main.js | 25 ++++++++++++++++++++++--- 7 files changed, 91 insertions(+), 15 deletions(-) diff --git a/dist/lib/en/instagram-widget.js b/dist/lib/en/instagram-widget.js index ab6cc73..a1ae24d 100644 --- a/dist/lib/en/instagram-widget.js +++ b/dist/lib/en/instagram-widget.js @@ -39,6 +39,19 @@ class InstagramWidget extends HTMLElement { }; this.options = Object.create(this.options_default); + + this.resize_event = function(event) { + this.resize(event); + }.bind(this); + } + + /** + * Append web component + * ===================== + * + */ + connectedCallback() { + window.addEventListener("resize", this.resize_event); } /** @@ -127,9 +140,6 @@ class InstagramWidget extends HTMLElement { }).then(function(response) { this.json = response; this.build_html(); - window.addEventListener("resize", function(event) { - this.resize(event); - }.bind(this)); }.bind(this)); } @@ -156,6 +166,15 @@ class InstagramWidget extends HTMLElement { } } } + + /** + * Remove web component + * ===================== + * + */ + disconnectedCallback() { + window.removeEventListener("resize", this.resize_event); + } } window.customElements.define("instagram-widget", InstagramWidget); diff --git a/dist/lib/en/instagram-widget.min.js b/dist/lib/en/instagram-widget.min.js index fe93044..d7d6d06 100644 --- a/dist/lib/en/instagram-widget.min.js +++ b/dist/lib/en/instagram-widget.min.js @@ -1,3 +1,3 @@ // WebComponent: InstagramWidget 2.5.0 - Collection of WebComponents by Patryk Rzucidlo [@PTKDev] // https://github.com/ptkdev-components/webcomponent-instagram-widget -(function() { class InstagramWidget extends HTMLElement{constructor(){super();const t=document.createElement("template");t.innerHTML='
\n\t
\n\t\t
\n\t\t\t
    \n\t\t
    \n\t
    \n
    ',this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.json=null,this.options_default={username:"@ptkdev","items-limit":"9","image-width":"100%","image-height":"100%",grid:"responsive",cache:"enabled","border-spacing":"2px","border-corners":"5","force-square":"yes"},this.options=Object.create(this.options_default)}build_html(){let t=this.json.graphql.user.edge_owner_to_timeline_media.edges,e=[];for(let i=0;i${e[t].caption.substring(0,100).replace(/`;if(this.shadowRoot.querySelector(".instagram-widget-photos").innerHTML=i,""!==this.options.grid&&null!==this.options.grid&&"responsive"!==this.options.grid){let t=this.options.grid.split("x"),e=100/parseInt(t[0]),i=this.shadowRoot.querySelectorAll(".instagram-widget-photos img");for(let s=0;s#instagram-widget *{margin:0;padding:0;line-height:0}#instagram-widget .instagram-widget-container{text-align:center;justify-content:center;font-weight:500}#instagram-widget .instagram-widget-photos li img{border-radius:5%;background-color:#f8f8ff;object-fit:cover;object-position:50% 50%;max-width:300px;max-height:300px;min-width:80px;min-height:80px;margin:2px}#instagram-widget .instagram-content ul{list-style-type:none;padding-inline-start:0;width:100%}#instagram-widget .instagram-widget-photos li{list-style-type:none;display:inline}
    \n\t
    \n\t\t
    \n\t\t\t
      \n\t\t
      \n\t
      \n
      ',this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.json=null,this.options_default={username:"@ptkdev","items-limit":"9","image-width":"100%","image-height":"100%",grid:"responsive",cache:"enabled","border-spacing":"2px","border-corners":"5","force-square":"yes"},this.options=Object.create(this.options_default),this.resize_event=function(t){this.resize(t)}.bind(this)}connectedCallback(){window.addEventListener("resize",this.resize_event)}build_html(){let t=this.json.graphql.user.edge_owner_to_timeline_media.edges,e=[];for(let i=0;i${e[t].caption.substring(0,100).replace(/`;if(this.shadowRoot.querySelector(".instagram-widget-photos").innerHTML=i,""!==this.options.grid&&null!==this.options.grid&&"responsive"!==this.options.grid){let t=this.options.grid.split("x"),e=100/parseInt(t[0]),i=this.shadowRoot.querySelectorAll(".instagram-widget-photos img");for(let s=0;s // https://github.com/ptkdev-components/webcomponent-instagram-widget -(function() { class InstagramWidget extends HTMLElement{constructor(){super();const t=document.createElement("template");t.innerHTML='
      \n\t
      \n\t\t
      \n\t\t\t
        \n\t\t
        \n\t
        \n
        ',this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.json=null,this.options_default={username:"@ptkdev","items-limit":"9","image-width":"100%","image-height":"100%",grid:"responsive",cache:"enabled","border-spacing":"2px","border-corners":"5","force-square":"yes"},this.options=Object.create(this.options_default)}build_html(){let t=this.json.graphql.user.edge_owner_to_timeline_media.edges,e=[];for(let i=0;i${e[t].caption.substring(0,100).replace(/`;if(this.shadowRoot.querySelector(".instagram-widget-photos").innerHTML=i,""!==this.options.grid&&null!==this.options.grid&&"responsive"!==this.options.grid){let t=this.options.grid.split("x"),e=100/parseInt(t[0]),i=this.shadowRoot.querySelectorAll(".instagram-widget-photos img");for(let s=0;s#instagram-widget *{margin:0;padding:0;line-height:0}#instagram-widget .instagram-widget-container{text-align:center;justify-content:center;font-weight:500}#instagram-widget .instagram-widget-photos li img{border-radius:5%;background-color:#f8f8ff;object-fit:cover;object-position:50% 50%;max-width:300px;max-height:300px;min-width:80px;min-height:80px;margin:2px}#instagram-widget .instagram-content ul{list-style-type:none;padding-inline-start:0;width:100%}#instagram-widget .instagram-widget-photos li{list-style-type:none;display:inline}
        \n\t
        \n\t\t
        \n\t\t\t
          \n\t\t
          \n\t
          \n
          ',this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.json=null,this.options_default={username:"@ptkdev","items-limit":"9","image-width":"100%","image-height":"100%",grid:"responsive",cache:"enabled","border-spacing":"2px","border-corners":"5","force-square":"yes"},this.options=Object.create(this.options_default),this.resize_event=function(t){this.resize(t)}.bind(this)}connectedCallback(){window.addEventListener("resize",this.resize_event)}build_html(){let t=this.json.graphql.user.edge_owner_to_timeline_media.edges,e=[];for(let i=0;i${e[t].caption.substring(0,100).replace(/`;if(this.shadowRoot.querySelector(".instagram-widget-photos").innerHTML=i,""!==this.options.grid&&null!==this.options.grid&&"responsive"!==this.options.grid){let t=this.options.grid.split("x"),e=100/parseInt(t[0]),i=this.shadowRoot.querySelectorAll(".instagram-widget-photos img");for(let s=0;s // https://github.com/ptkdev-components/webcomponent-instagram-widget -(function() { class InstagramWidget extends HTMLElement{constructor(){super();const t=document.createElement("template");t.innerHTML='
          \n\t
          \n\t\t
          \n\t\t\t
            \n\t\t
            \n\t
            \n
            ',this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.json=null,this.options_default={username:"@ptkdev","items-limit":"9","image-width":"100%","image-height":"100%",grid:"responsive",cache:"enabled","border-spacing":"2px","border-corners":"5","force-square":"yes"},this.options=Object.create(this.options_default)}build_html(){let t=this.json.graphql.user.edge_owner_to_timeline_media.edges,e=[];for(let i=0;i${e[t].caption.substring(0,100).replace(/`;if(this.shadowRoot.querySelector(".instagram-widget-photos").innerHTML=i,""!==this.options.grid&&null!==this.options.grid&&"responsive"!==this.options.grid){let t=this.options.grid.split("x"),e=100/parseInt(t[0]),i=this.shadowRoot.querySelectorAll(".instagram-widget-photos img");for(let s=0;s#instagram-widget *{margin:0;padding:0;line-height:0}#instagram-widget .instagram-widget-container{text-align:center;justify-content:center;font-weight:500}#instagram-widget .instagram-widget-photos li img{border-radius:5%;background-color:#f8f8ff;object-fit:cover;object-position:50% 50%;max-width:300px;max-height:300px;min-width:80px;min-height:80px;margin:2px}#instagram-widget .instagram-content ul{list-style-type:none;padding-inline-start:0;width:100%}#instagram-widget .instagram-widget-photos li{list-style-type:none;display:inline}
            \n\t
            \n\t\t
            \n\t\t\t
              \n\t\t
              \n\t
              \n
              ',this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(t.content.cloneNode(!0)),this.json=null,this.options_default={username:"@ptkdev","items-limit":"9","image-width":"100%","image-height":"100%",grid:"responsive",cache:"enabled","border-spacing":"2px","border-corners":"5","force-square":"yes"},this.options=Object.create(this.options_default),this.resize_event=function(t){this.resize(t)}.bind(this)}connectedCallback(){window.addEventListener("resize",this.resize_event)}build_html(){let t=this.json.graphql.user.edge_owner_to_timeline_media.edges,e=[];for(let i=0;i${e[t].caption.substring(0,100).replace(/`;if(this.shadowRoot.querySelector(".instagram-widget-photos").innerHTML=i,""!==this.options.grid&&null!==this.options.grid&&"responsive"!==this.options.grid){let t=this.options.grid.split("x"),e=100/parseInt(t[0]),i=this.shadowRoot.querySelectorAll(".instagram-widget-photos img");for(let s=0;s