Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: JScript Panel (Read 297488 times) previous topic - next topic
Jul2323 and 3 Guests are viewing this topic.

Re: JScript Panel

Reply #1375
Playcount is up to date, rating works. Clicking on the genres or the immediate vicinity triggers the error.
Here is the complete error message:
JScript Panel 3.3.31 (Smooth Playlist by Br3tt aka Falstaff)
Laufzeitfehler in JavaScript
Die Eigenschaft "rating" eines undefinierten oder Nullverweises kann nicht abgerufen werden.
File: C:\Users\Manfred\AppData\Roaming\foobar2000-v2\user-components-x64\foo_jscript_panel3\samples\smooth\jssp.js
Line: 884, Col: 6

I use the following setting in the smoot playlist:
Header Bar
Background Wallpaper: Front cover...
Group Headers: Enable 2 Album Art: Auto-fill
Track Info: Double Track Line + Rating

Re: JScript Panel

Reply #1376
Right I was a bit confused because I forgot genre tags are displayed in the group header if present.

Clicking there shouldn't trigger rating but it does because of a bug that thinks it's a track row and not a group header. It's now fixed and you can download this file if you can't wait for the next component release...

https://raw.githubusercontent.com/jscript-panel/component/main/samples/smooth/jssp.js

Save inside user your profile\user-components-x64\foo_jscript_panel3\samples\smooth overwriting the original file. Thanks for spotting.


Re: JScript Panel

Reply #1377
I went back to the package foo_jscript_panel3-3.3.29

The sample Album Art sometimes it is not updated:

3-3.3.29


3-3.3.31





Re: JScript Panel

Reply #1379
Quote from: marc2k3 link=msg=1038238 date=1705962195 https://raw.githubusercontent.com/jscript-panel/component/main/samples/smooth/jssp.js [/quote
/>

Danke/Thank you

Re: JScript Panel

Reply #1380
I have no idea what you mean. :/

Let's see if this is clearer to you.

albumart.js

blur_it = true;

change to

blur_it = this.is_review_panel;

if (this.blur_img) this.img.Dispose();

change to

if (this.blur_img) this.blur_img.Dispose();


with these changes there are image update problems

Re: JScript Panel

Reply #1381
Those changes are in this commit and are quite intentional.

https://github.com/jscript-panel/component/commit/13f0d0a3880bfe39e3952546542be2be2c1e0786

The first change is purely cosmetic with no difference to behaviour. The 2nd bit was a genuine bug fix. Checking this.blur_img and disposing this.img if true was a stupid mistake on my part.

If you think it's now buggy after that change, you're just plain wrong.

And this.blur_img is always going to null  in your panels because it's only applied in the text display and combined allmusic + album art samples. I don't see those in your screenshots.

I have zero issues using a plain panel with no blurring as per my previous attachment.

I have zero issues using either script where blurring actually happens as per this new attachment.



Re: JScript Panel

Reply #1382
Of course the image is not displayed. The _button object uses WriteText for displaying a font character.

https://github.com/jscript-panel/component/blob/9720ab515ba58752c85cf63e74d9ef8fe2fc4982/samples/js/common.js#L18

You'd have to take the button object and paste it somewhere in your own code and modify it with gr.DrawImage.

Well, I've tried and have tried it for many many hours. Starting from where you pointed me I just get type mismatches.

Funny thing is I have it working in JS2 for a long time but want to migrate to JS3. I also tried to migrate my working code from JS2 to JS3 but in the end it fails on a GDI function which is nowhere to be found in your code. I suspect that one resides in the DLL.

Why do I get type mismatches from this call of this.buttons.pbo?
Code: [Select]
// ==PREPROCESSOR==
// @name "Playback Buttons"
// @author "marc2003"
// @import "%fb2k_component_path%helpers.txt"
// @import "%fb2k_component_path%samples\js\lodash.min.js"
// @import "%fb2k_component_path%samples\js\common.js"
// @import "%fb2k_component_path%samples\js\panel.js"
// ==/PREPROCESSOR==

/*
Most samples already require FontAwesome and it's used for the default buttons.
https://github.com/FortAwesome/Font-Awesome/blob/4.x/fonts/fontawesome-webfont.ttf?raw=true

The Segoe Fluent Icons font is already included with Windows 11. Windows 10 users can download it here:
https://download.microsoft.com/download/8/f/c/8fc7cbc3-177e-4a22-af48-2a85e1c5bffb/Segoe-Fluent-Icons.zip

If installed, you can right click the panel and change the button set.
*/

var colours = {
buttons : RGB(255, 255, 255),
background : RGB(30, 30, 30),
sac : RGB(196, 30, 35),
};

//////////////////////////////////////////////////////////////

var panel = new _panel();
var buttons = new _buttons();
var bs = _scale(24);
var button_set_idx = 0;
var fluent_font = 'Segoe Fluent Icons';
var has_font = utils.CheckFont(fluent_font);

var char_set = [chars, fluent_chars];

if (has_font) {
button_set_idx = window.GetProperty('2K3.BUTTON.SET', 0);
}

// var configPath = fb.ProfilePath + 'cui-configs\\Defender\\';
// var imgPath = configPath + 'Images\\PlayBack\\';

