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

Unified Diff: content/browser/resources/media/util/collapse.js

Issue 18889006: Removed old media-internals page and rewrote it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 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
Index: content/browser/resources/media/util/collapse.js
diff --git a/content/browser/resources/media/util/collapse.js b/content/browser/resources/media/util/collapse.js
new file mode 100755
index 0000000000000000000000000000000000000000..6c386817654bf36b1f3aa4387e1a8f9159d337d7
--- /dev/null
+++ b/content/browser/resources/media/util/collapse.js
@@ -0,0 +1,22 @@
+/**
+ * @fileoverview Sets up the event handlers for the collapsing containers
+ */
+
+(function () {
+ "use strict";
+ var allCollapseDivs = document.querySelectorAll('.collapse');
+ goog.array.forEach(allCollapseDivs, function (elem) {
+ // find the header for the div, because we only want to trigger on that
+ var header = elem.querySelector("h2");
+ header.onclick = function () {
+ var wasOpen = elem.className.indexOf("open") !== -1;
+
+ if (wasOpen) {
+ elem.className = "collapse closed";
+ } else {
+ elem.className = "collapse open";
+ }
+ };
+ });
+
+}());

Powered by Google App Engine
This is Rietveld 408576698