Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: static/js/main.js

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
Patch Set: Created Nov. 3, 2017, 10:23 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« globals/browsers.py ('K') | « globals/browsers.py ('k') | static/scss/base/_variables.scss » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld