dollkingdom
Можно, но мне лень возиться. ;)
Список разделов › foobar2000 › Секреты foobar2000
Как сделать вместо "Seek прошло времени / общее время" > "прошло времени / осталось времени / общее время" ? *ну*Максим:evil
Подправил. Попробуй:
- Код: Выделить всё
function StringFormat() {
var h_align = 0, v_align = 0, trimming = 0, flags = 0;
switch (arguments.length)
{
// fall-thru
case 4:
flags = arguments[3];
case 3:
trimming = arguments[2];
case 2:
v_align = arguments[1];
case 1:
h_align = arguments[0];
break;
default:
return 0;
}
return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
}
StringAlignment = {
Near: 0,
Center: 1,
Far: 2
};
StringTrimming = {
None: 0,
Character: 1,
Word: 2,
EllipsisCharacter: 3,
EllipsisWord: 4,
EllipsisPath: 5
};
StringFormatFlags = {
DirectionRightToLeft: 0x00000001,
DirectionVertical: 0x00000002,
NoFitBlackBox: 0x00000004,
DisplayFormatControl: 0x00000020,
NoFontFallback: 0x00000400,
MeasureTrailingSpaces: 0x00000800,
NoWrap: 0x00001000,
LineLimit: 0x00002000,
NoClip: 0x00004000
};
function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}
function TimeFmt(t){
var zpad = function(n){
var str = n.toString();
return (str.length<2) ? "0"+str : str;
}
var h = Math.floor(t/3600); t-=h*3600;
var m = Math.floor(t/60); t-=m*60;
var s = Math.floor(t);
if(h>0) return h.toString()+":"+zpad(m)+":"+zpad(s);
return m.toString()+":"+zpad(s);
}
// APPLICATION - START
g_font = gdi.Font("Segoe UI", 12, 0);
g_tfo = fb.TitleFormat("[%album artist% - ][$if2(%track artist%,%performer%) - ]%title% '['$if(%ispaused%,Paused,%playback_time% / %length%)']'");
g_stringformat = StringFormat(StringAlignment.Center, StringAlignment.Center);
var g_drag = 0;
// Key point
function on_playback_stop(){
window.Repaint();
}
function on_playback_seek(time){
window.Repaint();
}
function on_playback_time(time){
window.Repaint();
}
function on_playback_pause(state){
window.Repaint();
}
function on_paint(gr) {
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var pos = 0
var length = fb.PlaybackLength;
var txt;
if(length > 0){
if(g_drag){
pos = window.Width * g_drag_seek;
txt = "Seek " + TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length);
}
else{
pos = window.Width * (fb.PlaybackTime / length);
//проигрываемая композиция
txt = g_tfo.Eval();
//следящий за фокусом курсора
//txt = g_tfo.EvalWithMetadb(g_focus_metadb);
//время, прогресс
//txt += " " + TimeFmt(fb.PlaybackTime) + " / " + TimeFmt(length - fb.PlaybackTime) + " [" +TimeFmt(length) + "]";
//txt += " " + Math.floor(fb.PlaybackTime / length * 100).toString() + "%";
}
} else if (fb.PlaybackTime) {
txt = "Streaming...";
}
//if(fb.IsPaused) { txt += " [Paused]" }
gr.FillGradRect(0, 0, pos, wh, 90, RGB(240,240,240), RGB(208,128,18));
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(240,240,240), RGB(190,190,190));
// Draw info
gr.DrawString(txt, g_font, RGB(0,0,0), 0, 0, window.Width, window.Height, g_stringformat);
gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(150,150,150));
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
on_mouse_move(x,y);
}
function on_mouse_lbtn_up(x,y){
if(g_drag){
g_drag = 0;
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
g_drag = 0;
}
}
function on_mouse_move(x,y){
if(g_drag){
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
window.Repaint();
}
}
function on_mouse_wheel(delta){
fb.PlaybackTime += delta;
}
// APPLICATION - END
function StringFormat() {
var h_align = 0, v_align = 0, trimming = 0, flags = 0;
switch (arguments.length)
{
// fall-thru
case 4:
flags = arguments[3];
case 3:
trimming = arguments[2];
case 2:
v_align = arguments[1];
case 1:
h_align = arguments[0];
break;
default:
return 0;
}
return ((h_align << 28) | (v_align << 24) | (trimming << 20) | flags);
}
StringAlignment = {
Near: 0,
Center: 1,
Far: 2
};
StringTrimming = {
None: 0,
Character: 1,
Word: 2,
EllipsisCharacter: 3,
EllipsisWord: 4,
EllipsisPath: 5
};
StringFormatFlags = {
DirectionRightToLeft: 0x00000001,
DirectionVertical: 0x00000002,
NoFitBlackBox: 0x00000004,
DisplayFormatControl: 0x00000020,
NoFontFallback: 0x00000400,
MeasureTrailingSpaces: 0x00000800,
NoWrap: 0x00001000,
LineLimit: 0x00002000,
NoClip: 0x00004000
};
function RGB(r, g, b) {
return (0xff000000 | (r << 16) | (g << 8) | (b));
}
function TimeFmt(t){
var zpad = function(n){
var str = n.toString();
return (str.length<2) ? "0"+str : str;
}
var h = Math.floor(t/3600); t-=h*3600;
var m = Math.floor(t/60); t-=m*60;
var s = Math.floor(t);
if(h>0) return h.toString()+":"+zpad(m)+":"+zpad(s);
return m.toString()+":"+zpad(s);
}
// APPLICATION - START
g_font = gdi.Font("Segoe UI", 12, 0);
g_tfo = fb.TitleFormat("[%album artist% - ][$if2(%track artist%,%performer%) - ]%title% '['$if(%ispaused%,Paused // )%playback_time% / -%playback_time_remaining% / %length%)']'");
g_stringformat = StringFormat(StringAlignment.Center, StringAlignment.Center);
var g_drag = 0;
// Key point
function on_playback_stop(){
window.Repaint();
}
function on_playback_seek(time){
window.Repaint();
}
function on_playback_time(time){
window.Repaint();
}
function on_playback_pause(state){
window.Repaint();
}
function on_paint(gr) {
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var pos = 0
var length = fb.PlaybackLength;
var txt;
if(length > 0){
if(g_drag){
pos = window.Width * g_drag_seek;
txt = "Seek " + TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length);
}
else{
pos = window.Width * (fb.PlaybackTime / length);
//проигрываемая композиция
txt = g_tfo.Eval();
//следящий за фокусом курсора
//txt = g_tfo.EvalWithMetadb(g_focus_metadb);
//время, прогресс
//txt += " " + TimeFmt(fb.PlaybackTime) + " / " + TimeFmt(length - fb.PlaybackTime) + " [" +TimeFmt(length) + "]";
//txt += " " + Math.floor(fb.PlaybackTime / length * 100).toString() + "%";
}
} else if (fb.PlaybackTime) {
txt = "Streaming...";
}
//if(fb.IsPaused) { txt += " [Paused]" }
gr.FillGradRect(0, 0, pos, wh, 90, RGB(240,240,240), RGB(208,128,18));
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(240,240,240), RGB(190,190,190));
// Draw info
gr.DrawString(txt, g_font, RGB(0,0,0), 0, 0, window.Width, window.Height, g_stringformat);
gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(150,150,150));
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
on_mouse_move(x,y);
}
function on_mouse_lbtn_up(x,y){
if(g_drag){
g_drag = 0;
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
g_drag = 0;
}
}
function on_mouse_move(x,y){
if(g_drag){
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
window.Repaint();
}
}
function on_mouse_wheel(delta){
fb.PlaybackTime += delta;
}
// APPLICATION - END
txt = TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length - g_drag_seek * length) + " / " + TimeFmt(length);
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;
function on_paint(gr){
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var volume = fb.Volume;
var pos = window.Width * ((100+volume)/100);
var txt = (Math.ceil(volume)) + "";
gr.FillGradRect( 0, 0, pos, wh, 90, RGB(92,96,126), RGB(46,48,63));
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(0,0,0), RGB(0,0,0));
gr.DrawString(txt, g_font, RGB(255,255,255), 0, 0, ww, wh, 0x11005000);
gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(0,0,0));
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = 0;
}
function on_mouse_move(x,y){
if(g_drag){
var v = x / window.Width;
v = (v<0) ? 0 : (v<1) ? v : 1;
v = -100 * (1-v);
if(fb.Volume != v)
fb.Volume = v;
}
}
function on_mouse_wheel(delta){
if(delta>0)
fb.VolumeUp();
else
fb.VolumeDown();
}
function on_volume_change(val){
window.Repaint();
}
//EOF
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var pos;
var g_font = gdi.Font("Tahoma", 14, 1);
var g_drag = 0;
function on_paint(gr){
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var volume = fb.Volume;
var pos=((Math.pow(10,volume/50)-0.01)/0.99)*ww;
pos = (pos<0) ? 0 : (pos<ww) ?Math.round(pos) : ww;
var txt = Math.round(100*pos/ww);
gr.FillGradRect( 0, 0, pos, wh, 90, RGB(148,204,72), RGB(40,80,21));
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(40,80,21), RGB(148,204,72));
gr.DrawString("Volume: " + txt +"%", g_font, RGB(255,255,255), 0, 0, ww, wh, 0x11005000);
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = 0;
}
function on_mouse_move(x,y){
if(g_drag){
var ww= window.Width;
pos=x;
pos = (pos<0) ? 0 : (pos<ww) ?Math.round(pos) : ww;
var vol =50*Math.log(0.99*pos/ww+0.01)/Math.log(10);
if(fb.Volume != vol)
fb.Volume = vol;
}
}
function on_mouse_wheel(delta){
var ww= window.Width;
if(delta>0)
pos=pos+ww/20;
else
pos=pos-ww/20;
pos = (pos<0) ? 0 : (pos<ww) ?Math.round(pos) : ww;
var vol =50*Math.log(0.99*pos/ww+0.01)/Math.log(10);
if(fb.Volume != vol)
fb.Volume = vol;
}
function on_volume_change(val){
window.Repaint();
}
function on_size(){
}
// Flags
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000002;
var DT_CENTER2 = 0x00000002;
var DT_SINGLELINE = 0x00000020;
//--------
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8 )|(b)); }
function RGBA(r,g,b,a){ return ((a<<24)|(r<<16)|(g<<8 )|(b)); }
//--------
function TimeFmt(t){
var zpad = function(n){
var str = n.toString();
return (str.length<2) ? "0"+str : str;
}
var h = Math.floor(t/3600); t-=h*3600;
var m = Math.floor(t/60); t-=m*60;
var s = Math.floor(t);
if(h>0) return h.toString()+":"+zpad(m)+":"+zpad(s);
return m.toString()+":"+zpad(s);
}
//----------------------------------------------------------------------------
var g_font = gdi.Font("Tahoma", 10);
var g_titlefmt = fb.TitleFormat("$if(%ispaused%,pause '-' ,) %title% %playback_time% / %length%");
var g_fileinfo = null;
var g_colors = new Array(RGB(114,159,207), RGB(252,234,79), RGB(52,101,164), RGB(245,121,0));
var g_drag = 0;
var g_drag_seek = 0;
var g_hover;
var g_bar = 0;
var Tooltip = window.CreateTooltip();
function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var spos = 0;
var length = fb.PlaybackLength;
var volume = fb.Volume;
var vpos = (window.Width / 5) * ((100+volume)/100);
var stxt;
var vtxt = "Volume: " + (Math.ceil(volume)) + " %";
if(length > 0) {
if ( g_drag && g_drag_seek && g_bar == 1) {
spos = (window.Width - window.Width/5) * g_drag_seek;
stxt = "Поиск " + TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length);
}
else if ( g_drag && g_bar == 2) {
vpos = (window.Width / 5) * ((100+volume)/100);
vtxt = "Volume: " + (Math.ceil(volume)) + " %";
}
if ( g_bar != 1 ) {
spos = (window.Width - window.Width/5) * (fb.PlaybackTime / length);
stxt = g_titlefmt.Eval();
}
}
else if ( fb.PlaybackTime ) { stxt = "Streaming..."; }
gr.FillGradRect(0, 13, ww-vpos, wh, 90, RGB(211,211,211), RGB(190,190,190));
gr.FillGradRect( 0, 13, spos, wh, 90, g_colors[0], g_colors[2]);
gr.FillGradRect( ww-ww/5, 13, vpos, wh, 90, g_colors[1], g_colors[3]);
gr.FillGradRect(4*ww/5+vpos, 13, ww-vpos, wh, 90, RGB(211,211,211), RGB(190,190,190));
gr.GdiDrawText(stxt, g_font, RGB(45,45,45), 0, 0, 4*ww/5, wh, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
gr.GdiDrawText(vtxt, g_font, RGB(45,45,45), 4*ww/5, 0, ww/5, wh, DT_CENTER2 | DT_VCENTER | DT_SINGLELINE);
gr.DrawRect( 4*ww/5-1, 13, 1, wh, 1.0, RGB(150,150,150));
gr.DrawRect(-1,13, ww+0, wh-14, 1.0, RGB(150,150,150));
if( g_hover && !g_drag ) { Tooltip.Text = g_hover; Tooltip.Activate(); }
}
function on_size(){
}
function on_focus(focused){
//fb.trace("focus " + focused);
}
function on_key_down(key){
//fb.trace("key " + key);
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
if ( x <= 4*window.Width/5) g_bar = 1;
else if ( x > 4*window.Width/5 ) g_bar = 2;
on_mouse_move(x,y);
}
function on_mouse_lbtn_up(x,y){
if( g_drag ) {
if ( g_bar == 1 ) {
g_drag = 0;
g_drag_seek = x / (4*window.Width/5);
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
g_bar = 0;
}
else if (g_bar == 2) {
on_mouse_move(x,y);
g_drag = 0;
}
}
}
function on_mouse_move(x,y) {
if(g_drag) {
if ( g_bar == 1 ) {
g_drag_seek = x / (4*window.Width/5);
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
window.Repaint();
}
else if ( g_bar == 2 ) {
var v = x / (window.Width/5);
v -= 4;
v = (v<0) ? 0 : (v<1) ? v : 1;
v = -100 * (1-v);
if(fb.Volume != v)
fb.Volume = v;
}
}
else {
if ( x <= 4*window.Width/5) {
g_hover = x / (4*window.Width/5);
g_hover = (g_hover<0) ? 0 : (g_hover<1) ? g_hover : 1;
g_hover = TimeFmt( g_hover * fb.PlaybackLength );
}
else if ( x > 4*window.Width/5 ) {
var v = x / (window.Width/5);
v -= 4;
v = (v<0) ? 0 : (v<1) ? v : 1;
v = -100 * (1-v);
g_hover = Math.ceil(v) + " dB";
}
window.Repaint();
}
}
function on_mouse_leave() {
Tooltip.Deactivate();
}
function on_mouse_wheel(delta){
if(delta<0)
fb.VolumeUp();
else
fb.VolumeDown();
}
//--------
function on_playback_starting(cmd, paused){
}
function on_playback_new_track(info){
window.Repaint();
}
function on_playback_stop(){
window.Repaint();
}
function on_playback_seek(time){
window.Repaint();
}
function on_playback_pause(state){
window.Repaint();
}
function on_playback_edited(){
}
function on_playback_dynamic_info(){
}
function on_playback_dynamic_info_track(){
}
function on_playback_time(time){
window.Repaint();
}
function on_volume_change(val){
window.Repaint();
}
//EOF
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8)|(b)); }
var pos;
var g_font = gdi.Font("Tahoma", 12, 0);
var g_drag = 0;
function on_paint(gr){
gr.SetTextRenderingHint(5);
var ww = window.Width;
var wh = window.Height;
var volume = fb.Volume;
var pos=((Math.pow(10,volume/50)-0.01)/0.99)*ww;
pos = (pos<0) ? 0 : (pos<ww) ?Math.round(pos) : ww;
var txt = Math.round(100*pos/ww);
gr.FillGradRect( 0, 0, pos, wh, 90, RGB(114,159,207), RGB(52,101,164));
gr.FillGradRect(pos, 0, ww-pos, wh, 90, RGB(240,240,240), RGB(190,190,190));
gr.DrawString("Громкость: " + txt +"%", g_font, RGB(45,45,45), 0, 0, ww, wh, 0x11005000);
gr.DrawRect(0,0, ww-1, wh-1, 1.0, RGB(150,150,150));
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
}
function on_mouse_lbtn_up(x,y){
on_mouse_move(x,y);
g_drag = 0;
}
function on_mouse_move(x,y){
if(g_drag){
var ww= window.Width;
pos=x;
pos = (pos<0) ? 0 : (pos<ww) ?Math.round(pos) : ww;
var vol =50*Math.log(0.99*pos/ww+0.01)/Math.log(10);
if(fb.Volume != vol)
fb.Volume = vol;
}
}
function on_mouse_wheel(delta){
var ww= window.Width;
if(delta>0)
pos=pos+ww/20;
else
pos=pos-ww/20;
pos = (pos<0) ? 0 : (pos<ww) ?Math.round(pos) : ww;
var vol =50*Math.log(0.99*pos/ww+0.01)/Math.log(10);
if(fb.Volume != vol)
fb.Volume = vol;
}
function on_volume_change(val){
window.Repaint();
}
function on_size(){
}
// Flags
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000002;
var DT_CENTER2 = 0x00000002;
var DT_SINGLELINE = 0x00000020;
//--------
function RGB(r,g,b){ return (0xff000000|(r<<16)|(g<<8 )|(b)); }
function RGBA(r,g,b,a){ return ((a<<24)|(r<<16)|(g<<8 )|(b)); }
//--------
function TimeFmt(t){
var zpad = function(n){
var str = n.toString();
return (str.length<2) ? "0"+str : str;
}
var h = Math.floor(t/3600); t-=h*3600;
var m = Math.floor(t/60); t-=m*60;
var s = Math.floor(t);
if(h>0) return h.toString()+":"+zpad(m)+":"+zpad(s);
return m.toString()+":"+zpad(s);
}
//----------------------------------------------------------------------------
var g_font = gdi.Font("Tahoma", 10);
var g_titlefmt = fb.TitleFormat("$if(%ispaused%,pause '-' ,) %title% %playback_time% / %length%");
var g_fileinfo = null;
var g_colors = new Array(RGB(114,159,207), RGB(252,234,79), RGB(52,101,164), RGB(245,121,0));
var g_drag = 0;
var g_drag_seek = 0;
var g_hover;
var g_bar = 0;
var Tooltip = window.CreateTooltip();
function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var spos = 0;
var length = fb.PlaybackLength;
var volume = fb.Volume;
var vpos = (window.Width / 5) * ((100+volume)/100);
var stxt;
var vtxt = "Громкость " + Math.round(100*vpos/(ww/5)) + " %";
if(length > 0) {
if ( g_drag && g_drag_seek && g_bar == 1) {
spos = (window.Width - window.Width/5) * g_drag_seek;
stxt = "Поиск " + TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length);
}
else if ( g_drag && g_bar == 2) {
vpos = (window.Width / 5) * ((100+volume)/100);
vtxt = "Громкость " + Math.round(100*vpos/(ww/5)) + " %";
}
if ( g_bar != 1 ) {
spos = (window.Width - window.Width/5) * (fb.PlaybackTime / length);
stxt = g_titlefmt.Eval();
}
}
else if ( fb.PlaybackTime ) { stxt = "Streaming..."; }
gr.FillGradRect(0, 13, ww-vpos, wh, 90, RGB(211,211,211), RGB(190,190,190));
gr.FillGradRect( 0, 13, spos, wh, 90, g_colors[0], g_colors[2]);
gr.FillGradRect( ww-ww/5, 13, vpos, wh, 90, g_colors[1], g_colors[3]);
gr.FillGradRect(4*ww/5+vpos, 13, ww-vpos, wh, 90, RGB(211,211,211), RGB(190,190,190));
gr.GdiDrawText(stxt, g_font, RGB(45,45,45), 0, 0, 4*ww/5, wh, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
gr.GdiDrawText(vtxt, g_font, RGB(45,45,45), 4*ww/5, 0, ww/5, wh, DT_CENTER2 | DT_VCENTER | DT_SINGLELINE);
gr.DrawRect( 4*ww/5-1, 13, 1, wh, 1.0, RGB(150,150,150));
gr.DrawRect(-1,13, ww+0, wh-14, 1.0, RGB(150,150,150));
if( g_hover && !g_drag ) { Tooltip.Text = g_hover; Tooltip.Activate(); }
}
function on_size(){
}
function on_focus(focused){
//fb.trace("focus " + focused);
}
function on_key_down(key){
//fb.trace("key " + key);
}
function on_mouse_lbtn_down(x,y){
g_drag = 1;
if ( x <= 4*window.Width/5) g_bar = 1;
else if ( x > 4*window.Width/5 ) g_bar = 2;
on_mouse_move(x,y);
}
function on_mouse_lbtn_up(x,y){
if( g_drag ) {
if ( g_bar == 1 ) {
g_drag = 0;
g_drag_seek = x / (4*window.Width/5);
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
g_bar = 0;
}
else if (g_bar == 2) {
on_mouse_move(x,y);
g_drag = 0;
}
}
}
function on_mouse_move(x,y) {
if(g_drag) {
if ( g_bar == 1 ) {
g_drag_seek = x / (4*window.Width/5);
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
window.Repaint();
}
else if ( g_bar == 2 ) {
var v = x / (window.Width/5);
v -= 4;
v = (v<0) ? 0 : (v<1) ? v : 1;
v = -100 * (1-v);
if(fb.Volume != v)
fb.Volume = v;
}
}
else {
if ( x <= 4*window.Width/5) {
g_hover = x / (4*window.Width/5);
g_hover = (g_hover<0) ? 0 : (g_hover<1) ? g_hover : 1;
g_hover = TimeFmt( g_hover * fb.PlaybackLength );
}
else if ( x > 4*window.Width/5 ) {
var v = x / (window.Width/5);
v -= 4;
v = (v<0) ? 0 : (v<1) ? v : 1;
v = -100 * (1-v);
g_hover = Math.ceil(v) + " dB";
}
window.Repaint();
}
}
function on_mouse_leave() {
Tooltip.Deactivate();
}
function on_mouse_wheel(delta){
if(delta<0)
fb.VolumeUp();
else
fb.VolumeDown();
}
//--------
function on_playback_starting(cmd, paused){
}
function on_playback_new_track(info){
window.Repaint();
}
function on_playback_stop(){
window.Repaint();
}
function on_playback_seek(time){
window.Repaint();
}
function on_playback_pause(state){
window.Repaint();
}
function on_playback_edited(){
}
function on_playback_dynamic_info(){
}
function on_playback_dynamic_info_track(){
}
function on_playback_time(time){
window.Repaint();
}
function on_volume_change(val){
window.Repaint();
}
//EOF
Вернуться в Секреты foobar2000