mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-29 16:33:17 +00:00
1 line
No EOL
8 KiB
JavaScript
Vendored
1 line
No EOL
8 KiB
JavaScript
Vendored
(window.webpackJsonp=window.webpackJsonp||[]).push([[18],{9:function(t,s,e){t.exports=e("EnJJ")},EnJJ:function(t,s,e){Vue.component("search-results",e("IpYn").default)},IpYn:function(t,s,e){"use strict";e.r(s);var a={props:["query","profileId"],data:function(){return{loading:!0,networkError:!1,results:{hashtags:[],profiles:[],statuses:[]},filters:{hashtags:!0,profiles:!0,statuses:!0}}},beforeMount:function(){this.fetchSearchResults()},mounted:function(){$(".search-bar input").val(this.query)},updated:function(){},methods:{fetchSearchResults:function(){var t=this;axios.get("/api/search",{params:{q:this.query,src:"metro",v:1}}).then(function(s){var e=s.data;t.results.hashtags=e.hashtags,t.results.profiles=e.profiles,t.results.statuses=e.posts,t.loading=!1}).catch(function(s){t.loading=!1})},followProfile:function(t,s){var e=this;this.loading=!0,axios.post("/i/follow",{item:t.entity.id}).then(function(a){return 1==t.entity.local?void e.fetchSearchResults():(e.loading=!1,void(e.results.profiles[s].entity.follow_request=!0))}).catch(function(t){t.response.data.message&&swal("Error",t.response.data.message,"error")})}}},r=e("KHd+"),l=Object(r.a)(a,function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"container"},[t.loading?e("div",{staticClass:"pt-5 text-center"},[t._m(0)]):t._e(),t._v(" "),t.networkError?e("div",{staticClass:"pt-5 text-center"},[t._m(1)]):t._e(),t._v(" "),t.loading||t.networkError?t._e():e("div",{staticClass:"mt-5 row"},[e("div",{staticClass:"col-12 col-md-2 mb-4"},[t.results.hashtags||t.results.profiles||t.results.statuses?e("div",[e("p",{staticClass:"font-weight-bold"},[t._v("Filters")]),t._v(" "),e("div",{staticClass:"custom-control custom-checkbox"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.filters.hashtags,expression:"filters.hashtags"}],staticClass:"custom-control-input",attrs:{type:"checkbox",id:"filter1"},domProps:{checked:Array.isArray(t.filters.hashtags)?t._i(t.filters.hashtags,null)>-1:t.filters.hashtags},on:{change:function(s){var e=t.filters.hashtags,a=s.target,r=!!a.checked;if(Array.isArray(e)){var l=t._i(e,null);a.checked?l<0&&t.$set(t.filters,"hashtags",e.concat([null])):l>-1&&t.$set(t.filters,"hashtags",e.slice(0,l).concat(e.slice(l+1)))}else t.$set(t.filters,"hashtags",r)}}}),t._v(" "),e("label",{staticClass:"custom-control-label text-muted font-weight-light",attrs:{for:"filter1"}},[t._v("Hashtags")])]),t._v(" "),e("div",{staticClass:"custom-control custom-checkbox"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.filters.profiles,expression:"filters.profiles"}],staticClass:"custom-control-input",attrs:{type:"checkbox",id:"filter2"},domProps:{checked:Array.isArray(t.filters.profiles)?t._i(t.filters.profiles,null)>-1:t.filters.profiles},on:{change:function(s){var e=t.filters.profiles,a=s.target,r=!!a.checked;if(Array.isArray(e)){var l=t._i(e,null);a.checked?l<0&&t.$set(t.filters,"profiles",e.concat([null])):l>-1&&t.$set(t.filters,"profiles",e.slice(0,l).concat(e.slice(l+1)))}else t.$set(t.filters,"profiles",r)}}}),t._v(" "),e("label",{staticClass:"custom-control-label text-muted font-weight-light",attrs:{for:"filter2"}},[t._v("Profiles")])]),t._v(" "),e("div",{staticClass:"custom-control custom-checkbox"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.filters.statuses,expression:"filters.statuses"}],staticClass:"custom-control-input",attrs:{type:"checkbox",id:"filter3"},domProps:{checked:Array.isArray(t.filters.statuses)?t._i(t.filters.statuses,null)>-1:t.filters.statuses},on:{change:function(s){var e=t.filters.statuses,a=s.target,r=!!a.checked;if(Array.isArray(e)){var l=t._i(e,null);a.checked?l<0&&t.$set(t.filters,"statuses",e.concat([null])):l>-1&&t.$set(t.filters,"statuses",e.slice(0,l).concat(e.slice(l+1)))}else t.$set(t.filters,"statuses",r)}}}),t._v(" "),e("label",{staticClass:"custom-control-label text-muted font-weight-light",attrs:{for:"filter3"}},[t._v("Statuses")])])]):t._e()]),t._v(" "),e("div",{staticClass:"col-12 col-md-10"},[e("p",{staticClass:"h5 font-weight-bold"},[t._v("Showing results for "),e("i",[t._v(t._s(t.query))])]),t._v(" "),e("hr"),t._v(" "),t.filters.hashtags&&t.results.hashtags?e("div",{staticClass:"row mb-4"},[e("p",{staticClass:"col-12 font-weight-bold text-muted"},[t._v("Hashtags")]),t._v(" "),t._l(t.results.hashtags,function(s,a){return e("a",{staticClass:"col-12 col-md-3 mb-3",staticStyle:{"text-decoration":"none"},attrs:{href:s.url}},[e("div",{staticClass:"card card-body text-center shadow-none border"},[e("p",{staticClass:"lead mb-0 text-truncate text-dark",attrs:{"data-toggle":"tooltip",title:s.value}},[t._v("\n\t\t\t\t\t\t\t#"+t._s(s.value)+"\n\t\t\t\t\t\t")]),t._v(" "),e("p",{staticClass:"lead mb-0 small font-weight-bold text-dark"},[t._v("\n\t\t\t\t\t\t\t"+t._s(s.count)+" posts\n\t\t\t\t\t\t")])])])})],2):t._e(),t._v(" "),t.filters.profiles&&t.results.profiles?e("div",{staticClass:"row mb-4"},[e("p",{staticClass:"col-12 font-weight-bold text-muted"},[t._v("Profiles")]),t._v(" "),t._l(t.results.profiles,function(s,a){return e("a",{staticClass:"col-12 col-md-4 mb-3",staticStyle:{"text-decoration":"none"},attrs:{href:s.url}},[e("div",{staticClass:"card card-body text-center shadow-none border"},[e("p",{staticClass:"text-center"},[e("img",{staticClass:"rounded-circle box-shadow",attrs:{src:s.entity.thumb,width:"32px",height:"32px"}})]),t._v(" "),e("p",{staticClass:"font-weight-bold text-truncate text-dark"},[t._v("\n\t\t\t\t\t\t\t"+t._s(s.value)+"\n\t\t\t\t\t\t")]),t._v(" "),e("p",{staticClass:"mb-0 text-center"},[s.entity.follow_request?e("button",{staticClass:"btn btn-secondary btn-sm py-1 font-weight-bold",attrs:{type:"button",disabled:""}},[t._v("Follow Requested")]):t._e(),t._v(" "),!s.entity.follow_request&&s.entity.following?e("button",{staticClass:"btn btn-secondary btn-sm py-1 font-weight-bold",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.followProfile(s,a)}}},[t._v("Unfollow")]):t._e(),t._v(" "),s.entity.follow_request||s.entity.following?t._e():e("button",{staticClass:"btn btn-primary btn-sm py-1 font-weight-bold",attrs:{type:"button"},on:{click:function(e){return e.preventDefault(),t.followProfile(s,a)}}},[t._v("Follow")])])])])})],2):t._e(),t._v(" "),t.filters.statuses&&t.results.statuses?e("div",{staticClass:"row mb-4"},[e("p",{staticClass:"col-12 font-weight-bold text-muted"},[t._v("Statuses")]),t._v(" "),t._l(t.results.statuses,function(t,s){return e("div",{staticClass:"col-4 p-0 p-sm-2 p-md-3 hashtag-post-square"},[e("a",{staticClass:"card info-overlay card-md-border-0",attrs:{href:t.url}},[e("div",{class:[t.filter?"square "+t.filter:"square"]},[e("div",{staticClass:"square-content",style:"background-image: url("+t.thumb+")"})])])])})],2):t._e(),t._v(" "),t.results.hashtags||t.results.profiles||t.results.statuses?t._e():e("div",[e("p",{staticClass:"text-center lead"},[t._v("No results found!")])])])])])},[function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"spinner-border",attrs:{role:"status"}},[s("span",{staticClass:"sr-only"},[this._v("Loading…")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("p",{staticClass:"lead font-weight-lighter"},[this._v("An error occured, results could not be loaded."),s("br"),this._v(" Please try again later.")])}],!1,null,"514c1abf",null);s.default=l.exports},"KHd+":function(t,s,e){"use strict";function a(t,s,e,a,r,l,o,i){var n,c="function"==typeof t?t.options:t;if(s&&(c.render=s,c.staticRenderFns=e,c._compiled=!0),a&&(c.functional=!0),l&&(c._scopeId="data-v-"+l),o?(n=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(o)},c._ssrRegister=n):r&&(n=i?function(){r.call(this,this.$root.$options.shadowRoot)}:r),n)if(c.functional){c._injectStyles=n;var u=c.render;c.render=function(t,s){return n.call(s),u(t,s)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,n):[n]}return{exports:t,options:c}}e.d(s,"a",function(){return a})}},[[9,0]]]); |