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

1 line
28 KiB
JavaScript
Raw Normal View History

2019-02-25 05:07:56 +00:00
!function(t){var e={};function n(s){if(e[s])return e[s].exports;var o=e[s]={i:s,l:!1,exports:{}};return t[s].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,s){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(s,o,function(e){return t[e]}.bind(null,o));return s},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=4)}({"0R0q":function(t,e,n){(t.exports=n("I1BE")(!1)).push([t.i,"\n.o-square[data-v-35b33644] {\n\tmax-width: 320px;\n}\n.o-portrait[data-v-35b33644] {\n\tmax-width: 320px;\n}\n.o-landscape[data-v-35b33644] {\n\tmax-width: 320px;\n}\n.post-icon[data-v-35b33644] {\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",""])},"2wtg":function(t,e,n){Vue.component("profile",n("EHjT").default)},4:function(t,e,n){t.exports=n("2wtg")},"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 o,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:(o=0===a.indexOf("//")?a:0===a.indexOf("/")?n+a:s+a.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")})}},EHjT: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 o={props:["profile-id"],data:function(){return{profile:{},user:{},timeline:[],timelinePage:2,loading:!0,owner:!1,mode:"grid",modes:["grid","list","masonry"],modalStatus:!1,relationship:{},followers:[],followerCursor:1,followerMore:!0,following:[],followingCursor:1,followingMore:!0}},beforeMount:function(){this.fetchProfile()},mounted:function(){},updated:function(){},methods:{fetchProfile:function(){var t=this;axios.get("/api/v1/accounts/"+this.profileId).then(function(e){t.profile=e.data}),axios.get("/api/v1/accounts/verify_credentials").then(function(e){t.user=e.data}),axios.get("/api/v1/accounts/relationships",{params:{"id[]":this.profileId}}).then(function(e){t.relationship=e.data[0]});var e="/api/v1/accounts/"+this.profileId+"/statuses";axios.get(e,{params:{only_media:!0,page:1}}).then(function(e){t.timeline=e.data,t.modalStatus=_.first(e.data),t.loading=!1,t.ownerCheck()}).catch(function(t){swal("Oops, something went wrong","Please release the page.","error")})},ownerCheck:function(){this.owner=this.profile.id===this.user.id},infiniteTimeline:function(t){var e=this,n="/api/v1/accounts/"+this.profileId+"/statuses";axios.get(n,{params:{page:this.timelinePage,only_media:!0}}).then(function(n){if(n.data.length&&0==e.loading){var o,a=n.data;(o=e.timeline).push.apply(o,s(a)),e.timelinePage+=1,t.loaded(),e.loading=!1}else t.complete()})},previewUrl:function(t){return t.media_attachments[0].preview_url},previewBackground:function(t){return"background-image: url("+this.previewUrl(t)+");"},switchMode:function(t){this.mode=_.indexOf(this.modes,t)?t:"grid","masonry"==this.mode&&$(".masonry").masonry({columnWidth:200,itemSelector:".masonry-item"})},r