pixelfed/public/js/discover.js

1 line
18 KiB
JavaScript
Raw Normal View History

2021-01-31 04:58:37 +00:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{"+nCD":function(t,e,n){Vue.component("discover-component",n("RlRG").default)},3:function(t,e,n){t.exports=n("+nCD")},"68Ps":function(t,e,n){"use strict";var s=n("6P6l");n.n(s).a},"6P6l":function(t,e,n){var s=n("YRdF");"string"==typeof s&&(s=[[t.i,s,""]]);var a={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(s,a);s.locals&&(t.exports=s.locals)},"9tPo":function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,s=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var a,i=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(a=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:s+i.replace(/^\.\//,""),"url("+JSON.stringify(a)+")")}))}},I1BE:function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",s=t[3];if(!s)return n;if(e&&"function"==typeof btoa){var a=(r=s,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),i=s.sources.map((function(t){return"/*# sourceURL="+s.sourceRoot+t+" */"}));return[n].concat(i).concat([a]).join("\n")}var r;return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var s={},a=0;a<this.length;a++){var i=this[a][0];"number"==typeof i&&(s[i]=!0)}for(a=0;a<t.length;a++){var r=t[a];"number"==typeof r[0]&&s[r[0]]||(n&&!r[2]?r[2]=n:n&&(r[2]="("+r[2]+") and ("+n+")"),e.push(r))}},e}},"KHd+":function(t,e,n){"use strict";function s(t,e,n,s,a,i,r,o){var l,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),s&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),r?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),a&&a.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},c._ssrRegister=l):a&&(l=o?function(){a.call(this,this.$root.$options.shadowRoot)}:a),l)if(c.functional){c._injectStyles=l;var d=c.render;c.render=function(t,e){return l.call(e),d(t,e)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,l):[l]}return{exports:t,options:c}}n.d(e,"a",(function(){return s}))},RlRG:function(t,e,n){"use strict";n.r(e);var s={data:function(){return{loaded:!1,config:window.App.config,posts:{},hashtags:{},places:{},trending:{},trendingDaily:{},trendingMonthly:{},categories:{},allCategories:{},searchTerm:"",trendingRange:"daily"}},mounted:function(){this.fetchData(),this.fetchCategories(),this.loadTrending(),this.loadTrendingHashtags(),this.loadTrendingPlaces()},methods:{fetchData:function(){var t=this;axios.get("/api/pixelfed/v2/discover/posts").then((function(e){t.posts=e.data.posts,t.loaded=!0})),axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(t){window._sharedData.curUser=t.data,window.App.util.navatar()}))},fetchCategories:function(){var t=this;axios.get("/api/v2/discover/categories").then((function(e){t.allCategories=e.data,t.categories=e.data}))},searchSubmit:function(){this.searchTerm.length>1&&(window.location.href="/i/results?q="+this.searchTerm)},loadTrending:function(){var t=this;"daily"==this.trendingRange&&this.trendingDaily.length?this.trending=this.trendingDaily:"monthly"==this.trendingRange&&this.trendingMonthly.length?this.trending=this.trendingMonthly:axios.get("/api/pixelfed/v2/discover/posts/trending",{params:{range:this.trendingRange}}).then((function(e){"daily"==t.trendingRange&&(t.trendingDaily=e.data.filter((function(t){return 0==t.sensitive}))),"monthly"==t.trendingRange&&(t.trendingMonthly=e.data.filter((function(t){return 0==t.sensitive}))),t.trending=e.data}))}