PageSourceSearch

https://auricartisan.com/js/common/portfolio-check.js

js auricartisan.com collected 2026-09-24 14:38:55 UTC 12,848 bytes, 4 lines download raw bytes

1var ae=Object.defineProperty;var c=(y,M)=>ae(y,"name",{value:M,configurable:!0});const AA=4.5,AA_LARGE=3,TAP=24;(function(){const y=document.getElementById("pf-check"),M=document.getElementById("pf-check-dot");if(!y)return;function z(e){const n=String(e).trim(),t=n.match(/^rgba?\(([^)]+)\)/);if(t){const a=t[1].split(/[,\s/]+/).filter(Boolean).map(Number);return a.length<3||a.some(i=>Number.isNaN(i))?null:{r:a[0],g:a[1],b:a[2],a:a.length>3?a[3]:1}}const o=n.match(/^color\(\s*([\w-]+)\s+([^)]+)\)/);if(o){const a=o[1],i=o[2].split(/[\s/]+/).filter(Boolean).map(h=>h.endsWith("%")?parseFloat(h)/100:Number(h));if(i.length<3||i.slice(0,3).some(h=>Number.isNaN(h)))return null;const r=i.length>3&&!Number.isNaN(i[3])?i[3]:1;if(a==="srgb")return{r:i[0]*255,g:i[1]*255,b:i[2]*255,a:r};if(a==="srgb-linear"){const h=c(p=>p<=.0031308?p*12.92:1.055*p**.4166666666666667-.055,"enc");return{r:h(i[0])*255,g:h(i[1])*255,b:h(i[2])*255,a:r}}return null}return n==="transparent"?{r:0,g:0,b:0,a:0}:null}c(z,"parse");function F({r:e,g:n,b:t}){const o=[e,n,t].map(a=>a/255).map(a=>a<=.03928?a/12.92:((a+.055)/1.055)**2.4);return .2126*o[0]+.7152*o[1]+.0722*o[2]}c(F,"lum");function B(e,n){const t=e.a??1;return t>=1?e:{r:e.r*t+n.r*(1-t),g:e.g*t+n.g*(1-t),b:e.b*t+n.b*(1-t),a:1}}c(B,"over");function K(e,n){const t=F(B(e,n)),o=F(n);return(Math.max(t,o)+.05)/(Math.min(t,o)+.05)}c(K,"ratio");const N=c(({r:e,g:n,b:t})=>"#"+[e,n,t].map(o=>Math.round(o).toString(16).padStart(2,"0")).join("").toUpperCase(),"hex");function X(e,n){let t=e;for(;t&&t!==n.parentNode;){const o=z(getComputedStyle(t).backgroundColor);if(o&&(o.a??1)>.05)return o;t=t.parentElement||t.parentNode&&t.parentNode.host||null}return{r:255,g:255,b:255,a:1}}c(X,"backdrop");function H(){const e=document.getElementById("pf-preview");return e&&e.shadowRoot&&e.shadowRoot.querySelector(".pf-render")||null}c(H,"renderRoot");function A(e,n){let t=e;for(;t&&t!==n;){if(t.classList&&(t.classList.contains("pf-b")||t.classList.contains("pf-hero")))return t;t=t.parentElement}return null}c(A,"blockOf");function x(e){if(!e)return"the page";if(e.classList.contains("pf-hero"))return"header";const n=e.className.match(/pf-b--([a-z]+)/);return n?n[1]:"a section"}c(x,"blockName");const J=/^(click here|here|read more|more|link|this|learn more|see more)$/i,L=c(e=>!e.closest("[data-pf-chrome]"),"mine");function Q(){const e=H();if(!e)return null;const n=[];let t=0;for(const i of e.querySelectorAll("*")){if(!L(i)||![...i.childNodes].some(d=>d.nodeType===3&&/[\p{L}\p{N}]/u.test(d.textContent)))continue;const h=getComputedStyle(i);if(h.visibility==="hidden"||h.display==="none")continue;const p=z(h.color);if(p&&(p.a??1)<.05)continue;if(!p){n.push({key:"unreadable:"+h.color,level:"warn",title:"A colour this check could not read",where:`${h.color} \xB7 ${x(A(i,e))}`,why:`This text is ${h.color}, in a colour space this check does not measure. It has not been graded, so treat it as unknown rather than as passing.`,fix:"Pick this colour from the Style pane, which works in sRGB and is graded.",el:i});continue}const m=X(i,e),v=parseFloat(h.fontSize)||16,C=parseInt(h.fontWeight,10)||400,l=v>=24||v>=18.66&&C>=700,f=l?3:4.5,u=K(p,m);if(t++,u<f){const d=A(i,e);n.push({key:"pair:"+N(B(p,m))+":"+N(m),swatch:{fg:N(B(p,m)),bg:N(m),ratio:u,need:f},level:u<f-1.2?"bad":"warn",title:l?"Large text below AA":"Text below AA",where:`${u.toFixed(2)}:1 \xB7 ${x(d)}`,why:`${N(B(p,m))} on ${N(m)} is ${u.toFixed(2)}:1, and text at ${Math.round(v)}px${C>=700?" bold":""} needs ${f}:1. WCAG 1.4.3 is about ordinary vision in ordinary light, not unusual cases.`,fix:l?"Deepen this colour, or set the text larger so the 3:1 threshold applies.":"Take a darker step from the same palette in Style, or change the paper.",el:i})}}for(const i of e.querySelectorAll("a")){if(!L(i))continue;const r=(i.textContent||"").trim();r?J.test(r)&&n.push({key:"link-vague",level:"bad",title:"A link that does not say where it goes",where:`"${r}" \xB7 ${x(A(i,e))}`,why:`Screen-reader users pull up a list of a page\u2019s links and read them out of context. "${r}" in that list is one of several identical entries \u2014 WCAG 2.4.4 is about exactly this.`,fix:"Name the destination in the link itself.",el:i}):n.push({key:"link-empty",level:"bad",title:"A link with no text",where:x(A(i,e)),why:"A link with nothing readable inside it is announced as its URL, or as nothing at all.",fix:"Give it text, or an aria-label if it is deliberately an icon.",el:i})}for(const i of e.querySelectorAll("img"))L(i)&&i.getAttribute("alt")===null&&n.push({key:"img-alt",level:"bad",title:"An image with no alt text",where:x(A(i,e)),why:'Without an alt attribute a screen reader falls back to the file name. An empty alt="" is a valid answer \u2014 it says the image is decorative \u2014 but a missing one says nothing was decided.',fix:'Describe what the image shows, or set alt="" if it is decoration.',el:i});const o=[...e.querySelectorAll("h1,h2,h3,h4,h5,h6")].filter(L);let a=0;for(const i of o){const r=+i.tagName[1];a&&r>a+1&&n.push({key:`heading:${a}:${r}`,level:"warn",title:`Heading jumps from h${a} to h${r}`,where:x(A(i,e)),why:"Screen-reader users navigate by heading level. A skipped level reads as a missing section.",fix:`Make this an h${a+1}, or add the level it skipped.`,el:i}),a=r}for(const i of e.querySelectorAll("a, button")){if(!L(i))continue;const r=i.getBoundingClientRect();!r.width||!r.height||r.height<24&&r.width<24&&n.push({key:"target",level:"warn",title:"A target smaller than 24px",where:`${Math.round(r.width)}\xD7${Math.round(r.height)} \xB7 ${x(A(i,e))}`,why:"WCAG 2.5.8 asks 24px in both directions for anything you tap, and a phone is where this page gets read.",fix:"Give it padding, or set a minimum height.",el:i})}return{findings:n,checked:t}}c(Q,"audit");let T=null,G=!1;const O=c(e=>{G=!0;try{e()}finally{requestAnimationFrame(()=>{G=!1})}},"ownWrite");function j(){if(!T)return;const e=T;T=null,O(()=>{e.style.outline="",e.style.outlineOffset=""})}c(j,"clearMark");function D(e,n){if(j(),!(!e||!e.isConnected)){T=e,O(()=>{e.style.outline=`2px solid ${n==="bad"?"#c62828":"#a97a12"}`,e.style.outlineOffset="3px"});try{e.scrollIntoView({block:"center",behavior:"auto"})}catch{}}}c(D,"mark");function U(e,n){for(const t of["pf-publish-open"]){const o=document.getElementById(t);o&&(o.disabled=e>0,o.title=e>0?`${e} thing${e===1?"":"s"} to fix in Check before this can go online`:"",o.classList.toggle("is-blocked",e>0))}M&&(M.hidden=e+n===0,M.classList.toggle("is-warn",e===0&&n>0),M.title=e?`${e} blocking`:n?`${n} worth a look`:"")}c(U,"gate");const s=c((e,n,t)=>{const o=document.createElement(e);return n&&(o.className=n),t!=null&&(o.textContent=t),o},"el"),Y=c((e,n=15)=>`<svg width="${n}" height="${n}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`,"svg");function Z(e){const n=new Map;for(const t of e){const o=t.key||t.title,a=n.get(o);a?(a.all.push(t),t.level==="bad"&&(a.level="bad"),t.swatch&&a.first.swatch&&t.swatch.ratio<a.first.swatch.ratio&&(a.first=t)):n.set(o,{key:o,level:t.level,first:t,all:[t]})}return[...n.values()].sort((t,o)=>(t.level===o.level?0:t.level==="bad"?-1:1)||o.all.length-t.all.length)}c(Z,"group");const ee=c(()=>window.AAPortfolioRender&&window.AAPortfolioRender.css||"","RENDER_CSS"),te=460;function ne(e,n,t){const o=e.getBoundingClientRect();if(!o.width||!o.height)return null;const a=s("div","pfc__map"),i=s("div","pfc__map-stage"),h=Math.max(180,(y.clientWidth||520)-28)/o.width,p=Math.max(Math.min(h,te/o.height,1),h*.5);i.style.inlineSize=Math.round(o.width*p)+"px",i.style.blockSize=Math.round(o.height*p)+"px";const m=s("div","pfc__map-shell"),v=m.attachShadow({mode:"open"}),C=document.createElement("style");C.textContent=ee()+`
2:host{display:block}
3.pf-render{margin:0}
4.pf-render *{animation:none!important;transition:none!important}`;const l=e.cloneNode(!0);l.removeAttribute("id"),l.querySelectorAll("[data-pf-chrome]").forEach(d=>d.remove()),l.querySelectorAll("img").forEach(d=>{d.loading="eager",d.removeAttribute("data-pf-img-broken")}),l.querySelectorAll("[contenteditable]").forEach(d=>d.removeAttribute("contenteditable")),v.append(C,l),m.style.inlineSize=Math.round(o.width)+"px",m.style.blockSize=Math.round(o.height)+"px",m.style.transform=`scale(${p})`,i.appendChild(m);const f=[],u=o.height*p;
4return n.forEach((d,w)=>{const S=d.first.el;if(!S||!S.isConnected)return;const g=S.getBoundingClientRect();if(!g.width&&!g.height)return;const E=(g.left+Math.min(g.width/2,26)-o.left)/o.width*100;let b=(g.top+g.height/2-o.top)*p;for(let _=0;_<f.length;_++)Math.abs(f[_].x-E)<6&&Math.abs(f[_].y-b)<19&&(b=f[_].y+19,_=-1);b=Math.max(11,Math.min(b,u-11)),f.push({x:E,y:b});const k=s("button","pfc__pin is-"+d.level,String(w+1));k.type="button",k.title=`${d.first.title} \u2014 ${d.all.length} place${d.all.length===1?"":"s"}`,k.style.insetInlineStart=E+"%",k.style.insetBlockStart=b+"px",k.addEventListener("click",()=>t(w)),i.appendChild(k)}),a.appendChild(i),a}c(ne,"buildMap");let R=null,W="all";function V(e){if(!e)return;const n=R===e.key;R=n?null:e.key,$(),n||D(e.first.el,e.level)}c(V,"select");function $(){const e=Q(),n=y.scrollTop;if(y.textContent="",j(),!e){y.appendChild(s("p","pfc__empty","The preview has not rendered yet.")),U(0,0);return}const{findings:t,checked:o}=e,a=t.filter(l=>l.level==="bad").length,i=t.length-a;if(U(a,i),!t.length){const l=s("div","pfc__score");l.appendChild(s("span","pfc__score-v is-ok","\u2713")),l.appendChild(s("span","pfc__score-l",`${o} text pairs checked against WCAG 2.2 AA. Nothing to fix.`)),y.appendChild(l);const f=s("div","pfc__clean");f.innerHTML=Y('<path d="M12 3l8 3.5v5c0 5-3.4 8.7-8 9.5-4.6-.8-8-4.5-8-9.5v-5z"/><path d="m9 12 2 2 4-4"/>',28),f.appendChild(s("p",null,"Every pair on this page clears AA, each link says where it goes, and the headings run in order.")),y.appendChild(f);return}const r=Z(t),h=r.filter(l=>W==="all"?!0:W==="bad"?l.level==="bad":String(l.key).startsWith("pair:")),p=s("div","pfc__score");p.appendChild(s("span","pfc__score-v "+(a?"is-bad":"is-warn"),String(r.length))),p.appendChild(s("span","pfc__score-l",`${r.length===1?"fault":"faults"} on this page, in ${t.length} place${t.length===1?"":"s"}. `+(a?`${a} of those would stop it going online.`:"None of them blocks publishing."))),y.appendChild(p);const m=ne(H(),h,l=>V(h[l]));m&&y.appendChild(m);const v=[["all","All",r.length],["bad","Blocking",r.filter(l=>l.level==="bad").length],["pair","Contrast",r.filter(l=>String(l.key).startsWith("pair:")).length]].filter(([,,l])=>l>0);if(v.length>2&&r.length>=4){const l=s("div","pfc__filters");for(const[f,u,d]of v){const w=s("button","pfc__chip"+(W===f?" is-on":""),"");w.type="button",w.appendChild(s("span",null,u)),w.appendChild(s("span","pfc__chip-n",String(d))),w.addEventListener("click",()=>{W=f,R=null,$()}),l.appendChild(w)}y.appendChild(l)}const C=s("ul","pfc__list");h.forEach((l,f)=>{const u=l.first,d=document.createElement("li"),w=s("button","pfc__f"+(R===l.key?" is-on":""));w.type="button",w.appendChild(s("span","pfc__f-n is-"+l.level,String(f+1)));const S=s("span","pfc__f-b");if(S.appendChild(s("span","pfc__f-t",u.title)),S.appendChild(s("span","pfc__f-w",u.where)),w.appendChild(S),u.swatch){const g=s("span","pfc__sw");g.style.background=u.swatch.bg,g.style.color=u.swatch.fg,g.textContent="Aa",g.title=`${u.swatch.fg} on ${u.swatch.bg}`,w.appendChild(g)}if(l.all.length>1&&w.appendChild(s("span","pfc__f-x","\xD7"+l.all.length)),w.addEventListener("click",()=>V(l)),d.appendChild(w),R===l.key){const g=s("div","pfc__why");g.appendChild(s("p","pfc__why-p",u.why));const E=s("div","pfc__fix");if(E.appendChild(s("p","pfc__fix-l","The fix")),E.appendChild(s("p","pfc__fix-p",u.fix)),g.appendChild(E),l.all.length>1){const b=s("div","pfc__walk");b.appendChild(s("span","pfc__walk-l",`${l.all.length} places on the page`));const k=s("div","pfc__walk-b");l.all.slice(0,24).forEach((_,oe)=>{const q=s("button","pfc__walk-i",String(oe+1));q.type="button",q.title=_.where,q.addEventListener("click",le=>{le.stopPropagation(),D(_.el,_.level)}),k.appendChild(q)}),l.all.length>24&&k.appendChild(s("span","pfc__walk-m",`+${l.all.length-24}`)),b.appendChild(k),g.appendChild(b)}d.appendChild(g)}C.appendChild(d)}),y.appendChild(C),y.scrollTop=n}c($,"paint");let I=!1;const ie=c(()=>{I||G||(I=!0,requestAnimationFrame(()=>{I=!1,$()}))},"recheck"),P=document.getElementById("pf-preview");if(P){const e=c(()=>{const t=P.shadowRoot;t&&new MutationObserver(ie).observe(t,{childList:!0,subtree:!0,attributes:!0}),$()},"start");let n=0;c(function t(){if(P.shadowRoot){e();return}if(n++>60){$();return}setTimeout(t,60)},"ready")()}document.getElementById("pf-mode-check")?.addEventListener("click",()=>setTimeout($,60)),window.AAPortfolioCheck={run:$}})();

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.