Debian Codegraph @

demos/tooltip/video-player.html

raw
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>jQuery UI Tooltip - Video Player demo</title>
7 <link rel="stylesheet" href="../../themes/base/all.css">
8 <link rel="stylesheet" href="../demos.css">
9 <style>
10 .player {
11 width: 500px;
12 height: 300px;
13 border: 2px groove gray;
14 background: #ccc;
15 text-align: center;
16 line-height: 300px;
17 }
18 .ui-tooltip {
19 border: 1px solid white;
20 background: #111;
21 color: white;
22 }
23 .ui-menu {
24 position: absolute;
25 }
26 .set {
27 display: inline-block;
28 }
29 .notification {
30 position: absolute;
31 display: inline-block;
32 font-size: 2em;
33 padding: .5em;
34 box-shadow: 2px 2px 5px -2px rgba(0,0,0,0.5);
35 }
36 </style>
37 <script src="../../external/requirejs/require.js"></script>
38 <script src="../bootstrap.js" data-modules="button controlgroup menu effect effect-blind">
39 function notify( input ) {
40 var msg = "Selected " +
41 String.prototype.trim.call(
42 input.data( "tooltip-title" ) || input.text() );
43 $( "<div>" )
44 .appendTo( document.body )
45 .text( msg )
46 .addClass( "notification ui-state-default ui-corner-bottom" )
47 .position({
48 my: "center top",
49 at: "center top",
50 of: window
51 })
52 .show({
53 effect: "blind"
54 })
55 .delay( 1000 )
56 .hide({
57 effect: "blind",
58 duration: "slow"
59 }, function() {
60 $( this ).remove();
61 });
62 }
63
64 $( "button" ).each(function() {
65 var button = $( this ).button({
66 icons: {
67 primary: $( this ).data( "icon" )
68 },
69 text: !!$( this ).attr( "title" )
70 });
71 button.not( ".menu" ).on( "click", function() {
72 notify( button );
73 });
74 });
75 $( ".set" ).controlgroup({
76 items: {
77 "button" : "button"
78 }
79 });
80
81 $( "button.menu" )
82 .on( "click", function() {
83 $( document ).tooltip( "close", { currentTarget: this });
84 var menu = $( this ).next().show().position({
85 my: "left top",
86 at: "left bottom",
87 of: this
88 });
89 $( document ).one( "click", function() {
90 menu.hide();
91 });
92 return false;
93 })
94 .next()
95 .hide()
96 .menu({
97 selected: function( event, ui ) {
98 notify( ui.item );
99 }
100 });
101
102 $( document ).tooltip({
103 position: {
104 my: "center top",
105 at: "center bottom+5",
106 },
107 show: {
108 duration: "fast"
109 },
110 hide: {
111 effect: "hide"
112 }
113 });
114 </script>
115 </head>
116 <body>
117
118 <div class="player">Here Be Video (HTML5?)</div>
119 <div class="tools">
120 <span class="set">
121 <button data-icon="ui-icon-circle-arrow-n" title="I like this">Like</button>
122 <button data-icon="ui-icon-circle-arrow-s">I dislike this</button>
123 </span>
124 <div class="set">
125 <button data-icon="ui-icon-circle-plus" title="Add to Watch Later">Add to</button>
126 <button class="menu" data-icon="ui-icon-triangle-1-s">Add to favorites or playlist</button>
127 <ul>
128 <li><div>Favorites</div></li>
129 <li><div>Funnees</div></li>
130 <li></li>
131 <li><div>New playlist...</div></li>
132 </ul>
133 </div>
134 <button title="Share this video">Share</button>
135 <button data-icon="ui-icon-alert">Flag as inappropriate</button>
136 </div>
137
138 <div class="demo-description">
139 <p>A fake video player with like/share/stats button, each with a custom-styled tooltip.</p>
140 </div>
141 </body>
142 </html>