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

1 line
12 KiB
JavaScript

!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=3)}({"+nCD":function(t,e,r){Vue.component("discover-component",r("RlRG").default)},3:function(t,e,r){t.exports=r("+nCD")},"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 r=e.protocol+"//"+e.host,n=r+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(t,e){var o,i=e.trim().replace(/^"(.*)"$/,function(t,e){return e}).replace(/^'(.*)'$/,function(t,e){return e});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?r+i:n+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}},CCry:function(t,e,r){"use strict";var n=r("wY8r");r.n(n).a},I1BE:function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var r=function(t,e){var r=t[1]||"",n=t[3];if(!n)return r;if(e&&"function"==typeof btoa){var o=(s=n,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(s))))+" */"),i=n.sources.map(function(t){return"/*# sourceURL="+n.sourceRoot+t+" */"});return[r].concat(i).concat([o]).join("\n")}var s;return[r].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+r+"}":r}).join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var n={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(n[i]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&n[s[0]]||(r&&!s[2]?s[2]=r:r&&(s[2]="("+s[2]+") and ("+r+")"),e.push(s))}},e}},"KHd+":function(t,e,r){"use strict";function n(t,e,r,n,o,i,s,a){var c,l="function"==typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=r,l._compiled=!0),n&&(l.functional=!0),i&&(l._scopeId="data-v-"+i),s?(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__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},l._ssrRegister=c):o&&(c=a?function(){o.call(this,this.$root.$options.shadowRoot)}:o),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 u=l.beforeCreate;l.beforeCreate=u?[].concat(u,c):[c]}return{exports:t,options:l}}r.d(e,"a",function(){return n})},RlRG:function(t,e,r){"use strict";r.r(e);var n={data:function(){return{people:{},posts:{},trending:{},categories:{},allCategories:{},categoryCursor:5}},mounted:function(){this.fetchData(),this.fetchCategories()},methods:{followUser:function(t,e){axios.post("/i/follow",{item:t}).then(function(t){var r=$(e.target);r.addClass("btn-outline-secondary").removeClass("btn-primary"),r.text("Unfollow")}).catch(function(t){swal("Whoops! Something went wrong...","An error occurred, please try again later.","error")})},fetchData:function(){var t=this;axios.get("/api/v2/discover/posts").then(function(e){var r=e.data;t.posts=r.posts,t.posts.length>1&&($(".section-explore .loader").hide(),$(".section-explore .row.d-none").removeClass("d-none"))})},fetchCategories:function(){var t=this;axios.get("/api/v2/discover/categories").then(function(e){t.allCategories=e.data,t.categories=_.slice(e.data,0,5)})},categoryNext:function(){if(!(this.categoryCursor>this.allCategories.length-1)){this.categoryCursor++;var t=this.categoryCursor,e=t-5,r=t;this.categories=_.slice(this.allCategories,e,r)}},categoryPrev:function(){if(5!=this.categoryCursor){this.categoryCursor--;var t=this.categoryCursor,e=t-5,r=t;this.categories=_.slice(this.allCategories,e,r)}}}},o=(r("CCry"),r("KHd+")),i=Object(o.a)(n,function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"container"},[t.categories.length>0?r("section",{staticClass:"mb-5 pb-3 px-2 d-flex",staticStyle:{"overflow-x":"hidden"}},[t._m(0),t._v(" "),r("div",{directives:[{name:"show",rawName:"v-show",value:t.categoryCursor>5,expression:"categoryCursor > 5"}],staticClass:"text-dark d-inline-flex align-items-center pr-3",on:{click:function(e){t.categoryPrev()}}},[r("i",{staticClass:"fas fa-chevron-circle-left fa-lg text-muted"})]),t._v(" "),t._l(t.categories,function(e,n){return r("a",{key:n+"_cat_",staticClass:"bg-dark rounded d-inline-flex align-items-end justify-content-center mr-3 box-shadow card-disc",style:"width:160px;height:100px;background: linear-gradient(rgba(0, 0, 0, 0.3),rgba(0, 0, 0, 0.3)),url("+e.thumb+");",attrs:{href:e.url}},[r("p",{staticClass:"text-white font-weight-bold",staticStyle:{"text-shadow":"3px 3px 16px #272634"}},[t._v(t._s(e.name))])])}),t._v(" "),r("div",{directives:[{name:"show",rawName:"v-show",value:t.allCategories.length!=t.categoryCursor,expression:"allCategories.length != categoryCursor"}],staticClass:"text-dark d-flex align-items-center",on:{click:function(e){t.categoryNext()}}},[r("i",{staticClass:"fas fa-chevron-circle-right fa-lg text-muted"})])],2):t._e(),t._v(" "),r("section",{staticClass:"mb-5 section-explore"},[r("div",{staticClass:"profile-timeline"},[t._m(1),t._v(" "),r("div",{staticClass:"row d-none"},t._l(t.posts,function(t){return r("div",{staticClass:"col-4 p-0 p-sm-2 p-md-3"},[r("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.url}},[r("div",{staticClass:"square filter_class"},[r("div",{staticClass:"square-content",style:{"background-image":"url("+t.thumb+")"}})])])])}),0)])]),t._v(" "),t._m(2)])},[function(){var t=this.$createElement,e=this._self._c||t;return e("a",{staticClass:"bg-dark rounded d-inline-flex align-items-end justify-content-center mr-3 box-shadow",staticStyle:{width:"160px",height:"100px"},attrs:{href:"/discover/personal"}},[e("p",{staticClass:"text-white font-weight-bold",staticStyle:{"text-shadow":"3px 3px 16px #272634","border-bottom":"2px solid #fff"}},[this._v("For You")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"loader text-center"},[e("div",{staticClass:"lds-ring"},[e("div"),e("div"),e("div"),e("div")])])},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,"1b6fcaf4",null);e.default=i.exports},VaX3:function(t,e,r){(t.exports=r("I1BE")(!1)).push([t.i,"\n.card-disc[data-v-1b6fcaf4] {\n background-size: cover !important;\n}\n",""])},"aET+":function(t,e,r){var n,o,i={},s=(n=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===o&&(o=n.apply(this,arguments)),o}),a=function(t){var e={};return function(t,r){if("function"==typeof t)return t();if(void 0===e[t]){var n=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,r);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}}(),c=null,l=0,f=[],u=r("9tPo");function d(t,e){for(var r=0;r<t.length;r++){var n=t[r],o=i[n.id];if(o){o.refs++;for(var s=0;s<o.parts.length;s++)o.parts[s](n.parts[s]);for(;s<n.parts.length;s++)o.parts.push(b(n.parts[s],e))}else{var a=[];for(s=0;s<n.parts.length;s++)a.push(b(n.parts[s],e));i[n.id]={id:n.id,refs:1,parts:a}}}}function p(t,e){for(var r=[],n={},o=0;o<t.length;o++){var i=t[o],s=e.base?i[0]+e.base:i[0],a={css:i[1],media:i[2],sourceMap:i[3]};n[s]?n[s].parts.push(a):r.push(n[s]={id:s,parts:[a]})}return r}function h(t,e){var r=a(t.insertInto);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var n=f[f.length-1];if("top"===t.insertAt)n?n.nextSibling?r.insertBefore(e,n.nextSibling):r.appendChild(e):r.insertBefore(e,r.firstChild),f.push(e);else if("bottom"===t.insertAt)r.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 o=a(t.insertAt.before,r);r.insertBefore(e,o)}}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 n=function(){0;return r.nc}();n&&(t.attrs.nonce=n)}return m(e,t.attrs),h(t,e),e}function m(t,e){Object.keys(e).forEach(function(r){t.setAttribute(r,e[r])})}function b(t,e){var r,n,o,i;if(e.transform&&t.css){if(!(i="function"==typeof e.transform?e.transform(t.css):e.transform.default(t.css)))return function(){};t.css=i}if(e.singleton){var s=l++;r=c||(c=g(e)),n=x.bind(null,r,s,!1),o=x.bind(null,r,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(r=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",m(e,t.attrs),h(t,e),e}(e),n=function(t,e,r){var n=r.css,o=r.sourceMap,i=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||i)&&(n=u(n));o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var s=new Blob([n],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(s),a&&URL.revokeObjectURL(a)}.bind(null,r,e),o=function(){v(r),r.href&&URL.revokeObjectURL(r.href)}):(r=g(e),n=function(t,e){var r=e.css,n=e.media;n&&t.setAttribute("media",n);if(t.styleSheet)t.styleSheet.cssText=r;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(r))}}.bind(null,r),o=function(){v(r)});return n(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;n(t=e)}else o()}}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=s()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var r=p(t,e);return d(r,e),function(t){for(var n=[],o=0;o<r.length;o++){var s=r[o];(a=i[s.id]).refs--,n.push(a)}t&&d(p(t,e),e);for(o=0;o<n.length;o++){var a;if(0===(a=n[o]).refs){for(var c=0;c<a.parts.length;c++)a.parts[c]();delete i[a.id]}}}};var y,C=(y=[],function(t,e){return y[t]=e,y.filter(Boolean).join("\n")});function x(t,e,r,n){var o=r?"":n.css;if(t.styleSheet)t.styleSheet.cssText=C(e,o);else{var i=document.createTextNode(o),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(i,s[e]):t.appendChild(i)}}},wY8r:function(t,e,r){var n=r("VaX3");"string"==typeof n&&(n=[[t.i,n,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};r("aET+")(n,o);n.locals&&(t.exports=n.locals)}});