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 298372 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: JScript Panel

Reply #1350
Hi marc , can i create a radio button in jscript panel 3 and how ? thanks

Re: JScript Panel

Reply #1351
So you want the slider to be displayed even when it's not playing?

Code: [Select]
if (fb.IsPlaying) {
   // original code here
} else {
   gr.FillEllipse(seekbar.x + _scale(3), seekbar.y + _scale(3), _scale(6), _scale(6), colours.seekbar_knob);
}
That's what it means. Thank you very much for your help, but I don't know where to put it. Can you help me modify the file?


Re: JScript Panel

Reply #1353
Hi marc , can i create a radio button in jscript panel 3 and how ? thanks

You'll have to be more specific. Do you mean online radio streams or some kind of display toggle where selecting one button deselects another? But either way, it's not likely I'm going to help much. I'm here to provide help on how to use various component functions and simple modifications. I'm not here to teach programming logic. If it's the latter you can set/get variables which survive panel reloads/fb2k restarts with window.GetProperty/window.SetProperty.

https://jscript-panel.github.io/docs/namespaces/window/#windowgetpropertyname-default_value

Re: JScript Panel

Reply #1354
Hi marc , can i create a radio button in jscript panel 3 and how ? thanks

You'll have to be more specific. Do you mean online radio streams or some kind of display toggle where selecting one button deselects another? But either way, it's not likely I'm going to help much. I'm here to provide help on how to use various component functions and simple modifications. I'm not here to teach programming logic. If it's the latter you can set/get variables which survive panel reloads/fb2k restarts with window.GetProperty/window.SetProperty.

https://jscript-panel.github.io/docs/namespaces/window/#windowgetpropertyname-default_value
Yes sorry I mean a button one button to deselect another
Like select and deselected . When selected is appear in red circle .
Maybe I can bring a image button to do the job ?

Re: JScript Panel

Reply #1355
I'd use font symbols myself because then the colours can be anything you like. If you're happy with fixed colours then images would be fine.

edit: if you use font awesome like I do in my scripts, you can use these characters with the existing _buttons / _button ojects.

Code: [Select]
var radio_off = '\uF10C';
var radio_on = '\uF111';


Re: JScript Panel

Reply #1356
I'd use font symbols myself because then the colours can be anything you like. If you're happy with fixed colours then images would be fine.

edit: if you use font awesome like I do in my scripts, you can use these characters with the existing _buttons / _button ojects.

Code: [Select]
var radio_off = '\uF10C';
var radio_on = '\uF111';



Thanks you marc2k3. I will try it . Thanks you 👍😊👍😊


Re: JScript Panel

Reply #1358
@Jul2323 - here's a quick and dirty example - I was too lazy to add text labels but the three radio buttons switch the background to be red, green or blue.

Code: [Select]
// ==PREPROCESSOR==
// @name "Radio 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"
// ==/PREPROCESSOR==

var property_name = "RADIO.BUTTON.COLOUR.INDEX";
var colours = [RGB(255, 0, 0), RGB(0, 255, 0), RGB(0, 0, 255)];
var colour_index = window.GetProperty(property_name, 0);
var white = RGB(255, 255, 255);
var black = RGB(0, 0, 0);

var buttons = new _buttons();
var bs = _scale(24);

var radio_off = '\uF10C';
var radio_on = '\uF111';

buttons.update = function () {
this.buttons.r = new _button(bs, bs, bs, bs, { char : colour_index == 0 ? radio_on : radio_off, colour: white }, null, function () { set(0); }, 'Red');
this.buttons.g = new _button(bs, bs * 2, bs, bs, { char : colour_index == 1 ? radio_on : radio_off, colour: white }, null, function () { set(1); }, 'Green');
this.buttons.b = new _button(bs, bs * 3, bs, bs, { char : colour_index == 2 ? radio_on : radio_off, colour: white }, null, function () { set(2); }, "Blue");
}

function set(index) {
colour_index = index;
window.SetProperty(property_name, colour_index);
buttons.update();
window.Repaint();
}

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[colour_index]);
gr.FillRectangle(bs, bs, bs, bs * 3, black);
buttons.paint(gr);
}

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



