Список разделов › foobar2000 › Секреты foobar2000
MC Web:проблему при использовании плейлистов с m-TAGS не работает скрипт биографии
Unable to open item for playback (Unsupported file format):
"D:\foobar2000 may be\playlists\Радио ФM.tags" / index: 20
function Eval(field) {
if (!metadb) return;
complete_path = fb.Titleformat("%path%").EvalWithMetadb(metadb);
directory_path = fb.Titleformat("$directory_path(%path%)").EvalWithMetadb(metadb);
//return complete_path.indexOf('://') > 0 ? fb.TitleFormat("[" + field + "]").Eval() : fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb);
return fb.Titleformat("[%length%]").Eval() ? fb.TitleFormat("[" + field + "]").EvalWithMetadb(metadb) : fb.TitleFormat("[" + field + "]").Eval();
}
Внес изменения, подтверждаю, биография теперь работает при использовании плейлистов с m-TAGS.kgena_ua:В сборке FooBAZ (RU) биография заработала
С переносом этих плейлистов возникают трудности, поэтому ими и не пользуюсь. Помимо плейлиста нужно переносить и БД.kgena_ua:У меня, пока этот плейлист не запускается, чего-то не хватает.
А чем скрипт marc2003 не устраивает?kutuzof:Может кто ни-будь уже адаптировал скрипт Properties & properties file (ml) под SMP. Если что, поделитесь .
скрипт от kgena_ua меня больше устраивает ) да я уже его почти адаптировал, не отображается только "similar artists"))imfam:А чем скрипт marc2003 не устраивает?
JScript Panel v2.5.3 (Properties & properties file (ml) v04112018 by kgena_ua)
Ошибка выполнения JavaScript:
Ошибка при вызове OpenClipboard
File: <main>
Line: 1110, Col: 5
var align_top=0;
var align_middle=1;
var align_bottom=2;
var align_left =0;
var align_center=1;
var align_right =2;
var trim_no =0;
var trim_chara =1;
var trim_word =2;
var trim_elips_chara =3;
var trim_elips_word =4;
var trim_elips_path =5;
var flag_rtl =0x0001;
var flag_vert =0x0002;
var flag_nofit =0x0004;
var flag_dispctrl =0x0020;
var flag_nofallback =0x0400;
var flag_trailspace =0x0800;
var flag_nowrap =0x1000;
var flag_linelimit =0x2000;
var flag_noclip =0x4000;
//---------
function StringFormat(alignH,alignV,trim,flag){ return ((alignH<<28)|(alignV<<24)|(trim<<20)|flag); }
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));
}
//var g_font = gdi.Font("Segoe UI", 36, 0);
var g_drag = 0;
function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var volume =fb.Volume;
var pos =Math.exp((-(-volume-100)*Math.log(100))/100);
var x = pos * (wh) /100 ;
var txt = (Math.ceil(volume)) + "dB";
var s_font = ww / 3;
var g_font = gdi.Font("Segoe UI", 12, 0);
if (fb.IsPaused) {
var color1 = RGB(230, 49, 35);
} else {
if (fb.IsPlaying) {
var color1 = RGB(230, 49, 35);
}
}
if (fb.IsPaused) {
var color1 = RGB(230, 49, 35);
} else {
if (fb.IsPlaying) {
var color1 = RGB(230, 49, 35);
}
}
if(x<5){x=5;}
gr.FillSolidRect(0, 0, ww, wh, RGB(20,20,25));
//gr.FillSolidRect(1, 1, ww-2, wh-2, RGB(18,34,45));
//gr.FillSolidRect(1,1, ww-2, wh-x+4, RGB(18,34,45));
//gr.FillRoundRect(2,2, ww-4, wh-4, 1, 1, RGB(0, 0, 0));
gr.FillSolidRect( 0, wh-x+0, ww, 6, color1);
//gr.DrawString(txt, g_font, color1, 2, wh/3, ww, wh/3, 0x11005000);
//gr.DrawString("+", g_font, color1, 2, 0, ww, wh/8, 0x11005000);
//gr.DrawString("-", g_font, color1, 2, wh- wh/8, ww, wh/8, 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){
var ww = window.Width;
var wh = window.Height;
if(g_drag){
var pos = (wh-y)*100 / (wh);
var v =100-(Math.log(pos)*100)/Math.log(100);
v = (v<0) ? 0 : (v<100) ? v : 100;
v = -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
var y = pos * (ww) /100 ;
gr.FillSolidRect( 0, wh-x+0, ww, 6, color1);
gr.FillSolidRect( ww-(ww-y+4), 0, 6, wh, color1);
var align_top=0;
var align_middle=1;
var align_bottom=2;
var align_left =0;
var align_center=1;
var align_right =2;
var trim_no =0;
var trim_chara =1;
var trim_word =2;
var trim_elips_chara =3;
var trim_elips_word =4;
var trim_elips_path =5;
var flag_rtl =0x0001;
var flag_vert =0x0002;
var flag_nofit =0x0004;
var flag_dispctrl =0x0020;
var flag_nofallback =0x0400;
var flag_trailspace =0x0800;
var flag_nowrap =0x1000;
var flag_linelimit =0x2000;
var flag_noclip =0x4000;
//---------
function StringFormat(alignH,alignV,trim,flag){ return ((alignH<<28)|(alignV<<24)|(trim<<20)|flag); }
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));
}
//var g_font = gdi.Font("Segoe UI", 36, 0);
var g_drag = 0;
function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var volume =fb.Volume;
var pos =Math.exp((-(-volume-100)*Math.log(100))/100);
var x = pos * (wh) /100 ;
var y = pos * (ww) /100 ;
var txt = (Math.ceil(volume)) + "dB";
var s_font = ww / 3;
var g_font = gdi.Font("Segoe UI", 12, 0);
if (fb.IsPaused) {
var color1 = RGB(230, 49, 35);
} else {
if (fb.IsPlaying) {
var color1 = RGB(230, 49, 35);
}
}
if (fb.IsPaused) {
var color1 = RGB(230, 49, 35);
} else {
if (fb.IsPlaying) {
var color1 = RGB(230, 49, 35);
}
}
if(x<5){x=5;}
gr.FillSolidRect(0, 0, ww, wh, RGB(20,20,25));
//gr.FillSolidRect(1, 1, ww-2, wh-2, RGB(18,34,45));
//gr.FillSolidRect(1,1, ww-2, wh-x+4, RGB(18,34,45));
//gr.FillRoundRect(2,2, ww-4, wh-4, 1, 1, RGB(0, 0, 0));
gr.FillSolidRect( ww-(ww-y+4), 0, 6, wh, color1);
//gr.DrawString(txt, g_font, color1, 2, wh/3, ww, wh/3, 0x11005000);
//gr.DrawString("+", g_font, color1, 2, 0, ww, wh/8, 0x11005000);
//gr.DrawString("-", g_font, color1, 2, wh- wh/8, ww, wh/8, 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){
var ww = window.Width;
var wh = window.Height;
if(g_drag){
var pos = (wh-y)*100 / (wh);
var v =100-(Math.log(pos)*100)/Math.log(100);
v = (v<0) ? 0 : (v<100) ? v : 100;
v = -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
// WSH РЕГУЛЯТОР ГРОМКОСТИ
var align_top=0;
var align_middle=1;
var align_bottom=2;
var align_left =0;
var align_center=1;
var align_right =2;
var trim_no =0;
var trim_chara =1;
var trim_word =2;
var trim_elips_chara =3;
var trim_elips_word =4;
var trim_elips_path =5;
var flag_rtl =0x0001;
var flag_vert =0x0002;
var flag_nofit =0x0004;
var flag_dispctrl =0x0020;
var flag_nofallback =0x0400;
var flag_trailspace =0x0800;
var flag_nowrap =0x1000;
var flag_linelimit =0x2000;
var flag_noclip =0x4000;
//---------
function StringFormat(alignH,alignV,trim,flag){ return ((alignH<<28)|(alignV<<24)|(trim<<20)|flag); }
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));
}
//var g_font = gdi.Font("Segoe UI", 36, 0);
var g_drag = 0;
function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var volume =fb.Volume;
var pos =Math.exp((-(-volume-100)*Math.log(100))/100);
var x = pos * (wh) /100 ;
var y = pos * (ww) /100 ;
var txt = (Math.ceil(volume)) + "dB";
var s_font = ww / 3;
var g_font = gdi.Font("Segoe UI", 12, 0);
if (fb.IsPaused) {
var color1 = RGB(230, 49, 35);
} else {
if (fb.IsPlaying) {
var color1 = RGB(230, 49, 35);
}
}
if (fb.IsPaused) {
var color1 = RGB(230, 49, 35);
} else {
if (fb.IsPlaying) {
var color1 = RGB(230, 49, 35);
}
}
if(x<5){x=5;}
gr.FillSolidRect(0, 0, ww, wh, RGB(20,20,25));
//gr.FillSolidRect(1, 1, ww-2, wh-2, RGB(18,34,45));
//gr.FillSolidRect(1,1, ww-2, wh-x+4, RGB(18,34,45));
//gr.FillRoundRect(2,2, ww-4, wh-4, 1, 1, RGB(0, 0, 0));
// gr.FillSolidRect( 0, wh-x+0, ww, 6, color1); // ВЕРТИКАЛЬНОЕ ИСПОЛНЕНИЯ
gr.FillSolidRect( ww-(ww-y+4), 0, 6, wh, color1); // ГОРИЗОНТАЛЬНОЕ ИСПОЛНЕНИЕ
//gr.DrawString(txt, g_font, color1, 2, wh/3, ww, wh/3, 0x11005000);
//gr.DrawString("+", g_font, color1, 2, 0, ww, wh/8, 0x11005000);
//gr.DrawString("-", g_font, color1, 2, wh- wh/8, ww, wh/8, 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){
var ww = window.Width;
var wh = window.Height;
if(g_drag){
//var pos = (wh-y)*100 / (wh); // ВЕРТИКАЛЬНОЕ ИСПОЛНЕНИЯ
var pos = (ww - (ww-x))*100 / (ww); // ГОРИЗОНТАЛЬНОЕ ИСПОЛНЕНИЕ
var v =100-(Math.log(pos)*100)/Math.log(100);
v = (v<0) ? 0 : (v<100) ? v : 100;
v = -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
var align_top=0;
var align_middle=1;
var align_bottom=2;
var align_left =0;
var align_center=1;
var align_right =2;
var trim_no =0;
var trim_chara =1;
var trim_word =2;
var trim_elips_chara =3;
var trim_elips_word =4;
var trim_elips_path =5;
var flag_rtl =0x0001;
var flag_vert =0x0002;
var flag_nofit =0x0004;
var flag_dispctrl =0x0020;
var flag_nofallback =0x0400;
var flag_trailspace =0x0800;
var flag_nowrap =0x1000;
var flag_linelimit =0x2000;
var flag_noclip =0x4000;
//---------
function StringFormat(alignH,alignV,trim,flag){ return ((alignH<<28)|(alignV<<24)|(trim<<20)|flag); }
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));
}
//var g_font = gdi.Font("Segoe UI", 36, 0);
var g_drag = 0;
function on_paint(gr){
var ww = window.Width;
var wh = window.Height;
var volume =fb.Volume;
var pos =Math.exp((-(-volume-100)*Math.log(100))/100);
var x = pos * (wh) /100 ;
var y = pos * (ww) /100 ;
var txt = (Math.ceil(volume)) + "dB";
var s_font = ww / 3;
var g_font = gdi.Font("Segoe UI", 12, 0);
if (fb.IsPaused) {
var color1 = RGB(230, 49, 35);
} else {
if (fb.IsPlaying) {
var color1 = RGB(230, 49, 35);
}
}
if (fb.IsPaused) {
var color1 = RGB(230, 49, 35);
} else {
if (fb.IsPlaying) {
var color1 = RGB(230, 49, 35);
}
}
if(x<5){x=5;}
//gr.FillSolidRect(0, 0, ww, wh, RGB(20,20,25));
//gr.FillSolidRect(1, 1, ww-2, wh-2, RGB(18,34,45));
//gr.FillSolidRect(1,1, ww-2, wh-x+4, RGB(18,34,45));
//gr.FillRoundRect(2,2, ww-4, wh-4, 1, 1, RGB(0, 0, 0));
// gr.FillSolidRect( 0, wh-x+0, ww, 6, color1);
gr.FillSolidRect( ww-(ww-y+5), 0, 5, wh, color1);
gr.DrawString(txt, g_font, color1, 2, wh/3, ww, wh/3, 0x11005000);
//gr.DrawString("+", g_font, color1, 2, 0, ww, wh/8, 0x11005000);
//gr.DrawString("-", g_font, color1, 2, wh- wh/8, ww, wh/8, 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){
var ww = window.Width;
var wh = window.Height;
if(g_drag){
//var pos = (wh-y)*100 / (wh);
var pos = (ww - (ww-x))*100 / (ww);
var v =100-(Math.log(pos)*100)/Math.log(100);
v = (v<0) ? 0 : (v<100) ? v : 100;
v = -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
// ==PREPROCESSOR==
// @name "Clock, Timer and Alarm clock"
// @version "10032021"
// @author "kgena_ua"
// ==/PREPROCESSOR==
function RGB(r,g,b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}
function getRed(color) {
return ((color >> 16) & 0xff);
}
function getGreen(color) {
return ((color >> 8) & 0xff);
}
function getBlue(color) {
return (color & 0xff);
}
var ww, wh;
DT_LEFT = 0x00000000;
DT_RIGHT = 0x00000002;
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_WORD_ELLIPSIS = 0x00040000;
DT_WORDBREAK = 0x00000010;
MF_ENABLED = 0x00000000;
MF_GRAYED = 0x00000001;
MF_SEPARATOR = 0x00000800;
MF_MENUBREAK = 0x00000040;
VK_SHIFT = 0x10;
VK_CONTROL = 0x11;
String.prototype.repeat = function(n) {
return new Array(n + 1).join(this);
}
window.SetProperty("_".repeat(50), "");
if (window.GetProperty("_".repeat(50)) != "" ) window.SetProperty("_".repeat(50), "");
ColorTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
}
ColorTypeDUI = {
text: 0,
background: 1,
highlight: 2,
selection: 3
}
var bgcolor, color_item;
function get_color(){
try {
if (window.InstanceType == 0){
s_bgcolor = window.GetColorCUI(ColorTypeCUI.background);
s_color_item = window.GetColorCUI(ColorTypeCUI.text);
} else if (window.InstanceType == 1) {
s_bgcolor = window.GetColorDUI(ColorTypeDUI.background);
s_color_item = window.GetColorDUI(ColorTypeDUI.text);
}
} catch(e){};
try {
if (window.InstanceType == 0){
s_bgcolor = window.GetColourCUI(ColorTypeCUI.background);
s_color_item = window.GetColourCUI(ColorTypeCUI.text);
} else if (window.InstanceType == 1) {
s_bgcolor = window.GetColourDUI(ColorTypeDUI.background);
s_color_item = window.GetColourDUI(ColorTypeDUI.text);
}
} catch(e){};
window.Repaint();
}
var c_bgcolor = customColor(window.GetProperty(" color: background", "0-0-0"));
var c_color_item = customColor(window.GetProperty(" color: item", "100-200-200"));
function customColor(color){
tempc = color.split("-");
return (0xff000000 | (tempc[0]<<16) | (tempc[1]<<8) | (tempc[2]));
}
var custom_colors = window.GetProperty(" colors: custom", false);
get_color();
ini_color();
function on_colors_changed(){
get_color();
ini_color();
}
function ini_color(){
bgcolor = custom_colors ? c_bgcolor : s_bgcolor;
color_item = custom_colors ? c_color_item : s_color_item;
}
var color_default = color_item; // color_default
var color_play = RGB(128, 255, 128);
var color_stop = RGB(255, 175, 89);
var t;
var t_y;
var t_h;
var t_show = window.GetProperty("text: show", true);
var font_size_n = window.GetProperty(" font size : number", 30);
var font_size_t = window.GetProperty(" font size : text", 11);
var font_name_n = window.GetProperty(" font name : number", "Arial");
var font_name_t = window.GetProperty(" font name : text", "Arial");
var font_style_n = window.GetProperty(" font style : number", 1);
var font_style_t = window.GetProperty(" font style : text", 0);
var t_font = gdi.Font(font_name_t, font_size_t, font_style_t);
var HSV = RGBtoHSV(getRed(color_default), getGreen(color_default), getBlue(color_default));
var t_color = HSVtoRGB(HSV.H, HSV.S, HSV.V * 0.8);
var num_font = gdi.Font(font_name_n, font_size_n, font_style_n);
var days = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var months = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var timer_rotate = [];
var timer_set = false;
var timer_started = false;
var timer_blink = false;
var timer_set_volume = false
var n = 6;
var n_x = [];
var n_y;
var n_w;
var n_h;
var n2 = 4;
var n2_x = [];
dim();
var dw = [], dh = [];
var step = [1, 1, 1, 1, 1, 1];
var step_o = [];
var step_set = [1, 1, 1, 1, 1, 1];
var dir = [];
var num = [], num_o = [0, 0, 0, 0, 0, 0];
var delay = [40, 30, 25, 20, 15, 10];
var delay_set = [];
var img = [];
var imgs_default = [];
var imgs_play = [];
var imgs_stop = [];
get_num_imgs(imgs_default, color_default);
get_num_imgs(imgs_play, color_play);
get_num_imgs(imgs_stop, color_stop);
var sep = ":";
imgs_default.push(create_img(sep, color_default));
imgs_play.push(create_img(sep, color_play));
imgs_stop.push(create_img(sep, color_stop));
var time_imgs = [];
get_time_imgs();
var playback = window.GetProperty("playback", "Play");
var timer_type = window.GetProperty("timer_type", "At a given time");
var time_format = window.GetProperty("time_format", "hh:mm:ss");
var time_format_o;
var date;
var date_current;
var date_timer;
var date_show = true;
var playback_text;
var volume_state;
var on_mouse = false;
var num_this = 0;
var hover_state = [];
var hover_alpha = [];
var alpha_min = 100;
var hover_timer_started = false;
var timer_blink_sep = false;
var timer_blink_sep_key = false;
var alpha_sep = 100;
var event_0 = false;
var img_path = fb.ProfilePath + "\\maybe\\textures\\timer\\";
var d = new Date();
var clock_timer = window.SetInterval(on_timer, 1000);
function on_paint(gr){
!window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
gr.SetSmoothingMode(4);
for (var i = 0; i < n; i++) {
img[i] = time_imgs[num[i]];
sep_img = time_imgs[10];
if (img[i] && sep_img && date_show){
if (i < (time_format == "hh:mm:ss" ? n : n2)){
x = time_format == "hh:mm:ss" ? n_x[i] : n2_x[i];
gr.DrawImage( img[i], x + dw[i] / 2, n_y + dh[i] / 2, img[i].Width - dw[i], img[i].Height - dh[i], 0, 0, img[i].Width, img[i].Height, 0, hover_alpha[i]);/// hover_alpha[i]
if (time_format == "hh:mm:ss") {
alpha_sep = 100;
}
if (i == 2 || i == 4) gr.DrawImage( sep_img, x - n_w, n_y - n_h * 0.07, n_w, n_h, 0, 0, n_w, n_h, 0, alpha_sep);
}
}
}
if (timer_set_volume) {
color = playback == "Play" ? color_play : color_stop;
gr.GdiDrawText( playback_text, num_font, color, 0, n_y, ww, n_h, DT_SINGLELINE | DT_CENTER | DT_VCENTER | DT_WORD_ELLIPSIS );
}
if (t_show){
num.length && gr.GdiDrawText( t, t_font, t_color, 0, t_y, ww, t_h, DT_CENTER );
}
}
function on_mouse_rbtn_up (x, y){
var _menu = window.CreatePopupMenu();
if (!timer_set && !timer_started){
_menu.AppendMenuItem(MF_ENABLED, 10, "Set time" );
}
if (timer_set && !timer_started){
_menu.AppendMenuItem(MF_ENABLED, 20, "Start timer" );
_menu.AppendMenuItem(MF_ENABLED, 30, "Reset timer" );
}
if (!timer_set && timer_started){
_menu.AppendMenuItem(MF_ENABLED, 30, "Stop timer" );
}
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
MF_STATE = !timer_started ? MF_ENABLED : MF_GRAYED;
_menu.AppendMenuItem(MF_STATE, 60, "Playback : " + playback);
text = timer_started && timer_type == "At a given time" ? "at " + sec_to_hms(date_timer).t : timer_type;
_menu.AppendMenuItem(MF_STATE, 70, text);
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
MF = timer_set ? MF_GRAYED : MF_ENABLED;
_menu.AppendMenuItem(MF, 80, "Time format : " + (time_format == "hh:mm:ss" ? "hh:mm" : "hh:mm:ss"));
_menu.AppendMenuItem(MF_ENABLED, 90, "Text");
_menu.CheckMenuItem(90, t_show);
_menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
_menu.AppendMenuItem(MF_ENABLED, 200, "Properties");
_menu.AppendMenuItem(MF_ENABLED, 210, "Configure...");
ret = _menu.TrackPopupMenu(x + 20, y - 50);
switch (ret) {
case 10: // Set time
timer_set = true;
check_time_format("hh:mm:ss");
step_set = [1, 1, 1, 1, 1, 1];
delay_set = [12, 10, 8, 6, 4, 2];
date_timer = 0;
// num = [];
break;
case 20: // Start timer
timer_set = false;
timer_started = true;
check_time_format();
date_timer = timer_type == "After a given time" && date_timer == 0 ? 86400 : date_timer;
get_time_imgs();
hover_state = [1, 1, 1, 1, 1, 1];
hover_alpha_timer(); ///
break;
case 30: // Reset (Stop) timer
timer_set = false;
timer_started = false;
check_time_format();
get_time_imgs();
step = [1, 1, 1, 1, 1, 1];
hover_state = [1, 1, 1, 1, 1, 1];
hover_alpha_timer();
break;
case 60:
playback = playback == "Play" ? "Stop" : "Play";
window.SetProperty("playback", playback);
on_mouse_rbtn_up(x, y);
break;
case 70:
timer_type = timer_type == "After a given time" ? "At a given time" : "After a given time";
window.SetProperty("timer_type", timer_type);
on_mouse_rbtn_up(x, y);
break;
case 80:
time_format = time_format == "hh:mm:ss" ? "hh:mm" : "hh:mm:ss";
time_format_o = time_format;
window.SetProperty("time_format", time_format);
num = [];
break;
case 90:
t_show = !t_show;
window.SetProperty("text: show", t_show);
dim();
break;
case 200:
window.ShowProperties();
break;
case 210:
window.ShowConfigure();
break;
}
_menu.Dispose();
return true;
}
function on_mouse_lbtn_up (x, y){
}
function on_mouse_lbtn_dblclk (x, y){
if (timer_set) {
date_timer = 0;
data_check();
}
}
function on_mouse_move(x, y) {
window.SetCursor(32649);
on_mouse = true;
timer_set && change_hover_state(x, y);
}
function on_mouse_leave() {
window.SetCursor(32512);
on_mouse = false;
timer_set && leave_hover_state();
if (timer_started && !event_0){
check_time_format();
}
}
function on_size(){
ww = window.Width;
wh = window.Height;
dim();
}
function check_time_format(n){
if (n) {
if (time_format != n){
time_format_o = time_format;
time_format = "hh:mm:ss";
window.SetProperty("time_format", time_format);
num = [];
}
}
if (!n) {
if (time_format != time_format_o){
time_format = time_format_o;
window.SetProperty("time_format", time_format);
num = [];
}
}
}
function blink() {
i = 0;
timer_blink = window.SetInterval(function() {
i++;
for (var j = 0; j < 5; j++) {
hover_alpha[j] = hover_alpha[5];
alpha_sep = Math.min(100, hover_alpha[5]);
}
if (i >= 20) {
for (var j = 0; j < 5; j++) {
hover_alpha[j] = 255;
}
window.ClearInterval(timer_blink);
timer_blink = false;
}
}, 40 )
}
function blink_sep() {
i = 0;
timer_blink_sep = window.SetInterval(function() {
i++;
if (timer_blink_sep_key){
alpha_sep = Math.min(255, alpha_sep + 12);
}
if (!timer_blink_sep_key){
alpha_sep = Math.max(0, alpha_sep - 12);
}
window.Repaint();
if (i >= 20) {
window.ClearInterval(timer_blink_sep);
timer_blink_sep_key = !timer_blink_sep_key;
timer_blink_sep = false;
}
}, 40)
}
function on_timer(id) {
d = new Date();
date_current = (d.getHours() * 3600) + (d.getMinutes() * 60) + d.getSeconds();
t = days[d.getDay()] + ", " + d.getDate() + " " + months[d.getMonth()] + " " + d.getYear();
date = timer_set ? date_timer : date_current;
if (time_format == "hh:mm" && !timer_blink_sep) {
arr = []; ///////////////////////////
blink_sep();
}
if (timer_started) {
var event_1, event_2;
if (on_mouse && !event_0){
check_time_format("hh:mm:ss");
date = date_timer;
}
if (timer_type == "After a given time") {
date_timer = date_timer - 1;
event_0 = date_timer <= 61;
event_1 = date_timer < 10;
event_2 = date_timer <= 0;
}
if (timer_type == "At a given time"){
event_0 = Math.abs(date_timer - date_current) <= 61;
event_1 = Math.abs(date_timer - date_current) < 10;
event_2 = Math.abs(date_timer - date_current) <= 0;
}
if (event_0) {
check_time_format("hh:mm:ss");
if (timer_type == "After a given time") {
date = date_timer;
}
if (timer_type == "At a given time"){
date = Math.abs(date_timer - date_current);
}
}
if (event_1 && !timer_blink) {
blink();
}
if (event_2 && !timer_set_volume) {
date_show = false;
playback_text = playback.toUpperCase();
if (playback == "Play") {
volume_state = fb.Volume == -100 ? -50 : fb.Volume;
if (!fb.IsPlaying) {
fb.Volume = -100;
fb.Play();
}
}
if (playback == "Stop") {
//if (playback == "Stop" && fb.IsPlaying) {
volume_state = fb.Volume;
}
set_volume();
}
}
data_check();
}
function set_volume() {
timer_set_volume = window.SetInterval(function(){
if (playback == "Play") {
fb.VolumeUp();
if (fb.Volume >= volume_state ) {
timer_set_volume_stop();
}
}
if (playback == "Stop") {
fb.VolumeDown();
if (fb.Volume <= -100 ) {
fb.Stop();
fb.Volume = volume_state;
timer_set_volume_stop();
}
}
}, 40);
}
function timer_set_volume_stop(){
window.ClearInterval(timer_set_volume);
event_0 = false;
timer_set_volume = false;
timer_started = false;
get_time_imgs();
date_show = true;
check_time_format();
num = [];
}
function on_mouse_wheel(delta) {
if (timer_set && Math.max.apply(null, dh) == 0){
switch (num_this) {
case 0:
delay_set = [1, 1, 1, 1, 1, 1];
date_timer = date_timer + 36000 * delta;
date_timer = date_timer > 86400 ? date_timer - 108000 : date_timer;
date_timer = date_timer < 0 ? date_timer + 108000 : date_timer;
break;
case 1:
delay_set = [2, 1, 1, 1, 1, 1];
date_timer = date_timer + 3600 * delta;
break;
case 2:
delay_set = [3, 2, 1, 1, 1, 1];
date_timer = date_timer + 600 * delta;
break;
case 3:
delay_set = [4, 3, 2, 1, 1, 1];
date_timer = date_timer + 60 * delta;
break;
case 4:
delay_set = [5, 4, 3, 2, 1, 1];
date_timer = date_timer + 10 * delta;
break;
case 5:
delay_set = [6, 5, 4, 3, 2, 1];
date_timer = date_timer + 1 * delta;
break;
}
for (var i in delay_set) {
}
date_timer = date_timer >= 86400 ? date_timer - 86400 : date_timer;
date_timer = date_timer < 0 ? date_timer + 86400 : date_timer;
data_check();
}
}
function data_check() {
date = timer_set ? date_timer : date;
h = sec_to_hms(date).h;
m = sec_to_hms(date).m;
s = sec_to_hms(date).s;
if (s > 9){
num_o[5] = parseInt(s.toString(10).replace(/^./g, ""), 10);
num_o[4] = parseInt(s.toString(10).replace(/.$/g, ""), 10);
} else {
num_o[5] = parseInt(s.toString(10), 10);
num_o[4] = 0;
}
if (num_o[5] != num[5]) rotate(5);
if (num_o[4] != num[4]) rotate(4);
if (m > 9){
num_o[3] = parseInt(m.toString(10).replace(/^./g, ""), 10);
num_o[2] = parseInt(m.toString(10).replace(/.$/g, ""), 10);
} else {
num_o[3] = parseInt(m.toString(10), 10);
num_o[2] = 0;
}
if (num_o[3] != num[3]) rotate(3);
if (num_o[2] != num[2]) rotate(2);
if (h > 9){
num_o[1] = parseInt(h.toString(10).replace(/^./g, ""), 10);
num_o[0] = parseInt(h.toString(10).replace(/.$/g, ""), 10);
} else {
num_o[1] = parseInt(h.toString(10), 10);
num_o[0] = 0;
}
if (num_o[1] != num[1]) rotate(1);
if (num_o[0] != num[0]) rotate(0);
}
function rotate(i){
dir[i] = 0;
if (!timer_set){
alpha_step = Math.round(255 / n_w);
if (dw[i] > 0) step[i] = step[i] + 1;
timer_rotate[i] && window.ClearInterval(timer_rotate[i]);
dw[i] = 0;
dh[i] = 0;
timer_rotate[i] = window.SetInterval(function() {
if (dir[i] == 0) dw[i] = dw[i] + step[i];
if (dir[i] == 1) dw[i] = dw[i] - step[i];
alpha = 255 - alpha_step * dw[i];
hover_alpha[i] = alpha <= 0 ? 0 : alpha;
if (dw[i] >= n_w && dir[i] == 0) {dir[i] = 1; num[i] = num_o[i];}
if (dw[i] <= 0 && dir[i] == 1) window.ClearInterval(timer_rotate[i]);
window.Repaint();
}, delay[i] );
}
if (timer_set){
alpha_step = Math.round(255 / n_h);
if (dh[i] > 0) step_set[i] = step_set[i] + 1;
timer_rotate[i] && window.ClearInterval(timer_rotate[i]);
dw[i] = 0;
dh[i] = 0;
timer_rotate[i] = window.SetInterval(function() {
if (dir[i] == 0) dh[i] = dh[i] + step[i];
if (dir[i] == 1) dh[i] = dh[i] - step[i];
alpha = 255 - alpha_step * dh[i];
hover_alpha[i] = alpha <= 0 ? 0 : alpha;
if (dh[i] >= n_h && dir[i] == 0) {dir[i] = 1; num[i] = num_o[i];}
if (dh[i] <= 0 && dir[i] == 1) {
window.ClearInterval(timer_rotate[i]);
timer_rotate[i] = false;
}
window.Repaint();
}, delay_set[i] );
}
}
function get_time_imgs(){
if (timer_started) {
if (playback == "Play" ) {
time_imgs = imgs_play;
}
if (playback == "Stop" ) {
time_imgs = imgs_stop;
}
} else {
time_imgs = imgs_default;
}
}
function sec_to_hms(sec) {
var time = {t: 0, h: 0, m: 0, s: 0};
var h, m, s;
h = Math.floor(sec / 3600);
m = Math.floor((sec - h * 3600) / 60);
s = sec - h * 3600 - m * 60;
if ( h < 10 ) h = "0" + h;
if ( m < 10 ) m = "0" + m;
if ( s < 10 ) s = "0" + s;
time.t = h + sep + m + sep + s;
time.h = h;
time.m = m;
time.s = s;
return time;
}
function get_num_imgs(arr, color){
for (var i = 0; i <= 9; i++) {
arr.push(create_img(i, color));
}
}
function create_img(n, color){
var temp = gdi.CreateImage(n_w, n_h);
var temp_gr = temp.GetGraphics();
temp_gr.GdiDrawText( n, num_font, color, 0, 0, n_w, n_h, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
temp.ReleaseGraphics(temp_gr);
return temp;
temp.Dispose();
temp_gr = null;
temp = null;
}
function dim(){
var temp = gdi.CreateImage(1, 1);
var temp_gr = temp.GetGraphics();
var tmp;
n_w = temp_gr.CalcTextWidth("0", num_font);
n_h = temp_gr.CalcTextHeight("0", num_font);
t_h = temp_gr.CalcTextHeight("0", t_font);
temp.ReleaseGraphics(temp_gr);
temp.Dispose();
temp_gr = null;
temp = null;
if (!t_show){
n_y = (wh - n_h) / 2;
} else {
n_y = (wh - (n_h + t_h * 2)) / 2;
t_y = n_y + n_h * 0.9;
}
n_x = [];
x = (ww - n_w * (n + 2)) / 2;
tmp = 0;
for (var i = 0; i < n; i++) {
n_x.push(Math.round(x + tmp));
tmp = tmp + n_w + (i == 1 || i == 3 ? n_w : 0);
}
n2_x = [];
x = (ww - n_w * (n2 + 1)) / 2;
tmp = 0;
for (var i = 0; i < n2; i++) {
n2_x.push(Math.round(x + tmp));
tmp = tmp + n_w + (i == 1 || i == 3 ? n_w : 0);
}
}
function RGBtoHSV(r, g, b) {
var HSV = {H: 0, S: 0, V: 0};
var r = (r / 255);
var g = (g / 255);
var b = (b / 255);
var min = Math.min( r, g, b );
var max = Math.max( r, g, b );
var delta = max - min;
v = max;
if (delta == 0) {
h = 0;
s = 0;
} else {
s = delta / max;
delta_r = (((max - r) / 6) + (delta / 2)) / delta;
delta_g = (((max - g) / 6) + (delta / 2)) / delta;
delta_b = (((max - b) / 6) + (delta / 2)) / delta;
if (r == max) h = delta_b - delta_g;
else if (g == max) h = (1 / 3) + delta_r - delta_b;
else if (b == max) h = (2 / 3) + delta_g - delta_r;
if ( h < 0 ) h += 1;
if ( h > 1 ) h -= 1;
}
HSV.H = Math.round(h * 360);
HSV.S = Math.round(s * 100);
HSV.V = Math.round(v * 100);
return HSV;
}
function HSVtoRGB(h, s, v) {
var h = h / 360;
var s = s / 100;
var v = v / 100;
if (s == 0) {
var r = v * 255;
var g = v * 255;
var b = v * 255;
} else {
h = h * 6;
if ( h == 6 ) h = 0;
var var_i = Math.floor( h );
var var_1 = v * (1 - s);
var var_2 = v * (1 - s * (h - var_i));
var var_3 = v * (1 - s * (1 - (h - var_i)));
if (var_i == 0) {r = v; g = var_3; b = var_1;}
else if (var_i == 1) {r = var_2; g = v; b = var_1;}
else if (var_i == 2) {r = var_1; g = v; b = var_3;}
else if (var_i == 3) {r = var_1; g = var_2; b = v;}
else if (var_i == 4) {r = var_3; g = var_1; b = v;}
else {r = v; g = var_1; b = var_2;}
r = r * 255;
g = g * 255;
b = b * 255;
}
return RGB( Math.round(r), Math.round(g), Math.round(b));
}
function calcBrightness(c) {
var r = getRed(c);
var g = getGreen(c);
var b = getBlue(c);
return Math.round(Math.sqrt( 0.299 * r * r + 0.587 * g * g + 0.114 *b * b ));
}
function print(msg) {
try {
fb.trace(msg);
} catch(e){console.log(msg);};
}
// *************
function change_hover_state(x, y) {
if (!hover_timer_started) hover_alpha_timer();
for (var i in n_x) {
hover_state[i] = 0;
num_this = mouse_on_n(x, y);
hover_state[num_this] = 1;
}
}
function leave_hover_state() {
for (var i in hover_state) {
if (hover_state[i] != 0) {
hover_state[i] = 0;
}
}
}
function hover_alpha_timer() {
hover_timer_started = true;
var hover_on_step = 39;
var hover_off_step = 10;
n_timer = window.SetInterval(function() {
for (var i = 0; i < n; i++) {
if (!hover_alpha[i]) hover_alpha[i] = 0;
switch (hover_state[i]) {
case 0:
hover_alpha[i] = Math.max(alpha_min, hover_alpha[i] -= hover_off_step);
break;
case 1:
hover_alpha[i]= Math.min(255, hover_alpha[i] += hover_on_step);
break;
}
window.Repaint();
}
if (timer_set && !on_mouse && Math.max.apply(null, hover_alpha) <= alpha_min){
hover_timer_started = false;
window.ClearInterval(n_timer);
}
if (!timer_set && Math.max.apply(null, hover_alpha) >= 255){
hover_timer_started = false;
window.ClearInterval(n_timer);
}
}, 40);
}
function mouse_on_n(x, y){
for (var i in n_x) {
if (x > n_x[i] && x < n_x[i] + n_w && y > 0 && y < wh) return parseInt(i);
}
}
// ==PREPROCESSOR==
// @name "emoticon"
// @author "kgena_ua"
// ==/PREPROCESSOR==
function RGB(r,g,b){
return (0xff000000|(r<<16)|(g<<8)|(b));
}
var ww = 0, wh = 0;
var bgcolor = RGB(128, 166, 255);
var color_1 = RGB(255, 255, 0);
var color_2 = RGB(0,0,0);
var emoticon_s = 60;
var emoticon = resize_emoticon(create_emoticon(color_1, color_2), emoticon_s, emoticon_s);
function resize_emoticon(img, w, h){
if (!img) return;
var scale_w = w / img.Width;
var scale_h = h / img.Height;
var scale = Math.min(scale_w, scale_h);
var iw = Math.round(img.Width * scale);
var ih = Math.round(img.Height * scale)
var temp_bmp = gdi.CreateImage(iw, ih);
var temp_gr = temp_bmp.GetGraphics();
temp_gr.SetSmoothingMode(2);
temp_gr.SetInterpolationMode(7);
temp_gr.DrawImage(img, 0, 0, iw, ih, 0, 0, img.width, img.height);
temp_bmp.ReleaseGraphics(temp_gr);
return temp_bmp;
temp_bmp.Dispose();
temp_gr = null;
temp_bmp = null;
}
function create_emoticon(c1, c2){
var temp = gdi.CreateImage(200, 200);
var temp_gr = temp.GetGraphics();
temp_gr.SetSmoothingMode(4);
r = 90;
d = r * 2;
x = r;
y = r;
ys = y - r * 0.3;
rs = r * 1.15;
rs1 = rs * 0.73;
rs2 = rs1 * 0.95;
rs3 = rs1 * 1.1;
rs4 = rs2 * 0.9;
angl1 = 120;
angl2 = 240;
steps = 360;
var dyP1 = 0;
temp_gr.FillEllipse(x - d /2, y - d /2, d, d, c1);
for (var j = angl1; j < angl2; j++) {
xP1 = (rs1 * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
yP1 = (rs1 * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));
xP2 = (rs2 * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
yP2 = (rs2 * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));
if (j > angl1 && j < 180) dyP1 = dyP1 + 0.15;
if (j > 180 && j < angl2) dyP1 = dyP1 - 0.15;
temp_gr.DrawLine(x + xP1, ys + yP1 + dyP1, x + xP2, ys + yP2, 2, c2);
}
for (var j = angl1; j < angl1 + rs * 0.02; j++) {
xP1 = (rs3 * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
yP1 = (rs3 * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));
xP2 = (rs4 * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
yP2 = (rs4 * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));
temp_gr.DrawLine(x + xP1, ys + yP1, x + xP2, ys + yP2, 2, c2);
}
for (var j = angl2 - rs * 0.02; j < angl2; j++) {
xP1 = (rs3 * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
yP1 = (rs3 * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));
xP2 = (rs4 * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
yP2 = (rs4 * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));
temp_gr.DrawLine(x + xP1, ys + yP1, x + xP2, ys + yP2, 2, c2);
}
temp_gr.FillEllipse(x + r * 0.15, y - r * 0.55, d * 0.12, d * 0.25, c2);
temp_gr.FillEllipse(x - r * 0.4, y - r * 0.55, d * 0.12, d * 0.25, c2);
lw = r * 0.08;
temp_gr.DrawEllipse(x - d /2 + lw / 2, y - d /2 + lw / 2, d - lw, d - lw, lw, c2);
temp.ReleaseGraphics(temp_gr);
return temp;
temp.Dispose();
temp_gr = null;
temp = null;
}
function on_paint(gr) {
!window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
gr.DrawImage(emoticon, ww / 2 - emoticon_s / 2, wh / 2 - emoticon_s / 2, emoticon.width, emoticon.Height, 0, 0, emoticon.width, emoticon.Height, 0, 255);
}
function on_mouse_move(x, y) {
on_mouse = true;
window.SetCursor(32649);
window.Repaint();
}
function on_mouse_leave() {
on_mouse = false;
window.SetCursor(32512);
window.Repaint();
}
function on_size(){
ww = window.Width;
wh = window.Height;
}
Если снова будет делать нечего, может накидаешь скрипт "пляшущих человечков" (условное название).kgena_ua:Дело было вечером, делать было нечего...
Вот это может быть интересно.MC Web:перемещения
function RGB(r,g,b) { return (0xff000000|(r<<16)|(g<<8)|(b)); }
var font = gdi.Font("arial",12,0);
var ww = 0, wh = 0;
DT_LEFT = 0x00000000;
var bgcolor = RGB(0, 128, 192);
var color1 = RGB(255, 255, 0);
var color2 = RGB(0,0,0);
var on_mouse = false;
var f_w, f_h;
var w_font_size = 100;
var w_font = gdi.Font("Preston Blair walk", w_font_size, 0);
var r_font_size = 100;
var r_font = gdi.Font("Preston Blair Run", r_font_size, 0);
var f_arr = ["q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "a", "s", "d", "f", "g", "h", "j", "k", "l", "z", "x", "c", "v", "b", "n"];
var f_y = 0;
function on_paint(gr) {
!window.IsTransparent && gr.FillSolidRect(0, 0, ww, wh, bgcolor);
f_w = gr.CalcTextWidth("q", w_font);
f_h = gr.CalcTextHeight("q", w_font);
gr.GdiDrawText( f_arr[w_idx], w_font, color1, w_x - f_w, f_y, ww, wh, DT_LEFT );
gr.GdiDrawText( f_arr[r_idx], r_font, color1, r_x - f_w, f_y + f_h, ww, wh, DT_LEFT );
}
var direction = true;
var w_idx = 0;
var w_x = 0;
var w_k = 0.039;
var w_s = w_font_size * w_k;
var w_timer = false;
walk_timer();
function walk_timer(){
w_timer && window.ClearInterval(w_timer);
w_timer = window.SetInterval(function() {
if (direction){
w_idx = w_idx == f_arr.length - 1 ? 0 : w_idx + 1;
w_x = w_x >= ww + f_w / 2 ? 0 : w_x + w_s;
}
if (!direction){
w_idx = w_idx == 0 ? f_arr.length - 1 : w_idx - 1;
w_x = w_x <= 0 ? ww + f_w / 2 : w_x - w_s;
}
window.Repaint();
}, 50);
}
var r_idx = 0;
var r_x = 0;
var r_k = 0.14;
var r_s = r_font_size * r_k;
var r_timer = false;
run_timer();
function run_timer(){
r_timer && window.ClearInterval(r_timer);
r_timer = window.SetInterval(function() {
r_idx = r_idx == f_arr.length - 1 ? 0 : r_idx + 1;
r_x = r_x >= ww + f_w / 2 ? 0 : r_x + r_s;
window.Repaint();
}, 50);
}
function on_mouse_wheel(delta) {
w_timer && window.ClearInterval(w_timer);
if (delta < 0) {
w_idx = w_idx == 0 ? f_arr.length - 1 : w_idx - 1;
w_x = w_x <= 0 ? ww + f_w / 2 : w_x - w_s;
}
if (delta > 0) {
w_idx = w_idx == f_arr.length - 1 ? 0 : w_idx + 1;
w_x = w_x >= ww + f_w / 2 ? 0 : w_x + w_s;
}
window.Repaint();
}
function on_mouse_lbtn_up(x,y) {
direction = !direction;
walk_timer();
}
function on_mouse_lbtn_down(x, y) {
}
function on_mouse_rbtn_up(x, y){
}
function on_mouse_move(x, y) {
on_mouse = true;
window.SetCursor(32649);
window.Repaint();
}
function on_mouse_leave() {
on_mouse = false;
window.SetCursor(32512);
window.Repaint();
}
function on_size(){
ww = window.Width;
wh = window.Height;
}
Вернуться в Секреты foobar2000