pixelfed/public/js/my2020.js
2021-02-15 20:33:21 -07:00

1 line
No EOL
16 KiB
JavaScript
Vendored

(window.webpackJsonp=window.webpackJsonp||[]).push([[17],{25:function(t,e,s){t.exports=s("Q00S")},"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 s=e.protocol+"//"+e.host,a=s+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var n,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:(n=0===i.indexOf("//")?i:0===i.indexOf("/")?s+i:a+i.replace(/^\.\//,""),"url("+JSON.stringify(n)+")")}))}},I1BE:function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var s=function(t,e){var s=t[1]||"",a=t[3];if(!a)return s;if(e&&"function"==typeof btoa){var n=(o=a,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),i=a.sources.map((function(t){return"/*# sourceURL="+a.sourceRoot+t+" */"}));return[s].concat(i).concat([n]).join("\n")}var o;return[s].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+s+"}":s})).join("")},e.i=function(t,s){"string"==typeof t&&(t=[[null,t,""]]);for(var a={},n=0;n<this.length;n++){var i=this[n][0];"number"==typeof i&&(a[i]=!0)}for(n=0;n<t.length;n++){var o=t[n];"number"==typeof o[0]&&a[o[0]]||(s&&!o[2]?o[2]=s:s&&(o[2]="("+o[2]+") and ("+s+")"),e.push(o))}},e}},"KHd+":function(t,e,s){"use strict";function a(t,e,s,a,n,i,o,r){var l,c="function"==typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=s,c._compiled=!0),a&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),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__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=l):n&&(l=r?function(){n.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:n),l)if(c.functional){c._injectStyles=l;var p=c.render;c.render=function(t,e){return l.call(e),p(t,e)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,l):[l]}return{exports:t,options:c}}s.d(e,"a",(function(){return a}))},Q00S:function(t,e,s){Vue.component("my-yearreview",s("lJj1").default)},VBOT:function(t,e,s){"use strict";s("qXge")},"aET+":function(t,e,s){var a,n,i={},o=(a=function(){return window&&document&&document.all&&!window.atob},function(){return void 0===n&&(n=a.apply(this,arguments)),n}),r=function(t,e){return e?e.querySelector(t):document.querySelector(t)},l=function(t){var e={};return function(t,s){if("function"==typeof t)return t();if(void 0===e[t]){var a=r.call(this,t,s);if(window.HTMLIFrameElement&&a instanceof window.HTMLIFrameElement)try{a=a.contentDocument.head}catch(t){a=null}e[t]=a}return e[t]}}(),c=null,p=0,u=[],h=s("9tPo");function d(t,e){for(var s=0;s<t.length;s++){var a=t[s],n=i[a.id];if(n){n.refs++;for(var o=0;o<n.parts.length;o++)n.parts[o](a.parts[o]);for(;o<a.parts.length;o++)n.parts.push(w(a.parts[o],e))}else{var r=[];for(o=0;o<a.parts.length;o++)r.push(w(a.parts[o],e));i[a.id]={id:a.id,refs:1,parts:r}}}}function f(t,e){for(var s=[],a={},n=0;n<t.length;n++){var i=t[n],o=e.base?i[0]+e.base:i[0],r={css:i[1],media:i[2],sourceMap:i[3]};a[o]?a[o].parts.push(r):s.push(a[o]={id:o,parts:[r]})}return s}function v(t,e){var s=l(t.insertInto);if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var a=u[u.length-1];if("top"===t.insertAt)a?a.nextSibling?s.insertBefore(e,a.nextSibling):s.appendChild(e):s.insertBefore(e,s.firstChild),u.push(e);else if("bottom"===t.insertAt)s.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 n=l(t.insertAt.before,s);s.insertBefore(e,n)}}function _(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=u.indexOf(t);e>=0&&u.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 a=function(){0;return s.nc}();a&&(t.attrs.nonce=a)}return m(e,t.attrs),v(t,e),e}function m(t,e){Object.keys(e).forEach((function(s){t.setAttribute(s,e[s])}))}function w(t,e){var s,a,n,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 o=p++;s=c||(c=g(e)),a=y.bind(null,s,o,!1),n=y.bind(null,s,o,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(s=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),v(t,e),e}(e),a=E.bind(null,s,e),n=function(){_(s),s.href&&URL.revokeObjectURL(s.href)}):(s=g(e),a=x.bind(null,s),n=function(){_(s)});return a(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;a(t=e)}else n()}}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 s=f(t,e);return d(s,e),function(t){for(var a=[],n=0;n<s.length;n++){var o=s[n];(r=i[o.id]).refs--,a.push(r)}t&&d(f(t,e),e);for(n=0;n<a.length;n++){var r;if(0===(r=a[n]).refs){for(var l=0;l<r.parts.length;l++)r.parts[l]();delete i[r.id]}}}};var b,C=(b=[],function(t,e){return b[t]=e,b.filter(Boolean).join("\n")});function y(t,e,s,a){var n=s?"":a.css;if(t.styleSheet)t.styleSheet.cssText=C(e,n);else{var i=document.createTextNode(n),o=t.childNodes;o[e]&&t.removeChild(o[e]),o.length?t.insertBefore(i,o[e]):t.appendChild(i)}}function x(t,e){var s=e.css,a=e.media;if(a&&t.setAttribute("media",a),t.styleSheet)t.styleSheet.cssText=s;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(s))}}function E(t,e,s){var a=s.css,n=s.sourceMap,i=void 0===e.convertToAbsoluteUrls&&n;(e.convertToAbsoluteUrls||i)&&(a=h(a)),n&&(a+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */");var o=new Blob([a],{type:"text/css"}),r=t.href;t.href=URL.createObjectURL(o),r&&URL.revokeObjectURL(r)}},lJj1:function(t,e,s){"use strict";s.r(e);var a={data:function(){return{config:window.App.config,user:{},loggedIn:!1,loaded:!1,page:1,stats:[],notEnoughData:!1,reportedView:!1}},mounted:function(){var t=this,e=new URLSearchParams(window.location.search);e.has("v")&&e.has("ned")&&e.has("sl")&&20==e.get("v")&&e.get("sl")>=1&&e.get("sl")<=9&&(0==e.get("ned")?this.page=e.get("sl"):this.notEnoughData=!0),axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(e){t.user=e.data,window._sharedData.curUser=e.data})),this.fetchData()},updated:function(){},methods:{fetchData:function(){var t=this;axios.get("/api/pixelfed/v2/seasonal/yir").then((function(e){t.stats=e.data,t.loaded=!0,t.shortcuts()}))},nextPage:function(){if(9!=this.page){if(7==this.page&&null==this.stats.popular.places)return this.page=9,void window.history.pushState({},{},"/i/my2020?v=20&ned=0&sl=9");8==this.page&&axios.post("/api/pixelfed/v2/seasonal/yir",{profile_id:this.user.profile_id}),++this.page,window.history.pushState({},{},"/i/my2020?v=20&ned=0&sl="+this.page)}},prevPage:function(){if(1!=this.page){if(9==this.page&&null==this.stats.popular.places)return this.page=7,void window.history.pushState({},{},"/i/my2020?v=20&ned=0&sl=7");--this.page,1==this.page?window.history.pushState({},{},"/i/my2020"):window.history.pushState({},{},"/i/my2020?v=20&ned=0&sl="+this.page)}},prevClass:function(){return 1==this.page?"btn btn-outline-muted rounded-pill":"btn btn-outline-light rounded-pill"},nextClass:function(){return 9==this.page?"btn btn-outline-muted rounded-pill":"btn btn-outline-light rounded-pill"},dateFormat:function(t){},shortcuts:function(){var t=this;window.addEventListener("keydown",(function(e){if(!e.defaultPrevented){switch(e.code){case"KeyA":case"ArrowLeft":t.prevPage();break;case"KeyD":case"ArrowRight":t.nextPage()}e.preventDefault()}}),!0)}}},n=(s("VBOT"),s("KHd+")),i=Object(n.a)(a,(function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"bg-dark text-white"},[t.loaded?t._e():s("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{height:"100vh"}},[t._m(0)]),t._v(" "),t.loaded&&t.notEnoughData?s("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{height:"100vh"}},[t._m(1)]):t._e(),t._v(" "),t.loaded&&!t.notEnoughData?s("div",{staticClass:"d-flex justify-content-center align-items-center",staticStyle:{width:"100%",height:"100vh","min-height":"500px",padding:"0 15px"}},[1==t.page?s("div",{staticClass:"text-center"},[s("p",{staticClass:"h1 font-weight-light"},[t._v("Hello "+t._s(t.user.username)+"!")]),t._v(" "),s("p",{staticClass:"h1 py-4"},[t._v("Your 2020 on Pixelfed.")]),t._v(" "),s("p",{staticClass:"h4 font-weight-light mb-0 animate__animated animate__bounceInDown"},[t._v("Use the buttons below to navigate.")])]):t._e(),t._v(" "),2==t.page?s("div",{staticClass:"text-center mw-500"},[s("p",{staticClass:"display-4"},[t._v("User #"),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.user_id))])]),t._v(" "),s("p",{staticClass:"h3 font-weight-light mb-0"},[t._v("You joined Pixelfed on "+t._s(t.stats.account.created_at))])]):t._e(),t._v(" "),3==t.page?s("div",{staticClass:"text-center mw-500"},[s("p",{staticClass:"display-4"},[t._v("You created "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.posts_count))]),t._v(" posts")]),t._v(" "),s("p",{staticClass:"h3 font-weight-light mb-0"},[t._v("The average user created "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.average.posts))]),t._v(" posts this year.")])]):t._e(),t._v(" "),4==t.page?s("div",{staticClass:"text-center mw-500"},[s("p",{staticClass:"display-4"},[t._v("You liked "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.likes_count))]),t._v(" posts")]),t._v(" "),s("p",{staticClass:"h3 font-weight-light mb-0"},[t._v("The average user liked "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.average.likes))]),t._v(" posts this year.")])]):t._e(),t._v(" "),5==t.page?s("div",{staticClass:"text-center mw-500"},[t.stats.account.most_popular?s("div",[s("p",{staticClass:"h1 font-weight-light mb-0 text-break md-line-height"},[t._v("Your most popular post of 2020 was created on "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.most_popular.created_at))]),t._v(" with "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.most_popular.likes_count))]),t._v(" likes.")]),t._v(" "),s("p",{staticClass:"mt-4 mb-0"},[s("a",{staticClass:"btn btn-outline-light btn-lg btn-block rounded-pill",attrs:{href:t.stats.account.most_popular.url}},[t._v("View Post")])])]):s("div",[s("p",{staticClass:"h1 font-weight-light mb-0 text-break md-line-height"},[t._v("The most popular post of 2020 was created by "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.popular.post.username))]),t._v(" on "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.popular.post.created_at))]),t._v(" with "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.popular.post.likes_count))]),t._v(" likes.")]),t._v(" "),s("p",{staticClass:"mt-4 mb-0"},[s("a",{staticClass:"btn btn-outline-light btn-lg btn-block rounded-pill",attrs:{href:t.stats.popular.post.url}},[t._v("View Post")])])])]):t._e(),t._v(" "),6==t.page?s("div",{staticClass:"text-center mw-500"},[s("p",{staticClass:"display-4"},[s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.followers_this_year))]),t._v(" New Followers")]),t._v(" "),s("p",{staticClass:"h3 font-weight-light mb-0"},[t._v("You followed "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.followed_this_year))]),t._v(" accounts this year!")])]):t._e(),t._v(" "),7==t.page?s("div",{staticClass:"text-center mw-500"},[t.stats.account.hashtag?s("div",[s("p",{staticClass:"h1 text-break"},[t._v("Your favourite hashtag was "),s("span",{staticClass:"font-weight-bold"},[t._v("#"+t._s(t.stats.account.hashtag.name))]),t._v(".")]),t._v(" "),s("p",{staticClass:"h3 font-weight-light mb-0"},[t._v("You used it "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.hashtag.count))]),t._v(" times!")])]):s("div",[s("p",{staticClass:"h1 text-break"},[t._v("The most popular hashtag was "),s("span",{staticClass:"font-weight-bold"},[t._v("#"+t._s(t.stats.popular.hashtag.name))])]),t._v(" "),s("p",{staticClass:"h3 font-weight-light mb-0"},[t._v("It was used "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.popular.hashtag.count))]),t._v(" times!")])])]):t._e(),t._v(" "),8==t.page?s("div",{staticClass:"text-center mw-500"},[s("p",{staticClass:"display-4"},[t._v("You tagged "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.places_total))]),t._v(" places.")]),t._v(" "),t.stats.account.places_total?s("p",{staticClass:"h3 font-weight-light mb-0"},[t._v("You tagged "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.places.name))]),t._v(" a total of "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.account.places.count))]),t._v(" times!")]):s("p",{staticClass:"h3 font-weight-light mb-0"},[t._v("The most tagged place was "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.popular.places.name))]),t._v(" that was tagged a total of "),s("span",{staticClass:"font-weight-bold"},[t._v(t._s(t.stats.popular.places.count))]),t._v(" times!")])]):t._e(),t._v(" "),9==t.page?s("div",{staticClass:"text-center"},[s("p",{staticClass:"display-4"},[t._v("Happy 2021!")]),t._v(" "),s("p",{staticClass:"h3 font-weight-light mb-0"},[t._v("We wish you the best in the new year.")])]):t._e()]):t._e(),t._v(" "),t.loaded?s("div",{staticClass:"fixed-top"},[t._m(2)]):t._e(),t._v(" "),t.loaded?s("div",{staticClass:"fixed-bottom"},[s("p",{staticClass:"text-center"},[t.notEnoughData?t._e():s("a",{class:t.prevClass(),attrs:{href:"#",disabled:1==t.page},on:{click:function(e){return e.preventDefault(),t.prevPage()}}},[s("i",{staticClass:"fas fa-chevron-left"}),t._v(" Back")]),t._v(" "),s("a",{staticClass:"btn btn-outline-light rounded-pill mx-3",attrs:{href:"/"}},[t._v("Back to Pixelfed")]),t._v(" "),t.notEnoughData?t._e():s("a",{class:t.nextClass(),attrs:{href:"#"},on:{click:function(e){return e.preventDefault(),t.nextPage()}}},[t._v("Next "),s("i",{staticClass:"fas fa-chevron-right"})])])]):t._e()])}),[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"text-center"},[e("div",{staticClass:"spinner-border text-light",attrs:{role:"status"}},[e("span",{staticClass:"sr-only"},[this._v("Loading...")])]),this._v(" "),e("p",{staticClass:"mb-0 lead mt-2"},[this._v("Loading")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"text-center"},[e("p",{staticClass:"display-4"},[this._v("Oops!")]),this._v(" "),e("p",{staticClass:"h3 font-weight-light py-3"},[this._v("We don't have enough data to display your "),e("span",{staticClass:"font-weight-bold"},[this._v("#my2020")]),this._v(".")]),this._v(" "),e("p",{staticClass:"mb-0 h5 font-weight-light"},[this._v("We hope to see you next year!")])])},function(){var t=this.$createElement,e=this._self._c||t;return e("p",{staticClass:"text-center mt-3 d-flex justify-content-center align-items-center mb-0"},[e("img",{attrs:{src:"/img/pixelfed-icon-grey.svg",width:"60",height:"60"}}),this._v(" "),e("span",{staticClass:"text-light font-weight-bold ml-3",staticStyle:{"font-size":"22px"}},[this._v("#my2020")])])}],!1,null,"502499fa",null);e.default=i.exports},"n/oA":function(t,e,s){(t.exports=s("I1BE")(!1)).push([t.i,"\n.md-line-height[data-v-502499fa] {\n\tline-height: 1.65 !important;\n}\n.mw-500[data-v-502499fa] {\n\tmax-width: 500px;\n}\n",""])},qXge:function(t,e,s){var a=s("n/oA");"string"==typeof a&&(a=[[t.i,a,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};s("aET+")(a,n);a.locals&&(t.exports=a.locals)}},[[25,0]]]);