1
0
Fork 0
pixelfed/public/js/discover.js

1 line
12 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[11],{"+nCD":function(t,e,n){Vue.component("discover-component",n("RlRG").default)},3:function(t,e,n){t.exports=n("+nCD")},"6Loh":function(t,e,n){"use strict";var s=n("cPT2");n.n(s).a},"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 r,o=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(o)?t:(r=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:s+o.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")}))}},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 r=(a=s,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),o=s.sources.map((function(t){return"/*# sourceURL="+s.sourceRoot+t+" */"}));return[n].concat(o).concat([r]).join("\n")}var a;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={},r=0;r<this.length;r++){var o=this[r][0];"number"==typeof o&&(s[o]=!0)}for(r=0;r<t.length;r++){var a=t[r];"number"==typeof a[0]&&s[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},"KHd+":function(t,e,n){"use strict";function s(t,e,n,s,r,o,a,i){var c,l="function"==typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=n,l._compiled=!0),s&&(l.functional=!0),o&&(l._scopeId="data-v-"+o),a?(c=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__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},l._ssrRegister=c):r&&(c=i?function(){r.call(this,this.$root.$options.shadowRoot)}:r),c)if(l.functional){l._injectStyles=c;var f=l.render;l.render=function(t,e){return c.call(e),f(t,e)}}else{var d=l.beforeCreate;l.beforeCreate=d?[].concat(d,c):[c]}return{exports:t,options:l}}n.d(e,"a",(function(){return s}))},KdMM:function(t,e,n){(t.exports=n("I1BE")(!1)).push([t.i,"\n.discover-bar[data-v-1b0a3480]::-webkit-scrollbar { \n\tdisplay: none;\n}\n.card-disc[data-v-1b0a3480] {\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-1b0a3480] {\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",""])},RlRG:function(t,e,n){"use strict";n.r(e);var s={data:function(){return{loaded:!1,config:window.App.config,posts:{},trending:{},categories:{},allCategories:{},searchTerm:""}},mounted:function(){this.fetchData(),this.fetchCategories()},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)}}},r=(n("6Loh"),n("KHd+")),o=Object(r.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 px-0 border-top-0 mx-n3"},[n("input",{directives:[{name:"model",rawName:"v-model",value:t.searchTerm,expression:"searchTerm"}],staticClass:"form-control rounded-0",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.categories.length>0?n("section",{staticClass:"d-none d-md-flex mb-md-2 pt-5 discover-bar",staticStyle:{width:"auto",overflow:"auto hidden"}},[1==t.config.ab.loops?n("a",{staticClass:"text-decoration-none bg-transparent border border-success rounded d-inline-flex align-items-center justify-content-center mr-3 card-disc",attrs:{href:"/discover/loops"}},[n("p",{staticClass:"text-success lead font-weight-bold mb-0"},[t._v("Loops")])]):t._e(),t._v(" "),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))])])}))],2):t._e(),t._v(" "),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 col-md-6"},[n("div",{staticClass:"mb-4"},[n("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.posts[0].url}},[n("div",{staticClass:"square"},["photo:album"==t.posts[0].type?n("span",{staticClass:"float-right mr-3 post-icon"},[n("i",{staticClass:"fas fa-images fa-2x"})]):t._e(),t._v(" "),"video"==t.posts[0].type?n("span",{staticClass:"float-right mr-3 post-icon"},[n("i",{staticClass:"fas fa-video fa-2x"})]):t._e(),t._v(" "),"video:album"==t.posts[0].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("+t.posts[0].thumb+")"}})])])])]),t._v(" "),n("div",{staticClass:"col-12 col-md-6 row p-0 m-0"},t._l(t.posts.slice(1,5),(function(e,s){return n("div",{staticClass:"col-6",staticStyle:{"margin-bottom":"1.8rem"}},[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)]),t._v(" "),n("div",{staticClass:"row p-0",staticStyle:{display:"flex"}},t._l(t.posts.slice(5),(function(e,s){return n("div",{staticClass:"col-3 p-1 p-sm-2 p-md-3"},[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)])]),t._v(" "),t._m(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("section",{staticClass:"mb-5"},[e("p",{staticClass:"lead text-center"},[this._v("To view more posts, check the "),e("a",{staticClass:"font-weight-bold",attrs:{href:"/"}},[this._v("home")]),this._v(" or "),e("a",{staticClass:"font-weight-bold",attrs:{href:"/timeline/public"}},[this._v("local")]),this._v(" timelines.")])])}],!1,null,"1b0a3480",null);e.default=o.exports},"aET+":function(t,e,n){var s,r,o={},a=(s=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===r&&(r=s.apply(this,arguments)),r}),i=function(t,e){return e?e.querySelector(t):document.querySelector(t)},c=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var s=i.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,f=0,d=[],u=n("9tPo");function p(t,e){for(var n=0;n<t.length;n++){var s=t[n],r=o[s.id];if(r){r.refs++;for(var a=0;a<r.parts.length;a++)r.parts[a](s.parts[a]);for(;a<s.parts.length;a++)r.parts.push(y(s.parts[a],e))}else{var i=[];for(a=0;a<s.parts.length;a++)i.push(y(s.parts[a],e));o[s.id]={id:s.id,refs:1,parts:i}}}}function h(t,e){for(var n=[],s={},r=0;r<t.length;r++){var o=t[r],a=e.base?o[0]+e.base:o[0],i={css:o[1],media:o[2],sourceMap:o[3]};s[a]?s[a].parts.push(i):n.push(s[a]={id:a,parts:[i]})}return n}function v(t,e){var n=c(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=d[d.length-1];if("top"===t.insertAt)s?s.nextSibling?n.insertBefore(e,s.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),d.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 r=c(t.insertAt.before,n);n.insertBefore(e,r)}}function m(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=d.indexOf(t);e>=0&&d.splice(e,1)}function b(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 g(e,t.attrs),v(t,e),e}function g(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,s,r,o;if(e.transform&&t.css){if(!(o="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=o}if(e.singleton){var a=f++;n=l||(l=b(e)),s=_.bind(null,n,a,!1),r=_.bind(null,n,a,!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",g(e,t.attrs),v(t,e),e}(e),s=R.bind(null,n,e),r=function(){m(n),n.href&&URL.revokeObjectURL(n.href)}):(n=b(e),s=w.bind(null,n),r=function(){m(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 r()}}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=a()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=h(t,e);return p(n,e),function(t){for(var s=[],r=0;r<n.length;r++){var a=n[r];(i=o[a.id]).refs--,s.push(i)}t&&p(h(t,e),e);for(r=0;r<s.length;r++){var i;if(0===(i=s[r]).refs){for(var c=0;c<i.parts.length;c++)i.parts[c]();delete o[i.id]}}}};var C,x=(C=[],function(t,e){return C[t]=e,C.filter(Boolean).join("\n")});function _(t,e,n,s){var r=n?"":s.css;if(t.styleSheet)t.styleSheet.cssText=x(e,r);else{var o=document.createTextNode(r),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}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,r=n.sourceMap,o=void 0===e.convertToAbsoluteUrls&&r;(e.convertToAbsoluteUrls||o)&&(s=u(s)),r&&(s+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var a=new Blob([s],{type:"text/css"}),i=t.href;t.href=URL.createObjectURL(a),i&&URL.revokeObjectURL(i)}},cPT2:function(t,e,n){var s=n("KdMM");"string"==typeof s&&(s=[[t.i,s,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(s,r);s.locals&&(t.exports=s.locals)}},[[3,0]]]);