pixelfed/public/js/discover.js
2020-11-18 14:41:37 -07:00

1 line
No EOL
16 KiB
JavaScript
Vendored

(window.webpackJsonp=window.webpackJsonp||[]).push([[12],{"+nCD":function(t,e,n){Vue.component("discover-component",n("RlRG").default)},"24l9":function(t,e,n){"use strict";var s=n("XcS0");n.n(s).a},3:function(t,e,n){t.exports=n("+nCD")},"4Fgl":function(t,e,n){(t.exports=n("I1BE")(!1)).push([t.i,"\n.discover-bar[data-v-3fc56934]::-webkit-scrollbar { \n\tdisplay: none;\n}\n.card-disc[data-v-3fc56934] {\n\t-webkit-box-flex: 0;\n\t flex: 0 0 160px;\n\twidth:160px;\n\theight:100px;\n\tbackground-size: cover !important;\n}\n.post-icon[data-v-3fc56934] {\n\tcolor: #fff;\n\tposition:relative;\n\tmargin-top: 10px;\n\tz-index: 9;\n\topacity: 0.6;\n\ttext-shadow: 3px 3px 16px #272634;\n}\n",""])},"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 i,a=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(a)?t:(i=0===a.indexOf("//")?a:0===a.indexOf("/")?n+a:s+a.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},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 i=(r=s,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */"),a=s.sources.map((function(t){return"/*# sourceURL="+s.sourceRoot+t+" */"}));return[n].concat(a).concat([i]).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={},i=0;i<this.length;i++){var a=this[i][0];"number"==typeof a&&(s[a]=!0)}for(i=0;i<t.length;i++){var r=t[i];"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,i,a,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),a&&(c._scopeId="data-v-"+a),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__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},c._ssrRegister=l):i&&(l=o?function(){i.call(this,this.$root.$options.shadowRoot)}:i),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}))},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),"monthly"==t.trendingRange&&(t.trendingMonthly=e.data),t.trending=e.data}))},trendingRangeToggle:function(t){this.trendingRange=t,this.loadTrending()},loadTrendingHashtags:function(){var t=this;axios.get("/api/pixelfed/v2/discover/posts/hashtags").then((function(e){t.hashtags=e.data}))},loadTrendingPlaces:function(){var t=this;axios.get("/api/pixelfed/v2/discover/posts/places").then((function(e){t.places=e.data}))}}},i=(n("24l9"),n("KHd+")),a=Object(i.a)(s,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[t.loaded?n("div",[n("div",{staticClass:"d-block d-md-none border-top-0 pt-3"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.searchTerm,expression:"searchTerm"}],staticClass:"form-control rounded-pill shadow-sm",attrs:{placeholder:"Search"},domProps:{value:t.searchTerm},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.searchSubmit(e)},input:function(e){e.target.composing||(t.searchTerm=e.target.value)}}})]),t._v(" "),t._m(0),t._v(" "),t.hashtags.length?n("section",{staticClass:"mb-4 pb-5 section-explore mt-4 pt-4"},[n("div",{staticClass:"lead"},[n("i",{staticClass:"fas fa-hashtag text-lighter fa-lg mr-3"}),t._v(" "),t._l(t.hashtags,(function(e,s){return n("a",{staticClass:"badge badge-light rounded-pill border py-2 px-3 mr-2 mb-2 shadow-sm border-danger text-danger",attrs:{href:e.url}},[t._v(t._s(e.name))])}))],2),t._v(" "),n("div",{staticClass:"lead mt-4"},[n("i",{staticClass:"fas fa-map-marker-alt text-lighter fa-lg mr-3"}),t._v(" "),t._l(t.places,(function(e,s){return n("a",{staticClass:"badge badge-light rounded-pill border py-2 px-3 mr-2 mb-2 shadow-sm border-danger text-danger",attrs:{href:e.url}},[t._v(t._s(e.name)+", "+t._s(e.country))])}))],2)]):t._e(),t._v(" "),t.trending.length?n("section",{staticClass:"mb-5 section-explore"},[n("div",{staticClass:"profile-timeline"},[n("div",{staticClass:"row p-0 mt-5"},[n("div",{staticClass:"col-12 mb-3 d-flex justify-content-between align-items-center"},[n("p",{staticClass:"d-block d-md-none h1 font-weight-bold mb-0"},[t._v("Trending")]),t._v(" "),n("p",{staticClass:"d-none d-md-block display-4 font-weight-bold mb-0"},[t._v("Trending")]),t._v(" "),n("div",[n("div",{staticClass:"btn-group"},[n("button",{class:"daily"==t.trendingRange?"btn py-1 font-weight-bold px-3 text-uppercase btn-sm btn-danger":"btn py-1 font-weight-bold px-3 text-uppercase btn-sm btn-outline-danger",on:{click:function(e){return t.trendingRangeToggle("daily")}}},[t._v("Daily")]),t._v(" "),n("button",{class:"monthly"==t.trendingRange?"btn py-1 font-weight-bold px-3 text-uppercase btn-sm btn-danger":"btn py-1 font-weight-bold px-3 text-uppercase btn-sm btn-outline-danger",on:{click:function(e){return t.trendingRangeToggle("monthly")}}},[t._v("Monthly")])])])])]),t._v(" "),n("div",{staticClass:"row p-0",staticStyle:{display:"flex"}},t._l(t.trending.slice(0,12),(function(e,s){return n("div",{staticClass:"col-4 p-1 p-sm-2 p-md-3 pt-0"},[n("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:e.url}},[n("div",{staticClass:"square"},["photo:album"==e.pf_type?n("span",{staticClass:"float-right mr-3 post-icon"},[n("i",{staticClass:"fas fa-images fa-2x"})]):t._e(),t._v(" "),"video"==e.pf_type?n("span",{staticClass:"float-right mr-3 post-icon"},[n("i",{staticClass:"fas fa-video fa-2x"})]):t._e(),t._v(" "),"video:album"==e.pf_type?n("span",{staticClass:"float-right mr-3 post-icon"},[n("i",{staticClass:"fas fa-film fa-2x"})]):t._e(),t._v(" "),n("div",{staticClass:"square-content",style:{"background-image":"url("+e.media_attachments[0].preview_url+")"}})])])])})),0)])]):t._e(),t._v(" "),t.categories.length>0?n("section",{staticClass:"mb-5 section-explore"},[n("div",{staticClass:"profile-timeline pt-3"},[t._m(1),t._v(" "),n("section",{staticClass:"d-none d-md-flex mb-md-2 discover-bar",staticStyle:{width:"auto",overflow:"auto hidden"}},t._l(t.categories,(function(e,s){return n("a",{key:s+"_cat_",staticClass:"bg-dark rounded d-inline-flex align-items-end justify-content-center mr-3 box-shadow card-disc text-decoration-none",style:"background: linear-gradient(rgba(0, 0, 0, 0.3),rgba(0, 0, 0, 0.3)),url("+e.thumb+");",attrs:{href:e.url}},[n("p",{staticClass:"text-white font-weight-bold",staticStyle:{"text-shadow":"3px 3px 16px #272634"}},[t._v(t._s(e.name))])])})),0)])]):t._e(),t._v(" "),t.categories.length>0?n("section",{staticClass:"py-5 mb-5 section-explore bg-warning rounded"},[t._m(2)]):t._e(),t._v(" "),n("section",{staticClass:"pt-5 mb-5 section-explore"},[n("div",{staticClass:"profile-timeline pt-3"},[t._m(3),t._v(" "),n("div",{staticClass:"row p-0",staticStyle:{display:"flex"}},t._l(t.posts,(function(e,s){return n("div",{staticClass:"col-4 p-1 p-sm-2 p-md-3 pt-0"},[n("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:e.url}},[n("div",{staticClass:"square"},["photo:album"==e.type?n("span",{staticClass:"float-right mr-3 post-icon"},[n("i",{staticClass:"fas fa-images fa-2x"})]):t._e(),t._v(" "),"video"==e.type?n("span",{staticClass:"float-right mr-3 post-icon"},[n("i",{staticClass:"fas fa-video fa-2x"})]):t._e(),t._v(" "),"video:album"==e.type?n("span",{staticClass:"float-right mr-3 post-icon"},[n("i",{staticClass:"fas fa-film fa-2x"})]):t._e(),t._v(" "),n("div",{staticClass:"square-content",style:{"background-image":"url("+e.thumb+")"}})])])])})),0)])])]):n("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{height:"70vh"}},[n("img",{attrs:{src:"/img/pixelfed-icon-grey.svg"}})])])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"pt-3"},[e("p",{staticClass:"d-block d-md-none h1 font-weight-bold text-lighter pt-3",staticStyle:{opacity:"0.4"}},[e("i",{staticClass:"far fa-compass"}),this._v(" DISCOVER")]),this._v(" "),e("p",{staticClass:"d-none d-md-block display-3 font-weight-bold text-lighter pt-3",staticStyle:{opacity:"0.4"}},[e("i",{staticClass:"far fa-compass"}),this._v(" DISCOVER")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"row p-0 mt-5"},[e("div",{staticClass:"col-12 mb-4 d-flex justify-content-between align-items-center"},[e("p",{staticClass:"d-block d-md-none h1 font-weight-bold mb-0"},[this._v("Categories")]),this._v(" "),e("p",{staticClass:"d-none d-md-block display-4 font-weight-bold mb-0"},[this._v("Categories")])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"profile-timeline py-3"},[e("div",{staticClass:"row p-0 my-5"},[e("div",{staticClass:"col-12 mb-3 text-center text-dark"},[e("p",{staticClass:"d-none d-md-block display-3 font-weight-bold"},[this._v("Discover. Categories.")]),this._v(" "),e("p",{staticClass:"d-block d-md-none h1 font-weight-bold"},[this._v("Discover. Categories.")]),this._v(" "),e("p",{staticClass:"h4 font-weight-light mb-0"},[this._v("Discover amazing posts, people, places and hashtags.")])])])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"row p-0 mt-5"},[e("div",{staticClass:"col-12 mb-3 d-flex justify-content-between align-items-center"},[e("p",{staticClass:"d-block d-md-none h1 font-weight-bold mb-0"},[this._v("For You")]),this._v(" "),e("p",{staticClass:"d-none d-md-block display-4 font-weight-bold mb-0"},[this._v("For You")])])])}],!1,null,"3fc56934",null);e.default=a.exports},XcS0:function(t,e,n){var s=n("4Fgl");"string"==typeof s&&(s=[[t.i,s,""]]);var i={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(s,i);s.locals&&(t.exports=s.locals)},"aET+":function(t,e,n){var s,i,a={},r=(s=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===i&&(i=s.apply(this,arguments)),i}),o=function(t,e){return e?e.querySelector(t):document.querySelector(t)},l=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var s=o.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]}}(),c=null,d=0,f=[],p=n("9tPo");function u(t,e){for(var n=0;n<t.length;n++){var s=t[n],i=a[s.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](s.parts[r]);for(;r<s.parts.length;r++)i.parts.push(y(s.parts[r],e))}else{var o=[];for(r=0;r<s.parts.length;r++)o.push(y(s.parts[r],e));a[s.id]={id:s.id,refs:1,parts:o}}}}function h(t,e){for(var n=[],s={},i=0;i<t.length;i++){var a=t[i],r=e.base?a[0]+e.base:a[0],o={css:a[1],media:a[2],sourceMap:a[3]};s[r]?s[r].parts.push(o):n.push(s[r]={id:r,parts:[o]})}return n}function g(t,e){var n=l(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 i=l(t.insertAt.before,n);n.insertBefore(e,i)}}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 m(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),g(t,e),e}function b(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,s,i,a;if(e.transform&&t.css){if(!(a="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=a}if(e.singleton){var r=d++;n=c||(c=m(e)),s=x.bind(null,n,r,!1),i=x.bind(null,n,r,!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),g(t,e),e}(e),s=R.bind(null,n,e),i=function(){v(n),n.href&&URL.revokeObjectURL(n.href)}):(n=m(e),s=w.bind(null,n),i=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 i()}}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=r()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=h(t,e);return u(n,e),function(t){for(var s=[],i=0;i<n.length;i++){var r=n[i];(o=a[r.id]).refs--,s.push(o)}t&&u(h(t,e),e);for(i=0;i<s.length;i++){var o;if(0===(o=s[i]).refs){for(var l=0;l<o.parts.length;l++)o.parts[l]();delete a[o.id]}}}};var _,C=(_=[],function(t,e){return _[t]=e,_.filter(Boolean).join("\n")});function x(t,e,n,s){var i=n?"":s.css;if(t.styleSheet)t.styleSheet.cssText=C(e,i);else{var a=document.createTextNode(i),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(a,r[e]):t.appendChild(a)}}function w(t,e){var n=e.css,s=e.media;if(s&&t.setAttribute("media",s),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function R(t,e,n){var s=n.css,i=n.sourceMap,a=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||a)&&(s=p(s)),i&&(s+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var r=new Blob([s],{type:"text/css"}),o=t.href;t.href=URL.createObjectURL(r),o&&URL.revokeObjectURL(o)}}},[[3,0]]]);