diff --git a/public/js/collectioncompose.js b/public/js/collectioncompose.js index 69d6aba85..5fcb3adea 100644 --- a/public/js/collectioncompose.js +++ b/public/js/collectioncompose.js @@ -1 +1 @@ -(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[597],{30323:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>s});const s={props:["collection-id","profile-id"],data:function(){return{config:window.App.config,loaded:!1,limit:8,step:1,title:"",description:"",collection:{title:"",description:"",visibility:"draft"},id:"",posts:[],tab:"add",tabs:["all","add","order"],recentPosts:[],selectedPost:""}},beforeMount:function(){var t=this;axios.get("/api/local/collection/"+this.collectionId).then((function(i){t.collection=i.data}))},mounted:function(){this.fetchRecentPosts(),this.fetchItems(),axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(t){window._sharedData.curUser=t.data,window.App.util.navatar()}))},methods:{addToIds:function(t){var i=this;axios.post("/api/local/collection/item",{collection_id:this.collectionId,post_id:t}).then((function(t){i.fetchItems(),i.fetchRecentPosts(),i.tab="all",i.id=""})).catch((function(t){swal("Invalid URL","The post you entered was invalid","error"),i.id=""}))},fetchItems:function(){var t=this;axios.get("/api/local/collection/items/"+this.collectionId).then((function(i){t.posts=i.data,t.loaded=!0}))},addId:function(){var t=this.config.uploader.max_collection_length;if(this.posts.length>=t)swal("Error","You can only add "+t+" posts per collection","error");else{var i=this.id,e=window.location.origin,s=i.split("/");if(i.slice(0,e.length)!==e&&(swal("Invalid URL","You can only add posts from this instance","error"),this.id=""),i.includes("/i/web/post/")||i.includes("/p/")){var o=s[s.length-1];return console.log("adding "+o),void this.addToIds(o)}swal("Invalid URL","Invalid URL","error"),this.id=""}},previewUrl:function(t){return t.sensitive?"/storage/no-preview.png?v="+(new Date).getTime():t.media_attachments[0].preview_url},previewBackground:function(t){return"background-image: url("+this.previewUrl(t)+");background-size:cover;"},fetchRecentPosts:function(){var t=this;axios.get("/api/v1/accounts/"+this.profileId+"/statuses",{params:{only_media:!0,min_id:1,limit:40}}).then((function(i){t.recentPosts=i.data.filter((function(i){var e=t.posts.map((function(t){return t.id}));return"public"==i.visibility&&0==i.sensitive&&-1==e.indexOf(i.id)}))}))},selectPost:function(t){this.selectedPost=t.id,this.id=t.url},publish:function(){0!=this.posts.length?axios.post("/api/local/collection/"+this.collectionId+"/publish",{title:this.collection.title,description:this.collection.description,visibility:this.collection.visibility}).then((function(t){window.location.href=t.data.url})).catch((function(t){swal("Something went wrong","There was a problem with your request, please try again later.","error")})):swal("Error","You cannot publish an empty collection")},save:function(){axios.post("/api/local/collection/"+this.collectionId,{title:this.collection.title,description:this.collection.description,visibility:this.collection.visibility}).then((function(t){swal("Saved!","You have successfully saved this collection.","success")}))},deleteCollection:function(){window.confirm("Are you sure you want to delete this collection?")&&axios.delete("/api/local/collection/"+this.collectionId).then((function(t){window.location.href="/"}))}}}},19860:(t,i,e)=>{Vue.component("collection-compose",e(95277).default)},95277:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>a});var s=e(44309),o=e(57725),l={};for(const t in o)"default"!==t&&(l[t]=()=>o[t]);e.d(i,l);const a=(0,e(51900).default)(o.default,s.render,s.staticRenderFns,!1,null,null,null).exports},57725:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>l});var s=e(30323),o={};for(const t in s)"default"!==t&&(o[t]=()=>s[t]);e.d(i,o);const l=s.default},44309:(t,i,e)=>{"use strict";e.r(i);var s=e(62199),o={};for(const t in s)"default"!==t&&(o[t]=()=>s[t]);e.d(i,o)},62199:(t,i,e)=>{"use strict";e.r(i),e.d(i,{render:()=>s,staticRenderFns:()=>o});var s=function(){var t=this,i=t.$createElement,e=t._self._c||i;return e("div",{staticClass:"container"},[t.loaded?e("div",{staticClass:"row"},[t._m(0),t._v(" "),e("div",{staticClass:"col-12 col-md-4 pt-3"},[e("div",{staticClass:"card rounded-0 shadow-none border ",staticStyle:{"min-height":"440px"}},[e("div",{staticClass:"card-body"},[e("div",[e("form",[e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Title")]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.collection.title,expression:"collection.title"}],staticClass:"form-control",attrs:{type:"text",id:"title",placeholder:"Collection Title"},domProps:{value:t.collection.title},on:{input:function(i){i.target.composing||t.$set(t.collection,"title",i.target.value)}}})]),t._v(" "),e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"description"}},[t._v("Description")]),t._v(" "),e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.collection.description,expression:"collection.description"}],staticClass:"form-control",attrs:{id:"description",placeholder:"Example description here",rows:"3"},domProps:{value:t.collection.description},on:{input:function(i){i.target.composing||t.$set(t.collection,"description",i.target.value)}}})]),t._v(" "),e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"visibility"}},[t._v("Visibility")]),t._v(" "),e("select",{directives:[{name:"model",rawName:"v-model",value:t.collection.visibility,expression:"collection.visibility"}],staticClass:"custom-select",on:{change:function(i){var e=Array.prototype.filter.call(i.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(t.collection,"visibility",i.target.multiple?e:e[0])}}},[e("option",{attrs:{value:"public"}},[t._v("Public")]),t._v(" "),e("option",{attrs:{value:"private"}},[t._v("Followers Only")]),t._v(" "),e("option",{attrs:{value:"draft"}},[t._v("Draft")])])])]),t._v(" "),e("hr"),t._v(" "),e("p",[t.posts.length>0&&"draft"!=t.collection.visibility?e("button",{staticClass:"btn btn-primary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.publish}},[t._v("Publish")]):e("button",{staticClass:"btn btn-primary font-weight-bold btn-block disabled",attrs:{type:"button",disabled:""}},[t._v("Publish")])]),t._v(" "),e("p",[e("button",{staticClass:"btn btn-outline-primary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.save}},[t._v("Save")])]),t._v(" "),e("p",{staticClass:"mb-0"},[e("button",{staticClass:"btn btn-outline-secondary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.deleteCollection}},[t._v("Delete")])])])])])]),t._v(" "),e("div",{staticClass:"col-12 col-md-8 pt-3"},[e("div",[e("ul",{staticClass:"nav nav-tabs"},[e("li",{staticClass:"nav-item"},[e("a",{class:["add"==t.tab?"nav-link font-weight-bold bg-white active":"nav-link font-weight-bold text-muted"],attrs:{href:"#"},on:{click:function(i){i.preventDefault(),t.tab="add"}}},[t._v("Add Posts")])]),t._v(" "),e("li",{staticClass:"nav-item"},[e("a",{class:["all"==t.tab?"nav-link font-weight-bold bg-white active":"nav-link font-weight-bold text-muted"],attrs:{href:"#"},on:{click:function(i){i.preventDefault(),t.tab="all"}}},[t._v("Preview")])])])]),t._v(" "),e("div",{staticClass:"card rounded-0 shadow-none border border-top-0"},[e("div",{staticClass:"card-body",staticStyle:{"min-height":"460px"}},["all"==t.tab?e("div",{staticClass:"row"},t._l(t.posts,(function(i,s){return e("div",{staticClass:"col-4 p-1"},[e("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:i.url}},[e("div",{staticClass:"square"},["photo:album"==i.pf_type?e("span",{staticClass:"float-right mr-3 post-icon"},[e("i",{staticClass:"fas fa-images fa-2x"})]):t._e(),t._v(" "),"video"==i.pf_type?e("span",{staticClass:"float-right mr-3 post-icon"},[e("i",{staticClass:"fas fa-video fa-2x"})]):t._e(),t._v(" "),"video:album"==i.pf_type?e("span",{staticClass:"float-right mr-3 post-icon"},[e("i",{staticClass:"fas fa-film fa-2x"})]):t._e(),t._v(" "),e("div",{staticClass:"square-content",style:t.previewBackground(i)}),t._v(" "),e("div",{staticClass:"info-overlay-text"},[e("h5",{staticClass:"text-white m-auto font-weight-bold"},[e("span",[e("span",{staticClass:"far fa-heart fa-lg p-2 d-flex-inline"}),t._v(" "),e("span",{staticClass:"d-flex-inline"},[t._v(t._s(i.favourites_count))])]),t._v(" "),e("span",[e("span",{staticClass:"fas fa-retweet fa-lg p-2 d-flex-inline"}),t._v(" "),e("span",{staticClass:"d-flex-inline"},[t._v(t._s(i.reblogs_count))])])])])])])])})),0):t._e(),t._v(" "),"add"==t.tab?e("div",[e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Post by URL")]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.id,expression:"id"}],staticClass:"form-control",attrs:{type:"text",placeholder:"https://pixelfed.dev/p/admin/1"},domProps:{value:t.id},on:{input:function(i){i.target.composing||(t.id=i.target.value)}}}),t._v(" "),e("p",{staticClass:"help-text small text-muted"},[t._v("Only local, public posts can be added")])]),t._v(" "),e("div",{staticClass:"form-group pt-4"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Recent Post")]),t._v(" "),e("div",{staticStyle:{"max-height":"360px","overflow-y":"auto"}},t._l(t.recentPosts,(function(i,s){return e("div",{class:[t.selectedPost==i.id?"box-shadow border border-warning d-inline-block m-1":"d-inline-block m-1"],on:{click:function(e){return t.selectPost(i)}}},[e("div",{staticClass:"cursor-pointer",style:"width: 175px; height: 175px; "+t.previewBackground(i)})])})),0)]),t._v(" "),e("hr"),t._v(" "),e("button",{staticClass:"btn btn-primary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.addId}},[t._v("Add Post")])]):t._e(),t._v(" "),"order"==t.tab?e("div"):t._e()])])])]):t._e()])},o=[function(){var t=this,i=t.$createElement,e=t._self._c||i;return e("div",{staticClass:"col-12 col-md-6 offset-md-3 pt-5"},[e("div",{staticClass:"text-center pb-4"},[e("h1",[t._v("Create Collection")])])])}]}},t=>{t.O(0,[898],(()=>{return i=19860,t(t.s=i);var i}));t.O()}]); \ No newline at end of file +(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[597],{30323:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>s});const s={props:["collection-id","profile-id"],data:function(){return{config:window.App.config,loaded:!1,limit:8,step:1,title:"",description:"",collection:{title:"",description:"",visibility:"draft"},id:"",posts:[],tab:"add",tabs:["all","add","order"],recentPosts:[],selectedPost:""}},beforeMount:function(){var t=this;axios.get("/api/local/collection/"+this.collectionId).then((function(i){t.collection=i.data}))},mounted:function(){this.fetchRecentPosts(),this.fetchItems(),axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(t){window._sharedData.curUser=t.data,window.App.util.navatar()}))},methods:{addToIds:function(t){var i=this;axios.post("/api/local/collection/item",{collection_id:this.collectionId,post_id:t}).then((function(t){i.fetchItems(),i.fetchRecentPosts(),i.tab="all",i.id=""})).catch((function(t){swal("Invalid URL","The post you entered was invalid","error"),i.id=""}))},fetchItems:function(){var t=this;axios.get("/api/local/collection/items/"+this.collectionId).then((function(i){t.posts=i.data,t.loaded=!0}))},addId:function(){var t=this.config.uploader.max_collection_length;if(this.posts.length>=t)swal("Error","You can only add "+t+" posts per collection","error");else{var i=this.id,e=window.location.origin,s=i.split("/");if(i.slice(0,e.length)!==e&&(swal("Invalid URL","You can only add posts from this instance","error"),this.id=""),i.includes("/i/web/post/")||i.includes("/p/")){var o=s[s.length-1];return console.log("adding "+o),void this.addToIds(o)}swal("Invalid URL","Invalid URL","error"),this.id=""}},previewUrl:function(t){return t.sensitive?"/storage/no-preview.png?v="+(new Date).getTime():t.media_attachments[0].preview_url},previewBackground:function(t){return"background-image: url("+this.previewUrl(t)+");background-size:cover;"},fetchRecentPosts:function(){var t=this;axios.get("/api/v1/accounts/"+this.profileId+"/statuses",{params:{only_media:!0,min_id:1,limit:40}}).then((function(i){t.recentPosts=i.data.filter((function(i){var e=t.posts.map((function(t){return t.id}));return"public"==i.visibility&&0==i.sensitive&&-1==e.indexOf(i.id)}))}))},selectPost:function(t){this.selectedPost=t.id,this.id=t.url},publish:function(){0!=this.posts.length?axios.post("/api/local/collection/"+this.collectionId+"/publish",{title:this.collection.title,description:this.collection.description,visibility:this.collection.visibility}).then((function(t){window.location.href=t.data.url})).catch((function(t){swal("Something went wrong","There was a problem with your request, please try again later.","error")})):swal("Error","You cannot publish an empty collection")},save:function(){axios.post("/api/local/collection/"+this.collectionId,{title:this.collection.title,description:this.collection.description,visibility:this.collection.visibility}).then((function(t){swal("Saved!","You have successfully saved this collection.","success")}))},deleteCollection:function(){window.confirm("Are you sure you want to delete this collection?")&&axios.delete("/api/local/collection/"+this.collectionId).then((function(t){window.location.href="/"}))}}}},19860:(t,i,e)=>{Vue.component("collection-compose",e(95277).default)},95277:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>a});var s=e(26160),o=e(57725),l={};for(const t in o)"default"!==t&&(l[t]=()=>o[t]);e.d(i,l);const a=(0,e(51900).default)(o.default,s.render,s.staticRenderFns,!1,null,null,null).exports},57725:(t,i,e)=>{"use strict";e.r(i),e.d(i,{default:()=>l});var s=e(30323),o={};for(const t in s)"default"!==t&&(o[t]=()=>s[t]);e.d(i,o);const l=s.default},26160:(t,i,e)=>{"use strict";e.r(i);var s=e(98413),o={};for(const t in s)"default"!==t&&(o[t]=()=>s[t]);e.d(i,o)},98413:(t,i,e)=>{"use strict";e.r(i),e.d(i,{render:()=>s,staticRenderFns:()=>o});var s=function(){var t=this,i=t.$createElement,e=t._self._c||i;return e("div",{staticClass:"container"},[t.loaded?e("div",{staticClass:"row"},[t._m(0),t._v(" "),e("div",{staticClass:"col-12 col-md-4 pt-3"},[e("div",{staticClass:"card rounded-0 shadow-none border ",staticStyle:{"min-height":"440px"}},[e("div",{staticClass:"card-body"},[e("div",[e("form",[e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Title")]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.collection.title,expression:"collection.title"}],staticClass:"form-control",attrs:{type:"text",id:"title",placeholder:"Collection Title",maxlength:"50"},domProps:{value:t.collection.title},on:{input:function(i){i.target.composing||t.$set(t.collection,"title",i.target.value)}}}),t._v(" "),e("div",{staticClass:"text-right small text-muted"},[e("span",[t._v(t._s(t.collection.title?t.collection.title.length:0)+"/50")])])]),t._v(" "),e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"description"}},[t._v("Description")]),t._v(" "),e("textarea",{directives:[{name:"model",rawName:"v-model",value:t.collection.description,expression:"collection.description"}],staticClass:"form-control",attrs:{id:"description",placeholder:"Example description here",rows:"3",maxlength:"500"},domProps:{value:t.collection.description},on:{input:function(i){i.target.composing||t.$set(t.collection,"description",i.target.value)}}}),t._v(" "),e("div",{staticClass:"text-right small text-muted"},[e("span",[t._v(t._s(t.collection.description?t.collection.description.length:0)+"/500")])])]),t._v(" "),e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"visibility"}},[t._v("Visibility")]),t._v(" "),e("select",{directives:[{name:"model",rawName:"v-model",value:t.collection.visibility,expression:"collection.visibility"}],staticClass:"custom-select",on:{change:function(i){var e=Array.prototype.filter.call(i.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.$set(t.collection,"visibility",i.target.multiple?e:e[0])}}},[e("option",{attrs:{value:"public"}},[t._v("Public")]),t._v(" "),e("option",{attrs:{value:"private"}},[t._v("Followers Only")]),t._v(" "),e("option",{attrs:{value:"draft"}},[t._v("Draft")])])])]),t._v(" "),e("hr"),t._v(" "),e("p",[t.posts.length>0&&"draft"!=t.collection.visibility?e("button",{staticClass:"btn btn-primary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.publish}},[t._v("Publish")]):e("button",{staticClass:"btn btn-primary font-weight-bold btn-block disabled",attrs:{type:"button",disabled:""}},[t._v("Publish")])]),t._v(" "),e("p",[e("button",{staticClass:"btn btn-outline-primary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.save}},[t._v("Save")])]),t._v(" "),e("p",{staticClass:"mb-0"},[e("button",{staticClass:"btn btn-outline-secondary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.deleteCollection}},[t._v("Delete")])])])])])]),t._v(" "),e("div",{staticClass:"col-12 col-md-8 pt-3"},[e("div",[e("ul",{staticClass:"nav nav-tabs"},[e("li",{staticClass:"nav-item"},[e("a",{class:["add"==t.tab?"nav-link font-weight-bold bg-white active":"nav-link font-weight-bold text-muted"],attrs:{href:"#"},on:{click:function(i){i.preventDefault(),t.tab="add"}}},[t._v("Add Posts")])]),t._v(" "),e("li",{staticClass:"nav-item"},[e("a",{class:["all"==t.tab?"nav-link font-weight-bold bg-white active":"nav-link font-weight-bold text-muted"],attrs:{href:"#"},on:{click:function(i){i.preventDefault(),t.tab="all"}}},[t._v("Preview")])])])]),t._v(" "),e("div",{staticClass:"card rounded-0 shadow-none border border-top-0"},[e("div",{staticClass:"card-body",staticStyle:{"min-height":"460px"}},["all"==t.tab?e("div",{staticClass:"row"},t._l(t.posts,(function(i,s){return e("div",{staticClass:"col-4 p-1"},[e("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:i.url}},[e("div",{staticClass:"square"},["photo:album"==i.pf_type?e("span",{staticClass:"float-right mr-3 post-icon"},[e("i",{staticClass:"fas fa-images fa-2x"})]):t._e(),t._v(" "),"video"==i.pf_type?e("span",{staticClass:"float-right mr-3 post-icon"},[e("i",{staticClass:"fas fa-video fa-2x"})]):t._e(),t._v(" "),"video:album"==i.pf_type?e("span",{staticClass:"float-right mr-3 post-icon"},[e("i",{staticClass:"fas fa-film fa-2x"})]):t._e(),t._v(" "),e("div",{staticClass:"square-content",style:t.previewBackground(i)}),t._v(" "),e("div",{staticClass:"info-overlay-text"},[e("h5",{staticClass:"text-white m-auto font-weight-bold"},[e("span",[e("span",{staticClass:"far fa-heart fa-lg p-2 d-flex-inline"}),t._v(" "),e("span",{staticClass:"d-flex-inline"},[t._v(t._s(i.favourites_count))])]),t._v(" "),e("span",[e("span",{staticClass:"fas fa-retweet fa-lg p-2 d-flex-inline"}),t._v(" "),e("span",{staticClass:"d-flex-inline"},[t._v(t._s(i.reblogs_count))])])])])])])])})),0):t._e(),t._v(" "),"add"==t.tab?e("div",[e("div",{staticClass:"form-group"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Post by URL")]),t._v(" "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.id,expression:"id"}],staticClass:"form-control",attrs:{type:"text",placeholder:"https://pixelfed.dev/p/admin/1"},domProps:{value:t.id},on:{input:function(i){i.target.composing||(t.id=i.target.value)}}}),t._v(" "),e("p",{staticClass:"help-text small text-muted"},[t._v("Only local, public posts can be added")])]),t._v(" "),e("div",{staticClass:"form-group pt-4"},[e("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Recent Post")]),t._v(" "),e("div",{staticStyle:{"max-height":"360px","overflow-y":"auto"}},t._l(t.recentPosts,(function(i,s){return e("div",{class:[t.selectedPost==i.id?"box-shadow border border-warning d-inline-block m-1":"d-inline-block m-1"],on:{click:function(e){return t.selectPost(i)}}},[e("div",{staticClass:"cursor-pointer",style:"width: 175px; height: 175px; "+t.previewBackground(i)})])})),0)]),t._v(" "),e("hr"),t._v(" "),e("button",{staticClass:"btn btn-primary font-weight-bold btn-block",attrs:{type:"button"},on:{click:t.addId}},[t._v("Add Post")])]):t._e(),t._v(" "),"order"==t.tab?e("div"):t._e()])])])]):t._e()])},o=[function(){var t=this,i=t.$createElement,e=t._self._c||i;return e("div",{staticClass:"col-12 col-md-6 offset-md-3 pt-5"},[e("div",{staticClass:"text-center pb-4"},[e("h1",[t._v("Create Collection")])])])}]}},t=>{t.O(0,[898],(()=>{return i=19860,t(t.s=i);var i}));t.O()}]); \ No newline at end of file diff --git a/public/js/collections.js b/public/js/collections.js index 905dd45d3..5ccf259cd 100644 --- a/public/js/collections.js +++ b/public/js/collections.js @@ -1 +1 @@ -(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[33],{98379:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});i(82364);function o(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return s(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return s(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,o=new Array(e);i9&&(t.canLoadMore=!0),t.fetchCurrentUser()}))},fetchCurrentUser:function(){var t=this;1==document.querySelectorAll("body")[0].classList.contains("loggedIn")?axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.user=e.data,t.owner=t.user.id==t.profileId,window._sharedData.curUser=e.data,window.App.util.navatar(),t.fetchItems()})):this.fetchItems()},fetchItems:function(){var t=this;axios.get("/api/local/collection/items/"+this.collectionId,{params:{page:this.page}}).then((function(e){var i;if(0==e.data.length)return console.log("no items found"),t.loaded=!0,t.isIntersecting=!1,void(t.canLoadMore=!1);var s=e.data.filter((function(e){return-1==t.ids.indexOf(e.id)}));(i=t.posts).push.apply(i,o(s)),t.ids=t.posts.map((function(t){return t.id})),t.loaded=!0,t.isIntersecting=!1,0==s.length&&(t.canLoadMore=!1)}))},previewUrl:function(t){return t&&t.sensitive?"/storage/no-preview.png?v="+(new Date).getTime():t.media_attachments[0].url},previewBackground:function(t){return"background-image: url("+this.previewUrl(t)+");"},addToCollection:function(){var t=this;this.loadingPostList=!0,0==this.postsList.length?axios.get("/api/v1/accounts/"+this.profileId+"/statuses",{params:{min_id:1,limit:40}}).then((function(e){t.postsList=e.data.filter((function(e){return-1==t.ids.indexOf(e.id)})),t.loadingPostList=!1,t.$refs.addPhotoModal.show()})).catch((function(e){t.loadingPostList=!1,swal("An Error Occured","We cannot process your request at this time, please try again later.","error")})):(this.$refs.addPhotoModal.show(),this.loadingPostList=!1)},pushId:function(){var t=this,e=this.config.uploader.max_collection_length,i=this;if(this.posts.length>=e)swal("Error","You can only add "+e+" posts per collection","error");else{var s=this.photoId,n=window.location.origin,a=s.split("/");if(s.slice(0,n.length)!==n&&(swal("Invalid URL","You can only add posts from this instance","error"),this.photoId=""),!s.includes("/i/web/post/")&&!s.includes("/p/"))return swal("Invalid URL","Invalid URL","error"),void(this.photoId="");var l=a[a.length-1].split("?")[0];axios.post("/api/local/collection/item",{collection_id:this.collectionId,post_id:l}).then((function(t){var e;(e=i.ids).push.apply(e,o(l)),i.posts.push(t.data),i.collection.post_count++,i.id=""})).catch((function(e){swal("Invalid URL","The post you entered was invalid","error"),t.photoId=""})),i.$refs.addPhotoModal.hide()}},editCollection:function(){this.$refs.editModal.show()},deleteCollection:function(){0!=this.owner&&(window.confirm("Are you sure you want to delete this collection?")&&axios.delete("/api/local/collection/"+this.collectionId).then((function(t){window.location.href="/"})))},publishCollection:function(){0!=this.owner&&(window.confirm("Are you sure you want to publish this collection?")&&axios.post("/api/local/collection/"+this.collectionId+"/publish",{title:this.title,description:this.description,visibility:this.visibility}).then((function(t){console.log(t.data)})))},updateCollection:function(){var t=this;this.closeModals(),axios.post("/api/local/collection/"+this.collectionId,{title:this.title,description:this.description,visibility:this.visibility}).then((function(e){t.collection=e.data}))},showEditPhotosModal:function(){this.$refs.editModal.hide(),this.$refs.editPhotosModal.show()},markPhotoForDeletion:function(t){-1==this.markedForDeletion.indexOf(t)?this.markedForDeletion.push(t):this.markedForDeletion=this.markedForDeletion.filter((function(e){return e!=t}))},confirmDeletion:function(){var t=this,e=this;window.confirm("Are you sure you want to delete this?")&&(this.markedForDeletion.forEach((function(i){axios.delete("/api/local/collection/item",{params:{collection_id:e.collectionId,post_id:i}}).then((function(o){e.removeItem(i),t.collection.post_count=t.collection.post_count-1,t.closeModals()})).catch((function(t){swal("Oops!","An error occured with your request, please try again later.","error")}))})),this.markedForDeletion=[])},removeItem:function(t){this.posts=this.posts.filter((function(e){return e.id!=t}))},addRecentId:function(t){var e=this;axios.post("/api/local/collection/item",{collection_id:this.collectionId,post_id:t.id}).then((function(t){e.closeModals(),e.posts.push(t.data),e.collection.post_count++})).catch((function(t){swal("Oops!","An error occured, please try selecting another post.","error"),e.photoId=""}))},timeago:function(t){return App.util.format.timeAgo(t)},closeModals:function(){this.$refs.editModal.hide(),this.$refs.addPhotoModal.hide(),this.$refs.editPhotosModal.hide()},getPreviewUrl:function(t){if(!t.media_attachments||!t.media_attachments.length)return"/storage/no-preview.png";var e=t.media_attachments[0];return e.preview_url.endsWith("storage/no-preview.png")?"image"===e.type?e.url:"/storage/no-preview.png":e.preview_url}}}},55386:(t,e,i)=>{Vue.component("collection-component",i(44051).default)},46670:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});var o=i(23645),s=i.n(o)()((function(t){return t[1]}));s.push([t.id,".dims[data-v-28d4925b]{background:rgba(0,0,0,.68);bottom:0;left:0;position:absolute;right:0;top:0;z-index:300}.scrollbar-hidden[data-v-28d4925b]::-webkit-scrollbar{display:none}.delete-border[data-v-28d4925b]{border:4px solid red}.delete-border .square-content[data-v-28d4925b]{background-blend-mode:screen;background-color:red}.info-overlay-text-field[data-v-28d4925b]{font-size:13.5px;margin-bottom:2px}@media(min-width:768px){.info-overlay-text-field[data-v-28d4925b]{font-size:20px;margin-bottom:15px}}.feed .card.info-overlay[data-v-28d4925b]{margin-bottom:2rem}",""]);const n=s},99254:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>l});var o=i(93379),s=i.n(o),n=i(46670),a={insert:"head",singleton:!1};s()(n.default,a);const l=n.default.locals||{}},44051:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>a});var o=i(67141),s=i(33195),n={};for(const t in s)"default"!==t&&(n[t]=()=>s[t]);i.d(e,n);i(65603);const a=(0,i(51900).default)(s.default,o.render,o.staticRenderFns,!1,null,"28d4925b",null).exports},33195:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});var o=i(98379),s={};for(const t in o)"default"!==t&&(s[t]=()=>o[t]);i.d(e,s);const n=o.default},65603:(t,e,i)=>{"use strict";i.r(e);var o=i(99254),s={};for(const t in o)"default"!==t&&(s[t]=()=>o[t]);i.d(e,s)},67141:(t,e,i)=>{"use strict";i.r(e);var o=i(15708),s={};for(const t in o)"default"!==t&&(s[t]=()=>o[t]);i.d(e,s)},15708:(t,e,i)=>{"use strict";i.r(e),i.d(e,{render:()=>o,staticRenderFns:()=>s});var o=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"w-100 h-100"},[t.loaded?t._e():i("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{height:"80vh"}},[i("img",{attrs:{src:"/img/pixelfed-icon-grey.svg"}})]),t._v(" "),t.loaded?i("div",{staticClass:"row mt-3"},[i("div",{staticClass:"col-12 p-0 mb-3"},[t.owner&&!t.collection.published_at?i("div",[t._m(0)]):t._e()]),t._v(" "),i("div",{staticClass:"col-12 p-0 mb-3"},[i("picture",{staticClass:"d-flex align-items-center justify-content-center"},[i("div",{staticClass:"dims"}),t._v(" "),i("div",{staticClass:"text-white",staticStyle:{"z-index":"500",position:"absolute"}},[i("p",{staticClass:"display-4 text-center pt-3"},[t._v(t._s(t.title||"Untitled Collection"))]),t._v(" "),i("p",{staticClass:"lead text-center mb-3"},[t._v(t._s(t.description))]),t._v(" "),i("p",{staticClass:"text-center"},[t.owner&&"public"!=t.collection.visibility?i("span",["draft"==t.collection.visibility?i("span",{staticClass:"btn btn-outline-light btn-sm text-capitalize py-0",staticStyle:{"font-size":"10px"}},[i("i",{staticClass:"far fa-lock"}),t._v(" Draft\n\t\t\t\t\t\t\t")]):"private"==t.collection.visibility?i("span",{staticClass:"btn btn-outline-light btn-sm text-capitalize py-0",staticStyle:{"font-size":"10px"}},[t._v("\n\t\t\t\t\t\t\t\tFollowers Only\n\t\t\t\t\t\t\t")]):t._e(),t._v(" "),i("span",[t._v("·")])]):t._e(),t._v(" "),i("span",[t._v(t._s(t.collection.post_count)+" photos")]),t._v(" "),i("span",[t._v("·")]),t._v(" "),i("span",[t._v("by "),i("a",{staticClass:"font-weight-bold text-white",attrs:{href:"/"+t.profileUsername}},[t._v(t._s(t.profileUsername))])])]),t._v(" "),1==t.owner?i("p",{staticClass:"pt-3 text-center"},[i("span",[i("button",{staticClass:"btn btn-outline-light btn-sm",attrs:{onclick:"this.blur();"},on:{click:function(e){return e.preventDefault(),t.addToCollection.apply(null,arguments)}}},[0==t.loadingPostList?i("span",[t._v("Add Photo")]):i("span",{staticClass:"px-4"},[t._m(1)])]),t._v("\n\t\t\t\t\t\t\t    \n\t\t\t\t\t\t\t"),i("button",{staticClass:"btn btn-outline-light btn-sm",attrs:{onclick:"this.blur();"},on:{click:function(e){return e.preventDefault(),t.editCollection.apply(null,arguments)}}},[t._v("Edit")]),t._v("\n\t\t\t\t\t\t\t    \n\t\t\t\t\t\t\t"),i("button",{staticClass:"btn btn-outline-light btn-sm",on:{click:function(e){return e.preventDefault(),t.deleteCollection.apply(null,arguments)}}},[t._v("Delete")])])]):t._e()]),t._v(" "),t.posts&&t.posts.length?i("img",{staticStyle:{width:"100%",height:"400px","object-fit":"cover"},attrs:{src:t.previewUrl(t.posts[0]),alt:""}}):i("div",{staticClass:"bg-info",staticStyle:{width:"100%",height:"400px"}})])]),t._v(" "),i("div",{staticClass:"col-12 p-0"},[t.posts&&t.posts.length>0?i("div",{staticClass:"row px-3 px-md-0"},[t._l(t.posts,(function(e,o){return i("div",{staticClass:"col-6 col-md-4 feed"},[e.hasOwnProperty("pf_type")&&"video"==e.pf_type?i("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.statusUrl(e)}},[i("div",{staticClass:"square"},[i("div",{staticClass:"square-content"},[t._m(2,!0),t._v(" "),i("blur-hash-canvas",{staticClass:"rounded",attrs:{width:"32",height:"32",hash:e.media_attachments[0].blurhash}})],1)])]):e.sensitive?i("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.statusUrl(e)}},[i("div",{staticClass:"square"},[i("div",{staticClass:"square-content"},[t._m(3,!0),t._v(" "),i("blur-hash-canvas",{staticClass:"rounded",attrs:{width:"32",height:"32",hash:e.media_attachments[0].blurhash}})],1)])]):i("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.statusUrl(e)}},[i("div",{staticClass:"square"},[i("div",{staticClass:"square-content"},[i("blur-hash-image",{staticClass:"rounded",attrs:{width:"32",height:"32",hash:e.media_attachments[0].blurhash,src:t.previewUrl(e)}})],1)])])])})),t._v(" "),t.canLoadMore?i("div",{staticClass:"col-12"},[i("intersect",{on:{enter:t.enterIntersect}},[i("div",{staticClass:"card card-body shadow-none border"},[i("div",{staticClass:"d-flex justify-content-center align-items-center flex-column"},[i("b-spinner",{attrs:{variant:"muted"}}),t._v(" "),i("p",{staticClass:"text-lighter small mt-2 mb-0"},[t._v("Loading more...")])],1)])])],1):t._e()],2):t._e()])]):t._e(),t._v(" "),i("b-modal",{ref:"editModal",attrs:{id:"edit-modal","hide-footer":"",centered:"",title:"Edit Collection","body-class":""}},[i("form",[i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Title")]),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.title,expression:"title"}],staticClass:"form-control",attrs:{type:"text",id:"title",placeholder:"Untitled Collection"},domProps:{value:t.title},on:{input:function(e){e.target.composing||(t.title=e.target.value)}}})]),t._v(" "),i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"description"}},[t._v("Description")]),t._v(" "),i("textarea",{directives:[{name:"model",rawName:"v-model",value:t.description,expression:"description"}],staticClass:"form-control",attrs:{id:"description",placeholder:"Add a description here ...",rows:"3"},domProps:{value:t.description},on:{input:function(e){e.target.composing||(t.description=e.target.value)}}})]),t._v(" "),i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"visibility"}},[t._v("Visibility")]),t._v(" "),i("select",{directives:[{name:"model",rawName:"v-model",value:t.visibility,expression:"visibility"}],staticClass:"custom-select",on:{change:function(e){var i=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.visibility=e.target.multiple?i:i[0]}}},[i("option",{attrs:{value:"public"}},[t._v("Public")]),t._v(" "),i("option",{attrs:{value:"private"}},[t._v("Followers Only")]),t._v(" "),i("option",{attrs:{value:"draft"}},[t._v("Draft")])])]),t._v(" "),i("div",{staticClass:"d-flex justify-content-between align-items-center pt-3"},[i("a",{staticClass:"text-primary font-weight-bold text-decoration-none",attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.showEditPhotosModal.apply(null,arguments)}}},[t._v("\n\t\t\t\t\tEdit Photos\n\t\t\t\t")]),t._v(" "),t.collection.published_at?i("div",[i("button",{staticClass:"btn btn-primary btn-sm py-1 font-weight-bold px-3 float-right",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.updateCollection.apply(null,arguments)}}},[t._v("\n\t\t\t\t\t\tSave\n\t\t\t\t\t")])]):i("div",{staticClass:"float-right"},[i("button",{staticClass:"btn btn-outline-primary btn-sm py-1 font-weight-bold px-3",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.publishCollection.apply(null,arguments)}}},[t._v("\n\t\t\t\t\t\tPublish\n\t\t\t\t\t")]),t._v(" "),i("button",{staticClass:"btn btn-primary btn-sm py-1 font-weight-bold px-3",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.updateCollection.apply(null,arguments)}}},[t._v("\n\t\t\t\t\t\tSave\n\t\t\t\t\t")])])])])]),t._v(" "),i("b-modal",{ref:"addPhotoModal",attrs:{id:"add-photo-modal","hide-footer":"",centered:"",title:"Add Photo","body-class":"m-3"}},[i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Recent Post")]),t._v(" "),t.postsList.length>0?i("div",{staticClass:"row m-1",staticStyle:{"max-height":"360px","overflow-y":"auto"}},[t._l(t.postsList,(function(e,o){return i("div",{key:"postList-"+o,staticClass:"col-4 p-1 cursor-pointer",on:{click:function(i){return t.addRecentId(e)}}},[i("div",{staticClass:"square border"},[i("div",{staticClass:"square-content",style:"background-image: url("+t.getPreviewUrl(e)+");"})])])})),t._v(" "),i("div",{staticClass:"col-12"},[i("hr")])],2):t._e()]),t._v(" "),i("form",[i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Post by URL")]),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.photoId,expression:"photoId"}],staticClass:"form-control",attrs:{type:"text",placeholder:"https://pixelfed.dev/p/admin/1"},domProps:{value:t.photoId},on:{input:function(e){e.target.composing||(t.photoId=e.target.value)}}}),t._v(" "),i("p",{staticClass:"help-text small text-muted"},[t._v("Only local, public posts can be added")])]),t._v(" "),i("button",{staticClass:"btn btn-primary btn-sm py-1 font-weight-bold px-3 float-right",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.pushId.apply(null,arguments)}}},[t.addingPostToCollection?i("span",{staticClass:"px-4"},[i("div",{staticClass:"spinner-border spinner-border-sm",attrs:{role:"status"}},[i("span",{staticClass:"sr-only"},[t._v("Loading...")])])]):i("span",[t._v("\n\t\t\t\t\tAdd Photo\n\t\t\t\t")])])])]),t._v(" "),i("b-modal",{ref:"editPhotosModal",attrs:{id:"edit-photos-modal","hide-footer":"",centered:"",title:"Edit Collection Photos","body-class":"m-3"}},[i("div",{staticClass:"form-group"},[i("p",{staticClass:"font-weight-bold text-dark text-center"},[t._v("Select a Photo to Delete")]),t._v(" "),t.posts.length>0?i("div",{staticClass:"row m-1 scrollbar-hidden",staticStyle:{"max-height":"350px","overflow-y":"auto"}},t._l(t.posts,(function(e,o){return i("div",{key:"plm-"+o,staticClass:"col-4 p-1 cursor-pointer"},[i("div",{class:[-1==t.markedForDeletion.indexOf(e.id)?"square":"square delete-border"],on:{click:function(i){return t.markPhotoForDeletion(e.id)}}},[i("div",{staticClass:"square-content border",style:"background-image: url("+e.media_attachments[0].url+");"})])])})),0):t._e(),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.markedForDeletion.length>0,expression:"markedForDeletion.length > 0"}]},[i("button",{staticClass:"btn btn-primary font-weight-bold py-0 btn-block mb-0 mt-4",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.confirmDeletion.apply(null,arguments)}}},[t._v("Delete "+t._s(t.markedForDeletion.length)+" "+t._s(1==t.markedForDeletion.length?"photo":"photos"))])])])])],1)},s=[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"alert alert-danger d-flex justify-content-center"},[i("div",{staticClass:"media align-items-center"},[i("i",{staticClass:"far fa-exclamation-triangle fa-3x mr-3"}),t._v(" "),i("div",{staticClass:"media-body"},[i("p",{staticClass:"font-weight-bold mb-0"},[t._v("\n\t\t\t\t\t\t\t\tThis collection is unpublished.\n\t\t\t\t\t\t\t")]),t._v(" "),i("p",{staticClass:"small mb-0"},[t._v("\n\t\t\t\t\t\t\t\tThis collection is not visible to anyone else until you publish it. "),i("br"),t._v("\n\t\t\t\t\t\t\t\tTo publish, click on the "),i("strong",[t._v("Edit")]),t._v(" button and then click on the "),i("strong",[t._v("Publish")]),t._v(" button.\n\t\t\t\t\t\t\t")])])])])},function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"spinner-border spinner-border-sm",attrs:{role:"status"}},[i("span",{staticClass:"sr-only"},[t._v("Loading...")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"info-overlay-text-label rounded"},[e("h5",{staticClass:"text-white m-auto font-weight-bold"},[e("span",[e("span",{staticClass:"far fa-video fa-2x p-2 d-flex-inline"})])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"info-overlay-text-label rounded"},[e("h5",{staticClass:"text-white m-auto font-weight-bold"},[e("span",[e("span",{staticClass:"far fa-eye-slash fa-lg p-2 d-flex-inline"})])])])}]}},t=>{t.O(0,[898],(()=>{return e=55386,t(t.s=e);var e}));t.O()}]); \ No newline at end of file +(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[33],{98379:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>r});i(82364);var o=i(78423),s=i(19755);function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function a(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return l(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,o=new Array(e);i9&&(t.canLoadMore=!0),t.fetchCurrentUser()}))},fetchCurrentUser:function(){var t=this;1==document.querySelectorAll("body")[0].classList.contains("loggedIn")?axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.user=e.data,t.owner=t.user.id==t.profileId,window._sharedData.curUser=e.data,window.App.util.navatar(),t.fetchItems()})):this.fetchItems()},fetchItems:function(){var t=this;axios.get("/api/local/collection/items/"+this.collectionId,{params:{page:this.page}}).then((function(e){var i;if(0==e.data.length)return console.log("no items found"),t.loaded=!0,t.isIntersecting=!1,void(t.canLoadMore=!1);var o=e.data.filter((function(e){return-1==t.ids.indexOf(e.id)}));(i=t.posts).push.apply(i,a(o)),t.ids=t.posts.map((function(t){return t.id})),t.loaded=!0,t.isIntersecting=!1,0==o.length&&(t.canLoadMore=!1)}))},previewUrl:function(t){return t&&t.sensitive?"/storage/no-preview.png?v="+(new Date).getTime():t.media_attachments[0].url},previewBackground:function(t){return"background-image: url("+this.previewUrl(t)+");"},addToCollection:function(){var t=this;this.loadingPostList=!0,0==this.postsList.length?axios.get("/api/v1/accounts/"+this.profileId+"/statuses",{params:{min_id:1,limit:40}}).then((function(e){t.postsList=e.data.filter((function(e){return-1==t.ids.indexOf(e.id)})),t.loadingPostList=!1,t.$refs.addPhotoModal.show()})).catch((function(e){t.loadingPostList=!1,swal("An Error Occured","We cannot process your request at this time, please try again later.","error")})):(this.$refs.addPhotoModal.show(),this.loadingPostList=!1)},pushId:function(){var t=this,e=this.config.uploader.max_collection_length,i=this;if(this.posts.length>=e)swal("Error","You can only add "+e+" posts per collection","error");else{var o=this.photoId,s=window.location.origin,n=o.split("/");if(o.slice(0,s.length)!==s&&(swal("Invalid URL","You can only add posts from this instance","error"),this.photoId=""),!o.includes("/i/web/post/")&&!o.includes("/p/"))return swal("Invalid URL","Invalid URL","error"),void(this.photoId="");var l=n[n.length-1].split("?")[0];axios.post("/api/local/collection/item",{collection_id:this.collectionId,post_id:l}).then((function(t){var e;(e=i.ids).push.apply(e,a(l)),i.posts.push(t.data),i.collection.post_count++,i.id=""})).catch((function(e){swal("Invalid URL","The post you entered was invalid","error"),t.photoId=""})),i.$refs.addPhotoModal.hide()}},editCollection:function(){this.$refs.editModal.show()},deleteCollection:function(){0!=this.owner&&(window.confirm("Are you sure you want to delete this collection?")&&axios.delete("/api/local/collection/"+this.collectionId).then((function(t){window.location.href="/"})))},publishCollection:function(){0!=this.owner&&(window.confirm("Are you sure you want to publish this collection?")&&axios.post("/api/local/collection/"+this.collectionId+"/publish",{title:this.title,description:this.description,visibility:this.visibility}).then((function(t){console.log(t.data)})))},updateCollection:function(){var t=this;this.closeModals(),axios.post("/api/local/collection/"+this.collectionId,{title:this.title,description:this.description,visibility:this.visibility}).then((function(e){t.collection=e.data}))},showEditPhotosModal:function(){this.$refs.editModal.hide(),this.$refs.editPhotosModal.show()},markPhotoForDeletion:function(t){-1==this.markedForDeletion.indexOf(t)?this.markedForDeletion.push(t):this.markedForDeletion=this.markedForDeletion.filter((function(e){return e!=t}))},confirmDeletion:function(){var t=this,e=this;window.confirm("Are you sure you want to delete this?")&&(this.markedForDeletion.forEach((function(i){axios.delete("/api/local/collection/item",{params:{collection_id:e.collectionId,post_id:i}}).then((function(o){e.removeItem(i),t.collection.post_count=t.collection.post_count-1,t.closeModals()})).catch((function(t){swal("Oops!","An error occured with your request, please try again later.","error")}))})),this.markedForDeletion=[])},removeItem:function(t){this.posts=this.posts.filter((function(e){return e.id!=t}))},addRecentId:function(t){var e=this;axios.post("/api/local/collection/item",{collection_id:this.collectionId,post_id:t.id}).then((function(t){e.closeModals(),e.posts.push(t.data),e.collection.post_count++})).catch((function(t){swal("Oops!","An error occured, please try selecting another post.","error"),e.photoId=""}))},timeago:function(t){return App.util.format.timeAgo(t)},closeModals:function(){this.$refs.editModal.hide(),this.$refs.addPhotoModal.hide(),this.$refs.editPhotosModal.hide()},getPreviewUrl:function(t){if(!t.media_attachments||!t.media_attachments.length)return"/storage/no-preview.png";var e=t.media_attachments[0];return e.preview_url.endsWith("storage/no-preview.png")?"image"===e.type?e.url:"/storage/no-preview.png":e.preview_url},initReadMore:function(){s(".read-more").each((function(t,e){var i=s(this),o=i.attr("data-readmore");"undefined"!==n(o)&&!1!==o||i.readmore({collapsedHeight:38,heightMargin:38,moreLink:'Show more',lessLink:'Show less'})}))}}}},55386:(t,e,i)=>{Vue.component("collection-component",i(44051).default)},75069:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});var o=i(23645),s=i.n(o)()((function(t){return t[1]}));s.push([t.id,".dims[data-v-b06436ce]{background:rgba(0,0,0,.68);bottom:0;left:0;position:absolute;right:0;top:0;z-index:300}.scrollbar-hidden[data-v-b06436ce]::-webkit-scrollbar{display:none}.delete-border[data-v-b06436ce]{border:4px solid red}.delete-border .square-content[data-v-b06436ce]{background-blend-mode:screen;background-color:red}.info-overlay-text-field[data-v-b06436ce]{font-size:13.5px;margin-bottom:2px}@media(min-width:768px){.info-overlay-text-field[data-v-b06436ce]{font-size:20px;margin-bottom:15px}}.feed .card.info-overlay[data-v-b06436ce]{margin-bottom:2rem}",""]);const n=s},74320:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>l});var o=i(93379),s=i.n(o),n=i(75069),a={insert:"head",singleton:!1};s()(n.default,a);const l=n.default.locals||{}},44051:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>a});var o=i(11795),s=i(33195),n={};for(const t in s)"default"!==t&&(n[t]=()=>s[t]);i.d(e,n);i(6351);const a=(0,i(51900).default)(s.default,o.render,o.staticRenderFns,!1,null,"b06436ce",null).exports},33195:(t,e,i)=>{"use strict";i.r(e),i.d(e,{default:()=>n});var o=i(98379),s={};for(const t in o)"default"!==t&&(s[t]=()=>o[t]);i.d(e,s);const n=o.default},6351:(t,e,i)=>{"use strict";i.r(e);var o=i(74320),s={};for(const t in o)"default"!==t&&(s[t]=()=>o[t]);i.d(e,s)},11795:(t,e,i)=>{"use strict";i.r(e);var o=i(32151),s={};for(const t in o)"default"!==t&&(s[t]=()=>o[t]);i.d(e,s)},32151:(t,e,i)=>{"use strict";i.r(e),i.d(e,{render:()=>o,staticRenderFns:()=>s});var o=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"w-100 h-100"},[t.loaded?t._e():i("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{height:"80vh"}},[i("img",{attrs:{src:"/img/pixelfed-icon-grey.svg"}})]),t._v(" "),t.loaded?i("div",{staticClass:"row mt-3"},[i("div",{staticClass:"col-12 p-0 mb-3"},[t.owner&&!t.collection.published_at?i("div",[t._m(0)]):t._e()]),t._v(" "),i("div",{staticClass:"col-12 p-0 mb-3"},[i("div",{staticClass:"d-flex align-items-center justify-content-center overflow-hidden"},[i("div",{staticClass:"dims"}),t._v(" "),i("div",{staticClass:"text-white mx-5",staticStyle:{"z-index":"500",position:"absolute"}},[i("p",{staticClass:"text-center pt-3 text-break",staticStyle:{"font-size":"3rem","line-height":"3rem"}},[t._v(t._s(t.title||"Untitled Collection"))]),t._v(" "),i("div",{staticClass:"text-center mb-3 text-break read-more",staticStyle:{"overflow-y":"hidden"}},[t._v(t._s(t.description))]),t._v(" "),i("p",{staticClass:"text-center"},[t.owner&&"public"!=t.collection.visibility?i("span",["draft"==t.collection.visibility?i("span",{staticClass:"btn btn-outline-light btn-sm text-capitalize py-0",staticStyle:{"font-size":"10px"}},[i("i",{staticClass:"far fa-lock"}),t._v(" Draft\n\t\t\t\t\t\t\t")]):"private"==t.collection.visibility?i("span",{staticClass:"btn btn-outline-light btn-sm text-capitalize py-0",staticStyle:{"font-size":"10px"}},[t._v("\n\t\t\t\t\t\t\t\tFollowers Only\n\t\t\t\t\t\t\t")]):t._e(),t._v(" "),i("span",[t._v("·")])]):t._e(),t._v(" "),i("span",[t._v(t._s(t.collection.post_count)+" photos")]),t._v(" "),i("span",[t._v("·")]),t._v(" "),i("span",[t._v("by "),i("a",{staticClass:"font-weight-bold text-white",attrs:{href:"/"+t.profileUsername}},[t._v(t._s(t.profileUsername))])])]),t._v(" "),1==t.owner?i("p",{staticClass:"pt-3 text-center"},[i("span",[i("button",{staticClass:"btn btn-outline-light btn-sm",attrs:{onclick:"this.blur();"},on:{click:function(e){return e.preventDefault(),t.addToCollection.apply(null,arguments)}}},[0==t.loadingPostList?i("span",[t._v("Add Photo")]):i("span",{staticClass:"px-4"},[t._m(1)])]),t._v("\n\t\t\t\t\t\t\t    \n\t\t\t\t\t\t\t"),i("button",{staticClass:"btn btn-outline-light btn-sm",attrs:{onclick:"this.blur();"},on:{click:function(e){return e.preventDefault(),t.editCollection.apply(null,arguments)}}},[t._v("Edit")]),t._v("\n\t\t\t\t\t\t\t    \n\t\t\t\t\t\t\t"),i("button",{staticClass:"btn btn-outline-light btn-sm",on:{click:function(e){return e.preventDefault(),t.deleteCollection.apply(null,arguments)}}},[t._v("Delete")])])]):t._e()]),t._v(" "),t.posts&&t.posts.length?i("img",{staticStyle:{width:"100%",height:"400px","object-fit":"cover"},attrs:{src:t.previewUrl(t.posts[0]),alt:""}}):i("div",{staticClass:"bg-info",staticStyle:{width:"100%",height:"400px"}})])]),t._v(" "),i("div",{staticClass:"col-12 p-0"},[t.posts&&t.posts.length>0?i("div",{staticClass:"row px-3 px-md-0"},[t._l(t.posts,(function(e,o){return i("div",{staticClass:"col-6 col-md-4 feed"},[e.hasOwnProperty("pf_type")&&"video"==e.pf_type?i("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.statusUrl(e)}},[i("div",{staticClass:"square"},[i("div",{staticClass:"square-content"},[t._m(2,!0),t._v(" "),i("blur-hash-canvas",{staticClass:"rounded",attrs:{width:"32",height:"32",hash:e.media_attachments[0].blurhash}})],1)])]):e.sensitive?i("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.statusUrl(e)}},[i("div",{staticClass:"square"},[i("div",{staticClass:"square-content"},[t._m(3,!0),t._v(" "),i("blur-hash-canvas",{staticClass:"rounded",attrs:{width:"32",height:"32",hash:e.media_attachments[0].blurhash}})],1)])]):i("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.statusUrl(e)}},[i("div",{staticClass:"square"},[i("div",{staticClass:"square-content"},[i("blur-hash-image",{staticClass:"rounded",attrs:{width:"32",height:"32",hash:e.media_attachments[0].blurhash,src:t.previewUrl(e)}})],1)])])])})),t._v(" "),t.canLoadMore?i("div",{staticClass:"col-12"},[i("intersect",{on:{enter:t.enterIntersect}},[i("div",{staticClass:"card card-body shadow-none border"},[i("div",{staticClass:"d-flex justify-content-center align-items-center flex-column"},[i("b-spinner",{attrs:{variant:"muted"}}),t._v(" "),i("p",{staticClass:"text-lighter small mt-2 mb-0"},[t._v("Loading more...")])],1)])])],1):t._e()],2):t._e()])]):t._e(),t._v(" "),i("b-modal",{ref:"editModal",attrs:{id:"edit-modal","hide-footer":"",centered:"",title:"Edit Collection","body-class":""}},[i("form",[i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Title")]),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.title,expression:"title"}],staticClass:"form-control",attrs:{type:"text",id:"title",placeholder:"Untitled Collection",maxlength:"50"},domProps:{value:t.title},on:{input:function(e){e.target.composing||(t.title=e.target.value)}}}),t._v(" "),i("div",{staticClass:"text-right small text-muted"},[i("span",[t._v(t._s(t.title?t.title.length:0)+"/50")])])]),t._v(" "),i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"description"}},[t._v("Description")]),t._v(" "),i("textarea",{directives:[{name:"model",rawName:"v-model",value:t.description,expression:"description"}],staticClass:"form-control",attrs:{id:"description",placeholder:"Add a description here ...",rows:"3",maxlength:"500"},domProps:{value:t.description},on:{input:function(e){e.target.composing||(t.description=e.target.value)}}}),t._v(" "),i("div",{staticClass:"text-right small text-muted"},[i("span",[t._v(t._s(t.description?t.description.length:0)+"/500")])])]),t._v(" "),i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"visibility"}},[t._v("Visibility")]),t._v(" "),i("select",{directives:[{name:"model",rawName:"v-model",value:t.visibility,expression:"visibility"}],staticClass:"custom-select",on:{change:function(e){var i=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){return"_value"in t?t._value:t.value}));t.visibility=e.target.multiple?i:i[0]}}},[i("option",{attrs:{value:"public"}},[t._v("Public")]),t._v(" "),i("option",{attrs:{value:"private"}},[t._v("Followers Only")]),t._v(" "),i("option",{attrs:{value:"draft"}},[t._v("Draft")])])]),t._v(" "),i("div",{staticClass:"d-flex justify-content-between align-items-center pt-3"},[i("a",{staticClass:"text-primary font-weight-bold text-decoration-none",attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.showEditPhotosModal.apply(null,arguments)}}},[t._v("\n\t\t\t\t\tEdit Photos\n\t\t\t\t")]),t._v(" "),t.collection.published_at?i("div",[i("button",{staticClass:"btn btn-primary btn-sm py-1 font-weight-bold px-3 float-right",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.updateCollection.apply(null,arguments)}}},[t._v("\n\t\t\t\t\t\tSave\n\t\t\t\t\t")])]):i("div",{staticClass:"float-right"},[i("button",{staticClass:"btn btn-outline-primary btn-sm py-1 font-weight-bold px-3",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.publishCollection.apply(null,arguments)}}},[t._v("\n\t\t\t\t\t\tPublish\n\t\t\t\t\t")]),t._v(" "),i("button",{staticClass:"btn btn-primary btn-sm py-1 font-weight-bold px-3",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.updateCollection.apply(null,arguments)}}},[t._v("\n\t\t\t\t\t\tSave\n\t\t\t\t\t")])])])])]),t._v(" "),i("b-modal",{ref:"addPhotoModal",attrs:{id:"add-photo-modal","hide-footer":"",centered:"",title:"Add Photo","body-class":"m-3"}},[i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Recent Post")]),t._v(" "),t.postsList.length>0?i("div",{staticClass:"row m-1",staticStyle:{"max-height":"360px","overflow-y":"auto"}},[t._l(t.postsList,(function(e,o){return i("div",{key:"postList-"+o,staticClass:"col-4 p-1 cursor-pointer",on:{click:function(i){return t.addRecentId(e)}}},[i("div",{staticClass:"square border"},[i("div",{staticClass:"square-content",style:"background-image: url("+t.getPreviewUrl(e)+");"})])])})),t._v(" "),i("div",{staticClass:"col-12"},[i("hr")])],2):t._e()]),t._v(" "),i("form",[i("div",{staticClass:"form-group"},[i("label",{staticClass:"font-weight-bold text-muted",attrs:{for:"title"}},[t._v("Add Post by URL")]),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.photoId,expression:"photoId"}],staticClass:"form-control",attrs:{type:"text",placeholder:"https://pixelfed.dev/p/admin/1"},domProps:{value:t.photoId},on:{input:function(e){e.target.composing||(t.photoId=e.target.value)}}}),t._v(" "),i("p",{staticClass:"help-text small text-muted"},[t._v("Only local, public posts can be added")])]),t._v(" "),i("button",{staticClass:"btn btn-primary btn-sm py-1 font-weight-bold px-3 float-right",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.pushId.apply(null,arguments)}}},[t.addingPostToCollection?i("span",{staticClass:"px-4"},[i("div",{staticClass:"spinner-border spinner-border-sm",attrs:{role:"status"}},[i("span",{staticClass:"sr-only"},[t._v("Loading...")])])]):i("span",[t._v("\n\t\t\t\t\tAdd Photo\n\t\t\t\t")])])])]),t._v(" "),i("b-modal",{ref:"editPhotosModal",attrs:{id:"edit-photos-modal","hide-footer":"",centered:"",title:"Edit Collection Photos","body-class":"m-3"}},[i("div",{staticClass:"form-group"},[i("p",{staticClass:"font-weight-bold text-dark text-center"},[t._v("Select a Photo to Delete")]),t._v(" "),t.posts.length>0?i("div",{staticClass:"row m-1 scrollbar-hidden",staticStyle:{"max-height":"350px","overflow-y":"auto"}},t._l(t.posts,(function(e,o){return i("div",{key:"plm-"+o,staticClass:"col-4 p-1 cursor-pointer"},[i("div",{class:[-1==t.markedForDeletion.indexOf(e.id)?"square":"square delete-border"],on:{click:function(i){return t.markPhotoForDeletion(e.id)}}},[i("div",{staticClass:"square-content border",style:"background-image: url("+e.media_attachments[0].url+");"})])])})),0):t._e(),t._v(" "),i("div",{directives:[{name:"show",rawName:"v-show",value:t.markedForDeletion.length>0,expression:"markedForDeletion.length > 0"}]},[i("button",{staticClass:"btn btn-primary font-weight-bold py-0 btn-block mb-0 mt-4",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.confirmDeletion.apply(null,arguments)}}},[t._v("Delete "+t._s(t.markedForDeletion.length)+" "+t._s(1==t.markedForDeletion.length?"photo":"photos"))])])])])],1)},s=[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"alert alert-danger d-flex justify-content-center"},[i("div",{staticClass:"media align-items-center"},[i("i",{staticClass:"far fa-exclamation-triangle fa-3x mr-3"}),t._v(" "),i("div",{staticClass:"media-body"},[i("p",{staticClass:"font-weight-bold mb-0"},[t._v("\n\t\t\t\t\t\t\t\tThis collection is unpublished.\n\t\t\t\t\t\t\t")]),t._v(" "),i("p",{staticClass:"small mb-0"},[t._v("\n\t\t\t\t\t\t\t\tThis collection is not visible to anyone else until you publish it. "),i("br"),t._v("\n\t\t\t\t\t\t\t\tTo publish, click on the "),i("strong",[t._v("Edit")]),t._v(" button and then click on the "),i("strong",[t._v("Publish")]),t._v(" button.\n\t\t\t\t\t\t\t")])])])])},function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"spinner-border spinner-border-sm",attrs:{role:"status"}},[i("span",{staticClass:"sr-only"},[t._v("Loading...")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"info-overlay-text-label rounded"},[e("h5",{staticClass:"text-white m-auto font-weight-bold"},[e("span",[e("span",{staticClass:"far fa-video fa-2x p-2 d-flex-inline"})])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"info-overlay-text-label rounded"},[e("h5",{staticClass:"text-white m-auto font-weight-bold"},[e("span",[e("span",{staticClass:"far fa-eye-slash fa-lg p-2 d-flex-inline"})])])])}]}},t=>{t.O(0,[898],(()=>{return e=55386,t(t.s=e);var e}));t.O()}]); \ No newline at end of file diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 72e63e7b4..35782727f 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -11,8 +11,8 @@ "/js/search.js": "/js/search.js?id=4bb81cba317cf1ad35f2c98dce78fd9d", "/js/developers.js": "/js/developers.js?id=dd22facb8cf2746992404468a9373ac5", "/js/hashtag.js": "/js/hashtag.js?id=5fe9d15d07a227f91eabd874cbb9fea2", - "/js/collectioncompose.js": "/js/collectioncompose.js?id=5832f2ffe4e624bb77a409ab7130f910", - "/js/collections.js": "/js/collections.js?id=003d6de8ceaeb3559478ece9f7c3315d", + "/js/collectioncompose.js": "/js/collectioncompose.js?id=96e040f887859e77549afcadf3e0fdc9", + "/js/collections.js": "/js/collections.js?id=b7315297770a9c1b02cb64176158d2df", "/js/profile-directory.js": "/js/profile-directory.js?id=04ec970031e6bf15de5ade019147d53e", "/js/story-compose.js": "/js/story-compose.js?id=afe8f35cf52d92ac48ee68a9916d218d", "/js/direct.js": "/js/direct.js?id=29127c125979e275afa50b47d692c892",