PageSourceSearch

https://vchasnoua.com/_nuxt/index.030add1e.js

js vchasnoua.com collected 2026-10-02 04:49:09 UTC 6,771 bytes, 1 lines download raw bytes

1import{H as q,T as A,M as H,L as V}from"./components.7bb46cf1.js";import{i as $,r as p,l as O,c as r,b as y,w as N,a as t,E as J,D as W,G as Y,d as i,t as m,F as Z,j as z,H as G,o as n,k as _,f as M,g as D,p as K,m as Q}from"./entry.dfaf5b35.js";import{_ as X}from"./_plugin-vue_export-helper.c27b6911.js";const I=w=>(K("data-v-d0241422"),w=w(),Q(),w),ee={class:"container"},te={class:"row mt-4 mb-4"},se={class:"col-md-8 offset-md-2"},ae={class:"innernews mt-4"},ne=I(()=>t("h1",null,"Пошук на «Вчасно»",-1)),oe={class:"input-group"},ie=I(()=>t("button",{class:"btn btn-primary",type:"submit"},[t("i",{class:"fas fa-search"}),M(" Пошук ")],-1)),le={key:0,class:"text-center my-4"},ce=I(()=>t("div",{class:"spinner-border",role:"status"},[t("span",{class:"visually-hidden"},"Завантаження...")],-1)),re=I(()=>t("p",{class:"mt-2"},"Завантаження результатів...",-1)),ue=[ce,re],de={key:1,class:"alert alert-danger",role:"alert"},pe={key:2,class:"search-results"},me={class:"card-body"},he={class:"card-title"},_e=["href","innerHTML"],ve={class:"mb-2"},fe={key:0,class:"card-text small mb-0"},ge={key:1,class:"card-text text-muted small mb-0"},be={key:0,class:"d-flex justify-content-between align-items-center mt-4"},ye=["disabled"],we=["disabled"],ke={key:3,class:"alert alert-info"},Le={__name:"index",setup(w){const v=$(),U="AIzaSyCEj0T4opf1ZfvFgUctlWchsEOs-rbFVZY",j="65bb6150408c54b39",C="https://www.googleapis.com/customsearch/v1",f=p(""),g=p([]),h=p({totalResults:0,searchTime:0}),k=p(!1),L=p(null),P=p(!1),u=p(1),x=async(e=1)=>{var a,c;if(f.value.trim()){k.value=!0,L.value=null,u.value=e;try{const d=((parseInt(e)||1)-1)*10+1,R=new URLSearchParams({key:U,cx:j,q:f.value,start:d.toString(),num:"10",safe:"active"}),b=await fetch(`${C}?${R.toString()}`);if(!b.ok)throw new Error(`API request failed with status ${b.status}`);const l=await b.json();g.value=l.items||[],h.value={totalResults:parseInt(((a=l.searchInformation)==null?void 0:a.totalResults)||0),searchTime:parseFloat(((c=l.searchInformation)==null?void 0:c.searchTime)||0)},P.value=!0}catch(s){console.error("Search error:",s),L.value=`Помилка пошуку: ${s.message}`,g.value=[]}finally{k.value=!1}}},E=()=>{if(u.value<Math.ceil(h.value.totalResults/10)){const e=Number(u.value)+1;x(e),window.scrollTo({top:0,behavior:"smooth"})}},F=()=>{if(u.value>1){const e=Number(u.value)-1;x(e),window.scrollTo({top:0,behavior:"smooth"})}},S=e=>{if(e.pagemap&&e.pagemap.metatags&&e.pagemap.metatags.length>0){const a=e.pagemap.metatags[0],c=["og:description","description","twitter:description","dc.description"];for(const s of c)if(a[s])return a[s]}return e.snippet?e.snippet:null},T=e=>{if(e.pagemap&&e.pagemap.metatags&&e.pagemap.metatags.length>0){const a=e.pagemap.metatags[0],c=["article:published_time","datePublished","date","og:published_time","pubdate","lastmod"];for(const s of c)if(a[s])try{const d=new Date(a[s]);if(!isNaN(d.getTime()))return new Intl.DateTimeFormat("uk-UA",{day:"numeric",month:"long",year:"numeric"}).format(d)}catch(d){console.error("Error parsing date:",d)}}if(e.snippet){const a=[/\b(\d{1,2})\s+(січ|лют|бер|кві|тра|чер|лип|сер|вер|жов|лис|гру)[а-я]*\s+(\d{4})\b/i,/\b(\d{1,2})[\.\/](\d{1,2})[\.\/](\d{4})\b/,/\b(\d{4})[\-\/](\d{1,2})[\-\/](\d{1,2})\b/];for(const c of a){const s=e.snippet.match(c);if(s)return s[0]}}return null};O(()=>{const a=new URLSearchParams(window.location.search).get("q");a&&(f.value=a,x())});const o=p({title:"Пошук на сайті",description:"Пошук серед всіх матеріалів сайту «Вчасно» за пошуковою фразю",jsonLD:JSON.stringify({"@context":"https://schema.org","@type":"WebPage",inLanguage:"uk",name:"Пошук на сайті",url:`${v.public.siteURL}/search`}),jsonLDBreadcrumb:JSON.stringify({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Головна",item:v.public.siteURL},{"@type":"ListItem",position:2,name:"Пошук на сайті",item:`${v.public.siteURL}/search`}]})});return(e,a)=>{const c=A,s=H,d=V,R=G("Script"),b=q;return n(),r("div",ee,[y(b,null,{default:N(()=>[o.value.title?(n(),_(c,{key:0},{default:N(()=>
1[M(m(o.value.title),1)]),_:1})):i("",!0),o.value.description?(n(),_(s,{key:1,name:"description",content:o.value.description},null,8,["content"])):i("",!0),o.value.title?(n(),_(s,{key:2,name:"og:title",content:o.value.title},null,8,["content"])):i("",!0),o.value.description?(n(),_(s,{key:3,name:"og:description",content:o.value.description},null,8,["content"])):i("",!0),y(s,{name:"og:url",content:D(v).public.siteURL+"/search"},null,8,["content"]),o.value.title?(n(),_(s,{key:4,name:"twitter:title",content:o.value.title},null,8,["content"])):i("",!0),o.value.description?(n(),_(s,{key:5,name:"twitter:description",content:o.value.description},null,8,["content"])):i("",!0),y(d,{rel:"canonical",href:D(v).public.siteURL+"/search"},null,8,["href"]),y(R,{type:"application/ld+json",children:o.value.jsonLD},null,8,["children"]),y(R,{type:"application/ld+json",children:o.value.jsonLDBreadcrumb},null,8,["children"])]),_:1}),t("div",te,[t("div",se,[t("div",ae,[ne,t("form",{onSubmit:a[1]||(a[1]=J(()=>x(1),["prevent"])),class:"mt-4 mb-4"},[t("div",oe,[W(t("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=l=>f.value=l),class:"form-control",placeholder:"Введіть пошуковий запит...","aria-label":"Search query",required:""},null,512),[[Y,f.value]]),ie])],32),k.value?(n(),r("div",le,ue)):i("",!0),L.value?(n(),r("div",de,m(L.value),1)):i("",!0),g.value.length>0?(n(),r("div",pe,[t("p",null,"Знайдено "+m(h.value.totalResults||0)+" результатів",1),(n(!0),r(Z,null,z(g.value,(l,B)=>(n(),r("div",{key:B,class:"card mb-3"},[t("div",me,[t("h3",he,[t("a",{href:l.link,target:"_blank",innerHTML:l.htmlTitle,class:"text-primary"},null,8,_e)]),t("div",ve,[S(l)?(n(),r("p",fe,m(S(l)),1)):i("",!0),T(l)?(n(),r("p",ge,m(T(l)),1)):i("",!0)])])]))),128)),h.value.totalResults>10?(n(),r("div",be,[t("button",{class:"btn btn-outline-primary",onClick:F,disabled:u.value===1}," Попередня сторінка ",8,ye),t("span",null,"Сторінка "+m(u.value)+" з "+m(Math.ceil(h.value.totalResults/10)),1),t("button",{class:"btn btn-outline-primary",onClick:E,disabled:u.value>=Math.ceil(h.value.totalResults/10)}," Наступна сторінка ",8,we)])):i("",!0)])):i("",!0),P.value&&g.value.length===0&&!k.value?(n(),r("div",ke," За вашим запитом нічого не знайдено. Спробуйте змінити пошуковий запит. ")):i("",!0)])])])])}}},Pe=X(Le,[["__scopeId","data-v-d0241422"]]);export{Pe as default};

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.