-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathheadingStruct.txt
More file actions
1 lines (1 loc) · 1.41 KB
/
Copy pathheadingStruct.txt
File metadata and controls
1 lines (1 loc) · 1.41 KB
1
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 ")})();