pixelfed/public/js/hashtag.js
2024-07-10 00:11:42 -06:00

28 lines
19 KiB
JavaScript
Vendored

(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([["/js/hashtag"],{"./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/Hashtag.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/Hashtag.vue?vue&type=script&lang=js ***!
\********************************************************************************************************************************************************************************************************/(t,s,e)=>{"use strict";e.r(s),e.d(s,{default:()=>n});var a=e(/*! jquery */"./node_modules/jquery/dist/jquery.js");function o(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,s){if(!t)return;if("string"==typeof t)return l(t,s);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return l(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 l(t,s){(null==s||s>t.length)&&(s=t.length);for(var e=0,a=new Array(s);e<s;e++)a[e]=t[e];return a}const n={props:["hashtag","hashtagCount"],data:function(){return{loaded:!1,page:1,authenticated:!1,following:!1,tags:[],top:[],forceNsfw:!1}},beforeMount:function(){this.authenticated=a("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 e=s.data,a=e.tags.filter((function(t){return!(!t||0==t.length||null==t.status)}));t.tags=a,t.loaded=!0,t.following=e.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(e){var a=e.data;if(a.tags.length){var l,n=a.tags.filter((function(t){return!(!t||0==t.length||null==t.status)}));if((l=s.tags).push.apply(l,o(n)),n.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}))}}}},"./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/Hashtag.vue?vue&type=template&id=8031dc36&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/Hashtag.vue?vue&type=template&id=8031dc36&scoped=true ***!
\*******************************************************************************************************************************************************************************************************************************************************************************************************/(t,s,e)=>{"use strict";e.r(s),e.d(s,{render:()=>a,staticRenderFns:()=>o});var a=function(){var t=this,s=t._self._c;return s("div",[t.loaded?s("div",{staticClass:"container"},[s("div",{staticClass:"profile-header row my-5"},[t._m(0),t._v(" "),s("div",{staticClass:"col-12 col-md-9 d-flex align-items-center"},[s("div",{staticClass:"profile-details"},[s("div",{staticClass:"username-bar pb-2"},[s("p",{staticClass:"tag-header mb-0"},[t._v("#"+t._s(t.hashtag))]),t._v(" "),s("p",{staticClass:"lead"},[s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.tags.length?t.hashtagCount:"0"))]),t._v(" posts")]),t._v(" "),s("div",{staticClass:"d-flex justify-content-between align-items-center"},[t.authenticated&&t.tags.length?s("p",{staticClass:"pt-3 mr-4"},[t.following?s("button",{staticClass:"btn btn-outline-secondary font-weight-bold py-1 px-5",attrs:{type:"button"},on:{click:t.unfollowHashtag}},[t._v("\n\t\t\t\t\t\t\t\t\tUnfollow\n\t\t\t\t\t\t\t\t")]):s("button",{staticClass:"btn btn-primary font-weight-bold py-1 px-5",attrs:{type:"button"},on:{click:t.followHashtag}},[t._v("\n\t\t\t\t\t\t\t\t\tFollow\n\t\t\t\t\t\t\t\t")])]):t._e(),t._v(" "),s("div",{staticClass:"custom-control custom-switch"},[s("input",{directives:[{name:"model",rawName:"v-model",value:t.forceNsfw,expression:"forceNsfw"}],staticClass:"custom-control-input",attrs:{type:"checkbox",id:"nsfwSwitch"},domProps:{checked:Array.isArray(t.forceNsfw)?t._i(t.forceNsfw,null)>-1:t.forceNsfw},on:{change:function(s){var e=t.forceNsfw,a=s.target,o=!!a.checked;if(Array.isArray(e)){var l=t._i(e,null);a.checked?l<0&&(t.forceNsfw=e.concat([null])):l>-1&&(t.forceNsfw=e.slice(0,l).concat(e.slice(l+1)))}else t.forceNsfw=o}}}),t._v(" "),s("label",{staticClass:"custom-control-label font-weight-bold text-muted",attrs:{for:"nsfwSwitch"}},[t._v("Show NSFW Content")])])])])])])]),t._v(" "),t.tags.length?s("div",{staticClass:"tag-timeline"},[t.top.length?s("p",{staticClass:"font-weight-bold text-muted mb-0"},[t._v("Top Posts")]):t._e(),t._v(" "),s("div",{staticClass:"row pb-5"},t._l(t.top,(function(e,a){return s("div",{staticClass:"col-3 p-0 p-sm-2 p-md-3 hashtag-post-square"},[s("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:e.status.url}},[s("div",{class:[e.status.filter?"square "+e.status.filter:"square"]},[e.status.sensitive&&0==t.forceNsfw?s("div",{staticClass:"square-content"},[t.s.sensitive?s("blur-hash-image",{attrs:{width:"32",height:"32",punch:"1",hash:e.status.media_attachments[0].blurhash}}):t._e()],1):s("div",{staticClass:"square-content",style:"background-image: url("+e.status.media_attachments[0].preview_url+")"}),t._v(" "),s("div",{staticClass:"info-overlay-text"},[s("h5",{staticClass:"text-white m-auto font-weight-bold"},[s("span",[s("span",{staticClass:"fas fa-retweet fa-lg pr-1"}),t._v(" "+t._s(e.status.share_count)+"\n\t\t\t\t\t\t\t\t\t")])])])])])])})),0),t._v(" "),s("p",{staticClass:"font-weight-bold text-muted mb-0"},[t._v("Most Recent")]),t._v(" "),s("div",{staticClass:"row"},[t._l(t.tags,(function(e,a){return s("div",{staticClass:"col-3 p-1 hashtag-post-square"},[s("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:e.status.url}},[s("div",{class:[e.status.filter?"square "+e.status.filter:"square"]},[e.status.sensitive&&0==t.forceNsfw?s("div",{staticClass:"square-content"},[t._m(1,!0),t._v(" "),s("blur-hash-canvas",{attrs:{width:"32",height:"32",hash:e.status.media_attachments[0].blurhash}})],1):s("div",{staticClass:"square-content"},[s("blur-hash-image",{attrs:{width:"32",height:"32",hash:e.status.media_attachments[0].blurhash,src:e.status.media_attachments[0].preview_url}})],1),t._v(" "),"photo:album"==e.status.pf_type?s("span",{staticClass:"float-right mr-3 post-icon"},[s("i",{staticClass:"fas fa-images fa-2x"})]):t._e(),t._v(" "),"video"==e.status.pf_type?s("span",{staticClass:"float-right mr-3 post-icon"},[s("i",{staticClass:"fas fa-video fa-2x"})]):t._e(),t._v(" "),"video:album"==e.status.pf_type?s("span",{staticClass:"float-right mr-3 post-icon"},[s("i",{staticClass:"fas fa-film fa-2x"})]):t._e(),t._v(" "),s("div",{staticClass:"info-overlay-text"},[s("h5",{staticClass:"text-white m-auto font-weight-bold"},[s("span",[s("span",{staticClass:"far fa-comment fa-lg pr-1"}),t._v(" "+t._s(e.status.reply_count)+"\n\t\t\t\t\t\t\t\t\t")])])])])])])})),t._v(" "),t.tags.length&&t.loaded?s("div",{staticClass:"col-12 text-center mt-4"},[s("infinite-loading",{on:{infinite:t.infiniteLoader}},[s("div",{staticClass:"font-weight-bold",attrs:{slot:"no-results"},slot:"no-results"}),t._v(" "),s("div",{staticClass:"font-weight-bold",attrs:{slot:"no-more"},slot:"no-more"})])],1):t._e()],2)]):s("div",[s("p",{staticClass:"text-center lead font-weight-bold"},[t._v("No public posts found.")])])]):s("div",{staticClass:"mt-5 text-center"},[t._m(2)])])},o=[function(){var t=this._self._c;return t("div",{staticClass:"col-12 col-md-3"},[t("div",{staticClass:"profile-avatar"},[t("div",{staticClass:"bg-primary mb-3 d-flex align-items-center justify-content-center display-4 font-weight-bold text-white",staticStyle:{width:"172px",height:"172px","border-radius":"100%"}},[this._v("#")])])])},function(){var t=this._self._c;return t("div",{staticClass:"info-overlay-text-label"},[t("h5",{staticClass:"text-white m-auto font-weight-bold"},[t("span",[t("span",{staticClass:"far fa-eye-slash fa-lg p-2 d-flex-inline"})])])])},function(){var t=this._self._c;return t("div",{staticClass:"spinner-border",attrs:{role:"status"}},[t("span",{staticClass:"sr-only"},[this._v("Loading...")])])}];a._withStripped=!0},"./resources/assets/js/hashtag.js":
/*!****************************************!*\
!*** ./resources/assets/js/hashtag.js ***!
\****************************************/(t,s,e)=>{Vue.component("hashtag-component",e(/*! ./components/Hashtag.vue */"./resources/assets/js/components/Hashtag.vue").default)},"./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-14.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-14.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css":
/*!*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-14.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-14.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css ***!
\*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/(t,s,e)=>{"use strict";e.r(s),e.d(s,{default:()=>l});var a=e(/*! ../../../../node_modules/laravel-mix/node_modules/css-loader/dist/runtime/api.js */"./node_modules/laravel-mix/node_modules/css-loader/dist/runtime/api.js"),o=e.n(a)()((function(t){return t[1]}));o.push([t.id,"\n.tag-header[data-v-8031dc36] {\n\tfont-size: 28px;\n\tfont-weight: 300;\n}\n",""]);const l=o},"./node_modules/style-loader/dist/cjs.js!./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-14.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-14.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css":
/*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/style-loader/dist/cjs.js!./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-14.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-14.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css ***!
\***********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/(t,s,e)=>{"use strict";e.r(s),e.d(s,{default:()=>i});var a=e(/*! !../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js */"./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),o=e.n(a),l=e(/*! !!../../../../node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-14.use[1]!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-14.use[2]!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css */"./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-14.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-14.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css"),n={insert:"head",singleton:!1};o()(l.default,n);const i=l.default.locals||{}},"./resources/assets/js/components/Hashtag.vue":
/*!****************************************************!*\
!*** ./resources/assets/js/components/Hashtag.vue ***!
\****************************************************/(t,s,e)=>{"use strict";e.r(s),e.d(s,{default:()=>i});var a=e(/*! ./Hashtag.vue?vue&type=template&id=8031dc36&scoped=true */"./resources/assets/js/components/Hashtag.vue?vue&type=template&id=8031dc36&scoped=true"),o=e(/*! ./Hashtag.vue?vue&type=script&lang=js */"./resources/assets/js/components/Hashtag.vue?vue&type=script&lang=js"),l={};for(const t in o)"default"!==t&&(l[t]=()=>o[t]);e.d(s,l);e(/*! ./Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css */"./resources/assets/js/components/Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css");var n=(0,e(/*! !../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */"./node_modules/vue-loader/lib/runtime/componentNormalizer.js").default)(o.default,a.render,a.staticRenderFns,!1,null,"8031dc36",null);n.options.__file="resources/assets/js/components/Hashtag.vue";const i=n.exports},"./resources/assets/js/components/Hashtag.vue?vue&type=script&lang=js":
/*!****************************************************************************!*\
!*** ./resources/assets/js/components/Hashtag.vue?vue&type=script&lang=js ***!
\****************************************************************************/(t,s,e)=>{"use strict";e.r(s),e.d(s,{default:()=>l});var a=e(/*! -!../../../../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Hashtag.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/Hashtag.vue?vue&type=script&lang=js"),o={};for(const t in a)"default"!==t&&(o[t]=()=>a[t]);e.d(s,o);const l=a.default},"./resources/assets/js/components/Hashtag.vue?vue&type=template&id=8031dc36&scoped=true":
/*!**********************************************************************************************!*\
!*** ./resources/assets/js/components/Hashtag.vue?vue&type=template&id=8031dc36&scoped=true ***!
\**********************************************************************************************/(t,s,e)=>{"use strict";e.r(s);var a=e(/*! -!../../../../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!./Hashtag.vue?vue&type=template&id=8031dc36&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/Hashtag.vue?vue&type=template&id=8031dc36&scoped=true"),o={};for(const t in a)"default"!==t&&(o[t]=()=>a[t]);e.d(s,o)},"./resources/assets/js/components/Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css":
/*!************************************************************************************************************!*\
!*** ./resources/assets/js/components/Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css ***!
\************************************************************************************************************/(t,s,e)=>{"use strict";e.r(s);var a=e(/*! -!../../../../node_modules/style-loader/dist/cjs.js!../../../../node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-14.use[1]!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-14.use[2]!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css */"./node_modules/style-loader/dist/cjs.js!./node_modules/laravel-mix/node_modules/css-loader/dist/cjs.js??clonedRuleSet-14.use[1]!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-14.use[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./resources/assets/js/components/Hashtag.vue?vue&type=style&index=0&id=8031dc36&scoped=true&lang=css"),o={};for(const t in a)"default"!==t&&(o[t]=()=>a[t]);e.d(s,o)}},t=>{t.O(0,["/js/vendor"],(()=>{return s="./resources/assets/js/hashtag.js",t(t.s=s);var s}));t.O()}]);