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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5
6 /**
7 * A function-object for displaying a tooltip.
8 * usage:
9 *
10 * hover("hi there!");
11 * hover.set(100,250);
12 * hover.stop();
13 */
14 var hover = (function () {
15 "use strict";
16
17 // Make a div to hold our tooltip.
18 // There will only be one globally, so we can close over
19 // a single one.
20 var hoverElement = document.createElement('div');
21 document.querySelector('body').appendChild(hoverElement);
22
23 // The visible style is what we will see when the hover is applied.
24 var visibleStyle = "position:absolute; display: block; padding:10px; " +
25 "border: 1px solid black; background: white; " +
26 "padding-top: 3px; padding-bottom: 3px;";
27
28 // Set the text for the tooltip
29 var hover = function (text) {
30 hoverElement.setAttribute('style', visibleStyle);
31 removeChildren(hoverElement);
32 hoverElement.appendChild(document.createTextNode(text));
33 };
34
35 // Make the tooltip disapear
36 hover.stop = function () {
37 hoverElement.setAttribute('style', "display:none;");
38 };
39
40 // Set the position of the tooltip
41 hover.set = function (x, y) {
42 x += 15;
43 y -= 20;
44 hoverElement.setAttribute('style', visibleStyle +
45 " left: " + x + "px; top: " + y + ";");
46 };
47
48 return hover;
49 }());
OLDNEW
« 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