PageSourceSearch

https://everlange.com/assets/SpeakableSchemaTool-B685KiGi.js

js everlange.com collected 2026-09-25 23:06:14 UTC 7,978 bytes, 8 lines download raw bytes

1import{a as m,j as e}from"./vendor-motion-Dg40ukRu.js";import{T as L}from"./ToolShell-EuW12vA_.js";import{C as R}from"./CodeOutput-hrrzcUcp.js";import{C as _}from"./credit-costs-CEdoRYxe.js";import{u as B,ad as f,G,X as g,S as M}from"./index-f6cR2jUt.js";import{u as D,A as H}from"./ArchiveSolutions-BkiRE_cN.js";import{P as j}from"./plus-BL00TCCS.js";import"./BackButton-R2j3LUAO.js";import"./arrow-left-bJ_DNcpA.js";import"./ai-generator-BlJ0obsK.js";import"./copy-iS1zF2wc.js";import"./vendor-charts-BtrAPO2T.js";import"./vendor-pdf-BVgqk7dV.js";import"./archive-Duo0Fte7.js";import"./rotate-ccw-Db98lGr_.js";import"./eye-quEojr7F.js";import"./trash-2-B5tMRo5v.js";const v=_.toolSpeakableSchema,U=[".article-summary",".article-intro","h1"];function ce({onBack:o,user:i,onDeductCredits:n,onRefundCredits:p}){const{t:s}=B(),u=D("speakable-schema"),[t,y]=m.useState({url:"",type:"Article",selectors:[...U],xpaths:[],useXpath:!1}),[h,N]=m.useState(!1),[w,b]=m.useState(null),c=(a,l)=>y(r=>({...r,[a]:l})),T=()=>c("selectors",[...t.selectors,""]),C=a=>c("selectors",t.selectors.filter((l,r)=>r!==a)),X=(a,l)=>c("selectors",t.selectors.map((r,x)=>x===a?l:r)),E=()=>c("xpaths",[...t.xpaths,""]),P=a=>c("xpaths",t.xpaths.filter((l,r)=>r!==a)),$=(a,l)=>c("xpaths",t.xpaths.map((r,x)=>x===a?l:r)),z=()=>{b(null);const a=!t.useXpath&&t.selectors.filter(r=>r.trim()).length>0,l=t.useXpath&&t.xpaths.filter(r=>r.trim()).length>0;if(!a&&!l){b(s("speakableSchemaTool.errorNoSelector"));return}n&&!n(v)||(N(!0),u.save({title:`Speakable : ${t.type} (${t.url||s("speakableSchemaTool.noUrl")})`,content:S(t),inputUrl:t.url||void 0,metadata:{type:t.type,useXpath:t.useXpath}}))},A=h?S(t):"",O=h?F(t):"";return e.jsx(L,{onBack:o,title:s("tools.speakableSchema.title"),description:s("tools.speakableSchema.description"),icon:f,color:"#0ea5e9",error:w,tip:s("speakableSchemaTool.tip"),form:e.jsxs("div",{className:"space-y-4",children:[e.jsx(k,{label:s("speakableSchemaTool.pageUrl"),children:e.jsxs("div",{className:"relative",children:[e.jsx(G,{size:12,className:"absolute left-3 top-1/2 -translate-y-1/2 text-white/30"}),e.jsx("input",{type:"text",value:t.url,onChange:a=>c("url",a.target.value),placeholder:"https://site.com/article",className:d+" pl-8"})]})}),e.jsx(k,{label:s("speakableSchemaTool.pageType"),children:e.jsx("div",{className:"grid grid-cols-2 gap-2",children:["Article","BlogPosting","NewsArticle","WebPage"].map(a=>e.jsx("button",{type:"button",onClick:()=>c("type",a),className:`py-2 rounded-xl text-[11px] font-semibold border transition ${t.type===a?"bg-[var(--accent)]/15 border-[var(--accent)]/30 text-[var(--accent)]":"bg-black/40 border-white/[0.06] text-white/50"}`,children:a},a))})}),e.jsxs("div",{className:"flex gap-2 p-1 bg-black/40 rounded-xl border border-white/[0.06]",children:[e.jsx("button",{type:"button",onClick:()=>c("useXpath",!1),className:`flex-1 py-2 rounded-lg text-xs font-semibold transition ${t.useXpath?"text-white/50":"bg-white/[0.06] text-white"}`,children:s("speakableSchemaTool.cssSelectorsRecommended")}),e.jsx("button",{type:"button",onClick:()=>c("useXpath",!0),className:`flex-1 py-2 rounded-lg text-xs font-semibold transition ${t.useXpath?"bg-white/[0.06] text-white":"text-white/50"}`,children:"XPath"})]}),t.useXpath?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-white/40",children:s("speakableSchemaTool.xpathExpressions")}),e.jsxs("button",{type:"button",onClick:E,className:"inline-flex items-center gap-1 text-[11px] text-[var(--accent)] hover:brightness-110",children:[e.jsx(j,{size:12})," ",s("speakableSchemaTool.add")]})]}),e.jsx("div",{className:"space-y-2",children:(t.xpaths.length===0?[""]:t.xpaths).map((a,l)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:a,onChange:r=>$(l,r.target.value),placeholder:"/html/body/article/h1",className:d+" font-mono text-[12px]"}),e.jsx("button",{type:"button",onClick:()=>P(l),className:"w-10 rounded-xl bg-white/[0.03] hover:bg-red-500/15 text-white/40 hover:text-red-400 flex items-center justify-center transition",children:e.jsx(g,{size:12})})]},l))})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2.5",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-white/40",children:s("speakableSchemaTool.cssSelectors")}),e.jsxs("button",{type:"button",onClick:T,className:"inline-flex items-center gap-1 text-[11px] text-[var(--accent)] hover:brightness-110",children:[e.jsx(j,{size:12})," ",s("speakableSchemaTool.add")]})]}),e.jsx("div",{className:"space-y-2",children:t.selectors.map((a,l)=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:a,onChange:r=>X(l,r.target.value),placeholder:l===0?".article-summary":l===1?".article-intro":"h1",className:d+" font-mono text-[12px]"}),e.jsx("button",{type:"button",onClick:()=>C(l),className:"w-10 rounded-xl bg-white/[0.03] hover:bg-red-500/15 text-white/40 hover:text-red-400 flex items-center justify-center transition",children:e.jsx(g,{size:12})})]},l))}),e.jsxs("p",{className:"text-[10px] text-white/40 mt-2",children:[s("speakableSchemaTool.examples")," ",e.jsx("code",{className:"text-[var(--accent)]",children:".tldr"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:".article-summary"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:"h1"}),", ",e.jsx("code",{className:"text-[var(--accent)]",children:".headline"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-white/50 bg-white/[0.02] border border-white/[0.06] rounded-xl px-3 py-2.5",children:[e.jsx(M,{size:12,className:"text-[var(--accent)]"}),e.jsxs("span",{children:[s("speakableSchemaTool.cost")," ",e.jsxs("strong",{className:"text-white",children:[v," GTO"]})]})]})]}),generateButton:e.jsxs("button",{type:"button",onClick:z,className:"w-full py-3 rounded-xl bg-[var(--accent)] text-black font-bold text-sm hover:brightness-110 transition inline-flex items-center justify-center gap-2",children:[e.jsx(f,{size:14})," ",s("speakableSchemaTool.buildButton")]}),result:h?e.jsx(R,{heading:"Speakable Schema",description:`${t.type} · ${s("speakableSchemaTool.selectorsCount",{count:t.useXpath?t.xpaths.filter(
1Boolean).length:t.selectors.filter(Boolean).length})}`,tabs:[{id:"jsonld",label:"JSON-LD",language:"json",content:A,filename:"speakable-schema.json"},{id:"html",label:"HTML (classes)",language:"html",content:O,filename:"speakable-markup.html"}],instructions:e.jsxs(e.Fragment,{children:[s("speakableSchemaTool.instructionsPart1")," ",e.jsx("code",{className:"text-[var(--accent)]",children:"<head>"}),"."," ",s("speakableSchemaTool.instructionsPart2")]}),footer:e.jsx(H,{toolType:"speakable-schema",handle:u})}):null})}function S(o){const i={"@type":"SpeakableSpecification"};if(o.useXpath){const p=o.xpaths.filter(s=>s.trim());p.length>0&&(i.xpath=p)}else{const p=o.selectors.filter(s=>s.trim());p.length>0&&(i.cssSelector=p)}const n={"@context":"https://schema.org","@type":o.type,...o.url?{url:o.url,mainEntityOfPage:{"@type":"WebPage","@id":o.url}}:{},speakable:i};return JSON.stringify(n,null,2)}function F(o){return`<!-- Assurez-vous que ces éléments existent dans votre HTML -->
2<article>
3  <h1>Titre de l'article</h1>
4${(o.useXpath?[]:o.selectors.filter(n=>n.trim())).filter(n=>n.startsWith(".")).map(n=>`  <div class="${n.slice(1)}">
5    <!-- Contenu récitable : 60-90 mots max, self-contained -->
6  </div>`).join(`
7`)}
8</article>`}const d="w-full bg-black/40 border border-white/[0.06] rounded-xl px-3 py-2.5 text-sm text-white placeholder:text-white/25 focus:border-[var(--accent)]/30 outline-none transition";function k({label:o,children:i}){return e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] font-semibold uppercase tracking-wider text-white/40 mb-1.5",children:o}),i]})}export{ce 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.