|
102 | 102 | <li class="nav-item"> |
103 | 103 | <a class="nav-link newnavbar" href="https://www.splunk.com/en_us/training/course-catalog.html?sort=Newest&filters=filterGroup4SplunkObservabilityCloud%2CfilterGroup4SplunkSyntheticMonitoring%2CfilterGroup4SplunkInfrastructureMonitoring%2CfilterGroup4SplunkITSI%2CfilterGroup4SplunkAPM%2CfilterGroup4SplunkOnCall%2CfilterGroup4SplunkRUM%2CfilterGroup4SplunkLogObserver%2CfilterGroup4SplunkInsights" target="_blank">Training</a> |
104 | 104 | </li> |
| 105 | + <li class="nav-item nav-lang"> |
| 106 | + <span class="lang" data-lang="en">EN</span> | <span class="lang" data-lang="ja">JA</span> |
| 107 | + </li> |
105 | 108 | <li class="nav-item"> |
106 | 109 | <a class="nav-link newnavbar" href="https://www.splunk.com/en_us/download/infrastructure-monitoring.html" target="_blank" style=" |
107 | 110 | font-size: 12px; |
|
118 | 121 | </ul> |
119 | 122 | </div> |
120 | 123 |
|
| 124 | + <style> |
| 125 | + .nav-lang{ |
| 126 | + margin-top: 18px; |
| 127 | + color:darkgrey; |
| 128 | + } |
| 129 | + .active-lang { |
| 130 | + font-weight: bold; |
| 131 | + color: white !important; |
| 132 | + } |
| 133 | + .lang{ |
| 134 | + cursor:pointer; |
| 135 | + } |
| 136 | + </style> |
| 137 | + <script> |
| 138 | + $(document).ready(function() { |
| 139 | + function setActiveLanguage() { |
| 140 | + var path = window.location.pathname; |
| 141 | + $('.lang').each(function() { |
| 142 | + var lang = $(this).data('lang'); |
| 143 | + if (path.includes('/' + lang + '/')) { |
| 144 | + $(this).addClass('active-lang').css({ |
| 145 | + "font-weight": "bold", |
| 146 | + "color": "red" |
| 147 | + }); |
| 148 | + } else { |
| 149 | + $(this).removeClass('active-lang').removeAttr('style'); |
| 150 | + } |
| 151 | + }); |
| 152 | + } |
| 153 | + |
| 154 | + setActiveLanguage(); |
| 155 | + |
| 156 | + function constructNewPath(lang) { |
| 157 | + var currentPath = window.location.pathname; |
| 158 | + var pathSegments = currentPath.split('/'); |
| 159 | + var langIndex = pathSegments.findIndex(segment => $('.lang').map(function() { return $(this).data('lang'); }).get().includes(segment)); |
| 160 | + |
| 161 | + if (langIndex > -1) { |
| 162 | + pathSegments[langIndex] = lang; |
| 163 | + } else { |
| 164 | + pathSegments.splice(1, 0, lang); |
| 165 | + } |
| 166 | + |
| 167 | + return pathSegments.join('/'); |
| 168 | + } |
| 169 | + |
| 170 | + $('.lang').click(function() { |
| 171 | + var lang = $(this).data('lang'); |
| 172 | + var newPath = constructNewPath(lang); |
| 173 | + window.location.pathname = newPath; |
| 174 | + |
| 175 | + setActiveLanguage(); |
| 176 | + }); |
| 177 | + }); |
| 178 | + </script> |
| 179 | + |
121 | 180 | <div id="mobileSideBar"> |
122 | 181 | {%- block sidebar2 %}{{ sidebar() }}{% endblock %} |
123 | 182 | </div> |
|
0 commit comments