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

1 line
8.3 KiB
JavaScript
Raw Normal View History

2019-04-18 05:05:53 +00:00
!function(t){var s={};function e(r){if(s[r])return s[r].exports;var a=s[r]={i:r,l:!1,exports:{}};return t[r].call(a.exports,a,a.exports,e),a.l=!0,a.exports}e.m=t,e.c=s,e.d=function(t,s,r){e.o(t,s)||Object.defineProperty(t,s,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,s){if(1&s&&(t=e(t)),8&s)return t;if(4&s&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&s&&"string"!=typeof t)for(var a in t)e.d(r,a,function(s){return t[s]}.bind(null,a));return r},e.n=function(t){var s=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(s,"a",s),s},e.o=function(t,s){return Object.prototype.hasOwnProperty.call(t,s)},e.p="/",e(e.s=8)}({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 r={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})}}},a=e("KHd+"),i=Object(a.a)(r,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,r=s.target,a=!!r.checked;if(Array.isArray(e)){var i=t._i(e,null);r.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",a)}}}),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,r=s.target,a=!!r.checked;if(Array.isArray(e)){var i=t._i(e,null);r.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",a)}}}),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:"fi