 Issue 29596595:
  Issue 5912 - Hide/Show Content based on selected browser on help.eyeo.com article pages  (Closed) 
  Base URL: https://hg.adblockplus.org/help.eyeo.com
    
  
    Issue 29596595:
  Issue 5912 - Hide/Show Content based on selected browser on help.eyeo.com article pages  (Closed) 
  Base URL: https://hg.adblockplus.org/help.eyeo.com| Index: static/js/main.js | 
| =================================================================== | 
| --- a/static/js/main.js | 
| +++ b/static/js/main.js | 
| @@ -301,18 +301,36 @@ | 
| .getElementById('browser-select-autodetected') | 
| .innerHTML; | 
| selectedOption += "<span class='muted'>(" + autodetected + ")</span>"; | 
| } | 
| this.select | 
| .querySelector(".custom-select-selected") | 
| .innerHTML = selectedOption; | 
| + | 
| + this.checkBrowserContent(browser); | 
| }; | 
| + BrowserSelect.prototype.checkBrowserContent = function(browser) | 
| 
juliandoucette
2017/11/06 15:56:05
NIT: I don't think that this method name is descri
 
ire
2017/11/08 07:46:59
I think you're right.
Since the method was essent
 | 
| + { | 
| + var browserContent = document.querySelector(".platform-" + browser); | 
| + if (browserContent) return; | 
| + | 
| + var section = document.createElement("section"); | 
| 
juliandoucette
2017/11/06 15:56:05
TOL: This could be done with fewer lines of code e
 
ire
2017/11/08 07:46:59
I think it does matter where the unsupported messa
 | 
| + section.classList.add("platform-" + browser); | 
| + section.innerHTML = document | 
| + .getElementById("no-content-for-platform-message") | 
| + .innerHTML; | 
| + | 
| + document | 
| 
juliandoucette
2017/11/06 10:45:00
Why insert this instead of adding a class to the b
 
ire
2017/11/06 14:27:20
I think it makes sense semantically this way. Beca
 | 
| + .querySelector(".article-body") | 
| + .insertAdjacentElement('afterbegin', section); | 
| + } | 
| + | 
| BrowserSelect.prototype._onClickOrKeyDown = function(event) | 
| { | 
| if (!event.target.classList.contains("custom-select-option")) return; | 
| var IS_ENTER_KEY = event.key == "Enter" || event.keyCode == 13; | 
| if (event.keyCode && !IS_ENTER_KEY) return; | 
| localStorage.removeItem(this.BROWSER_AUTODETECTED_STORAGE_KEY); |