buttons.update = function () {
var x = ((panel.w - bs * 4) / 2);
var y = Math.round((panel.h - bs) / 2);
this.buttons.stop = new _button(x, y, 0, bs, { char : char_set[button_set_idx].stop, colour:fb.StopAfterCurrent ? colours.sac : colours.buttons}, null, function () { fb.Stop(); }, 'Stop');
this.buttons.previous = new _button(x + bs, y, 0, bs, { char : char_set[button_set_idx].prev, colour:colours.buttons }, null, function () { fb.Prev(); }, 'Previous');
this.buttons.play = new _button(x + (bs * 2), y, 0, bs, { char : !fb.IsPlaying || fb.IsPaused ? char_set[button_set_idx].play : char_set[button_set_idx].pause, colour:colours.buttons}, null, function () { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? 'Play' : 'Pause');
this.buttons.next = new _button(x + (bs * 3), y, 0, bs, { char : char_set[button_set_idx].next, colour:colours.buttons }, null, function () { fb.Next(); }, 'Next');

// var img_normal = imgPath + 'PBO-' + _typePBO() + '-normal.png';
// var img_hover = imgPath + 'PBO-' + _typePBO() + '-hover.png';
var img_normal = utils.LoadImage(fb.ComponentPath + 'samples\\images\\cog.png');
var img_hover = utils.LoadImage(fb.ComponentPath + 'samples\\images\\cog.png');

// this.buttons.pbo = new _button_img(0, 0, panel.w, panel.h, { char : char_set[button_set_idx].next, colour:colours.buttons }, null, function () { fb.Next(); }, '');
this.buttons.pbo = new _button_img(0, 0, panel.w, panel.h, { normal : img_normal }, { hover : img_hover }, function () { fb.Next(); }, '');

if (button_set_idx == 1) {
this.change_font(fluent_font);
}
}

function _button_img(x, y, w, h, normal, hover, fn, tiptext) {
this.paint = function (gr) {
if (this.current) {
// gr.WriteText(this.current.char, this.font, this.current.colour, this.x, this.y, this.w, this.h, 2, 2);
gr.DrawImage(this.current, this.x, this.y, window.Width, window.Height, 0, 0, this.w, this.h);
}
}

this.containsXY = function (x, y) {
return x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.h;
}

this.lbtn_up = function (x, y, mask) {
if (this.fn) {
this.fn(x, y, mask);
}
}

this.cs = function (s) {
if (s == 'hover') {
this.current = this.hover;
_tt(this.tiptext);
} else {
this.current = this.normal;
}
window.RepaintRect(this.x, this.y, this.w, this.h);
}

this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.fn = fn;
this.tiptext = tiptext;
this.normal = normal;
this.hover = hover || normal;
this.current = normal;
this.font = JSON.stringify({Name:'FontAwesome',Size:this.h - _scale(10)});
}

function on_mouse_lbtn_up(x, y) {
buttons.lbtn_up(x, y);
}

function on_mouse_leave() {
buttons.leave();
}

function on_mouse_move(x, y) {
buttons.move(x, y);
}

function on_mouse_rbtn_up(x, y) {
if (buttons.buttons.stop.containsXY(x, y)) {
fb.StopAfterCurrent = !fb.StopAfterCurrent;
return true;
}

var menu = window.CreatePopupMenu();
var sub = window.CreatePopupMenu();
sub.AppendMenuItem(MF_STRING, 1, 'Original');
sub.AppendMenuItem(EnableMenuIf(has_font), 2, 'Fluent');
sub.CheckMenuRadioItem(1, 2, button_set_idx + 1);
sub.AppendTo(menu, MF_STRING, 'Buttons');
menu.AppendMenuSeparator();
menu.AppendMenuItem(MF_STRING, 3, 'Configure');

var idx = menu.TrackPopupMenu(x, y);
menu.Dispose();

switch (idx ) {
case 1:
case 2:
button_set_idx = idx - 1;
window.SetProperty('2K3.BUTTON.SET', button_set_idx);
buttons.update();
window.Repaint();
break;
case 3:
window.ShowConfigure();
break;
}

return true;
}

function on_paint(gr) {
// gr.Clear(colours.background);
buttons.paint(gr);
}

function on_playback_pause() {
buttons.update();
window.Repaint();
}

function on_playback_starting() {
buttons.update();
window.Repaint();
}

function on_playback_stop() {
buttons.update();
window.Repaint();
}

function on_playlist_stop_after_current_changed() {
buttons.update();
window.Repaint();
}

function on_size() {
panel.size();
buttons.update();
}

For reference this is the working JS2 code:
Code: [Select]
// ==PREPROCESSOR==
// @name "PBO Button - PBO dropdown/Reset PBO to Default"
// @author "marc2003, modified by Defender"
// @import "%fb2k_component_path%samples\js\lodash.min.js"
// @import "%fb2k_component_path%samples\js\helpers.js"
// @import "%fb2k_component_path%samples\js\panel.js"
// ==/PREPROCESSOR==

var dbg             = 0;

var configPath = fb.ProfilePath + "cui-configs\\Defender\\";
var imgPath = configPath + "Images\\PlayBack\\";

var panel = new _panel({ custom_background : true });
var buttons = new _buttons();

buttons.update = function () {
var img_normal = imgPath + 'PBO-' + _typePBO() + '-normal.png';
var img_hover = imgPath + 'PBO-' + _typePBO() + '-hover.png';

this.buttons.pbo = new _button_modified(0, 0, window.Width, window.Height, {normal : img_normal,hover : img_hover}, function (x, y, mask) { _pbo(-_scale(28), window.Height + _scale(3));}, ''); // Perfect
}

function _pbo(x, y, flags) {
var menu = window.CreatePopupMenu();
// var str = fb.GetOutputDevices(); // ORG
// var arr = JSON.parse(str); // ORG
var arr = new Array("Default", "Repeat (Playlist)", "Repeat (Track)", "Random", "Shuffle (tracks)", "Shuffle (albums)", "Shuffle (folders)"); // NEW
var active = -1;
for (var i = 0; i < arr.length; i++) {
// menu.AppendMenuItem(MF_STRING, i + 1, arr[i].name); // ORG
menu.AppendMenuItem(MF_STRING, i + 1, arr[i]); // NEW
if (arr[i].active) active = i;
}

if (active > -1) menu.CheckMenuRadioItem(1, arr.length + 1, active + 1);

var idx = menu.TrackPopupMenu(x, y);
menu.Dispose();

// if (idx > 0) fb.RunMainMenuCommand("Playback/Device/" + arr[idx - 1].name); // ORG
if (idx > 0) {fb.RunMainMenuCommand("Playback/Order/" + arr[idx - 1]); }; // NEW
}

function _button_modified(x, y, w, h, img_src, fn, tiptext) {
this.paint = function (gr) {
if (this.img) {
// _drawImage(gr, this.img, this.x, this.y, this.w, this.h); // ORG
_drawImage(gr, this.img, this.x, this.y, window.Width, window.Height); // NEW
}
}

this.containsXY = function (x, y) {
// return x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.h; // ORG
return x > this.x && x < this.x + window.Width && y > this.y && y < this.y + window.Height; // NEW
}

this.lbtn_up = function (x, y, mask) {
if (this.fn) {
this.fn(x, y, mask);
}
}

this.cs = function (s) {
if (s == 'hover') {
this.img = this.img_hover;
_tt(this.tiptext);
} else {
this.img = this.img_normal;
}
// window.RepaintRect(this.x, this.y, this.w, this.h); // ORG
window.RepaintRect(this.x, this.y, window.Width, window.Height); // NEW
}

this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.fn = fn;
this.tiptext = tiptext;
this.img_normal = typeof img_src.normal == 'string' ? _img(img_src.normal) : img_src.normal;
this.img_hover = img_src.hover ? (typeof img_src.hover == 'string' ? _img(img_src.hover) : img_src.hover) : this.img_normal;
this.img = this.img_normal;
}

function on_colours_changed() {
panel.colours_changed();
window.Repaint();
}

function on_mouse_lbtn_up(x, y, mask) {
buttons.lbtn_up(x, y, mask);
}

function on_mouse_leave() {
buttons.leave();
}

function on_mouse_move(x, y) {
buttons.move(x, y);
}

function on_mouse_rbtn_up(x, y) {
/* ORG
if (buttons.buttons.pbo.containsXY(x, y)) {
// _help(0, 36); // ORG
_help(-_scale(28), window.Height + _scale(3)); // NEW
return true;
} else {
return panel.rbtn_up(x, y);
}
*/
if (dbg == 1) {
if (buttons.buttons.pbo.containsXY(x, y)) {
// _help(0, 36); // ORG
_help(-_scale(28), window.Height + _scale(3)); // NEW
return true;
} else {
return panel.rbtn_up(x, y);
}
} else {

// BEGIN - NEW
// Cycle through options
// if ( plman.PlaybackOrder == 6 ) plman.PlaybackOrder = 0;
// else plman.PlaybackOrder = plman.PlayBackOrder + 1;

// Reset to Default
plman.PlaybackOrder = 0;
return true;
// END - NEW
}
}

function on_paint(gr) {
panel.paint(gr);
buttons.paint(gr);
}

function on_playback_order_changed(new_index) {
buttons.update();
window.Repaint();
}

function on_size() {
panel.size();
buttons.update();
}

// BEGIN - NEW
function _typePBO() {
switch (plman.PlaybackOrder) {
case 0: return 'Default';
case 1: return 'RepeatPlaylist';
case 2: return 'RepeatTrack';
case 3: return 'Random';
case 4: return 'ShuffleTracks';
case 5: return 'ShuffleAlbums';
case 6: return 'ShuffleFolders';
}
}
// END - NEW

Re: JScript Panel

Reply #1383
This is wrong...

Code: [Select]
this.buttons.pbo = new _button_img(0, 0, panel.w, panel.h, { normal : img_normal }, { hover : img_hover }, function () { fb.Next(); }, '');

Specifically

Code: [Select]
{ normal : img_normal }

An object was used in the char version because a char and colour needed to passed. With the image, pass it as-is.

Code: [Select]
this.buttons.pbo = new _button_img(0, 0, panel.w, panel.h, img_normal, img_hover, function () { fb.Next(); }, '');

Use null for the hover image if it's not different.

Your gr.DrawImage is faulty as well. This...

Code: [Select]
gr.DrawImage(this.current, this.x, this.y, window.Width, window.Height, 0, 0, this.w, this.h)

should be

Code: [Select]
gr.DrawImage(this.current, this.x, this.y, this.w, this.h, 0, 0, this.current.Width, this.current.Height)

It assumes square images.

If that won't always be the case, use _drawImage which is my own bit of JS which I use extensively. You don't have to pass it the image dimensions. It will centre the image automatically.

Code: [Select]
_drawImage(gr, this.current, this.x, this.y, this.w, this.h)

edit: fixed typos

 


Re: JScript Panel

Reply #1386
3.3.32 fixes the Smooth Playlist bug from a few posts up and other internal tidy ups.

https://github.com/jscript-panel/release/releases

https://jscript-panel.github.io/docs/changes/

Even with this latest package I have problems updating the album art module in my configuration.

I have no reason to insist, but the problem occurs with all packages after 3.3.29.


Re: JScript Panel

Reply #1387
This is wrong...

Thx. I'll give it another go.

White smoke through the chimney. Got it working thanks to your tips. I had to add on_playback_order_changed to update the button if the PBO changed somewhere else.

Two things ...
If I use _drawImage(gr, this.x, this.y, this.w, this.h) nothing is displayed.

Second thing is I use a bit of code from the original OutputDeviceButton. Is there a function similar as fb.GetOutputDevices() to retrieve Playbackorder?

For reference I attach the working code with the button images:
Code: [Select]
// ==PREPROCESSOR==
// @name "Playback Buttons - PBO dropdown, rightclick resets to Default"
// @author "marc2003, modified by Defender"
// @import "%fb2k_component_path%helpers.txt"
// @import "%fb2k_component_path%samples\js\lodash.min.js"
// @import "%fb2k_component_path%samples\js\common.js"
// @import "%fb2k_component_path%samples\js\panel.js"
// ==/PREPROCESSOR==

/*
Most samples already require FontAwesome and it's used for the default buttons.
https://github.com/FortAwesome/Font-Awesome/blob/4.x/fonts/fontawesome-webfont.ttf?raw=true

The Segoe Fluent Icons font is already included with Windows 11. Windows 10 users can download it here:
https://download.microsoft.com/download/8/f/c/8fc7cbc3-177e-4a22-af48-2a85e1c5bffb/Segoe-Fluent-Icons.zip

If installed, you can right click the panel and change the button set.
*/

var colours = {
background : RGB(30, 30, 30),
};

//////////////////////////////////////////////////////////////

var panel = new _panel();
var buttons = new _buttons();

var r_menu = 0; // 0=OFF rightclick resets to Default PBO 1=ON rightclick shows help menu

var configPath = fb.ProfilePath + 'cui-configs\\Defender\\';
var imgPath = configPath + 'Images\\PlayBack\\';

buttons.update = function () {
var img_normal = utils.LoadImage(imgPath + 'PBO-' + _typePBO() + '-normal.png');
var img_hover = utils.LoadImage(imgPath + 'PBO-' + _typePBO() + '-hover.png');

this.buttons.pbo = new _button_img(0, 0, panel.w, panel.h, img_normal, img_hover, function (x, y, mask) { _pbo(-_scale(28), window.Height + _scale(3));}, '');
}

function _button_img(x, y, w, h, normal, hover, fn, tiptext) {
this.paint = function (gr) {
if (this.current) {
gr.DrawImage(this.current, this.x, this.y, this.w, this.h, 0, 0, this.current.Width, this.current.Height)
// _drawImage(gr, this.x, this.y, this.w, this.h)
}

}

this.containsXY = function (x, y) {
return x > this.x && x < this.x + this.w && y > this.y && y < this.y + this.h;
}

this.lbtn_up = function (x, y, mask) {
if (this.fn) {
this.fn(x, y, mask);
}
}

this.cs = function (s) {
if (s == 'hover') {
this.current = this.hover;
_tt(this.tiptext);
} else {
this.current = this.normal;
}
window.RepaintRect(this.x, this.y, this.w, this.h);
}

this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.fn = fn;
this.tiptext = tiptext;
this.normal = normal;
this.hover = hover || normal;
this.current = normal;
}

function _pbo(x, y, flags) {
var menu = window.CreatePopupMenu();
// var str = fb.GetOutputDevices(); // ORG
// var arr = JSON.parse(str); // ORG
var arr = new Array("Default", "Repeat (Playlist)", "Repeat (Track)", "Random", "Shuffle (tracks)", "Shuffle (albums)", "Shuffle (folders)"); // NEW
var active = -1;
for (var i = 0; i < arr.length; i++) {
// menu.AppendMenuItem(MF_STRING, i + 1, arr[i].name); // ORG
menu.AppendMenuItem(MF_STRING, i + 1, arr[i]); // NEW
if (arr[i].active) active = i;
}

if (active > -1) menu.CheckMenuRadioItem(1, arr.length + 1, active + 1);

var idx = menu.TrackPopupMenu(x, y);
menu.Dispose();

// if (idx > 0) fb.RunMainMenuCommand("Playback/Device/" + arr[idx - 1].name); // ORG
if (idx > 0) {fb.RunMainMenuCommand("Playback/Order/" + arr[idx - 1]); }; // NEW
}

// BEGIN - NEW
function _typePBO() {
switch (plman.PlaybackOrder) {
case 0: return 'Default';
case 1: return 'RepeatPlaylist';
case 2: return 'RepeatTrack';
case 3: return 'Random';
case 4: return 'ShuffleTracks';
case 5: return 'ShuffleAlbums';
case 6: return 'ShuffleFolders';
}
}

function on_playback_order_changed(new_index) {
buttons.update();
window.Repaint();
}
// END - NEW

function on_mouse_rbtn_up(x, y) {
// BEGIN - NEW
if (r_menu == 1) {
if (buttons.buttons.pbo.containsXY(x, y)) {
// _help(0, 36); // ORG
_help(-_scale(28), window.Height + _scale(3));
return true;
} else {
return panel.rbtn_up(x, y);
}
} else {

// Cycle through options
// if ( plman.PlaybackOrder == 6 ) plman.PlaybackOrder = 0;
// else plman.PlaybackOrder = plman.PlayBackOrder + 1;

// Reset to Default
plman.PlaybackOrder = 0;
return true;
}
// END - NEW

var menu = window.CreatePopupMenu();
var sub = window.CreatePopupMenu();
sub.AppendMenuItem(MF_STRING, 1, 'Original');
sub.AppendMenuItem(EnableMenuIf(has_font), 2, 'Fluent');
sub.CheckMenuRadioItem(1, 2, button_set_idx + 1);
sub.AppendTo(menu, MF_STRING, 'Buttons');
menu.AppendMenuSeparator();
menu.AppendMenuItem(MF_STRING, 3, 'Configure');

var idx = menu.TrackPopupMenu(x, y);
menu.Dispose();

switch (idx ) {
case 1:
case 2:
button_set_idx = idx - 1;
window.SetProperty('2K3.BUTTON.SET', button_set_idx);
buttons.update();
window.Repaint();
break;
case 3:
window.ShowConfigure();
break;
}
return true;
}

function on_mouse_lbtn_up(x, y) {
buttons.lbtn_up(x, y);
}

function on_mouse_leave() {
buttons.leave();
}

function on_mouse_move(x, y) {
buttons.move(x, y);
}

function on_paint(gr) {
// gr.Clear(colours.background); // ORIGINAL
buttons.paint(gr);
}

function on_playback_pause() {
buttons.update();
window.Repaint();
}

function on_playback_starting() {
buttons.update();
window.Repaint();
}

function on_playback_stop() {
buttons.update();
window.Repaint();
}

function on_playlist_stop_after_current_changed() {
buttons.update();
window.Repaint();
}

function on_size() {
panel.size();
buttons.update();
}

Re: JScript Panel

Reply #1388
If I use _drawImage(gr, this.x, this.y, this.w, this.h) nothing is displayed.

Yes, my original post was wrong which is why I edited it and left an edit note. It was 9 minutes after I posted. You're pointing out my mistake more than 12 hours later. :/

And there is plman.PlaybackOrder which is a read/write property.

Code: [Select]
var current_pbo = plman.PlaybackOrder;
plman.PlaybackOrder = new_pbo;

Valid values are here..

https://jscript-panel.github.io/docs/flags/#playbackorder

If you want text labels for all orders, write an array like...

Code: [Select]
var playback_orders = [ "one", "two"]; //I'm not writing this out

Then you can display it with

Code: [Select]
playback_orders[plman.PlaybackOrder]

edit: the foobar2000 SDK does have an API for retrieving playback order by name so maybe I'll expose that in the next release.

Re: JScript Panel

Reply #1389
Since version 3.3.30, all my button animations have failed. Is there any change? The document did not mention it.

Re: JScript Panel

Reply #1390
3.3.30 was borked but 3.3.31 supposedly fixed some issues detailed in the changelog.

https://jscript-panel.github.io/docs/changes/

If you're having issues with the latest version, I'll need your code to investigate.

Re: JScript Panel

Reply #1391
If I use _drawImage(gr, this.x, this.y, this.w, this.h) nothing is displayed.

Yes, my original post was wrong which is why I edited it and left an edit note. It was 9 minutes after I posted. You're pointing out my mistake more than 12 hours later. :/

Code: [Select]
var playback_orders = [ "one", "two"]; //I'm not writing this out

All good now.

_drawImage works but gr.DrawImage works better for me.
I used the var thing to get rid of my function with switch.

Thx!

Re: JScript Panel

Reply #1392
I have tried all the versions, from 3.3.30 to the latest 3.3.32. Only 3.3.29 is normal. I'm using the font called "Material Design Icons".
Code: [Select]
var LANGUAGE=window.GetProperty("Language","auto").toLowerCase();if(LANGUAGE!=="cn"&&LANGUAGE!=="en"){LANGUAGE=(fb.TitleFormat("$meta()").Eval()==="[未知函数]")?"cn":"en";}
var IDC_ARROW=32512;var IDC_HAND=32649;var iconFontName='Material Design Icons';var chars={stop:['\uf667','\uf666','\uf667'],play:['\uF40D','\uf40c','\uF40D'],pause:['\uF3E6','\uf3e5','\uF3E6'],previous:['\uF664','\uf663','\uF664'],next:['\uF662','\uf661','\uF662'],pbo:['\uf49e','\uf456','\uf458','\uf49d','\uf759','\uf025','\uf256'],volume:['\uf57e','\uf580','\uf57f','\uf75e'],love:['\uf2d1','\uf2d4','\uf2d1'],unlove:['\uf2d5','\uf5f6','\uf2d5'],wave:'\uf63a'};var tfs={artist:"$if2(%artist%,'[unknown artist]')",title:'%title%',album:"$if2(%album%,'[unknown album]')",date:'[%date%]',genre:'[%genre%]',album_artist:"$if2(%album artist%,'[unknown album artist]')",tracknumber:'[%tracknumber%]',style:'[%style%]',albumstatus:'[$if2(%albumstatus%,%musicbrainz_albumstatus%)]',albumtype:'[$if2(%albumtype%,%musicbrainz_albumtype%)]',label:'[$if3(%label%,%copyright%,%publisher%,%discogs_label%)]',original_release_date:'[%original release date%]',length:'$if2(%length%,LIVE)',playback_time:'[%playback_time%]',playback_time_remaining:'[%playback_time_remaining%]',playcount:'[$max(%play_count%,%lfm_playcount%,%lastfm_play_count%)]',loved:'[$if3(%loved%,%lfm_loved%,%smp_loved%,%mood%)]'};function _tf(string,handle){return fb.IsPlaying?fb.TitleFormat(string).Eval():(handle&&fb.TitleFormat(string).EvalWithMetadb(handle));}
function PlaybackOrder(){var arr=LANGUAGE==='cn'?['默认','重复 (列表)','重复 (音轨)','随机','乱序 (音轨)','乱序 (专辑)','乱序 (目录)']:['Default','Repeat (playlist)','Repeat (track)','Random','Shuffle (tracks)','Shuffle (albums)','Shuffle (folders)'];var len=arr.length;this.order=arr[plman.PlaybackOrder];this.update=function(){this.order=arr[plman.PlaybackOrder];};this.popup=function(x,y){var menu=window.CreatePopupMenu();for(var i=0;i<len;i++){menu.AppendMenuItem(0,i+1,arr[i]);}
menu.CheckMenuRadioItem(1,len,plman.PlayBackOrder+1);var idx=menu.TrackPopupMenu(x,y);if(idx>0){plman.PlaybackOrder=idx-1;}
menu.Dispose();}}
function imageMask(w,r){var gr;var mask=utils.CreateImage(w,w);gr=mask.GetGraphics();gr.FillRoundedRectangle(0,0,w,w,r,r,0xccffffff);mask.ReleaseGraphics();gr=null;return mask;}
function makeImgSquare(img,size){if(!img)
return null;var iW=img.Width,iH=img.Height,s=iW/iH;if(0.9<s&&s<1.1){img.Resize(size,size);return img;}else if(s>1){var y=0;var w=iH;var h=iH;var x=Math.round((iW-w)/2);}else{var x=0;var w=iW;var h=iW;var y=Math.round((iH-h)/4);}
var square=utils.CreateImage(size,size);var gr=square.GetGraphics();gr.DrawImage(img,0,0,size,size,x,y,w,h);square.ReleaseGraphics();gr=null;return square;}
function makeImgRound(img,size){if(!img)
return null;imgSquare=makeImgSquare(img,size);imgMaskRound=imageMask(size,size/2);var round=utils.CreateImage(size,size);var gr=round.GetGraphics();gr.DrawImageWithMask(imgSquare,imgMaskRound,0,0,size,size);round.ReleaseGraphics();gr=null;return round;}
function _cc(name){return utils.CheckComponent(name);}
function _drawRect(gr,x,y,w,h){gr.FillRectangle(x,y,6,6,0xff202020);gr.FillRectangle(x+2,y+2,4,4,0xff000000);gr.FillRectangle(x+w-6,y,6,6,0xff202020);gr.FillRectangle(x+w-6,y+2,4,4,0xff000000);gr.FillRectangle(x+w-6,y+h-6,6,6,0xff202020);gr.FillRectangle(x+w-6,y+h-6,4,4,0xff000000);gr.FillRectangle(x,y+h-6,6,6,0xff202020);gr.FillRectangle(x+2,y+h-6,4,4,0xff000000);}
function _font(name,size,style){var font={Name:name,Size:size,Weight:(style&1)===1?700:400,Style:(style&2)===2?2:0,Underline:(style&4)===4,Strikethrough:(style&8)===8};return JSON.stringify(font);}
function _now(){return utils.TimestampToDateString(Math.round(new Date().getTime()/1000));}
function _isContainsXY(o,x,y){return o&&(x>=o.x)&&(x<=o.x+o.w)&&(y>=o.y)&&(y<=o.y+o.h);};function _isIn(o1,o2){return o1&&o2&&(o1.x>=o2.x)&&(o1.x+o1.w<=o2.x+o2.w)&&(o1.y>=o2.y)&&(o1.y+o1.h<=o2.y+o2.h);}
function _lovedReverse(handle){if(handle){var handles=fb.CreateHandleList(handle);if(!_tf(tfs.loved,handle)){handles.UpdateFileInfoFromJSON(JSON.stringify({'loved':_now()}));fb.RunContextCommand('Last.fm Playcount Sync/Love');}else{handles.UpdateFileInfoFromJSON(JSON.stringify({'loved':'','mood':''}));fb.RunContextCommand('Last.fm Playcount Sync/Unlove');}
handles.Dispose();handles=null;}}
var tooltip=window.GetProperty('Tooltip',true)?window.CreateTooltip():null;function _tt(text){if(tooltip){if(text){tooltip.Text=text;tooltip.TrackActivate=true;tooltip.TrackPosition(mX+15,mY-25);tooltip.Activate();}else{tooltip.Text='';}}}
var image={cover:0,fit:1,center:0,stretch:2,left:4,top:8,right:16,bottom:32}
function _drawImage(gr,img,x,y,w,h,style,margin,opacity,angle){if(!img){return{};}
var mode=style&3;var align=style&60;var x1=x,y1=y,w1=w,h1=h;var x2=margin||0,y2=margin||0,w2=img.Width-2*x2,h2=img.Height-2*y2;var s1=w/w2,s2=h/h2;switch(true){case mode==2:break;case mode==1:var s=Math.min(s1,s2);if(s1>s2){w1=Math.floor(w2*s);switch(true){case(align&4)===4:break;case(align&16)===16:x1=x+w-w2;break;default:x1=x+Math.round((w-w1)/2);}}else{h1=Math.floor(h2*s);switch(true){case(align&8)===8:break;case(align&32)===32:y1=y+h-h2;break;default:y1=y+Math.round((h-h1)/2);}}
break;case mode==0:default:var s=Math.max(s1,s2);if(s1>s2){h2=Math.ceil(h*w2/Math.max(w,1));switch(true){case(align&8)===8:y2=Math.round((img.Height-h2)/4);break;case(align&32)===32:y2=Math.round((img.Height-h2)*0.75);break;default:y2=Math.round((img.Height-h2)/2);}}else{w2=Math.ceil(w*h2/Math.max(h,1));switch(true){case(align&4)===4:x2=Math.round((img.Width-w2)/4)
break;case(align&16)===16:x2=Math.round((img.Width-w2)*0.75)
break;default:x2=Math.round((img.Width-w2)/2);}}}
gr.DrawImage(img,x1,y1,Math.max(0,w1),Math.max(0,h1),x2,y2,Math.max(1,w2),Math.max(1,h2),opacity===undefined?1:opacity,angle);return{x:x1,y:y1,w:w1,h:h1};}
function _getImageColors(img,n){if(!img){return{};}
var arr=img.GetColourScheme(n?n:64).toArray();var c,s,b,d;c=arr[0];arr.sort(function(a,b){var c1=toRGB(a),c2=toRGB(b),x1=Math.max(c1[0],c1[1],c1[2])-Math.min(c1[0],c1[1],c1[2]),x2=Math.max(c2[0],c2[1],c2[2])-Math.min(c2[0],c2[1],c2[2]);return(x2-x1);});s=arr[0];arr.sort(function(a,b){var c1=toRGB(a),c2=toRGB(b),x1=0.299*c1[0]+0.587*c1[1]+0.114*c1[2],x2=0.299*c2[0]+0.587*c2[1]+0.114*c2[2];return(x2-x1);});b=arr[0];d=arr[arr.length-1];return{c:c,s:s,b:b,d:d};}
var DPI=window.DPI;function Point2Pixel(pt){return Math.round((pt*DPI/72));}
function Pixel2Point(px){return Math.round((px*72/DPI));}
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 toRGB(col){var a=col-0xFF000000;return[a>>16,a>>8&0xFF,a&0xFF];}
function getAlpha(colour){return((colour>>24)&0xff);}
function getRed(colour){return((colour>>16)&0xff);}
function getGreen(colour){return((colour>>8)&0xff);}
function getBlue(colour){return(colour&0xff);}
function setAlpha(colour,a){return((colour&0x00ffffff)|(a<<24));}
function setRed(colour,r){return((colour&0xff00ffff)|(r<<16));}
function setGreen(colour,g){return((colour&0xffff00ff)|(g<<8));}
function setBlue(colour,b){return((colour&0xffffff00)|b);}
function blendColours(c1,c2,factor){var c1=toRGB(c1);var c2=toRGB(c2);var r=Math.round(c1[0]+factor*(c2[0]-c1[0]));var g=Math.round(c1[1]+factor*(c2[1]-c1[1]));var b=Math.round(c1[2]+factor*(c2[2]-c1[2]));return(0xff000000|(r<<16)|(g<<8)|(b));}
function pos2vol(pos){return Math.max(-100,10*Math.log(pos)/Math.LN2);}
function vol2pos(v){return Math.pow(2,fb.Volume/10);}
var LINE=0;var colors={background:RGB(0,0,0),buttons:[RGB(128,128,128),RGB(156,156,156),RGB(255,255,255)],title:RGB(128,128,128),artist:RGB(128,128,128),unlove:[RGB(32,32,32),RGBA(128,17,22),RGBA(128,17,22)],love:[RGBA(128,17,22),RGB(24,24,24),RGB(24,24,24)]};var fontName='Sylfaen';var fontSize=20;var font=_font(fontName,fontSize);var ww=0,wh=0;var mX=-1,mY=-1;var timer_ButtonCS=null;var timer_Playing=null;var bs1=72,bs2=54;var vol=getVol();var pbo=new PlaybackOrder();var handle=null;var art={img:null,imgMask:imageMask(400,30),size:function(x,y,w,h){this.x=x+20;this.y=y+20;this.w=this.h=h-40;},angle:0,paint:function(gr){LINE&&this.w>0&&this.h>0&&gr.DrawRectangle(this.x,this.y,this.w,this.h,1,0xffffffff);this.img&&this.w>0&&this.h>0&&gr.DrawImage(this.img,this.x,this.y,this.w,this.h,0,0,224,224,192,this.angle)},repaint:function(){window.RepaintRect(this.x,this.y,this.w,this.h);},update:function(h){if(this.img){this.img.Dispose();this.img=null;}
this.img=h.GetAlbumArt();this.img&&(this.img=makeImgRound(this.img,224));}};var title_artist={title:'',artist:'',tw:0,size:function(x,y,w,h){this.x=x+h;this.y=wh/4;this.w=w-h-bs2-15;this.h=wh-2*this.y;},paint:function(gr){LINE&&this.w>0&&this.h>0&&gr.DrawRectangle(this.x,this.y,this.w,this.h,1,0xffffffff);gr.WriteText(this.title,font,colors.title,this.x,this.y,this.w,this.h,0,0,1,1);gr.WriteText(this.artist,font,colors.title,this.x,this.y,this.w,this.h,0,1,1,1);},update:function(h){this.title=_tf(tfs.title,h);this.artist=_tf(tfs.artist,h);this.tw=Math.max(utils.CalcTextWidth(this.title,fontName,fontSize),utils.CalcTextWidth(this.artist,fontName,fontSize));}};var time={timeMode:false,playback_time:'0:00',length:'',tw:Math.round(utils.CalcTextWidth('-00:00:00',fontName,fontSize)),th:fontSize,size:function(x,y,w,h){this.x1=x;this.y1=y+(h-this.th)/2;this.w1=this.tw;this.h1=this.th;this.x2=x+w-this.tw;this.y2=y+(h-this.th)/2;this.w2=this.tw;this.h2=this.th;this.bw=w;},paint:function(gr){if(LINE){this.w1>0&&this.h1>0&&gr.DrawRectangle(this.x1,this.y1,this.w1,this.h1,1,0xffffffff);this.w2>0&&this.h2>0&&gr.DrawRectangle(this.x2,this.y2,this.w2,this.h2,1,0xffffffff);}
this.playback_time=fb.IsPlaying?(this.timeMode?'-'+_tf(tfs.playback_time_remaining):_tf(tfs.playback_time)):'0:00';(this.bw>=this.tw)&&gr.WriteText(this.playback_time,font,colors.title,this.x1,this.y1,this.w1,this.h1,1,2);(this.bw>=this.tw*2+15)&&gr.WriteText(this.length,font,colors.title,this.x2,this.y2,this.w2,this.h2,0,2);},repaint:function(){window.RepaintRect(this.x1,this.y1,this.w1,this.h1);window.RepaintRect(this.x2,this.y2,this.w2,this.h2);},update:function(h){this.length=_tf(tfs.length,h);}}
var btnNext=new Button('Next',{lbtn_up:function(){fb.Next();}},chars.next,'Next');var btnPlay=new Button('Play/Pause',{lbtn_up:function(){fb.PlayOrPause();},update:function(trigger,state){switch(trigger){case'stop':btnPlay.text=chars.play;btnPlay.updateTip('Play');break;case'pause':btnPlay.text=state?chars.play:chars.pause;btnPlay.updateTip(state?'Play':'Pause');break;case'new_track':default:btnPlay.text=!fb.IsPlaying||fb.IsPaused?chars.play:chars.pause;btnPlay.updateTip(!fb.IsPlaying||fb.IsPaused?'Play':'Pause');}
btnPlay.repaint();}},!fb.IsPlaying||fb.IsPaused?chars.play:chars.pause,!fb.IsPlaying||fb.IsPaused?'Play':'Pause');var btnPrev=new Button('Previous',{lbtn_up:function(){fb.Prev();}},chars.previous,'Previous');var btnStop=new Button('Stop',{lbtn_up:function(x,y){fb.Stop();}},chars.stop,'Stop');var btnVol=new Button('Volume',{lbtn_up:function(){fb.RunMainMenuCommand('Playback/Volume/Mute');}},chars.volume[0],vol);var btnPbo=new Button('Playback Order',{lbtn_up:function(x,y){pbo.popup(x,y);},wheel:function(s){if(btnPbo.containsXY(mX,mY)){var o=plman.PlaybackOrder-s;plman.PlaybackOrder=o<0?0:(o>6?6:o);return true;}},update:function(i){pbo.update();btnPbo.text=chars.pbo[i];btnPbo.updateTip(pbo.order);btnPbo.repaint();}},chars.pbo[plman.PlaybackOrder],'Playback Order: '+pbo.order);var btnWave=new Button('Wave',{lbtn_up:function(x,y){}},chars.wave,'Wave');var btnLove=new Button('Love/Unlove',{lbtn_up:function(){_lovedReverse(handle,btnLove.loved);},update:function(h){btnLove.loved=_tf(tfs.loved,h)?1:0;btnLove.text=btnLove.loved?chars.love:chars.unlove;btnLove.updateTip(btnLove.loved?'Unlove':'Love');btnLove.color=btnLove.loved?colors.love:colors.unlove;}},chars.love,'Love');btnLove.size=function(x,y,w,h){btnLove.x=x+w-bs2;btnLove.y=Math.round(y+(h-bs2)/2);btnLove.w=btnLove.h=bs2;btnLove.visible=(btnLove.x>=art.x+art.w);};var btnArt=new Button('Picture Viewer',{lbtn_up:function(){art.img&&handle.ShowAlbumArtViewer();}},'','Picture Viewer');btnArt.size=function(x,y,w,h){btnArt.x=art.x;btnArt.y=art.y;btnArt.w=art.w;btnArt.h=art.h;};var buttons=new Buttons([btnNext,btnPlay,btnPrev,btnStop,btnVol,btnPbo,btnWave,btnLove,btnArt]);buttons.btns.forEach(function(b){b.name==='Play/Pause'?b.w=b.h=bs1:b.w=b.h=bs2;});var box1=new Box([art,title_artist,btnLove,btnArt]);var box2=new Box([time]);var box3=new Box([buttons]);fb.IsPlaying?on_playback_new_track():on_item_focus_change();function Button(name,fn,text,tiptext){this.x=this.y=this.w=this.h=0;this.visible=true;this.name=name;this.fn=fn;this.text=text;this.tiptext=tiptext;this.color=colors.buttons;this.oldstate=0;this.state=0;this.needRefresh=0;this.opacity=0;this.cs=function(s){this.oldstate=this.state;this.state=s;this.opacity=0;this.needRefresh=1;this.step=[26,75,85][s];!timer_ButtonCS&&(timer_ButtonCS=window.SetInterval(this.changing,40));};this.refreshOpacity=function(){if(this.opacity<255)
this.opacity=Math.min(this.opacity+this.step,255);else{this.oldstate=this.state;this.opacity=0;this.needRefresh=0};};this.changing=function(){var needRepaint=0;buttons.btns.filter(function(b){return b.needRefresh;}).forEach(function(b){b.refreshOpacity();b.repaint();needRepaint+=1;});if(!needRepaint){timer_ButtonCS&&window.ClearInterval(timer_ButtonCS);timer_ButtonCS=null;}};this.updateTip=function(t){this.tiptext=t;buttons.updateTip(this);};this.paint=function(gr){LINE&&this.w>0&&this.h>0&&gr.DrawRectangle(this.x,this.y,this.w,this.h,1,0xffffffff);var t1='',t2='';if(typeof this.text==='string'){t1=t2=this.text;}else{t1=this.text[this.oldstate];t2=this.text[this.state];}
if(this.text){if(this.opacity<255)
gr.WriteText(t1,_font(iconFontName,this.h-11),setAlpha(this.color[this.oldstate],255-this.opacity),this.x,this.y-1,this.w,this.h,2,2);if(this.opacity)
gr.WriteText(t2,_font(iconFontName,this.h-11),setAlpha(this.color[this.state],this.opacity),this.x,this.y-1,this.w,this.h,2,2);}};this.repaint=function(){window.RepaintRect(this.x,this.y,this.w,this.h);};this.containsXY=function(x,y){return(x>=this.x)&&(x<=this.x+this.w)&&(y>=this.y)&&(y<=this.y+this.h);};}
function Buttons(arr){this.btns=arr;this.count=arr.length;this.cb=this.btnH=this.btnLD=null;this.x=this.y=this.w=this.h=0;var i=0;this.size=function(x,y,w,h){this.x=x;this.y=y;this.w=w;this.h=h;var btnsW=15;for(i=0;i<7;i++){this.btns[i].y=Math.round(this.y+(this.h-this.btns[i].h)/2);this.btns[i].x=this.x+this.w-btnsW-this.btns[i].w;btnsW+=this.btns[i].w;this.btns[i].visible=_isIn(this.btns[i],this);}};this.paint=function(gr){for(i=0;i<this.count;i++){this.btns[i].visible&&this.btns[i].paint(gr);}};this.move=function(x,y){window.SetCursor(_isContainsXY(art,x,y)&&art.img?IDC_HAND:IDC_ARROW);this.cb=this.chooseButton(x,y);if(this.btnLD){if(this.btnLD.containsXY(x,y)){if(this.btnLD.state!==2)
this.btnLD.cs(2);}else if(this.btnLD.state!==1){this.btnLD.cs(1);}}else{if(this.cb){if(this.btnH!==this.cb){this.btnH&&this.btnH.cs(0);this.btnH=this.cb;this.btnH.cs(1);this.btnH.fn.move&&this.btnH.fn.move(x,y);};_tt(this.cb.tiptext);}else{if(this.btnH){this.btnH.cs(0);this.btnH=null;};_isContainsXY(title_artist,x,y)&&title_artist.tw>title_artist.w?_tt(title_artist.title+' / '+title_artist.artist):_tt('');}};};this.leave=function(){if(this.btnH){this.btnH.cs(0);this.btnH=null;}
_tt('');};this.lbtn_down=function(x,y){if(this.btnH){this.btnLD=this.btnH;this.btnLD.cs(2);};_tt('');};this.lbtn_up=function(x,y){if(this.btnLD){if(this.btnLD.state==2){this.btnLD.fn.lbtn_up(x,y);this.btnLD.cs(1);};this.btnLD=null;this.move(x,y);}else{fb.RunMainMenuCommand('View/Show now playing in playlist');}
this.cb&&_tt(this.cb.tiptext);};this.updateTip=function(b){b&&b===this.cb&&b.state===1&&_tt(b.tiptext);};this.wheel=function(s){var b=this.chooseButton(mX,mY);return b&&b.fn.hasOwnProperty('wheel')&&b.fn.wheel(s);};this.chooseButton=function(x,y){for(i=0;i<this.count;i++){if(this.btns[i].visible&&this.btns[i].containsXY(x,y)){return this.btns[i];}}
return null;};}
function getVol(){return'Volume: '+Math.round(vol2pos(fb.Volume)*100)+'%';}
function qiege(){if(handle){handle.Dispose();handle=null;}
handle=fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem();if(handle){[art,title_artist,time,btnLove.fn].forEach(function(i){i.update(handle);});box1.repaint();time.repaint();}}
function Box(arr){this.x=this.y=this.w=this.h=0;this.visible=false;var i=0,max=arr.length;this.size=function(x,y,w,h){this.visible=(w>0&&h>0);if(this.visible){this.x=x;this.y=y;this.w=w;this.h=h;for(i=0;i<max;i++){arr[i].size(this.x,this.y,this.w,this.h);}}};this.paint=function(gr){if(this.visible){LINE&&this.w>0&&this.h>0&&gr.DrawRectangle(this.x,this.y,this.w,this.h,1,0xffffffff);for(i=0;i<max;i++){arr[i].visible!==false&&arr[i].paint(gr);}}};this.repaint=function(){this.visible&&window.RepaintRect(this.x,this.y,this.w,this.h);};}
function on_size(){window.MinHeight=112;window.MaxHeight=112;ww=window.Width;wh=window.Height;var l=0,m=0;var x=l,y=x,w=bs1+bs2*6+15,h=wh-2*y;box1.size(x,y,Math.min(ww-2*x,w),h);x+=(w+m);w=Math.max(0,ww-2*x);box2.size(x,y,w,h);x+=(w+m);w=ww-x-l;box3.size(x,y,w,h);}
function on_paint(gr){gr.FillRectangle(0,0,ww,wh,0xff000000);LINE&&gr.FillRectangle(0,0,ww,Math.round(wh/2),0x33ffffff);if(btnLove.visible){_drawRect(gr,btnLove.x,btnLove.y,btnLove.w,btnLove.h);}
box1.paint(gr);box2.paint(gr);box3.paint(gr);}
function on_playback_new_track(){qiege();btnPlay.fn.update('new_track');if(!timer_Playing)
timer_Playing=window.SetInterval(function(){if(art.angle<360){art.angle+=1;}else{art.angle=1;}
art.repaint();time.repaint();},40);}
function on_playback_pause(state){btnPlay.fn.update(state);}
function on_playback_stop(){btnPlay.fn.update('stop');timer_Playing&&window.ClearInterval(timer_Playing);timer_Playing=null;}
function on_item_focus_change(){!fb.IsPlaying&&qiege();}
function on_metadb_changed(){qiege();}
function on_playback_order_changed(i){btnPbo.fn.update(i);}
function on_volume_change(){vol=getVol();btnVol.updateTip(vol);mX>=0&&mY>=0&&_tt(vol);}
function on_mouse_move(x,y,mask){if(mX!==x||mY!==y){mX=x;mY=y;buttons.move(x,y,mask);}}
function on_mouse_leave(){mX=-1;mY=-1;buttons.leave();}
function on_mouse_lbtn_down(x,y){buttons.lbtn_down(x,y);}
function on_mouse_lbtn_up(x,y){buttons.lbtn_up(x,y);if(_isContainsXY(box2,x,y)){time.timeMode=!time.timeMode;box2.repaint();}}
function on_mouse_lbtn_dblclk(x,y){_isContainsXY(title_artist,x,y)&&fb.Play();}
function on_mouse_rbtn_up(x,y){return true;}
function on_mouse_wheel(s){!buttons.wheel(s)&&(s===1?fb.VolumeUp():fb.VolumeDown());}



Re: JScript Panel

Reply #1395
Right I can easily see the bug now. Previous versions basically handled update rectangles automatically. Now I have to track it myself and use it whenever windows is ready to paint and that's not always immediate. Adding a counter made me see 4-5 rectangle dimensions were lost in the ether on mouse movements so only the last one would be used. I have an idea on how to fix this.



Re: JScript Panel

Reply #1398
Those changes are in this commit and are quite intentional.

https://github.com/jscript-panel/component/commit/13f0d0a3880bfe39e3952546542be2be2c1e0786

The first change is purely cosmetic with no difference to behaviour. The 2nd bit was a genuine bug fix. Checking this.blur_img and disposing this.img if true was a stupid mistake on my part.

If you think it's now buggy after that change, you're just plain wrong.

But, I would like to point out that the problem is always there.

Then you do it. JScript Panel 3 version 3.3.33

https://www.youtube.com/watch?v=bth0hjp3_jY

No problem with JScript Panel 3 version 3.3.29


Re: JScript Panel

Reply #1399
When Thumbnail display in Thumbs is other than Grid, up to 218 Thumbnails are displayed if Thumbnail is 75px, but nothing is displayed if Thumbnail is more than 219. Is it possible to increase the number of Thumbnails displayed by using Left?

JScript Panel 3 Version 3.3.33