forked from mirror/pixelfed
1 line
7.6 KiB
JavaScript
1 line
7.6 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{8: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){axios.post("/i/follow",{item:t}).then(function(t){window.location.href=window.location.href}).catch(function(t){t.response.data.message&&swal("Error",t.response.data.message,"error")})}}},r=e("KHd+"),i=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-3 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 i=t._i(e,null);a.checked?i<0&&t.$set(t.filters,"hashtags",e.concat([null])):i>-1&&t.$set(t.filters,"hashtags",e.slice(0,i).concat(e.slice(i+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("Show 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 i=t._i(e,null);a.checked?i<0&&t.$set(t.filters,"profiles",e.concat([null])):i>-1&&t.$set(t.filters,"profiles",e.slice(0,i).concat(e.slice(i+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("Show 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 i=t._i(e,null);a.checked?i<0&&t.$set(t.filters,"statuses",e.concat([null])):i>-1&&t.$set(t.filters,"statuses",e.slice(0,i).concat(e.slice(i+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("Show Statuses")])])]):t._e()]),t._v(" "),e("div",{staticClass:"col-12 col-md-9"},[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"},[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"},[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"},[e("button",{class:[s.entity.following?"btn btn-secondary btn-sm py-1 font-weight-bold":"btn btn-primary btn-sm py-1 font-weight-bold"],on:{click:function(e){return t.followProfile(s.entity.id)}}},[t._v("\n\t\t\t\t\t\t\t \t"+t._s(s.entity.following?"Unfollow":"Follow")+"\n\t\t\t\t\t\t\t ")])])])])})],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(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"},[e("img",{staticClass:"card-img-top img-fluid",attrs:{src:s.thumb}}),t._v(" "),e("div",{staticClass:"card-body text-center "},[e("p",{staticClass:"mb-0 small text-truncate font-weight-bold text-muted",domProps:{innerHTML:t._s(s.value)}})])])])})],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,"f2044b98",null);s.default=i.exports},"KHd+":function(t,s,e){"use strict";function a(t,s,e,a,r,i,l,o){var n,c="function"==typeof t?t.options:t;if(s&&(c.render=s,c.staticRenderFns=e,c._compiled=!0),a&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),l?(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(l)},c._ssrRegister=n):r&&(n=o?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 d=c.beforeCreate;c.beforeCreate=d?[].concat(d,n):[n]}return{exports:t,options:c}}e.d(s,"a",function(){return a})}},[[8,0]]]); |