Re: JScript Panel

Reply #1361
3.3.30-Beta.2 - again the link is temporary in case I bork it. :P

https://jscript-panel.github.io/files/foo_jscript_panel3-3.3.30-Beta.2.fb2k-component

This fixes the DPI issue in Beta1. Only changes from the last stable release is under the hood stuff so nothing new to play with - I just need to check it works.

Blur effect

Reply #1362
Hi, Marc

Would it be possible to have a Blur effect for the background of "Last.fm Bio" and "Allmusic Review", with or without image ?

Jacob91

Re: JScript Panel

Reply #1363
Is there an option to create 2 Playlists vieweres that show different states?
The idea is simple.
First Playlist viewer is changing according to the ReFacts browsing (this is easy and is the default).
Second is showing only the current playing selection and not change/affected by ReFacts or the first Playlist viewer while browsing the m (similar to queue viewer but I don't won't to queue the music I hear).
I used to have this a while ago with ESPlaylist (if I remember correctly) but it's deprecated since 2011 and since it closed source code one day I'll probably move to 64-bit and it's no good.

Re: JScript Panel

Reply #1364
Real thank you Marc2k3 for your investment and your time ...  :D  :D  :D  :D  :D  :D 

 

Re: JScript Panel

Reply #1365
@Jacob91 - I don't have any plans for the plain text scripts supporting background images. The combined bio text + last.fm image / allmusic + album art already do that.

@Gabriel Schwartz - your idea might be simple, the implementation not so much. I guess it's possible for people writing their own playlists but I'm not doing it. IMO, you should continue using 32bit/working components. Support for it isn't going away any time soon.


Re: JScript Panel

Reply #1366
@Gabriel Schwartz - your idea might be simple, the implementation not so much. I guess it's possible for people writing their own playlists but I'm not doing it. IMO, you should continue using 32bit/working components. Support for it isn't going away any time soon.

Thanks for the quick reply.
Now I need to find that component I used to use. :-(
I know 32-bit is here to stay and it's good since I'm using foo_hack_ui just to remove the main menu and status bar from DUI.


Re: JScript Panel

Reply #1368
How can I create an imagebutton with hover functionality in JS3?

var img_cog = utils.LoadImage(fb.ComponentPath + 'samples\\images\\cog.png');
this.buttons.next = new _button(x, y, w, bh, { image : img_cog }, { char : char_set[button_set_idx].next, colour:colours.hover }, function () { fb.Next(); }, '');

The image is not displayed. The hover part is displayed fine and the button is functional.

How can I display an image instead of a char in the normal part of the button?

Re: JScript Panel

Reply #1369
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.

Re: JScript Panel

Reply #1370
Here's  3.3.30-Beta.3

https://jscript-panel.github.io/files/foo_jscript_panel3-3.3.30-Beta.3.fb2k-component

For script authors:

Support for the ancient GDI windows API for drawing has been disabled by default. This means window.CreateThemeManager will return null and ThemeManager methods are unavailable unless you specifically enable it by adding this in your preprocessor section.

Code: [Select]
// @feature "theme_manager"

For sample users:

If you don't use dark mode and have the system default DUI theme or themed mode in CUI, JSPlaylist, Smooth Playlist, Smooth Browser or Smooth Playlist Manager will look different than you're used to. To restore the old look, the same theming feature can be enabled by adding the above to the existing preprocessor section in each panel.

edit: support for theming is always enabled in CUI toolbars because it uses that ancient API for transparency and enables it automatically. Changing the preprocessor in CUI toolbars will have zero effect.







Re: JScript Panel

Reply #1373
Clicking on the genres in the Smooth Playlist triggers a JavaScript error:
File: C:\Users\Manfred\AppData\Roaming\foobar2000-v2\user-components-x64\foo_jscript_panel3\samples\smooth\jssp.js
Line: 884, Col: 6

Re: JScript Panel

Reply #1374
Did you mean to say rating, not genre??

The line points towards that - specifically when you have foo_playcount installed. I tried it just now and it works for me so more details are needed. Also, are you using the latest JSP3/foo_playcount?