pixelfed/public/js/hashtag.js
2019-07-08 20:16:44 -06:00

1 line
No EOL
12 KiB
JavaScript
Vendored

(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{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-12 col-md-9 d-flex align-items-center"},[n("div",{staticClass:"profile-details"},[n("div",{staticClass:"username-bar pb-2"},[n("p",{staticClass:"tag-header mb-0"},[t._v("#"+t._s(t.hashtag))]),t._v(" "),n("p",{staticClass:"lead"},[n("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.tags.length?t.hashtagCount:"0"))]),t._v(" posts")]),t._v(" "),t.authenticated&&t.tags.length?n("p",{staticClass:"pt-3"},[t.following?n("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\tUnfollow\n\t\t\t\t\t\t\t")]):n("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\tFollow\n\t\t\t\t\t\t\t")])]):t._e()])])])]),t._v(" "),t.tags.length?n("div",{staticClass:"tag-timeline"},[t.top.length?n("p",{staticClass:"font-weight-bold text-muted mb-0"},[t._v("Top Posts")]):t._e(),t._v(" "),n("div",{staticClass:"row pb-5"},t._l(t.top,function(e,s){return n("div",{staticClass:"col-4 p-0 p-sm-2 p-md-3 hashtag-post-square"},[n("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:e.status.url}},[n("div",{class:[e.status.filter?"square "+e.status.filter:"square"]},[n("div",{staticClass:"square-content",style:"background-image: url("+e.status.thumb+")"}),t._v(" "),n("div",{staticClass:"info-overlay-text"},[n("h5",{staticClass:"text-white m-auto font-weight-bold"},[n("span",{staticClass:"pr-4"},[n("span",{staticClass:"far fa-heart fa-lg pr-1"}),t._v(" "+t._s(e.status.like_count)+"\n\t\t\t\t\t\t\t\t\t")]),t._v(" "),n("span",[n("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(" "),n("p",{staticClass:"font-weight-bold text-muted mb-0"},[t._v("Most Recent")]),t._v(" "),n("div",{staticClass:"row"},[t._l(t.tags,function(e,s){return n("div",{staticClass:"col-4 p-0 p-sm-2 p-md-3 hashtag-post-square"},[n("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:e.status.url}},[n("div",{class:[e.status.filter?"square "+e.status.filter:"square"]},[n("div",{staticClass:"square-content",style:"background-image: url("+e.status.thumb+")"}),t._v(" "),n("div",{staticClass:"info-overlay-text"},[n("h5",{staticClass:"text-white m-auto font-weight-bold"},[n("span",{staticClass:"pr-4"},[n("span",{staticClass:"far fa-heart fa-lg pr-1"}),t._v(" "+t._s(e.status.like_count)+"\n\t\t\t\t\t\t\t\t\t")]),t._v(" "),n("span",[n("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")])])])])])])}),t._v(" "),t.tags.length&&t.loaded?n("div",{staticClass:"card card-body text-center shadow-none bg-transparent border-0"},[n("infinite-loading",{on:{infinite:t.infiniteLoader}},[n("div",{staticClass:"font-weight-bold",attrs:{slot:"no-results"},slot:"no-results"}),t._v(" "),n("div",{staticClass:"font-weight-bold",attrs:{slot:"no-more"},slot:"no-more"})])],1):t._e()],2)]):n("div",[n("p",{staticClass:"text-center lead font-weight-bold"},[t._v("No public posts found.")])])]):n("div",{staticClass:"container text-center"},[t._m(1)])])},[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"col-12 col-md-3"},[e("div",{staticClass:"profile-avatar"},[e("div",{staticClass:"bg-pixelfed 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.$createElement,e=this._self._c||t;return e("div",{staticClass:"mt-5 spinner-border",attrs:{role:"status"}},[e("span",{staticClass:"sr-only"},[this._v("Loading...")])])}],!1,null,"870cf892",null);e.default=o.exports},Veo2:function(t,e,n){(t.exports=n("I1BE")(!1)).push([t.i,"\n.tag-header[data-v-870cf892] {\n\tfont-size: 28px;\n\tfont-weight: 300;\n}\n",""])},"aET+":function(t,e,n){var s,a,r={},o=(s=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===a&&(a=s.apply(this,arguments)),a}),i=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var s=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&s instanceof window.HTMLIFrameElement)try{s=s.contentDocument.head}catch(t){s=null}e[t]=s}return e[t]}}(),l=null,c=0,f=[],u=n("9tPo");function d(t,e){for(var n=0;n<t.length;n++){var s=t[n],a=r[s.id];if(a){a.refs++;for(var o=0;o<a.parts.length;o++)a.parts[o](s.parts[o]);for(;o<s.parts.length;o++)a.parts.push(m(s.parts[o],e))}else{var i=[];for(o=0;o<s.parts.length;o++)i.push(m(s.parts[o],e));r[s.id]={id:s.id,refs:1,parts:i}}}}function p(t,e){for(var n=[],s={},a=0;a<t.length;a++){var r=t[a],o=e.base?r[0]+e.base:r[0],i={css:r[1],media:r[2],sourceMap:r[3]};s[o]?s[o].parts.push(i):n.push(s[o]={id:o,parts:[i]})}return n}function h(t,e){var n=i(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var s=f[f.length-1];if("top"===t.insertAt)s?s.nextSibling?n.insertBefore(e,s.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),f.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var a=i(t.insertAt.before,n);n.insertBefore(e,a)}}function v(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=f.indexOf(t);e>=0&&f.splice(e,1)}function g(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var s=function(){0;return n.nc}();s&&(t.attrs.nonce=s)}return b(e,t.attrs),h(t,e),e}function b(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})}function m(t,e){var n,s,a,r;if(e.transform&&t.css){if(!(r="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=r}if(e.singleton){var o=c++;n=l||(l=g(e)),s=_.bind(null,n,o,!1),a=_.bind(null,n,o,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",b(e,t.attrs),h(t,e),e}(e),s=function(t,e,n){var s=n.css,a=n.sourceMap,r=void 0===e.convertToAbsoluteUrls&&a;(e.convertToAbsoluteUrls||r)&&(s=u(s));a&&(s+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */");var o=new Blob([s],{type:"text/css"}),i=t.href;t.href=URL.createObjectURL(o),i&&URL.revokeObjectURL(i)}.bind(null,n,e),a=function(){v(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(e),s=function(t,e){var n=e.css,s=e.media;s&&t.setAttribute("media",s);if(t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),a=function(){v(n)});return s(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;s(t=e)}else a()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=o()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=p(t,e);return d(n,e),function(t){for(var s=[],a=0;a<n.length;a++){var o=n[a];(i=r[o.id]).refs--,s.push(i)}t&&d(p(t,e),e);for(a=0;a<s.length;a++){var i;if(0===(i=s[a]).refs){for(var l=0;l<i.parts.length;l++)i.parts[l]();delete r[i.id]}}}};var y,w=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function _(t,e,n,s){var a=n?"":s.css;if(t.styleSheet)t.styleSheet.cssText=w(e,a);else{var r=document.createTextNode(a),o=t.childNodes;o[e]&&t.removeChild(o[e]),o.length?t.insertBefore(r,o[e]):t.appendChild(r)}}},ah3q:function(t,e,n){"use strict";var s=n("xMFo");n.n(s).a},gqTO:function(t,e,n){Vue.component("hashtag-component",n("Pvfc").default)},xMFo:function(t,e,n){var s=n("Veo2");"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)}},[[15,0]]]);