1
0
Fork 0
forked from mirror/pixelfed
pixelfed/public/js/search.js

1 line
28 KiB
JavaScript
Raw Normal View History

2021-12-15 05:34:14 +00:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[19],{"42qW":function(t,s,e){"use strict";e("SJD7")},9:function(t,s,e){t.exports=e("EnJJ")},"9tPo":function(t,s){t.exports=function(t){var s="undefined"!=typeof window&&window.location;if(!s)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var e=s.protocol+"//"+s.host,a=e+s.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,s){var r,i=s.trim().replace(/^"(.*)"$/,(function(t,s){return s})).replace(/^'(.*)'$/,(function(t,s){return s}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(r=0===i.indexOf("//")?i:0===i.indexOf("/")?e+i:a+i.replace(/^\.\//,""),"url("+JSON.stringify(r)+")")}))}},EJIY:function(t,s,e){(t.exports=e("I1BE")(!1)).push([t.i,"\n.result-card[data-v-07d98d75] {\n\ttext-decoration: none;\n}\n.result-card .media[data-v-07d98d75]:hover {\n\tbackground: #EDF2F7;\n}\n@media (min-width: 1200px) {\n.container[data-v-07d98d75] {\n\t\tmax-width: 995px;\n}\n}\n",""])},EnJJ:function(t,s,e){Vue.component("search-results",e("IpYn").default)},I1BE:function(t,s){t.exports=function(t){var s=[];return s.toString=function(){return this.map((function(s){var e=function(t,s){var e=t[1]||"",a=t[3];if(!a)return e;if(s&&"function"==typeof btoa){var r=(n=a,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),i=a.sources.map((function(t){return"/*# sourceURL="+a.sourceRoot+t+" */"}));return[e].concat(i).concat([r]).join("\n")}var n;return[e].join("\n")}(s,t);return s[2]?"@media "+s[2]+"{"+e+"}":e})).join("")},s.i=function(t,e){"string"==typeof t&&(t=[[null,t,""]]);for(var a={},r=0;r<this.length;r++){var i=this[r][0];"number"==typeof i&&(a[i]=!0)}for(r=0;r<t.length;r++){var n=t[r];"number"==typeof n[0]&&a[n[0]]||(e&&!n[2]?n[2]=e:e&&(n[2]="("+n[2]+") and ("+e+")"),s.push(n))}},s}},IpYn:function(t,s,e){"use strict";e.r(s);function a(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,s){if(!t)return;if("string"==typeof t)return r(t,s);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return r(t,s)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,s){(null==s||s>t.length)&&(s=t.length);for(var e=0,a=new Array(s);e<s;e++)a[e]=t[e];return a}var i={props:["query","profileId"],data:function(){return{loading:!0,networkError:!1,results:{hashtags:[],profiles:[],statuses:[],places:[]},filters:{hashtags:!0,profiles:!0,statuses:!0},analysis:"profile",showPlaces:!1,placesCursor:1,placesCache:[],placesSearchEnabled:!1,searchVersion:2}},beforeMount:function(){this.bootSearch()},mounted:function(){$(".search-bar input").val(this.query)},updated:function(){$('[data-toggle="tooltip"]').tooltip()},methods:{bootSearch:function(){var t=this.searchLexer();this.analysis=t,this.fetchSearchResults(),axios.get("/api/pixelfed/v1/accounts/verify_credentials").then((function(t){window._sharedData.curUser=t.data,window.App.util.navatar()}))},fetchSearchResults:function(){if("remote"==this.analysis){var t=this.query;if(new URL(t).host===window.location.host)return void(window.location.href=t)}this.searchContext(this.analysis)},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")}))},searchLexer:function(){var t=this.query;return t.startsWith("#")?"hashtag":2==(t.match(/@/g)||[]).length?"webfinger":t.startsWith(