1
0
Fork 0
forked from mirror/pixelfed
pixelfed/public/js/hashtag.js

1 line
12 KiB
JavaScript
Raw Normal View History

2019-07-18 02:05:52 +00:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{15:function(t,e,n){t.exports=n("gqTO")},"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,r=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(r)?t:(a=0===r.indexOf("//")?r:0===r.indexOf("/")?n+r:s+r.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=(o=s,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),r=s.sources.map(function(t){return"/*# sourceURL="+s.sourceRoot+t+" */"});return[n].concat(r).concat([a]).join("\n")}var o;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 r=this[a][0];"number"==typeof r&&(s[r]=!0)}for(a=0;a<t.length;a++){var o=t[a];"number"==typeof o[0]&&s[o[0]]||(n&&!o[2]?o[2]=n:n&&(o[2]="("+o[2]+") and ("+n+")"),e.push(o))}},e}},"KHd+":function(t,e,n){"use strict";function s(t,e,n,s,a,r,o,i){var l,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),s&&(c.functional=!0),r&&(c._scopeId="data-v-"+r),o?(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(o)},c._ssrRegister=l):a&&(l=i?function(){a.call(this,this.$root.$options.shadowRoot)}:a),l)if(c.functional){c._injectStyles=l;var f=c.render;c.render=function(t,e){return l.call(e),f(t,e)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,l):[l]}return{exports:t,options:c}}n.d(e,"a",function(){return s})},Pvfc:function(t,e,n){"use strict";n.r(e);function s(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var a={props:["hashtag","hashtagCount"],data:function(){return{loaded:!1,page:1,authenticated:!1,following:!1,tags:[],top:[]}},beforeMount:function(){this.authenticated=$("body").hasClass("loggedIn"),this.getResults()},methods:{getResults:function(){var t=this;axios.get("/api/v2/discover/tag",{params:{hashtag:this.hashtag,page:this.page}}).then(function(e){var n=e.data,s=n.tags.filter(function(t){return!(!t||0==t.length)});t.tags=s,t.loaded=!0,t.following=n.follows,t.page++})},infiniteLoader:function(t){var e=this;this.page>(this.authenticated?19:3)?t.complete():axios.get("/api/v2/discover/tag",{params:{hashtag:this.hashtag,page:this.page}}).then(function(n){var a=n.data;if(a.tags.length){var r,o=a.tags.filter(function(t){return!(!t||0==t.length)});if((r=e.tags).push.apply(r,s(o)),o.length>9)return void t.complete();e.page++,t.loaded()}else t.complete()})},followHashtag:function(){var t=this;axios.post("/api/local/discover/tag/subscribe",{name:this.hashtag}).then(function(e){t.following=!0})},unfollowHashtag:function(){var t=this;axios.post("/api/local/discover/tag/subscribe",{name:this.hashtag}).then(function(e){t.following=!1})}}},r=(n("ah3q"),n("KHd+")),o=Object(r.a)(a,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[t.loaded?n("div",{staticClass:"container"},[n("div",{staticClass:"profile-header row my-5"},[t._m(0),t._v(" "),n("div",{staticClass:"col-1