Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: src/site/js/Switcher.dart

Issue 1394993002: Doing some cleanup. (Closed) Base URL: https://github.com/dart-lang/www.dartlang.org.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/tests/site/code/Switcher.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/site/js/Switcher.dart
diff --git a/src/site/js/Switcher.dart b/src/site/js/Switcher.dart
deleted file mode 100644
index 828f00a62f5c4674e03a7cb1e4c65fa6442edc52..0000000000000000000000000000000000000000
--- a/src/site/js/Switcher.dart
+++ /dev/null
@@ -1,45 +0,0 @@
-// XXX: This file isn't used right now
-
-import 'dart:html';
-
-final List<String> osList = const <String>['macos', 'windows', 'linux']; // all supported OSs
-String osName = 'linux'; // the currently displayed platform
-
-/** Initializes osName and selects the corresponding radio button. */
-void detectPlatform() {
- // osName is initially 'linux', since linux strings are unpredictable.
- if (window.navigator.appVersion.contains('Win')) {
- osName = 'windows';
- } else if (window.navigator.appVersion.contains('Mac')) {
- osName = 'macos';
- }
- document.querySelector('#$osName').attributes['checked'] = 'true';
-}
-
-/** Shows the text for the chosen platform (and no other). */
-void filterPlatformText() {
- // Get all the platform-specific elements.
- osList.forEach((os) {
- bool shouldShow = (os == osName);
- document.querySelectorAll('.$os').forEach((el) {
- el.hidden = !shouldShow; // Show or hide each element.
- });
- });
-}
-
-/** Allows the user to choose the OS. */
-void registerHandlers() {
- osList.forEach((os) {
- document.querySelector('#$os').onClick.listen((e) {
- osName = os;
- filterPlatformText();
- });
- });
-}
-
-/** Ready, set, go! */
-void main() {
- detectPlatform();
- filterPlatformText();
- registerHandlers();
-}
« no previous file with comments | « no previous file | src/tests/site/code/Switcher.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698