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

Delta Between Two Patch Sets: static/src/js/main.js

Issue 29607560: Issue 6003 - Better handling of no-content-for-platform-message on help.eyeo.com (Closed) Base URL: https://hg.adblockplus.org/help.eyeo.com
Left Patch Set: Rebased Created Dec. 12, 2017, 10:02 a.m.
Right Patch Set: Addressed NITs Created Dec. 12, 2017, 10:20 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | static/src/scss/components/_article.scss » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /*! 1 /*!
2 * This file is part of help.eyeo.com. 2 * This file is part of help.eyeo.com.
3 * Copyright (C) 2017-present eyeo GmbH 3 * Copyright (C) 2017-present eyeo GmbH
4 * 4 *
5 * help.eyeo.com is free software: you can redistribute it and/or modify 5 * help.eyeo.com is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or 7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 * 9 *
10 * help.eyeo.com is distributed in the hope that it will be useful, 10 * help.eyeo.com is distributed in the hope that it will be useful,
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 /************************************************************************** 247 /**************************************************************************
248 * BrowserSelect 248 * BrowserSelect
249 **************************************************************************/ 249 **************************************************************************/
250 250
251 function BrowserSelect(select) 251 function BrowserSelect(select)
252 { 252 {
253 this.select = select; 253 this.select = select;
254 CustomSelect.apply(this, [this.select]); 254 CustomSelect.apply(this, [this.select]);
255 this.noContentMessage = document.getElementById("no-content-for-platform-m essage"); 255 this.noContentMessage = document.getElementById("no-content-for-platform-n otice");
256 256
257 this.BROWSER_STORAGE_KEY = "BROWSER"; 257 this.BROWSER_STORAGE_KEY = "BROWSER";
258 this.BROWSER_AUTODETECTED_STORAGE_KEY = "BROWSER_AUTODETECTED"; 258 this.BROWSER_AUTODETECTED_STORAGE_KEY = "BROWSER_AUTODETECTED";
259 this.SUPPORTED_BROWSERS = ["chrome", "opera", "samsungBrowser", 259 this.SUPPORTED_BROWSERS = ["chrome", "opera", "samsungBrowser",
260 "yandexbrowser", "maxthon", "msie", 260 "yandexbrowser", "maxthon", "msie",
261 "msedge", "firefox", "ios", "safari"]; 261 "msedge", "firefox", "ios", "safari"];
262 this.DEFAULT_BROWSER = "chrome"; 262 this.DEFAULT_BROWSER = "chrome";
263 263
264 this.setCurrentArticleSupportedBrowsers(); 264 this.setCurrentArticleSupportedBrowsers();
265 265
(...skipping 14 matching lines...) Expand all
280 BrowserSelect.prototype = Object.create(CustomSelect.prototype); 280 BrowserSelect.prototype = Object.create(CustomSelect.prototype);
281 BrowserSelect.prototype.constructor = BrowserSelect; 281 BrowserSelect.prototype.constructor = BrowserSelect;
282 282
283 BrowserSelect.prototype.setCurrentArticleSupportedBrowsers = function() 283 BrowserSelect.prototype.setCurrentArticleSupportedBrowsers = function()
284 { 284 {
285 for (var i = 0; i < this.SUPPORTED_BROWSERS.length; i++) 285 for (var i = 0; i < this.SUPPORTED_BROWSERS.length; i++)
286 { 286 {
287 var supportedBrowser = this.SUPPORTED_BROWSERS[i]; 287 var supportedBrowser = this.SUPPORTED_BROWSERS[i];
288 if (!document.querySelector(".platform-"+supportedBrowser)) 288 if (!document.querySelector(".platform-"+supportedBrowser))
289 { 289 {
290 this.noContentMessage.querySelector("[data-value='" + supportedBrowser + "']") 290 this.noContentMessage
291 .querySelector("[data-value='" + supportedBrowser + "']")
291 .setAttribute("hidden", "true"); 292 .setAttribute("hidden", "true");
292 } 293 }
293 } 294 }
294 }; 295 };
295 296
296 BrowserSelect.prototype.detectBrowser = function() 297 BrowserSelect.prototype.detectBrowser = function()
297 { 298 {
298 for (var i = 0; i < this.SUPPORTED_BROWSERS.length; i++) 299 for (var i = 0; i < this.SUPPORTED_BROWSERS.length; i++)
299 { 300 {
300 var supportedBrowser = this.SUPPORTED_BROWSERS[i]; 301 var supportedBrowser = this.SUPPORTED_BROWSERS[i];
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 .setAttribute("aria-checked", "false"); 370 .setAttribute("aria-checked", "false");
370 371
371 this.selectOption(option.getAttribute("data-value")); 372 this.selectOption(option.getAttribute("data-value"));
372 373
373 this.close(); 374 this.close();
374 }; 375 };
375 376
376 BrowserSelect.prototype._onClickNoContentMessage = function(event) 377 BrowserSelect.prototype._onClickNoContentMessage = function(event)
377 { 378 {
378 if (event.target.tagName != "BUTTON") return; 379 if (event.target.tagName != "BUTTON") return;
379 380 this.selectOption(event.target.parentElement.getAttribute("data-value"));
380 var browser = event.target.parentElement.getAttribute("data-value");
381 this.selectOption(browser);
382 }; 381 };
383 382
384 var browserSelect = document.getElementById("browser-select"); 383 var browserSelect = document.getElementById("browser-select");
385 if (browserSelect) 384 if (browserSelect)
386 { 385 {
387 new BrowserSelect(browserSelect); 386 new BrowserSelect(browserSelect);
388 } 387 }
389 388
390 }, false); 389 }, false);
391 }()); 390 }());
LEFTRIGHT

Powered by Google App Engine
This is Rietveld