pixelfed/public/js/hashtag.js

1 line
8.9 KiB
JavaScript
Raw Normal View History

2022-03-31 06:22:49 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[881],{42974:(t,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>r});var e=a(19755);function i(t){return function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,s){if(!t)return;if("string"==typeof t)return n(t,s);var a=Object.prototype.toString.call(t).slice(8,-1);"Object"===a&&t.constructor&&(a=t.constructor.name);if("Map"===a||"Set"===a)return Array.from(t);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return n(t,s)}(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 n(t,s){(null==s||s>t.length)&&(s=t.length);for(var a=0,e=new Array(s);a<s;a++)e[a]=t[a];return e}const r={props:["hashtag","hashtagCount"],data:function(){return{loaded:!1,page:1,authenticated:!1,following:!1,tags:[],top:[],forceNsfw:!1}},beforeMount:function(){this.authenticated=e("body").hasClass("loggedIn"),this.getResults(),this.hashtagCount=window.App.util.format.count(this.hashtagCount)},methods:{getResults:function(){var t=this;this.authenticated&&axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(t){window._sharedData.curUser=t.data,window.App.util.navatar()})),axios.get("/api/v2/discover/tag",{params:{hashtag:this.hashtag,page:this.page}}).then((function(s){var a=s.data,e=a.tags.filter((function(t){return!(!t||0==t.length||null==t.status)}));t.tags=e,t.loaded=!0,t.following=a.follows,t.page++}))},infiniteLoader:function(t){var s=this;this.page>(this.authenticated?29:10)?t.complete():axios.get("/api/v2/discover/tag",{params:{hashtag:this.hashtag,page:this.page}}).then((function(a){var e=a.data;if(e.tags.length){var n,r=e.tags.filter((function(t){return!(!t||0==t.length||null==t.status)}));if((n=s.tags).push.apply(n,i(r)),r.length>9)return void t.complete();s.page++,t.loaded()}else t.complete()}))},followHashtag:function(){var t=this;axios.post("/api/local/discover/tag/subscribe",{name:this.hashtag}).then((function(s){t.following=!0}))},unfollowHashtag:function(){var t=this;axios.post("/api/local/discover/tag/subscribe",{name:this.hashtag}).then((function(s){t.following=!1}))}}}},44982:(t,s,a)=>{Vue.component("hashtag-component",a(18820).default)},15458:(t,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>n});var e=a(23645),i=a.n(e)()((function(t){return t[1]}));i.push([t.id,".tag-header[data-v-2eea2c2e]{font-size:28px;font-weight:300}",""]);const n=i},51627:(t,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>o});var e=a(93379),i=a.n(e),n=a(15458),r={insert:"head",singleton:!1};i()(n.default,r);const o=n.default.locals||{}},18820:(t,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>r});var e=a(65955),i=a(96219),n={};for(const t in i)"default"!==t&&(n[t]=()=>i[t]);a.d(s,n);a(12349);const r=(0,a(51900).default)(i.default,e.render,e.staticRenderFns,!1,null,"2eea2c2e",null).exports},96219:(t,s,a)=>{"use strict";a.r(s),a.d(s,{default:()=>n});var e=a(42974),i={};for(const t in e)"default"!==t&&(i[t]=()=>e[t]);a.d(s,i);const n=e.default},12349:(t,s,a)=>{"use strict";a.r(s);var e=a(51627),i={};for(const t in e)"default"!==t&&(i[t]=()=>e[t]);a.d(s,i)},65955:(t,s,a)=>{"use strict";a.r(s);var e=a(45768),i={};for(const t in e)"default"!==t&&(i[t]=()=>e[t]);a.d(s,i)},45768:(t,s,a)=>{"use strict";a.r(s),a.d(s,{render:()=>e,staticRenderFns:()=>i});var e=function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",[t.loaded?a("div",{staticClass:"container"},[a("div",{staticClass:"profile-header row my-5"},[t._m(0),t._v(" "),a("div",{staticClass:"col-12 col-md-9 d-flex align-items-center"},[a("div",{staticClass:"profile-details"},[a("div",{staticClass:"username-bar pb-2"},[a("p",{staticClass:"tag-header mb-0"},[t._v("#"+t._s(t.hashtag))]),t._v(" "),a("p",{staticClass:"lead"},[a("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.tags.length?t.hashtagCount:"0"))]),t._v(" posts")]),t._v(" "),a("div",{staticClass