1
0
Fork 0
pixelfed/public/js/landing.js

2 lines
180 KiB
JavaScript
Raw Normal View History

2023-04-08 05:29:39 +00:00
/*! For license information please see landing.js.LICENSE.txt */
2024-02-02 06:19:25 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[4046],{49794:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>u});var a=o(25275),s=o(78423);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);"Object"===o&&e.constructor&&(o=e.constructor.name);if("Map"===o||"Set"===o)return Array.from(e);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return r(e,t)}(e)||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 r(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,a=new Array(t);o<t;o++)a[o]=e[o];return a}function l(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,a)}return o}function c(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?l(Object(o),!0).forEach((function(t){d(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function d(e,t,o){return(t=function(e){var t=function(e,t){if("object"!==i(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var a=o.call(e,t||"default");if("object"!==i(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===i(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const u={components:{"user-card":a.default,intersect:s.default},data:function(){return{loading:!0,config:window.pfl,pagination:void 0,feed:[],isEmpty:!1,canLoadMore:!1,isIntersecting:!1,isLoadingMore:!1}},beforeMount:function(){0==this.config.show_directory&&this.$router.push("/")},mounted:function(){this.init()},methods:{init:function(){var e=this;axios.get("/api/landing/v1/directory").then((function(t){t.data.data.length||(e.isEmpty=!0),e.feed=t.data.data,e.pagination=c(c({},t.data.links),t.data.meta)})).finally((function(){e.canLoadMore=!0,e.$nextTick((function(){e.loading=!1}))}))},enterIntersect:function(e){var t=this;!this.isIntersecting&&this.pagination.next_cursor&&(this.isIntersecting=!0,this.isLoadingMore=!0,axios.get("/api/landing/v1/directory",{params:{cursor:this.pagination.next_cursor}}).then((function(e){var o;(o=t.feed).push.apply(o,n(e.data.data)),t.pagination=c(c({},e.data.links),e.data.meta)})).finally((function(){t.pagination.next_cursor?t.canLoadMore=!0:t.canLoadMore=!1,t.isLoadingMore=!1,t.isIntersecting=!1})),console.log(e))}}}},82304:(e,t,o)=>{"use strict";o.r(t),o.d(t,{default:()=>a});const a={components:{"post-card":o(28145).default},data:function(){return{loading:!0,config:window.pfl,isFetching:!1,range:"daily",ranges:["daily","monthly","yearly"],rangeIndex:0,feed:[]}},beforeMount:function(){0==this.config.show_explore_feed&&this.$router.push("/")},mounted:function(){this.init()},methods:{init:function(){var e=this;axios.get("/api/pixelfed/v2/discover/posts/trending?range=daily").then((function(t){t&&t.data.length>3?(e.feed=t.data,e.loading=!1):(e.rangeIndex++,e.fetchTrending())}))},fetchTrending:function(){var e=this;this.isFetching||this.rangeIndex>=3||(this.isFetching=!0,axios.get("/api/pixelfed/v2/discover/posts/trending",{params:{range:this.ranges[this.rangeIndex]}}).then((function(t){t&&t.data.length&&2==e.rangeIndex&&t.data.length>3?(e.feed=t.data,e.loadi