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 script discussion/help (Read 289893 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: JScript Panel script discussion/help

Reply #1025
If you are on Columns UI, why not use the Panel Stack Splitter (see here) to place your panels?
Don't get too much confused by the scripting options. To just place panels, you can use the 'Panel List' tab which is pretty much straight-forward.

Re: JScript Panel script discussion/help

Reply #1026
thanks you very much for your help

Re: JScript Panel script discussion/help

Reply #1027
Playback History + Now Playing 2 (foo_nowplaying2)+ Text Reader
Now Playing 2 (foo_nowplaying2)
https://hydrogenaud.io/index.php/topic,124427.0.html

https://i.imgur.com/NNUtmqr.png

Playback history is displayed in Text Reader in cooperation.
Garbled characters in Text Reader (Japanese).
foo_nowplaying2 is not garbled.

Thanks.
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD 490 PRO, DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, Bose QuietComfort 45 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1028
I would like some help with the samples jsplaylist.

I would like to set the correct aspect ratio of the image to the background of the playlist (see pictures below)  and reduce the star character / rating.

I understood that the interested module is the main.js but more than having changed the font size of group 1 and 2 I was unable to do thanks

JS Playlist


EL Playlist

Re: JScript Panel script discussion/help

Reply #1029
in playlist.js  line 140 and 141 : g_font_awesome_20 
you can change to g_font_awesome_12

in main.js line 1306 you have the font size . maybe you can add a line :

g_font_awesome_18 = _font("FontAwesome", 18);  with the size you want and put in playlist.js  :g_font_awesome_18

For the background image i don't know

Re: JScript Panel script discussion/help

Reply #1030
Is it possible to make a text like the title song ( gr.WriteText ) to scroll from left to right in Jscript Panel 3 ?

The offset is only vertical in WriteTextLayout( ) ? I can not figure out how to do it another way ? Thanks You .

Re: JScript Panel script discussion/help

Reply #1031
Hello,

how can I set the font and color in JScrip3/Samples:Properties. I already got the color of the heading (see Appendix).

Re: JScript Panel script discussion/help

Reply #1032
Playback History + Now Playing 2 (foo_nowplaying2)+ Text Reader
Now Playing 2 (foo_nowplaying2)
https://hydrogenaud.io/index.php/topic,124427.0.html

https://i.imgur.com/NNUtmqr.png

Playback history is displayed in Text Reader in cooperation.
Garbled characters in Text Reader (Japanese).
foo_nowplaying2 is not garbled.

Thanks.

and
I would like a Pre-second update option in Text Reader.
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD 490 PRO, DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, Bose QuietComfort 45 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1033
I would like a Pre-second update option in Text Reader.
Related to Air KEN's requests for the Text Reader sample:

1) Offer an "auto-refresh" option for Text Reader that will auto-refresh itself each time the text file it's displaying is written to.,

2) Enable the display of Unicode UTF-8;  e.g., while the text file (and window title) correctly shows "2023-07-25 17:55:59  Blacknasty - Давай Идти Никуда," it is displayed in the main Text Reader window as:

Thanks for your consideration!

Re: JScript Panel script discussion/help

Reply #1034
I would like a Pre-second update option in Text Reader.
Related to Air KEN's requests for the Text Reader sample:

1) Offer an "auto-refresh" option for Text Reader that will auto-refresh itself each time the text file it's displaying is written to.,

2) Enable the display of Unicode UTF-8;  e.g., while the text file (and window title) correctly shows "2023-07-25 17:55:59  Blacknasty - Давай Идти Никуда," it is displayed in the main Text Reader window as:

Thanks for your consideration!

I think it's probably because the font is different.
I want to change the font, but I can't find which script it is.

// @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"
// @import "%fb2k_component_path%samples\js\text.js"
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD 490 PRO, DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, Bose QuietComfort 45 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1035
Solved the garbled problem.
I found that it depends on the installed fonts.
It may be a font other than this.

MaterialIconsRound-Regular,Segoe Fluent Icons fonts
https://mega.nz/file/9S0xQaDL#VCGminQGRN28M5uDaaJgbyx8dM55VnIMyEla7Aa-F2A

