-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtranscriptCheck.html
More file actions
9 lines (8 loc) · 2.06 KB
/
transcriptCheck.html
File metadata and controls
9 lines (8 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
<html lang="en">
<head>
<title>CSUN Bookmarklet Heading Structure</title>
</head>
<body><h1>Heading Structure Bookmarklet</h1>
<p>Copy the bookmark link below to your browser's bookmark bar.</p>
<a href="javascript:(function(){var e=document.title,t=window.location.href,n=new Date().toLocaleDateString(),o=Array.from(document.querySelectorAll("h1, h2, h3, h4, h5, h6, heading, [role='heading']")),a=[],r=!1,l=0;o.forEach(function(e){var t=parseInt(e.tagName.slice(1))||parseInt(e.getAttribute("aria-level")),n=e.textContent.trim();1===t&&(r=!0),t-l>1&&a.push("[WCAG 1.3.1 Info and Relationships] Heading level skipped from "+l+" to "+t),n||a.push("[WCAG 2.4.6 Headings and Labels] Empty heading at level "+t),a.push("<li style='margin-left: "+(t-1)*20+"px;'>"+n+" (Level "+t+")</li>"),l=t}),r||(a.unshift("[WCAG 1.3.1 Info and Relationships] No heading level 1 found"),o.filter(function(e){return 1===parseInt(e.tagName.slice(1))||1===parseInt(e.getAttribute("aria-level"))}).length>1&&a.unshift("[WCAG 1.3.1 Info and Relationships] Multiple heading level 1 found"));var i=window.open("","Heading Report","width=600,height=400");i.document.write("\n <html>\n <head>\n <title>Heading Report</title>\n <style>\n body { font-family: Arial, sans-serif; }\n ul { list-style-type: none; padding-left: 0; }\n </style>\n </head>\n <body>\n <h1>Heading Report</h1>\n <p><strong>Page Title:</strong> "+e+"</p>\n <p><strong>Page URL:</strong> "+t+"</p>\n <p><strong>Report Date:</strong> "+n+"</p>\n <ul>"+a.join("")+"</ul>\n </body>\n </html>\n ")})();">Heading Structure Bookmarklet</a>
</body></html>