pixelfed/public/js/collections.js

28 lines
33 KiB
JavaScript
Raw Normal View History

2024-07-10 06:11:42 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([["/js/collections"],{"./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=script&lang=js":
/*!********************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=script&lang=js ***!
\********************************************************************************************************************************************************************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>r});s(/*! vue-masonry-css */"./node_modules/vue-masonry-css/dist/vue-masonry.es2015.js");var o=s(/*! vue-intersect */"./node_modules/vue-intersect/dist/index.js"),i=s(/*! jquery */"./node_modules/jquery/dist/jquery.js");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 l(t){return function(t){if(Array.isArray(t))return a(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 a(t,e);var s=Object.prototype.toString.call(t).slice(8,-1);"Object"===s&&t.constructor&&(s=t.constructor.name);if("Map"===s||"Set"===s)return Array.from(t);if("Arguments"===s||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return a(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 a(t,e){(null==e||e>t.length)&&(e=t.length);for(var s=0,o=new Array(e);s<e;s++)o[s]=t[s];return o}const r={props:["collection-id","collection-title","collection-description","collection-visibility","profile-id","profile-username"],components:{intersect:o.default},data:function(){return{collection:{},config:window.App.config,loaded:!1,posts:[],ids:[],user:!1,owner:!1,title:this.collectionTitle,description:this.collectionDescription,visibility:this.collectionVisibility,photoId:"",postsList:[],loadingPostList:!1,addingPostToCollection:!1,markedForDeletion:[],canLoadMore:!1,isIntersecting:!1,page:1}},beforeMount:function(){this.fetchCollection()},updated:function(){this.initReadMore()},methods:{enterIntersect:function(){this.isIntersecting||(this.isIntersecting=!0,this.page++,this.fetchItems())},statusUrl:function(t){return"/i/web/post/"+t.id},fetchCollection:function(){var t=this;axios.get("/api/local/collection/"+this.collectionId).then((function(e){t.collection=e.data,t.collection.post_count>9&&(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 s;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)}));(s=t.posts).push.apply(s,l(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("public"==e.visibility||"unlisted"==e.visibility)&&0==e.sensitive&&-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
/*!*******************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=template&id=74b829d0&scoped=true ***!
\*******************************************************************************************************************************************************************************************************************************************************************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{render:()=>o,staticRenderFns:()=>i});var o=function(){var t=this,e=t._self._c;return e("div",{staticClass:"w-100 h-100"},[t.loaded?t._e():e("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{height:"80vh"}},[e("img",{attrs:{src:"/img/pixelfed-icon-grey.svg"}})]),t._v(" "),t.loaded?e("div",{staticClass:"row mt-3"},[e("div",{staticClass:"col-12 p-0 mb-3"},[t.owner&&!t.collection.published_at?e("div",[t._m(0)]):t._e()]),t._v(" "),e("div",{staticClass:"col-12 p-0 mb-3"},[e("div",{staticClass:"d-flex align-items-center justify-content-center overflow-hidden"},[e("div",{staticClass:"dims"}),t._v(" "),e("div",{staticClass:"text-white mx-5",staticStyle:{"z-index":"500",position:"absolute"}},[e("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(" "),e("div",{staticClass:"text-center mb-3 text-break read-more",staticStyle:{"overflow-y":"hidden"}},[t._v(t._s(t.description))]),t._v(" "),e("p",{staticClass:"text-center"},[t.owner&&"public"!=t.collection.visibility?e("span",["draft"==t.collection.visibility?e("span",{staticClass:"btn btn-outline-light btn-sm text-capitalize py-0",staticStyle:{"font-size":"10px"}},[e("i",{staticClass:"far fa-lock"}),t._v(" Draft\n\t\t\t\t\t\t\t")]):"private"==t.collection.visibility?e("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(" "),e("span",[t._v("·")])]):t._e(),t._v(" "),e("span",[t._v(t._s(t.collection.post_count)+" photos")]),t._v(" "),e("span",[t._v("·")]),t._v(" "),e("span",[t._v("by "),e("a",{staticClass:"font-weight-bold text-white",attrs:{href:"/"+t.profileUsername}},[t._v(t._s(t.profileUsername))])])]),t._v(" "),1==t.owner?e("p",{staticClass:"pt-3 text-center"},[e("span",[e("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?e("span",[t._v("Add Photo")]):e("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"),e("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"),e("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?e("img",{staticStyle:{width:"100%",height:"400px","object-fit":"cover"},attrs:{src:t.previewUrl(t.posts[0]),alt:""}}):e("div",{staticClass:"bg-info",staticStyle:{width:"100%",height:"400px"}})])]),t._v(" "),e("div",{staticClass:"col-12 p-0"},[t.posts&&t.posts.length>0?e("div",{staticClass:"row px-3 px-md-0"},[t._l(t.posts,(function(s,o){return e("div",{staticClass:"col-6 col-md-4 feed"},[s.hasOwnProperty("pf_type")&&"video"==s.pf_type?e("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.statusUrl(s)}},[e("div",{staticClass:"square"},[e("div",{staticClass:"square-content"},[t._m(2,!0),t._v(" "),e("blur-hash-canvas",{staticClass:"rounded",attrs:{width:"32",height:"32",hash:s.media_attachments[0].blurhash}})],1)])]):s.sensitive?e("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.statusUrl(s)}},[e("div",{staticClass:"square"},[e("div",{staticClass:"square-content"},[t._m(3,!0),t._v(" "),e("blur-hash-canvas",{staticClass:"rounded",attrs:{width:"32",height:"32",hash:s.media_attachments[0].blurhash}})],1)])]):e("a",{staticClass:"card i
/*!********************************************!*\
!*** ./resources/assets/js/collections.js ***!
\********************************************/(t,e,s)=>{Vue.component("collection-component",s(/*! ./components/CollectionComponent.vue */"./resources/assets/js/components/CollectionComponent.vue").default)},"./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-17.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-17.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-17.use[3]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true":
/*!************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-17.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-17.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-17.use[3]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true ***!
\************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>n});var o=s(/*! ../../../../node_modules/laravel-mix/node_modules/css-loader/dist/runtime/api.js */"./node_modules/laravel-mix/node_modules/css-loader/dist/runtime/api.js"),i=s.n(o)()((function(t){return t[1]}));i.push([t.id,".dims[data-v-74b829d0] {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: rgba(0, 0, 0, 0.68);\n z-index: 300;\n}\n.scrollbar-hidden[data-v-74b829d0]::-webkit-scrollbar {\n display: none;\n}\n.delete-border[data-v-74b829d0] {\n border: 4px solid #ff0000;\n}\n.delete-border .square-content[data-v-74b829d0] {\n background-color: red;\n background-blend-mode: screen;\n}\n.info-overlay-text-field[data-v-74b829d0] {\n font-size: 13.5px;\n margin-bottom: 2px;\n}\n@media (min-width: 768px) {\n.info-overlay-text-field[data-v-74b829d0] {\n font-size: 20px;\n margin-bottom: 15px;\n}\n}\n.feed .card.info-overlay[data-v-74b829d0] {\n margin-bottom: 2rem;\n}",""]);const n=i},"./node_modules/style-loader/dist/cjs.js!./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-17.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-17.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-17.use[3]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true":
/*!****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/style-loader/dist/cjs.js!./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-17.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-17.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-17.use[3]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true ***!
\****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>a});var o=s(/*! !../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),i=s.n(o),n=s(/*! !!../../../../node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-17.use[1]!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-17.use[2]!../../../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-17.use[3]!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true */"./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-17.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-17.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-17.use[3]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true"),l={insert:"head",singleton:!1};i()(n.default,l);const a=n.default.locals||{}},"./resources/assets/js/components/CollectionComponent.vue":
/*!****************************************************************!*\
!*** ./resources/assets/js/components/CollectionComponent.vue ***!
\****************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>a});var o=s(/*! ./CollectionComponent.vue?vue&type=template&id=74b829d0&scoped=true */"./resources/assets/js/components/CollectionComponent.vue?vue&type=template&id=74b829d0&scoped=true"),i=s(/*! ./CollectionComponent.vue?vue&type=script&lang=js */"./resources/assets/js/components/CollectionComponent.vue?vue&type=script&lang=js"),n={};for(const t in i)"default"!==t&&(n[t]=()=>i[t]);s.d(e,n);s(/*! ./CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true */"./resources/assets/js/components/CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true");var l=(0,s(/*! !../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */"./node_modules/vue-loader/lib/runtime/componentNormalizer.js").default)(i.default,o.render,o.staticRenderFns,!1,null,"74b829d0",null);l.options.__file="resources/assets/js/components/CollectionComponent.vue";const a=l.exports},"./resources/assets/js/components/CollectionComponent.vue?vue&type=script&lang=js":
/*!****************************************************************************************!*\
!*** ./resources/assets/js/components/CollectionComponent.vue?vue&type=script&lang=js ***!
\****************************************************************************************/(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>n});var o=s(/*! -!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CollectionComponent.vue?vue&type=script&lang=js */"./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=script&lang=js"),i={};for(const t in o)"default"!==t&&(i[t]=()=>o[t]);s.d(e,i);const n=o.default},"./resources/assets/js/components/CollectionComponent.vue?vue&type=template&id=74b829d0&scoped=true":
/*!**********************************************************************************************************!*\
!*** ./resources/assets/js/components/CollectionComponent.vue?vue&type=template&id=74b829d0&scoped=true ***!
\**********************************************************************************************************/(t,e,s)=>{"use strict";s.r(e);var o=s(/*! -!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CollectionComponent.vue?vue&type=template&id=74b829d0&scoped=true */"./node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=template&id=74b829d0&scoped=true"),i={};for(const t in o)"default"!==t&&(i[t]=()=>o[t]);s.d(e,i)},"./resources/assets/js/components/CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true":
/*!*************************************************************************************************************************!*\
!*** ./resources/assets/js/components/CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true ***!
\*************************************************************************************************************************/(t,e,s)=>{"use strict";s.r(e);var o=s(/*! -!../../../../node_modules/style-loader/dist/cjs.js!../../../../node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-17.use[1]!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-17.use[2]!../../../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-17.use[3]!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true */"./node_modules/style-loader/dist/cjs.js!./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-17.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-17.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-17.use[3]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/CollectionComponent.vue?vue&type=style&index=0&id=74b829d0&lang=scss&scoped=true"),i={};for(const t in o)"default"!==t&&(i[t]=()=>o[t]);s.d(e,i)}},t=>{t.O(0,["/js/vendor"],(()=>{return e="./resources/assets/js/collections.js",t(t.s=e);var e}));t.O()}]);