PageSourceSearch

https://www.juniperresearch.com/vue/scripts/GLOBAL_Search.js?c=884?v=12

js juniperresearch.com collected 2026-09-24 07:33:16 UTC 21,478 bytes, 562 lines download raw bytes

1import { _ as _export_sfc } from "./_plugin-vue_export-helper.js";
2import { P as ProductListing } from "./ProductListing.js";
3import { O as OtherSort } from "./SearchSortBar.js";
4import { S as SearchBar, a as SearchSwitcher } from "./SearchSwitcher.js";
5import { r as resolveComponent, o as openBlock, c as createElementBlock, a as createBaseVNode, e as createVNode, F as Fragment, b as renderList, n as normalizeClass, d as createTextVNode, t as toDisplayString, w as withModifiers, i as withDirectives, v as vShow, f as createCommentVNode, g as createApp } from "./@vue.js";
6import { S as SkeletonCard } from "./SkeletonCard.js";
7import { A as APISettings$1 } from "./ApiConfig.js";
8const APISettings = {
9  token: "",
10  headers: new Headers({
11    "Accept": "application/json"
12  }),
13  baseURL: "/umbraco/api",
14  baseSurfaceURL: "/umbraco/surface"
15};
16const _sfc_main$1 = {
17  data() {
18    return {
19      filteritems: [],
20      selectedFilters: [],
21      selectedType: [],
22      typeitems: [
23        { "title": "Report", "type": "report" },
24        { "title": "Blog", "type": "blogPost" },
25        { "title": "Events", "type": "eventPost" },
26        { "title": "Infographic", "type": "infographicPost" },
27        { "title": "Press", "type": "pressPost" },
28        { "title": "Video", "type": "videoPost" },
29        { "title": "Whitepaper", "type": "whitepaperPost" }
30      ],
31      lastFilteredDate: null,
32      storeFiltersFor: -1
33    };
34  },
35  mounted() {
36    this.getLastFiltedDate();
37    const storedFilters = localStorage.getItem("storedFilters");
38    if (storedFilters) {
39      this.selectedFilters = JSON.parse(storedFilters);
40      this.changedFilters(this.selectedFilters);
41    }
42    const storedTypes = localStorage.getItem("storedTypes");
43    if (storedTypes) {
44      this.selectedType = JSON.parse(storedTypes);
45      this.changedType(this.selectedType);
46    }
47    this.getData();
48  },
49  methods: {
50    getData() {
51      APISettings.headers.set("RequestVerificationToken", window.token);
52      fetch(APISettings.baseSurfaceURL + "/filterapi/getfilters", {
53        method: "GET",
54        headers: APISettings.headers
55        //body: data
56      }).then((response) => response.json()).then((data) => {
57        this.filteritems = data;
58      });
59    },
60    toggleFilter(filterId) {
61      const index = this.selectedFilters.indexOf(filterId);
62      if (index === -1) {
63        this.selectedFilters.push(filterId);
64      } else {
65        this.selectedFilters.splice(index, 1);
66      }
67    },
68    toggleSubFilter(subfilterId) {
69      const index = this.selectedFilters.indexOf(subfilterId);
70      if (index === -1) {
71        this.selectedFilters.push(subfilterId);
72      } else {
73        this.selectedFilters.splice(index, 1);
74      }
75    },
76    changedFilters(selectedFilters) {
77      this.setLastFilteredDate(Date.now());
78      localStorage.setItem("storedFilters", JSON.stringify(selectedFilters));
79      this.$emit("update-filters", this.selectedFilters);
80    },
81    toggleType(typeId) {
82      const index = this.selectedType.indexOf(typeId);
83      if (index === -1) {
84        this.selectedType.push(typeId);
85      } else {
86        this.selectedType.splice(index, 1);
87      }
88    },
89    changedType(selectedType) {
90      this.setLastFilteredDate(Date.now());
91      localStorage.setItem("storedTypes", JSON.stringify(selectedType));
92      this.$emit("update-type", this.selectedType);
93    },
94    addDays(date, days) {
95      var result = new Date(date);
96      result.setDate(result.getDate() + days);
97      return result;
98    },
99    getLastFiltedDate() {
100      const lastFilteredDate = localStorage.getItem("lastFilteredDate");
101      if (lastFilteredDate) {
102        if (lastFilteredDate < this.addDays(Date.now(), this.storeFiltersfor)) {
103          localStorage.removeItem("storedFilters");
104          localStorage.removeItem("storedTypes");
105        } else {
106          this.lastFilteredDate = lastFilteredDate;
107        }
108      }
109    },
110    setLastFilteredDate(now) {
111      this.lastFilteredDate = now;
112      localStorage.setItem("lastFilteredDate", now);
113    }
114  },
115  computed: {
116    isMobile() {
117      return window.matchMedia("(max-width: 767px)").matches;
118    }
119  }
120};
121const _hoisted_1 = { class: "filters" };
122const _hoisted_2 = { class: "filter-body" };
123const _hoisted_3 = { key: 0 };
124const _hoisted_4 = { class: "mobile-filters" };
125const _hoisted_5 = { class: "mobile-filter-popup filter" };
126const _hoisted_6 = { class: "head" };
127const _hoisted_7 = {
128  id: "filterClose",
129  class: "close"
130};
131const _hoisted_8 = ["id"];
132const _hoisted_9 = { class: "filter-item" };
133const _hoisted_10 = ["onClick"];
134const _hoisted_11 = ["onClick"];
135const _hoisted_12 = { key: 0 };
136const _hoisted_13 = ["id"];
137const _hoisted_14 = ["onClick"];
138const _hoisted_15 = { key: 1 };
139const _hoisted_16 = { class: "listing-filters" };
140const _hoisted_17 = { class: "filter-area" };
141const _hoisted_18 = ["id"];
142const _hoisted_19 = { class: "filter-item" };
143const _hoisted_20 = ["onClick"];
144const _hoisted_21 = ["onClick"];
145const _hoisted_22 = { key: 0 };
146const _hoisted_23 = ["id"];
147const _hoisted_24 = ["onClick"];
148const _hoisted_25 = { class: "filter-body" };
149const _hoisted_26 = { key: 0 };
150const _hoisted_27 = { class: "mobile-filters" };
151const _hoisted_28 = { class: "mobile-filter-popup sort" };
152const _hoisted_29 = { class: "head" };
153const _hoisted_30 = {
154  id: "sortClose",
155  class: "close"
156};
157const _hoisted_31 = ["id"];
158const _hoisted_32 = { class: "filter-item" };
159const _hoisted_33 = ["onClick"];
160const _hoisted_34 = {
161  key: 1,
162  class: "listing-filters"
163};
164const _hoisted_35 = { class: "filter-area" };
165const _hoisted_36 = ["id"];
166const _hoisted_37 = { class: "filter-item" };
167const _hoisted_38 = ["onClick"];
168function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
169  const _component_ion_icon = resolveComponent("ion-icon");
170  return openBlock(), createElementBlock("div", _hoisted_1, [
171    _cache[8] || (_cache[8] = createBaseVNode("span", { class: "sub" }, "REFINE YOUR SEARCH:", -1)),
172    createBaseVNode("div", _hoisted_2, [
173      $options.isMobile ? (openBlock(), createElementBlock("div", _hoisted_3, [
174        createBaseVNode("div", _hoisted_4, [
175          _cache[1] || (_cache[1] = createBaseVNode("div", { class: "popup-buttons" }, [
176            createBaseVNode("button", {
177              id: "mobileFilter",
178              class: "mobile-filter-button"
179            }, "Filter")
180          ], -1)),
181          createBaseVNode("div", _hoisted_5, [
182            createBaseVNode("div", _hoisted_6, [
183              _cache[0] || (_cache[0] = createBaseVNode("h2", null, "Filter", -1)),
184              createBaseVNode("button", _hoisted_7, [
185                createVNode(_component_ion_icon, { name: "close-outline" })
186              ])
187            ]),
188            createBaseVNode("ul", null, [
189              (openBlock(true), createElementBlock(Fragment, null, renderList($data.filteritems, (filter, index) => {
190                return openBlock(), createElementBlock("li", {
191                  id: filter.id,
192                  key: index
193                }, [
194                  createBaseVNode("div", _hoisted_9, [
195                    createBaseVNode("a", {
196                      class: normalizeClass({ "active": $data.selectedFilters.includes(filter.key) }),
197                      onClick: ($event) => {
198                        $options.toggleFilter(filter.key);
199                        $options.changedFilters($data.selectedFilters);
200                      }
201                    }, [
202                      createTextVNode(toDisplayString(filter.title) + " ", 1),
203                      createBaseVNode("span", {
204                        class: "filter-toggle",
205                        onClick: withModifiers(($event) => filter.open = !filter.open, ["stop"])
206                      }, [
207                        createVNode(_component_ion_icon, {
208                          name: filter.open ? "remove-circle" : "add-circle"
209                        }, null, 8, ["name"])
210                      ], 8, _hoisted_11)
211                    ], 10, _hoisted_10),
212                    filter.topics ? withDirectives((openBlock(), createElementBlock("ul", _hoisted_12, [
213                      (openBlock(true), createElementBlock(Fragment, null, renderList(filter.topics, (subfilter, index2) => {
214                        return openBlock(), createElementBlock("li", {
215                          class: "filter-bot",
216                          id: subfilter.id
217                        }, [
218                          createBaseVNode("a", {
219                            class: normalizeClass({ "active": $data.selectedFilters.includes(subfilter.key) }),
220                            onClick: ($event) => {
221                              $options.toggleFilter(subfilter.key);
222                              $options.changedFilters($data.selectedFilters);
223                            }
224                          }, toDisplayString(subfilter.title), 11, _hoisted_14)
225                        ], 8, _hoisted_13);
226                      }), 256))
227                    ], 512)), [
228                      [vShow, filter.open]
229                    ]) : createCommentVNode("", true)
230                  ])
231                ], 8, _hoisted_8);
232              }), 128))
233            ])
234          ]),
235          _cache[2] || (_cache[2] = createBaseVNode("div", {
236            class: "menuBG",
237            id: "filterBG",
238            style: { "display": "none" }
239          }, null, -1))
240        ])
241      ])) : (openBlock(), createElementBlock("div", _hoisted_15, [
242        createBaseVNode("div", _hoisted_16, [
243          _cache[3] || (_cache[3] = createBaseVNode("div", { class: "filter-heading" }, " Filter by stream ", -1)),
244          createBaseVNode("div", _hoisted_17, [
245            createBaseVNode("ul", null, [
246              (openBlock(true), createElementBlock(Fragment, null, renderList($data.filteritems, (filter, index) => {
247                return openBlock(), createElementBlock("li", {
248                  id: filter.id,
249                  key: index
250                }, [
251                  createBaseVNode("div", _hoisted_19, [
252                    createBaseVNode("a", {
253                      class: normalizeClass({ "active": $data.selectedFilters.includes(filter.key) }),
254                      onClick: ($event) => {
255                        $options.toggleFilter(filter.key);
256                        $options.changedFilters($data.selectedFilters);
257                      }
258                    }, [
259                      createTextVNode(toDisplayString(filter.title) + " ", 1),
260                      createBaseVNode("span", {
261                        class: "filter-toggle",
262                        onClick: withModifiers(($event) => filter.open = !filter.open, ["stop"])
263                      }, [
264                        createVNode(_component_ion_icon, {
265                          name: filter.open ? "remove-circle" : "add-circle"
266                        }, null, 8, ["name"])
267                      ], 8, _hoisted_21)
268                    ], 10, _hoisted_20),
269                    filter.topics ? withDirectives((openBlock(), createElementBlock("ul", _hoisted_22, [
270                      (openBlock(true), createElementBlock(Fragment, null, renderList(filter.topics, (subfilter, index2) => {
271                        return openBlock(), createElementBlock("li", {
272                          class: "filter-bot",
273                          id: subfilter.id
274                        }, [
275                          createBaseVNode("a", {
276                            class: normalizeClass({ "active": $data.selectedFilters.includes(subfilter.key) }),
277                            onClick: ($event) => {
278                              $options.toggleFilter(subfilter.key);
279                              $options.changedFilters($data.selectedFilters);
280                            }
281                          }, toDisplayString(subfilter.title), 11, _hoisted_24)
282                        ], 8, _hoisted_23);
283                      }), 256))
284                    ], 512)), [
285                      [vShow, filter.open]
286                    ]) : createCommentVNode("", true)
287                  ])
288                ], 8, _hoisted_18);
289              }), 128))
290            ])
291          ])
292        ])
293      ]))
294    ]),
295    createBaseVNode("div", _hoisted_25, [
296      $options.isMobile ? (openBlock(), createElementBlock("div", _hoisted_26, [
297        createBaseVNode("div", _hoisted_27, [
298          _cache[5] || (_cache[5] = createBaseVNode("div", { class: "popup-buttons" }, [
299            createBaseVNode("button", {
300              id: "mobileSort",
301              class: "mobile-filter-button"
302            }, "Sort")
303          ], -1)),
304          createBaseVNode("div", _hoisted_28, [
305            createBaseVNode("div", _hoisted_29, [
306              _cache[4] || (_cache[4] = createBaseVNode("h2", null, "Type", -1)),
307              createBaseVNode("button", _hoisted_30, [
308                createVNode(_component_ion_icon, { name: "close-outline" })
309              ])
310            ]),
311            createBaseVNode("ul", null, [
312              (openBlock(true), createElementBlock(Fragment, null, renderList($data.typeitems, (type, index) => {
313                return openBlock(), createElementBlock("li", {
314                  id: type.id,
315                  key: index
316                }, [
317                  createBaseVNode("div", _hoisted_32, [
318                    createBaseVNode("a", {
319                      class: normalizeClass({ "active": $data.selectedType.includes(type.type) }),
320                      onClick: ($event) => {
321                        $options.toggleType(type.type);
322                        $options.changedType($data.selectedType);
323                      }
324                    }, toDisplayString(type.title), 11, _hoisted_33)
325                  ])
326                ], 8, _hoisted_31);
327              }), 128))
328            ])
329          ]),
330          _cache[6] || (_cache[6] = createBaseVNode("div", {
331            class: "menuBG",
332            id: "filterBG",
333            style: { "display": "none" }
334          }, null, -1))
335        ])
336      ])) : (openBlock(), createElementBlock("div", _hoisted_34, [
337        _cache[7] || (_cache[7] = createBaseVNode("div", { class: "filter-heading" }, " Filter by Type ", -1)),
338        createBaseVNode("div", _hoisted_35, [
339          createBaseVNode("ul", null, [
340            (openBlock(true), createElementBlock(Fragment, null, renderList($data.typeitems, (type, index) => {
341              return openBlock(), createElementBlock("li", {
342                id: type.id,
343                key: index
344              }, [
345                createBaseVNode("div", _hoisted_37, [
346                  createBaseVNode("a", {
347                    class: normalizeClass({ "active": $data.selectedType.includes(type.type) }),
348                    onClick: ($event) => {
349                      $options.toggleType(type.type);
350                      $options.changedType($data.selectedType);
351                    }
352                  }, toDisplayString(type.title), 11, _hoisted_38)
353                ])
354              ], 8, _hoisted_36);
355            }), 128))
356          ])
357        ])
358      ]))
359    ])
360  ]);
361}
362const SearchFilters = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "C:/Work/Juniper research/2023/JuniperUmbraco11/VueSrc/components/GlobalSearch/SearchFilters.vue"]]);
363const _sfc_main = {
364  name: "Global.Search",
365  components: {
366    "j-searchbar": SearchBar,
367    "j-searchswitcher": SearchSwitcher,
368    "j-searchfilters": SearchFilters,
369    "j-searchsort": OtherSort,
370    "j-productlisting": ProductListing,
371    "j-skeletoncard": SkeletonCard
372  },
373  data() {
374    return {
375      loaded: false,
376      griditems: [],
377      itemsPerPage: 9,
378      currentPage: 1,
379      updatedTab: 1,
380      currentSort: "default",
381      updatedFilters: [],
382      updatedType: [],
383      updatedSort: "",
384      queryText: "",
385      origin: null
386    };
387  },
388  mounted() {
389    this.loadLocal();
390    this.show();
391    this.searchQuery();
392  },
393  computed: {
394    shouldShowLoadMore() {
395      return this.visibleItems.length < this.griditems.length;
396    },
397    visibleItems() {
398      const lastIndex = this.currentPage * this.itemsPerPage;
399      return this.griditems.slice(0, lastIndex);
400    }
401  },
402  watch: {
403    currentPage: "saveLocal"
404  },
405  methods: {
406    loadLocal() {
407      const storedPage = localStorage.getItem("currentPage");
408      if (storedPage) {
409        this.currentPage = parseInt(storedPage);
410      }
411    },
412    saveLocal() {
413      localStorage.setItem("currentPage", this.currentPage);
414    },
415    loadMore() {
416      this.currentPage++;
417    },
418    searchQuery() {
419      if (query) {
420        this.queryText = query;
421        this.getData();
422      } else {
423        this.getData();
424      }
425    },
426    show() {
427      $(".vue-inital-load").show();
428    },
429    search() {
430      this.getData();
431    },
432    getMyReports() {
433      if (this.abortController) {
434        this.abortController.abort();
435      }
436      this.abortController = new AbortController();
437      var data = { QueryDocumentTypes: ["report"] };
438      if (this.queryText != "") {
439        data.QueryText = this.queryText;
440      }
441      if (this.updatedFilters != null && this.updatedFilters != "") {
442        data.FilterGroups = [{ FilterField: "searchableCategories", SearchFilters: this.updatedFilters.map((item) => ({ Id: item })) }];
443      }
444      fetch(APISettings$1.baseSurfaceURL + "/search/SearchMyReports", {
445        method: "POST",
446        headers: {
447          "Accept": "application/json",
448          "Content-Type": "application/json",
449          "RequestVerificationToken": token
450        },
451        body: JSON.stringify(data),
452        signal: this.abortController.signal
453      }).then((response) => response.json()).then((data2) => {
454        this.griditems = data2;
455        this.origin = [...data2];
456        this.loaded = true;
457      }).catch((err) => {
458        if (err.name === "AbortError")
459          return;
460        console.error(err);
461      });
462    },
463    getData() {
464      if (this.abortController) {
465        this.abortController.abort();
466      }
467      this.abortController = new AbortController();
468      APISettings$1.headers.set("Content-Type", "multipart/form-data");
469      APISettings$1.headers.set("RequestVerificationToken", window.token);
470      if (this.updatedType.length > 0) {
471        var data = { QueryDocumentTypes: [this.updatedType.join(",")] };
472      } else {
473        var data = { QueryDocumentTypes: ["report", "whitepaperpost", "blogpost", "infographicpost", "eventpost", "videopost"] };
474      }
475      data.SearchType = "global";
476      if (this.queryText != "") {
477        data.QueryText = this.queryText;
478      }
479      if (this.updatedFilters != null && this.updatedFilters != "") {
480        data.FilterGroups = [{ FilterField: "searchableCategories", SearchFilters: this.updatedFilters.map((item) => ({ Id: item })) }];
481      }
482      fetch(APISettings$1.baseSurfaceURL + "/search/SearchSite", {
483        method: "POST",
484        headers: {
485          "Accept": "application/json",
486          "Content-Type": "application/json",
487          "RequestVerificationToken": token
488        },
489        body: JSON.stringify(data),
490        signal: this.abortController.signal
491      }).then((response) => response.json()).then((data2) => {
492        this.griditems = data2;
493        this.origin = [...data2];
494        this.loaded = true;
495        if (this.currentSort != null && this.currentSort != "") {
496          this.sortGridItems();
497        }
498      }).catch((err) => {
499        if (err.name === "AbortError")
500          return;
501        console.error(err);
502      });
503    },
504    handleUpdate(selectedFilters) {
505      this.updatedFilters = selectedFilters;
506      this.getData();
507    },
508    handleSwitcher(activeTab) {
509      this.updatedTab = activeTab;
510      if (this.updatedTab == 1) {
511        this.getData();
512      } else {
513        this.getMyReports();
514      }
515    },
516    handleSearch(newSearch) {
517      window.location.assign("/global-search?query=" + newSearch);
518    },
519    handleType(selectedType) {
520      this.updatedType = selectedType;
521      this.getData();
522    },
523    handleSort(selectedSort) {
524      this.updatedSort = selectedSort;
525      this.currentSort = selectedSort;
526      this.sortGridItems();
527    },
528    sortGridItems() {
529      function parseDate(dateString) {
530        const parts = dateString.split(" ");
531        const monthName = parts[0];
532        const year = parseInt(parts[1], 10);
533        const monthIndex = new Date(Date.parse(monthName + " 1, 2000")).getMonth();
534        return new Date(year, monthIndex);
535      }
536      if (!this.origin) {
537        this.origin = [...this.griditems];
538      }
539      switch (this.updatedSort) {
540        case "1":
541          this.griditems.sort((a, b) => a.title.localeCompare(b.title));
542          break;
543        case "2":
544          this.griditems.sort((a, b) => b.title.localeCompare(a.title));
545          break;
546        case "3":
547          this.griditems.sort((a, b) => parseDate(b.date) - parseDate(a.date));
548          break;
549        case "4":
550          this.griditems.sort((a, b) => parseDate(a.date) - parseDate(b.date));
551          break;
552        default:
553          this.griditems = [...this.origin];
554          break;
555      }
556    }
557  }
558};
559const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "C:/Work/Juniper research/2023/JuniperUmbraco11/VueSrc/apps/Global_Search.vue"]]);
560document.addEventListener("DOMContentLoaded", function() {
561  createApp(App).mount("#app");
562}, false);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.