]> git.sesse.net Git - vlc/blob - share/lua/http/js/ui.js
50a0df4b266c385e2b256de67fc2c3ed27e62235
[vlc] / share / lua / http / js / ui.js
1 $(function () {
2     $("#seekSlider").slider({
3         range: "min",
4         value: 0,
5         min: 0,
6         max: 100,
7         stop: function (event, ui) {
8             $("#currentTime").empty().append(format_time(Math.round((ui.value / 100) * $('#seekSlider').attr('totalLength'))));
9             switch (current_que) {
10             case 'main':
11                 sendCommand({
12                     'command': 'seek',
13                     'val': (ui.value) + '%'
14                 });
15                 break;
16             case 'stream':
17                 sendVLMCmd('control Current seek ' + ui.value);
18                 break;
19             }
20         }
21     });
22     $("#volumeSlider").slider({
23         range: "min",
24         value: 50,
25         min: 0,
26         max: 100,
27         stop: function (event, ui) {
28             $("#currentVolume").empty().append(ui.value * 2 + "%");
29             sendCommand({
30                 'command': 'volume',
31                 'val': Math.round(ui.value * 5.12)
32             })
33         }
34     });
35     $('#buttonStop').click(function () {
36         switch (current_que) {
37         case 'main':
38             sendCommand({
39                 'command': 'pl_stop'
40             })
41             break;
42         case 'stream':
43             sendVLMCmd('control Current stop');
44             break;
45         }
46         return false;
47     });
48     $('#buttonPlay').click(function () {
49         if ($(this).attr('state') == 'stopped') {
50             switch (current_que) {
51             case 'main':
52                 var id = $('.jstree-clicked', '#libraryTree').length > 0 ? $('.jstree-clicked', '#libraryTree').first().parents().first().attr('id').substr(5) : current_id;
53                 sendCommand({
54                     'command': 'pl_play',
55                     'id': id
56                 });
57                 break;
58             case 'stream':
59                 sendVLMCmd('control Current play');
60                 flowplayer("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf");
61                 break;
62             }
63         } else {
64             switch (current_que) {
65             case 'main':
66                 sendCommand({
67                     'command': 'pl_pause'
68                 });
69                 break;
70             case 'stream':
71                 sendVLMCmd('control Current pause');
72                 break;
73             }
74         }
75         return false;
76     });
77     $('#buttonFull').click(function () {
78         sendCommand({
79             'command': 'fullscreen'
80         });
81         return false;
82     });
83     $('#stream_host').val(stream_server);
84 })