|
132 | 132 | return '' |
133 | 133 | } |
134 | 134 |
|
135 | | - function create_placeholders_if_missing() { |
136 | | - const version_segment = version_segment_from_url(); |
137 | | - const language_segment = language_segment_from_url(); |
138 | | - const index = "/" + language_segment + version_segment; |
139 | | - |
140 | | - if (document.querySelectorAll('.version_switcher_placeholder').length > 0) { |
141 | | - return; |
142 | | - } |
143 | | - |
144 | | - const html = '<span class="language_switcher_placeholder"></span> \ |
145 | | -<span class="version_switcher_placeholder"></span> \ |
146 | | -<a href="/" id="indexlink">Documentation</a> »'; |
147 | | - |
148 | | - const probable_places = [ |
149 | | - "body>div.related>ul>li:not(.right):contains('Documentation'):first", |
150 | | - "body>div.related>ul>li:not(.right):contains('documentation'):first", |
151 | | - ]; |
152 | | - |
153 | | - for (let i = 0; i < probable_places.length; i++) { |
154 | | - let probable_place = $(probable_places[i]); |
155 | | - if (probable_place.length == 1) { |
156 | | - probable_place.html(html); |
157 | | - document.getElementById('indexlink').href = index; |
158 | | - return; |
159 | | - } |
160 | | - } |
161 | | - } |
162 | | - |
163 | 135 | document.addEventListener('DOMContentLoaded', function() { |
164 | 136 | const language_segment = language_segment_from_url(); |
165 | 137 | const current_language = language_segment.replace(/\/+$/g, '') || 'en'; |
166 | 138 | const version_select = build_version_select(DOCUMENTATION_OPTIONS.VERSION); |
167 | 139 |
|
168 | | - create_placeholders_if_missing(); |
169 | | - |
170 | 140 | let placeholders = document.querySelectorAll('.version_switcher_placeholder'); |
171 | 141 | placeholders.forEach(function(placeholder) { |
172 | 142 | placeholder.innerHTML = version_select; |
|
0 commit comments