for confirmation.
Text Reader right click > Configure... > Samples > Text Reader.
Text Reader right click > Fixed width font on/off repeat.
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD 490 PRO, DT 1990 PRO, HiFiMAN Edition XS, Bowers & Wilkins P7, FiiO FT5, 水月雨 (MOONDROP) 空鳴 - VOID, Nakamichi Elite FIVE ANC, Bose QuietComfort 45 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #1036
The text reader has been updated in the latest release to try and handle files with other encodings other than UTF8. If it were proper UTF8 (with or without BOM is fine), the previous versions would not have issues.

It has to be manually chosen from the right click menu and may not always work. If it does, great. If not, meh.

All the comments about refreshing and what not I'm just plain ignoring. Don't like it? Don't use it..

Re: JScript Panel script discussion/help

Reply #1037
The text reader has been updated in the latest release to try and handle files with other encodings other than UTF8. If it were proper UTF8 (with or without BOM is fine), the previous versions would not have issues.

It has to be manually chosen from the right click menu and may not always work. If it does, great. If not, meh.

All the comments about refreshing and what not I'm just plain ignoring. Don't like it? Don't use it..
After replacing the Text Reader sample with the 3.3.2 release, the window does show correct Cyrillic from the target file with "UTF8" selected in the context menu.  Thank you!
Did not mean to annoy you with the feature request for the additional refresh option.

Re: JScript Panel script discussion/help

Reply #1038
Hello,

https://imgbox.com/QJK3K1wu

Is it possible for the graphic thumbnails to be displayed in the same order as in the image? So the front cover comes first, then the back cover and a photo of the disc. Apart from that - is it possible to change the background of the thumbnails to make it the same as the large photo? Besides, couldn't you set the photo size differently so that it fits the overall window? (I also marked it in the image). Many thanks in advance for your help!

Re: JScript Panel script discussion/help

Reply #1039
There's no easy way to sort the files in a specfic order so you'd to bypass adding all images in folder and add them manually. If you browse the component folder\samples\js and open the file thumbs.js in a text editor, line 563 should be...

Code: [Select]
this.files = _getFiles(this.folder, this.exts);

You can replace it with something like...

Code: [Select]
this.files = [];
this.files.push(this.folder + "\\front.jpg");
this.files.push(this.folder + "\\back.jpg");
this.files.push(this.folder + "\\disc.jpg");

Note that title formatting and wildcards are not supported here - the filename/extension must match. And it doesn't matter if a given filename isn't valid for all folders - it will be ignored.

Re: JScript Panel script discussion/help

Reply #1040
Thanks for the help!

I noticed that if there are only 2 graphics in the folder (for example, front and back covers), when I go to the second photo, it automatically changes to the first one after a second or two. When there are 3 photos (front cover, back cover, disc) this problem does not occur. One more question - if the name of the disc file is also in .png, should I enter:

this.files.push(this.folder + "\\disc.jpg;disc.png");

?

Edit:

Okay, I see that now the covers saved in the file are not displayed, only those in the folder. Can't you combine it so that the built-in ones and those in the folder are displayed? Do you have to do either way?

Re: JScript Panel script discussion/help

Reply #1041
Hi,
I am using the panel pre-configured with the "Text Display" sample
and I have not touched anything in the JS code,
but I have tweaked some of the options from the context menu to display the custom text that I want
and to also display the album cover as the background.

But, something that I really want but can't seem to get working is just trying to add a simple blur to this album cover BG.
I have tried coding this myself and other snippets I have found from here produced JS errors.

So, it would be of great help to know how I can make it all work!

I have the latest version of both FB2K (2.0 / 32 bits) and the JScript 3.0 panel.
Thanks in advance for any help!



Re: JScript Panel script discussion/help

Reply #1044
I tried implementing in that "Stack Blur" function before,
but it doesn't seem to work out at all.
In fact, the album art object does not appear to support this method,
because all I get is a "Object doesn't support property or method 'StackBlur' " error in the console when I try to do so.
So, I am really clueless on how I can fix that issue.
Thanks.

Re: JScript Panel script discussion/help

Reply #1045
you are probably not applying the StackBlur method to an image.
Can you show us the code ?
Thanks

Re: JScript Panel script discussion/help

Reply #1046
On line 16 of samples\js\albumart.js is this...

Code: [Select]
this.img = img;

Simply insert this on a new line after it...

Code: [Select]
this.img.StackBlur(50); // valid values are 2-254

Re: JScript Panel script discussion/help

Reply #1047
It worked!
I added the new line to the JS file,
but as I am using multiple JScript panels that also displays the album cover,
they're all using that same "albumart" JS script file,
so obviously, (almost) all of the album covers got blurry.

