File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -4351,4 +4351,4 @@ <h1 id="title" class="title">Web Content Accessibility Guidelines (WCAG) 2.2</h1
43514351 panel.hidden = true;
43524352 panel.classList.remove("docked");
43534353}
4354- })()</script><script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script></body></html>
4354+ })()</script><script src="https://www.w3.org/scripts/TR/2021/fixup.js"></script><script src="waic_link.js"></script>< /body></html>
Original file line number Diff line number Diff line change 1+ const trNote = "この文書内にあるリンクのうち、「Understanding WCAG 2.2」へのリンクについては、WAIC の公開する日本語版にリンク先を追加しています。WAIC の日本語訳は、 W3C の公開する英語版より内容が古い可能性がありますのでご注意ください。" ;
2+ const jaLinkText = '[日本語訳]' ;
3+ const jaLinkTitleSuffix = 'の日本語訳' ;
4+ const taregtUrlString = [ 'Understanding' ] ;
5+
6+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
7+ const lastTrNote = document . querySelector ( "aside.trnote>p:last-child" ) ;
8+ if ( lastTrNote ) lastTrNote . textContent = trNote ;
9+
10+ const w3cDocumentAnchors = document . querySelectorAll ( "a[href*=https\\:\\/\\/www\\.w3\\.org\\/WAI\\/WCAG22]" ) ;
11+ for ( let i = 0 ; i < w3cDocumentAnchors . length ; i ++ ) {
12+ const anchor = w3cDocumentAnchors [ i ] ;
13+ const href = anchor . getAttribute ( 'href' ) ;
14+ taregtUrlString . forEach ( taregtString => {
15+ if ( href . indexOf ( taregtString ) != - 1 ) {
16+ const jaLinkUrl = href . replace ( '\/\/www.w3.org\/WAI\/WCAG22\/' , '//waic.jp/translations/WCAG22/' ) ;
17+ const jaLinkTitle = '"' + anchor . textContent + '"' + jaLinkTitleSuffix ;
18+ const jaAnchor = document . createElement ( 'a' ) ;
19+ jaAnchor . setAttribute ( 'href' , jaLinkUrl ) ;
20+ jaAnchor . setAttribute ( 'title' , jaLinkTitle ) ;
21+ jaAnchor . textContent = jaLinkText ;
22+ anchor . parentNode . insertBefore ( jaAnchor , anchor . nextSibling ) ;
23+ jaAnchor . parentNode . insertBefore ( document . createTextNode ( " " ) , jaAnchor ) ;
24+ }
25+ } )
26+ }
27+ } ) ;
You can’t perform that action at this time.
0 commit comments