@@ -98,6 +98,91 @@ npm run test:unit
9898npm run test:e2e
9999```
100100
101+ ## Architecture
102+
103+ ### DOM Structure and Element Cloning
104+
105+ This extension displays English version update information by cloning the existing ` article-metadata-footer ` element on Microsoft Learn pages.
106+
107+ #### HTML Structure
108+
109+ The Microsoft Learn page has the following structure:
110+
111+ ``` html
112+ <div data-main-column =" " >
113+ <div >
114+ <!-- Page header with breadcrumbs and actions -->
115+ <div id =" article-header" >...</div >
116+
117+ <!-- Article title -->
118+ <div class =" content" ><h1 >Title</h1 ></div >
119+
120+ <!-- Top metadata (existing) -->
121+ <div id =" article-metadata" >
122+ <div id =" user-feedback" >...</div >
123+ </div >
124+
125+ <!-- Our custom cloned element (inserted here - after article-metadata) -->
126+ <div id =" custom-header-from-article-metadata-footer" >
127+ <hr class =" hr" >
128+ <ul class =" metadata page-metadata" lang =" ja-jp" >
129+ <li >
130+ <span class =" badge" >Last updated on 2025/10/08</span >
131+ <p >英語版の更新日: <a href =" ..." >2025/4/10 (224 日前に更新)</a ></p >
132+ </li >
133+ </ul >
134+ </div >
135+
136+ <hr class =" hr" >
137+
138+ <!-- Article content -->
139+ <div class =" content" >...</div >
140+
141+ <!-- Feedback section and other components -->
142+
143+ <!-- Bottom metadata (clone source) -->
144+ <div id =" article-metadata-footer" >
145+ <hr class =" hr" >
146+ <ul class =" metadata page-metadata" >
147+ <li >
148+ <span class =" badge" >Last updated on 2025/10/08</span >
149+ </li >
150+ </ul >
151+ </div >
152+ </div >
153+ </div >
154+ ```
155+
156+ #### Cloning Strategy
157+
158+ The extension uses the following approach:
159+
160+ 1 . ** Clone Source** : ` article-metadata-footer ` element (bottom of the page)
161+ - This element contains the page's metadata structure with proper styling
162+
163+ 2 . ** Clone Process** :
164+ ``` javascript
165+ customContainer = articleMetadataFooter .cloneNode (true );
166+ customContainer .id = ' custom-header-from-article-metadata-footer' ;
167+ ```
168+
169+ 3 . ** Insertion Point** : Inserted immediately after ` article-metadata ` (top of the page)
170+ ``` javascript
171+ articleMetadata .insertAdjacentElement (' afterend' , customContainer);
172+ ```
173+
174+ 4 . ** Customization** :
175+ - Update the ` lang ` attribute to match the current page language
176+ - Add a new ` <p> ` element containing the English version update information
177+ - Apply appropriate styling based on whether the English version is newer
178+
179+ #### Why This Approach?
180+
181+ - ** Consistency** : By cloning the existing metadata footer, we inherit all the proper CSS classes and structure
182+ - ** Maintainability** : If Microsoft changes the metadata structure, our extension adapts automatically
183+ - ** Visibility** : Placing the update information near the top of the page ensures users see it immediately
184+ - ** Clone-based** : We clone from ` article-metadata-footer ` at the bottom but display at the top for better UX
185+
101186## Contribution
102187
103188Contributions are welcome! Follow these steps to contribute:
0 commit comments