So, to fix that,
I simply duplicated the JS file with a new name ("albumart+blur.js"), added in the StackBlur to it
and in the code for my "Text Display" panel, in the Preprocessor area,
I just changed the import path for the old "albumart" to reflect the new name for the new script just like so!
Code: [Select]
// @import "%fb2k_component_path%samples\js\albumart+blur.js"
After saving the script, it only applied the blur here, which is perfectly what I wanted!

Thanks for the help!

Re: JScript Panel script discussion/help

Reply #1048
Good to know you got it working, but if I'm not mistaken, all changes made in the JS Sample directories would be overwritten upon update.
Anyway, here's my newbie attempt at a text reader with album art blur code.
We could change the blur radius and the overlay shade here.
Code: [Select]
// ==PREPROCESSOR==
// @name "Text Display + Album Art Blur"
// @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"
// @import "%fb2k_component_path%samples\js\albumart.js"
// @import "%fb2k_component_path%samples\js\text_display.js"
// ==/PREPROCESSOR==

// https://jscript-panel.github.io/gallery/text-display/

var radius = 50;
var overlay = 180;

var g_img = null;
var g_metadb = null;
var g_info = '';

var panel = new _panel({ custom_background : true });
var albumart = new _albumart(0, 0, 0, 0);
var text = new _text_display(LM, 0, 0, 0);

var blur_img = null;

var ww = 0, wh = 0;

update_album_art();
StackBlur(radius);

panel.item_focus_change();

function update_album_art() {
if (g_img) g_img.Dispose();
g_img = null;
g_info = '';
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (g_metadb) {
g_img = g_metadb.GetAlbumArt(); // omitting the type defaults to front
if (g_img) {
blur_img = g_img.Clone();
blur_img.StackBlur(radius);
}
}
window.Repaint();
}

//
function StackBlur(radius) {
if (blur_img) blur_img.Dispose();
blur_img = g_img.Clone();
g_img.StackBlur(radius);
}
//

function on_colours_changed() {
panel.colours_changed();
text.refresh(true);
//
window.Repaint();
}

function on_font_changed() {
panel.font_changed();
text.refresh(true);
}

function on_item_focus_change() {
panel.item_focus_change();
//
if (!fb.IsPlaying) update_album_art();
}

function on_metadb_changed() {
albumart.metadb_changed();
text.metadb_changed();
}

function on_mouse_lbtn_dblclk() {
if (g_metadb) g_metadb.ShowAlbumArtViewer(0);
}

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

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

function on_mouse_rbtn_up(x, y) {
return panel.rbtn_up(x, y, text);
}

function on_mouse_wheel(s) {
text.wheel(s);
}

function on_paint(gr) {

panel.paint(gr);

var bg = window.IsDefaultUI ? window.GetColourDUI(1) : window.GetColourCUI(3);
gr.Clear(bg);
    if (g_img) {
        _drawImage(gr, blur_img, 0, 0, panel.w, panel.h, image.crop);
}

    _drawOverlay(gr, 0, 0, panel.w, panel.h, overlay);
text.paint(gr);

}

// get notified of album art changes when listening to a supported stream
function on_playback_dynamic_info_track(type) {
if (type == 1) update_album_art();
// type 0 is metadata which we're not interested in
}

function on_playback_new_track() {
panel.item_focus_change();
//
update_album_art();
}

function on_playback_pause() {
text.refresh();
}

function on_playback_stop(reason) {
text.refresh();
//
if (reason != 2) {
update_album_art();
}
}

function on_playback_time() {
text.playback_time();
}

function on_playlist_items_added() {
panel.item_focus_change();
}

function on_playlist_items_removed() {
panel.item_focus_change();
}

function on_playlist_items_reordered() {
text.refresh();
}

function on_playlist_switch() {
panel.item_focus_change();
//
if (!fb.IsPlaying) update_album_art();
}

function on_size() {
panel.size();
text.w = panel.w - (LM * 2);
text.h = panel.h;
text.size();

ww = window.Width;
wh = window.Height;
}
Preview
Spoiler (click to show/hide)

Re: JScript Panel script discussion/help

Reply #1049
@ eurekagliese

THX.

Already put into practice.



Edit: When restarting foobar2000 it goes into error.

JScript Panel 3.3.4 (Text Display + Album Art Blur by marc2003)
JavaScript run-time error
Cannot retrieve the 'Clone' property of a null or undefined reference
File: <main>
Line: 52, Col: 2