File tree Expand file tree Collapse file tree 4 files changed +25
-22
lines changed
Expand file tree Collapse file tree 4 files changed +25
-22
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,8 @@ export default function initializeEvents () {
192192 } )
193193 } )
194194
195+ if ( ! document . querySelector ( '.sidebar-products' ) ) return
196+
195197 // Navigate event
196198 Array . from (
197199 document . querySelectorAll ( '.sidebar-products details' )
Original file line number Diff line number Diff line change @@ -19,26 +19,23 @@ import filterCodeExamples from './filter-code-examples'
1919import allArticles from './all-articles'
2020import devToc from './dev-toc'
2121
22- if ( location . pathname . endsWith ( '/dev-toc' ) ) {
22+ document . addEventListener ( 'DOMContentLoaded' , async ( ) => {
23+ displayPlatformSpecificContent ( )
24+ explorer ( )
25+ search ( )
26+ nav ( )
27+ browserDateFormatter ( )
28+ deprecationBanner ( )
29+ sidebar ( )
30+ wrapCodeTerms ( )
31+ print ( )
32+ localization ( )
33+ await fillCsrf ( ) // this must complete before any POST calls
34+ helpfulness ( )
35+ experiment ( )
36+ copyCode ( )
37+ initializeEvents ( )
38+ filterCodeExamples ( )
39+ allArticles ( )
2340 devToc ( )
24- } else {
25- document . addEventListener ( 'DOMContentLoaded' , async ( ) => {
26- displayPlatformSpecificContent ( )
27- explorer ( )
28- search ( )
29- nav ( )
30- browserDateFormatter ( )
31- deprecationBanner ( )
32- sidebar ( )
33- wrapCodeTerms ( )
34- print ( )
35- localization ( )
36- await fillCsrf ( ) // this must complete before any POST calls
37- helpfulness ( )
38- experiment ( )
39- copyCode ( )
40- initializeEvents ( )
41- filterCodeExamples ( )
42- allArticles ( )
43- } )
44- }
41+ } )
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ export default function () {
33 const hamburgerButton = document . querySelector ( '.nav-mobile-burgerIcon' )
44 const mobileDropdown = document . querySelector ( '.nav-mobile-dropdown' )
55
6+ if ( ! ( hamburgerButton && mobileDropdown ) ) return
7+
68 hamburgerButton . addEventListener ( 'click' , ( event ) => {
79 event . preventDefault ( )
810 hamburgerButton . classList . toggle ( 'js-open' )
Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ const resultTemplate = (item) => {
6363}
6464
6565export default function ( ) {
66+ if ( ! document . querySelector ( '#search-results-container' ) ) return
67+
6668 window . initialPageLoad = true
6769 const opts = {
6870
You can’t perform that action at this time.
0 commit comments