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

Unified Diff: content/browser/resources/media/new/hover.js

Issue 18889006: Removed old media-internals page and rewrote it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved all 'new' media internals files into its own folder for a smooth transition. 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/new/hover.js
diff --git a/content/browser/resources/media/new/hover.js b/content/browser/resources/media/new/hover.js
new file mode 100644
index 0000000000000000000000000000000000000000..28638b8530c058249069f0380f481b83b1e8227b
--- /dev/null
+++ b/content/browser/resources/media/new/hover.js
@@ -0,0 +1,49 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+/**
+ * A function-object for displaying a tooltip.
+ * usage:
+ *
+ * hover("hi there!");
+ * hover.set(100,250);
+ * hover.stop();
+ */
+var hover = (function () {
+ "use strict";
+
+ // Make a div to hold our tooltip.
+ // There will only be one globally, so we can close over
+ // a single one.
+ var hoverElement = document.createElement('div');
+ document.querySelector('body').appendChild(hoverElement);
+
+ // The visible style is what we will see when the hover is applied.
+ var visibleStyle = "position:absolute; display: block; padding:10px; " +
+ "border: 1px solid black; background: white; " +
+ "padding-top: 3px; padding-bottom: 3px;";
+
+// Set the text for the tooltip
+ var hover = function (text) {
+ hoverElement.setAttribute('style', visibleStyle);
+ removeChildren(hoverElement);
+ hoverElement.appendChild(document.createTextNode(text));
+ };
+
+// Make the tooltip disapear
+ hover.stop = function () {
+ hoverElement.setAttribute('style', "display:none;");
+ };
+
+// Set the position of the tooltip
+ hover.set = function (x, y) {
+ x += 15;
+ y -= 20;
+ hoverElement.setAttribute('style', visibleStyle +
+ " left: " + x + "px; top: " + y + ";");
+ };
+
+ return hover;
+}());
« no previous file with comments | « content/browser/resources/media/new/graph_painter.js ('k') | content/browser/resources/media/new/log_painter.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698