1: var mouseOverState=fb.TitleFormat("%Rating%").Eval(true);
2: function on_playback_new_track(metadb){
3: mouseOverState=fb.TitleFormat("%Rating%").Eval(true);
4: window.repaint();
5: }
6: function on_size(){
7: ww = window.Width;
8: wh = window.Height;
9: }
10: function RGB(r, g, b) {
11: return (0xff000000 | (r << 16) | (g << 8) | (b));
12: }
13: function on_paint(gr) {
14: gr.SetTextRenderingHint(5);
15: var ww = window.Width;
16: var wh = window.Height;
17: if(ww/5<wh) var g_font = gdi.Font("Tahoma", ww/5, 0);
18: else var g_font = gdi.Font("Tahoma", wh, 0);
19: if(mouseOverState==0){
20: for(i=1; i<6; i++){
21: gr.DrawString("★", g_font, RGB(204,204,255), (ww/5.0)*(i-1), 0, ww/5, wh, 0x11005000);
22: }
23: }
24: else if(mouseOverState<=fb.TitleFormat("%Rating%").Eval(true)){
25: for(i=1; i<6; i++){
26: if(i<mouseOverState){
27: gr.DrawString("★", g_font, RGB(255,204,0), (ww/5.0)*(i-1), 0, ww/5, wh, 0x11005000);
28: }
29: else if((mouseOverState<=i)&&(i<=fb.TitleFormat("%Rating%").Eval(true))&&(mouseOverState==fb.TitleFormat("%Rating%").Eval(true))){
30: gr.DrawString("★", g_font, RGB(255,204,0), (ww/5.0)*(i-1), 0, ww/5, wh, 0x11005000);
31: }
32: else if((mouseOverState<=i)&&(i<=fb.TitleFormat("%Rating%").Eval(true))&&(mouseOverState!=fb.TitleFormat("%Rating%").Eval(true))){
33: gr.DrawString("★", g_font, RGB(204,255,102), (ww/5.0)*(i-1), 0, ww/5, wh, 0x11005000);
34: }
35: else{
36: gr.DrawString("★", g_font, RGB(102,153,204), (ww/5.0)*(i-1), 0, ww/5, wh, 0x11005000);
37: }
38: }
39: }
40: else{
41: for(i=1; i<6; i++){
42: if(i<=fb.TitleFormat("%Rating%").Eval(true)){
43: gr.DrawString("★", g_font, RGB(255,204,0), (ww/5.0)*(i-1), 0, ww/5, wh, 0x11005000);
44: }
45: else if(i<=mouseOverState){
46: gr.DrawString("★", g_font, RGB(255,255,0), (ww/5.0)*(i-1), 0, ww/5, wh, 0x11005000);
47: }
48: else{
49: gr.DrawString("★", g_font, RGB(102,153,204), (ww/5.0)*(i-1), 0, ww/5, wh, 0x11005000);
50: }
51: }
52: }
53: }
54:
55: function on_mouse_lbtn_down(x, y) {
56: var WshShell = new ActiveXObject("WScript.Shell");
57: if (mouseOverState==0) WshShell.Run("foobar2000.exe \"/runcmd-playlist=Playback Statistics/Rating/<not set>\"");
58: else WshShell.Run("foobar2000.exe \"/runcmd-playlist=Playback Statistics/Rating/"+mouseOverState+"\"");
59: }
60:
61: function on_mouse_move(x, y) {
62: for(i=1; i<6; i++){
63: if(x<(ww/5.0)*i){
64: mouseOverState=i;
65: break;
66: }
67: }
68: if(x<ww/12.0) mouseOverState=0;
69: window.repaint();
70: }
71: function on_mouse_leave(){
72: mouseOverState=fb.TitleFormat("%Rating%").Eval(true);
73: window.repaint();
74: }
■動作例
0 件のコメント:
コメントを投稿