OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
3 document.addEventListener("DOMContentLoaded", function() | 3 document.addEventListener("DOMContentLoaded", function() |
4 { | 4 { |
5 | 5 |
6 /************************************************************************** | 6 /************************************************************************** |
7 * General | 7 * General |
8 **************************************************************************/ | 8 **************************************************************************/ |
9 | 9 |
10 // Change html class name from "no-js" to "js" | 10 // Change html class name from "no-js" to "js" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 .getElementById("no-content-for-platform-message") | 321 .getElementById("no-content-for-platform-message") |
322 .innerHTML; | 322 .innerHTML; |
323 | 323 |
324 document | 324 document |
325 .querySelector(".article-body") | 325 .querySelector(".article-body") |
326 .insertAdjacentElement("afterbegin", section); | 326 .insertAdjacentElement("afterbegin", section); |
327 } | 327 } |
328 | 328 |
329 BrowserSelect.prototype._onClickOrKeyDown = function(event) | 329 BrowserSelect.prototype._onClickOrKeyDown = function(event) |
330 { | 330 { |
331 if (!event.target.classList.contains("custom-select-option")) return; | 331 var option = event.target.closest(".custom-select-option"); |
| 332 if (!option) return; |
332 | 333 |
333 var IS_ENTER_KEY = event.key == "Enter" || event.keyCode == 13; | 334 var IS_ENTER_KEY = event.key == "Enter" || event.keyCode == 13; |
334 if (event.keyCode && !IS_ENTER_KEY) return; | 335 if (event.keyCode && !IS_ENTER_KEY) return; |
335 | 336 |
336 localStorage.removeItem(this.BROWSER_AUTODETECTED_STORAGE_KEY); | 337 localStorage.removeItem(this.BROWSER_AUTODETECTED_STORAGE_KEY); |
337 | 338 |
338 // Uncheck previously checked option | 339 // Uncheck previously checked option |
339 this.select | 340 this.select |
340 .querySelector("[aria-checked='true']") | 341 .querySelector("[aria-checked='true']") |
341 .setAttribute("aria-checked", "false"); | 342 .setAttribute("aria-checked", "false"); |
342 | 343 |
343 this.selectOption(event.target.getAttribute("data-value")); | 344 this.selectOption(option.getAttribute("data-value")); |
344 | 345 |
345 this.close(); | 346 this.close(); |
346 }; | 347 }; |
347 | 348 |
348 var browserSelect = document.getElementById("browser-select"); | 349 var browserSelect = document.getElementById("browser-select"); |
349 if (browserSelect) | 350 if (browserSelect) |
350 { | 351 { |
351 new BrowserSelect(browserSelect); | 352 new BrowserSelect(browserSelect); |
352 } | 353 } |
353 | 354 |
354 }, false); | 355 }, false); |
355 }()); | 356 }()); |
OLD | NEW |