HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: marc2003 on 2015-11-09 11:41:31

Title: JScript Panel
Post by: marc2003 on 2015-11-09 11:41:31
Since I can no longer make new posts, let's see if editing works??
Title: JScript Panel
Post by: Falstaff on 2015-11-09 16:27:47
welcome to the new baby

I think you take the right decision, WSH Panel Mod will stay in v1.5.6 for those who want to run WSH panel mod scripts designed for, and new scripts will have to be for your new component.

my 3 jscripts in progress are now ported to JScript Panel:

- JS Smooth Playlist
- JS Smooth Browser
- JS Smooth Playlist Manager

I will share them as JScript Panel scripts only in next updates

The king is dead, long live the king!
Title: JScript Panel
Post by: marc2003 on 2015-11-09 18:24:14
It's good to have you onboard. 
Title: JScript Panel
Post by: Falstaff on 2015-11-10 10:51:05
my first "JScript Panel" scripts, now available from my DA account, so i share links here

JS Smooth Playlist Manager: http://fav.me/d9g6kss (http://fav.me/d9g6kss)
JS Smooth Playlist: http://fav.me/d9g6kgk (http://fav.me/d9g6kgk)
JS Smooth Browser: http://fav.me/d9g6ko0 (http://fav.me/d9g6ko0)

Title: JScript Panel
Post by: marc2003 on 2015-11-10 12:36:31
Nice. You may want to update the requirements though. You list foobar2000 v1.1 but the component requires v1.3 or above. Also, you mention clearing WSH panel properties when updating. 
Title: JScript Panel
Post by: Falstaff on 2015-11-10 13:11:37
fixed, thanks ...
Title: JScript Panel
Post by: marc2003 on 2015-11-10 18:55:27
Code: [Select]
v1.0.1
- CHG: Update default script so you know a blank panel
       is JScript Panel as opposed to WSH Panel Mod.


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

(http://i.imgur.com/CE8tRsZ.png)

Hopefully, I removed all remaining references to WSH panel in the docs as well.
Title: JScript Panel
Post by: zeremy on 2015-11-10 21:06:32
This is certainly going in the right direction.
Great decision.

You should update https://github.com/19379/foo_uie_wsh_panel_mod (https://github.com/19379/foo_uie_wsh_panel_mod) README.md to notify/redirect users to the JScript Panel component as I assume all updates will be made to it only.
Title: JScript Panel
Post by: marc2003 on 2015-11-11 03:30:01
I'll probably nuke the WSH repo in a few days. I'll put the last version and source in the uploads forum for anyone who wants it.

Rather stupidly, I didn't even put a description of this component in the first post so I've updated the wiki page here:

https://github.com/19379/foo-jscript-panel/wiki (https://github.com/19379/foo-jscript-panel/wiki)
Title: JScript Panel
Post by: MachineHead on 2015-11-11 04:09:54
New JScript sample lastfm bio.txt used in chooser panel crashes. The other text samples I used (properties & thumbs) work fine. Error message below.

Code: [Select]
JScript Panel (Panel Receiver by marc2003): Microsoft JScript runtime error:
'this.content.length' is null or not an object
Line: 1, Col: 1
<source text only available at compile time>
Title: JScript Panel
Post by: marc2003 on 2015-11-11 05:43:12
Answered in the new JScript Panel script discussion/help (https://www.hydrogenaud.io/forums/index.php?showtopic=110516) thread. 

I'd like to keep this thread for component updates/issues only.
Title: JScript Panel
Post by: foosion on 2015-11-11 20:43:57
I think it was a good idea to create a fork of WSH panel mod. Throwing away the git history prior to your fork? Not so much.

Git has some powerful tools to transplant changes from one branch to another. Re-starting history makes this process harder than needs to be because most of these tools require that the branches have a common ancestor. It does not affect me in this case so take this as a friendly suggestion instead of a complaint: Please preserve the continuity of your git history! Otherwise some day some people might form a lynch mob (http://justinhileman.info/article/git-pretty/).
Title: JScript Panel
Post by: marc2003 on 2015-11-12 06:26:54
One person has forked the WSH repo on github so I'm not too concerned. If they know what they're doing, they can clone the JScript Panel repo, checkout the first commit and copy those files into the WSH panel mod source folder and commit the changes.

EDIT: I just remembered github lets you download from any point in history so no need to clone/checkout the first commit. Here's the source of my very first commit to the new repo.

https://github.com/19379/foo-jscript-panel/...81db9e209a5.zip (https://github.com/19379/foo-jscript-panel/archive/f584e9ca8f3cc48b6a22e02ddb11d81db9e209a5.zip)

EDIT2: Because of renamed folders, they shouldn't copy the whole zip but rather the contents of foobar2000/foo_jscript_panel/foo_jscript_panel in to foobar2000/foo_uie_wsh_panel_mod/foo_uie_wsh_panel_mod
Title: JScript Panel
Post by: marc2003 on 2015-11-12 09:48:32
Code: [Select]
v1.0.2

- CHG: Update to latest Columns UI SDK.
- CHG: Hopefully removed all traces of WSH Panel Mod
       from sources and documentation!


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)
Title: JScript Panel
Post by: marc2003 on 2015-11-12 12:48:25
@foosion, because I have far too much time on my hands, I've uploaded a new repo with full history.

https://github.com/19379/foo-jscript-panel/commits/master (https://github.com/19379/foo-jscript-panel/commits/master)
Title: JScript Panel
Post by: always.beta on 2015-11-13 00:49:49
Can you add a special interface for me, that interface is used to transform metadata Traditional Chinese into Simplified Chinese?  utils.LCMapString(str,lcid,flag)
Title: JScript Panel
Post by: marc2003 on 2015-11-13 01:54:51
If it exists in that "plus" component, I may be able to copy it. Can you give me an example of the input/output you expect so I can check it.
Title: JScript Panel
Post by: always.beta on 2015-11-13 02:50:09
If it exists in that "plus" component, I may be able to copy it. Can you give me an example of the input/output you expect so I can check it.

JSSmoothPlaylist main script.txt?Line 2743-2747?2771-2773?2821-2842
A demonstration of the operation?a.pomf.cat/rtthdj.gif   
Modified files?a.pomf.cat/ptlzst.7z  ?  a.pomf.cat/sztrpu.m4a
Title: JScript Panel
Post by: marc2003 on 2015-11-13 12:46:13
Code: [Select]
v1.0.3
- CHG: Revert previous Columns UI SDK update as I've just had foobar2000 crash.
       It did actually point at Panel Stack Splitter as the problematic
       component but I've never had an issue with it before. Given PSS acts
       as a container for other panels, I think it might be related. I don't
       have the skills to troubleshoot such an issue so the easiest thing to do
       is roll back.


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)
Title: JScript Panel
Post by: bdport67 on 2015-11-13 15:00:11
ok switching over to JScript.
Seems there isnt an "use display preferences" selection mode on the art viewer anymore?

so I end up with same art in both Library and Now playing sides

you assisted me before with my setup with WSH panel.

https://www.hydrogenaud.io/forums/index.php...=104363&hl= (https://www.hydrogenaud.io/forums/index.php?showtopic=104363&hl=)

thoughts?

Title: JScript Panel
Post by: marc2003 on 2015-11-13 15:21:27
As much as I don't like that option, I've decided to restore it. Save this inside js_marc2003\js

https://raw.githubusercontent.com/19379/js-...ter/js/panel.js (https://raw.githubusercontent.com/19379/js-marc2003/master/js/panel.js)

Further questions about scripts should go in this thread: https://www.hydrogenaud.io/forums/index.php?showtopic=110516 (https://www.hydrogenaud.io/forums/index.php?showtopic=110516)

Title: JScript Panel
Post by: bdport67 on 2015-11-13 15:38:14
As much as I don't like that option, I've decided to restore it. Save this inside js_marc2003\js

https://raw.githubusercontent.com/19379/js-...ter/js/panel.js (https://raw.githubusercontent.com/19379/js-marc2003/master/js/panel.js)

Further questions about scripts should go in this thread: https://www.hydrogenaud.io/forums/index.php?showtopic=110516 (https://www.hydrogenaud.io/forums/index.php?showtopic=110516)

perfect thanks
like a charm

addl q posted in other post
Title: JScript Panel
Post by: Falstaff on 2015-11-14 11:20:05
bug report / WSH Panel Mod, method GetPlaylistFocusItemHandle no more available in plman :'(

bug in JSPlaylist that use this method...

JScript panel 1.0.3, earlier version not checked.
Title: JScript Panel
Post by: marc2003 on 2015-11-14 12:11:59
It's my fault for not including my removal of it in the changelog. I've just updated it.

It was removed because it's identical to fb.GetFocusItem which is used much more often.

Also, I think your usage was incorrect.

Code: [Select]
var save_focus_handle = plman.GetPlaylistFocusItemHandle(p.list.playlist);


The optional argument is force which defaults to true when omitted.

Original docs:

Code: [Select]
IFbMetadbHandle GetPlaylistFocusItemHandle(force);


Original docs for GetFocusItem
Code: [Select]
    // force: if this parameter is set to false, GetFocusItem() will only look for the focus item, otherwise, 
    //   if the focus item not found, find the first item of the active playlist.
    IFbMetadbHandle GetFocusItem(force = true);


You can see here where I removed it from my own mod of JSplaylist...

https://github.com/19379/jsplaylist-mod/com...08dbcede7a16f47 (https://github.com/19379/jsplaylist-mod/commit/f7227edb175c2b7708c844a7508dbcede7a16f47)
Title: JScript Panel
Post by: zeremy on 2015-11-14 13:54:14
If it exists in that "plus" component, I may be able to copy it. Can you give me an example of the input/output you expect so I can check it.

JSSmoothPlaylist main script.txt?Line 2743-2747?2771-2773?2821-2842
A demonstration of the operation?a.pomf.cat/rtthdj.gif   
Modified files?a.pomf.cat/ptlzst.7z  ?  a.pomf.cat/sztrpu.m4a


@marc2003
It was in the "plus" component.
Forked and commit at https://github.com/smoralis/foo-jscript-pan...a96cf9ee05f626b (https://github.com/smoralis/foo-jscript-panel/commit/df067ecf5ac0242aafbc3ba39a96cf9ee05f626b)

I hope you don't mind me contributing, this component was dead until you picked it up , so lets all contribute to make it what we all want...

@always.beta
Tested with your samples.
You need to update though your modified JSSmoothPlaylist to a JScript component compatible version.
Title: JScript Panel
Post by: always.beta on 2015-11-14 16:31:17
@always.beta
Tested with your samples.
You need to update though your modified JSSmoothPlaylist to a JScript component compatible version.
[/quote]

I'm currently using the js_smooth_playlist and foo_jscript_panel,I just take the old modified version as an example. Because of the time, I did not modify the new version.Thank you!!
Title: JScript Panel
Post by: marc2003 on 2015-11-15 03:51:28
Code: [Select]
v.1.0.4
- ADD: utils.MapString(text, lcid, flags)


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)
Title: JScript Panel
Post by: always.beta on 2015-11-15 05:11:20
Code: [Select]
v.1.0.4
- ADD: utils.MapString(text, lcid, flags)


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

I've added in the script, it works well, thank you??
Title: JScript Panel
Post by: WilB on 2015-11-17 16:24:28
I just had a crash using a script with JScript panel. The same piece of code has been working with wsh panel mod 1.5.6 for ages, so it seems something has changed in JScript panel. I isolated the problematical code and a snippet that shows the issue is below. It will occur if the user sets the border to <1 but any other value seems OK.

Code: [Select]
var border = 0; // if border set to < 1 crashes in JScript panel; wsh panel mod 1.5.6 doesn't crash
var ny = border * 0.5; // it's this multiplication that results in the bad handling
// weird as 0 * 0.5 should equal 0 & so the multiplication shouldn't actually do anything when border = 0

var n_y = ny - 1;

fb.trace("isNAN", isNaN(n_y)) // returns false so is a number

function on_paint(gr) {
gr.FillSolidRect(0, n_y, 50, 50, RGB(255,0,0))
}

fb.trace("n_y", n_y) // n_y traces to -1

window.RepaintRect(0, -1, 50, 50); // DOESN'T CRASH IF DIRECTLY ENTER -1

window.RepaintRect(0, n_y, 50, 50); // weirdly crashes here when y is calculated as above to -1;

//crashes in JScript panel; wsh panel mod 1.5.6 doesn't crash

function RGB(r, g, b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}

Seeing as I spotted the issue I have reported it, although I do know how to work around it easily enough. There seems to be something strange going on with the maths handling in JScript panel.

 Edit: I just discovered that it's due to use of the jscript9 engine I was using with JScript panel. Switching wsh panel mod 1.5.6 to jscript 9 also gives the script crash. Both JScript panel and wsh panel mod 1.5.6 run the snippet OK with the jscript engine.
Title: JScript Panel
Post by: marc2003 on 2015-11-17 16:43:03
Can you check your JScript engine setting? For me, it crashes in both components with JScript9. Using just JScript, it works fine in both components.

edit: I see you figured this out. It would have been very troubling if my changes had caused this kind of breakage so I'm glad we can rule that out.
Title: JScript Panel
Post by: WilB on 2015-11-17 16:45:35
Yes I realised that after I originally posted and my edit of post #29 crossed with your post.
Title: JScript Panel
Post by: foosion on 2015-11-17 17:53:19
Try passing -1.0 to the window.RepaintRect. Yes, that is different from -1 because it is a floating point number instead of an integer.
Title: JScript Panel
Post by: marc2003 on 2015-11-18 07:06:26
This is the source for RepaintRect...

Code: [Select]
STDMETHODIMP FbWindow::RepaintRect(UINT x, UINT y, UINT w, UINT h, VARIANT_BOOL force)
{
    TRACK_FUNCTION();

    m_host->RepaintRect(x, y, w, h, force != FALSE);
    return S_OK;
}


According to a quick google, UINT should be a positive integer so I don't know why using -1 doesn't throw errors all the time??

EDIT: I just added this inside the function...

Code: [Select]
console::formatter() << y;


and it spits out this when you feed it -1.

Code: [Select]
4294967295


That just happens to the maximum possible value for UINT. So even though it's not crashing, it's not repainting the area you want it to either!!

With JScript9 engine, the console code doesn't even get to run. I get an overflow error before it happens. Presumably there is some difference with how the scripting engine handles these numbers??

EDIT2
: I've updated the docs...

Code: [Select]
window.RepaintRect(x, y, w, h[, force]);
// x, y, w, h must be an integer, 0 or above. if you cannot be sure of values when
// calculating, do something like this...
// window.RepaintRect(Math.max(0, x), Math.max(0, y), w, h);
// force: boolean, default false
// use this instead of Repaint on frequently updated areas
// such as time, bitrate, seekbar, etc. this should reduce CPU usage.
// you can use Windows Task Manager to double check.
Title: JScript Panel
Post by: marc2003 on 2015-11-20 16:15:16
@Falstaff, I've restored all the return value types to interfaces.txt. I've also shuffled a few other bits around.

https://raw.githubusercontent.com/19379/foo.../Interfaces.txt (https://raw.githubusercontent.com/19379/foo-jscript-panel/master/foobar2000/foo_jscript_panel/docs/Interfaces.txt)
Title: JScript Panel
Post by: marc2003 on 2015-12-07 04:39:35
Just a little maintenance update...

Code: [Select]
- CHG: Update Columns UI SDK to 6.4
- CHG: Update WTL to 9.1
- CHG: Update scintilla to 3.6.2
- CHG: Tidy up docs/samples.


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

And before anyone grumbles, I'm well aware of the increased file size. This is caused by the scintilla update.
Title: JScript Panel
Post by: colagen on 2015-12-07 16:36:34
You probably remember: in the WSH thread i posted a updated WSH component with a fix to on_mouse_wheel (because my laptop trackpad wasn't working with the previous function).
But it look like you didn't merge my changes to your new component.
In my component i also added two functions similar to UpdateFileInfoSimple, in order to update a group of songs with a nice progress bar while the update is going on, instead of updating the songs one by one.

IFbMetadbHandleList.UpdateFileInfoSimple(field1, value1 [, filed2, value2 [,...] ] [, multivalue_fields]);
This one update the metadb tags for a IFbMetadbHandleList, in order to update a group of songs with a nice progress bar while the update is going on, instead of updating the songs one by one.

IFbMetadbHandleList.UpdateFileInfoArray([field1, value1,field2, value2....]);
This one update the metadb tags based on the array given as a parameter. I needed that because sometimes in my code, the number of tags to update vary depending of the file, so i would have to call UpdateFileInfoSimple for each tag (because you can't have a dynamic number of arguments) and then i wouldn't have a real progress bar if the action take time. With UpdateFileInfoArray, you can build your array of tags to update first, and then you can call the function at the end, and you have a progress bar. This function may need an update, it doesn't care about multivalue fiedl i think, i don't remember exactly how i did it ..

The sources are here http://www.mediafire.com/download/1vl0x0zd....10_sources.zip (http://www.mediafire.com/download/1vl0x0zd0ald5zv/foo_uie_wsh_panel_mod-1.5.10_sources.zip), if you browse those sources and search for the names of my functions, you will be able to add them to your component. I can eventually help you
Title: JScript Panel
Post by: marc2003 on 2015-12-08 23:56:12
I'll take a look. Thanks.
Title: JScript Panel
Post by: Scrummble on 2015-12-10 11:36:52
I think utils.MapString(text, lcid, flags) need to be explained in the docs...
At least a link to the documentation its API relate to.
The discussions in this page make me confused. BTW I'm a simplified Chinese user myself.
Title: JScript Panel
Post by: Scrummble on 2015-12-10 11:53:40
As in WSH Panel Mod Plus, I found the window controlling functions much useful in certain situations. Maybe that's worth considering to be added in JS Panel?
Title: JScript Panel
Post by: marc2003 on 2015-12-10 15:00:31
@colagen, your sources only contain the mouse wheel changes.

@Scrummble, I copied the MapString function from that other component which also has no documentation. I'm English and only speak English so it's no good asking me. And the window stuff is illegal. I'd rather not the flout the SDK terms given I'm posting on the official forums.
Title: JScript Panel
Post by: colagen on 2015-12-10 17:54:15
@marx2003 oups, sorry, here it is, containing only the relevant files with the UpdateFileInfoXXX functions http://www.mediafire.com/download/qtav66aj...t_interface.zip (http://www.mediafire.com/download/qtav66ajwqi2jrb/script_interface.zip)
Title: JScript Panel
Post by: Scrummble on 2015-12-10 23:10:07
Actually, the mapstring function has documentation:
Code: [Select]
// see https://msdn.microsoft.com/en-us/library/windows/desktop/dd318700(v=vs.85).aspx

Yep, just a link, but still useful to other users.

BTW I'd like to know, did the SDK terms forbid components influencing one another?
The "window controlling functions" which I mentioned, are just functions that controls the panels in Panel Stack Splitters, I think, rather than the main window. The author of wshpm+ do not speak English, and I'd like to check if there's any misunderstanding.
Apologise for any of my ignorance.
Title: JScript Panel
Post by: marc2003 on 2015-12-14 07:19:07
Code: [Select]
v1.0.6
- ADD: FbMetadbHandleList UpdateFileInfoSimple method.


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

@colagen, I've added your trackpad fix but I haven't documented it because no one else has ever had this issue. Also, thanks for the UpdateFileInfoSimple code.
@Scrummble, I'm not adding any of the window stuff. You can always use that other component side by side with this or compile your own component.
Title: JScript Panel
Post by: colagen on 2015-12-14 11:32:47
Thanks a lot.
Will you add the updateFileInfoArray later to your component ? I can't find any way to do my code with one unique call to the standard UpdateFileInfoSimple.
Actually what i made is a function which remove all the tags from the selected tracks, except the ones i want to keep. I use it for all the new tracks added to my library, it's a fast way to organize the new files. And obviously i can't list all the weird tags directly in my code, so i have to check the file tags, and when there is a tag which i don't want, i add it to my array of tag to erase, and i call updateFileInfoArray at the end.

Maybe you didn't add it because my code is dirty ? Which is probably true, i'm not a developer myself, i did it without a clear understanding of what i was doing, so it may be buggy.
Title: JScript Panel
Post by: marc2003 on 2015-12-14 13:04:00
If you had provided an example of how to use the function within a script, I might have considered it. I'm totally confused by your post and the fact you've added it as a handle method as well!!
Title: JScript Panel
Post by: Rhand on 2015-12-14 16:39:16
General question:

Is it possible to make a button in JScript with (switch to playlist) as menu?

Thx
Title: JScript Panel
Post by: marc2003 on 2015-12-14 17:12:59
edit: Answered in the script thread: https://www.hydrogenaud.io/forums/index.php...st&p=912900 (https://www.hydrogenaud.io/forums/index.php?s=&showtopic=110516&view=findpost&p=912900)
Title: JScript Panel
Post by: colagen on 2015-12-14 17:55:59
If you had provided an example of how to use the function within a script, I might have considered it. I'm totally confused by your post and the fact you've added it as a handle method as well!!


Nope, it's just a FbMetadbHandleList method.
I can provide you an example of use yes, but i don't know if it will be easier to understand
The function is quite easy, it's basically the same function than UpdateFileInfoSimple, but it accept only an array as argument, and this array must contain the tags to update, and their values.
FbMetadbHandleList.UpdateFileInfoArray ( ["tagName1","TagValue1","tagName2","TagValue2"...] )

Below is a example, it's a little script i just wrote, which loop over the tags of the first item of a FbMetadbHandleList ( plist_items.Item(0) ), and build an array containing all the tags which aren't in the array named toKeepArray (it use a function named arrayContains(array, string), which is defined below), and after the tag name, an empty string.
Then, with the resulting array, i can call UpdateFileInfoArray and it will remove all those tags from all the items of this FbMetadbHandleList.
This is something you can't do with UpdateFileInfoSimple(). But you course this is a very specific usage, and it's not a big deal if it can't be added to the component.

Code: [Select]
var toRemoveArray=Array();
var toKeepArray=["album","artist","composer","date","genre","title","tracknumber"];
var track_FileInfo = plist_items.Item(0).GetFileInfo();
for (var i = 0; i <= track_FileInfo.MetaCount; i++) {
       if(!arrayContains(toKeepArray , track_FileInfo.MetaName(i))) {
           toRemoveArray[toRemoveArray.length]=track_FileInfo.MetaName(i);
           toRemoveArray[toRemoveArray.length]="";
       }
}
plist_items.UpdateFileInfoArray(toRemoveArray);


function arrayContains(array,string){
    for (var i = 0; i < array.length; i++) {
        if(array[i]==string) return true;
    }
    return false;
}
Title: JScript Panel
Post by: marc2003 on 2015-12-15 08:34:26
Nope, it's just a FbMetadbHandleList method.


You are quite right. I need my eyes testing.

I'll just need to do some testing before I include it.
Title: JScript Panel
Post by: blaxima on 2015-12-15 21:05:56
Hi marc,

I seem to be having problems with certain bands for the last.fm bio.

This was the error message
Quote
JScript Panel (Last.fm Bio by marc2003): Microsoft JScript runtime error:
Unable to get value of the property 'length': object is null or undefined
File: text.js
Line: 249, Col: 25
<source text only available at compile time>


With the latest release it says the cached file is corrupted but I've removed the file so there is nothing there to be corrupted. All other information is fetched, album review, similar artists and other releases.
Title: JScript Panel
Post by: marc2003 on 2015-12-16 06:20:32
I'm not really sure why you removed the file. The error tells you exactly what to do:

Quote
"It appears the cached file has been corrupted. Use the right click menu>Force Update to try again."


If it's happening randomly (fixed by a forced update) then there isn't much I can do. If you can't get the bio of specific artist with multiple retries then I can take a look if you tell me what the artist is.

edit: If you reply, please do it in the script thread: https://www.hydrogenaud.io/forums/index.php?showtopic=110516 (https://www.hydrogenaud.io/forums/index.php?showtopic=110516)
Title: JScript Panel
Post by: WilB on 2015-12-17 19:24:16
    I am in the process of finalising a Jscript "Library  Tree" and have come across a few points. Please can you consider the following  requests.

           
Title: JScript Panel
Post by: marc2003 on 2015-12-17 23:19:51
1) From what I can see, nothing like that is available. There is a library get_relative_path for metadb handles so I guess that could be added. You'd then have to loop through all library items and strip it from the full path to get the library folder.

2) I don't see that as a component issue. You can track the mouse yourself, use timers to prevent code running, mess around with SetDelayTime etc. FWIW, I never deactivate tooltips. If I want to clear them, I just set the tooltip text as an empty string and activate it.

3) I'll look in to it but given my zero knowledge/skills, I'm not sure I'll get very far.
Title: JScript Panel
Post by: marc2003 on 2015-12-18 10:19:10
I've added fb.GetLibraryRelativePath. I won't be uploading a new component just yet but you can view the docs/check an example here.

https://github.com/19379/foo-jscript-panel/...es.txt#L146L158 (https://github.com/19379/foo-jscript-panel/blob/9ac63437f74c4dc18b3ef72a3e9068a6097a5050/foobar2000/foo_jscript_panel/docs/Interfaces.txt#L146L158)

I don't think I'll be able to do anything about #3.
Title: JScript Panel
Post by: WilB on 2015-12-18 13:12:01
Thanks for adding fb.GetLibraryRelativePath. I look forward to trying it out when a new version is released. 

#2 The problem is when them mouse is over a tooltip with tooltip showing. Then when Alt + Tab to a different program, the tooltip will still show. I thought SetDelayTime() delays the appearance of the tooltip and so I don't see how that helps remove a tooltip when the window is left. I also don't see how mouse tracking (you mean through on_mouse_move?) can be used to report if the window is left, since it doesn't report a change in that scenario. I had already tried these before I originally posted & have unsuccessfullly tried them again. The solution which I was also using before I originally posted is to use a timer, but the tooltip will still show when Alt + Tab to a different window until the timer kicks in.

So it seems the proper way of doing it would be to use on_mouse_leave to kill the tooltip - but that doesn't work when the mouse is over the tooltip as that triggers the callback. I note that in your helpers button example you do use on_mouse_leave (this.leave -> tt("")) to kill the tooltip - here the mouse isn't over the tooltip.

Probably you aren't able to change the on_mouse_leave operation in JScript panel, & since there may be no other workaround, the timer will have to do. Else if I am overlooking something please advise.
Title: JScript Panel
Post by: marc2003 on 2015-12-18 13:45:12
For your alt-tab problem, you should be able to use the on_focus callback.

Code: [Select]
function on_focus(is_focused) {
    if (!is_focused) //clear tooltips
}
Title: JScript Panel
Post by: WilB on 2015-12-18 16:25:53
Thanks, it helps. It works if the JScript panel has focus (i.e. last mouse click is in the panel). Then Alt + Tab causes the JScript panel to lose focus. 

But tooltips show even when the panel hasn't focus (e.g. last click in playlist and mouse over JScript panel), and so then its not called on Alt + Tab, because the JScript panel focus doesn't change, and so doesn't work.
Title: JScript Panel
Post by: marc2003 on 2015-12-18 16:52:37
Code: [Select]
v1.0.7
- ADD: fb.GetLibraryRelativePath(handle)


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

It should be noted that the SDK function used to get the relative path has a special warning. 

Quote
//! SPECIAL WARNING: to allow multi-CPU optimizations to parse relative track paths, this API works in threads other than the main app thread. Main thread MUST be blocked while working in such scenarios, it's NOT safe to call from worker threads while the Media Library content/configuration might be getting altered.


I had a quick poke around the columns UI album list code and that doesn't appear to be doing anything special except the loop through all library items is inside a try/catch statement so that would be my recommendation as well.

@colagen, I didn't add your UpdateFileInfoArray method because I want to try and get it working with multi-value tags.
Title: JScript Panel
Post by: Falstaff on 2015-12-18 19:50:40
<???> fb.GetLibraryRelativePath(handle)

what does it return ? a string ? an array (i hope so cause library can be set w/ many paths in foobar2000) ? ...
Title: JScript Panel
Post by: marc2003 on 2015-12-18 20:08:52
It's the relative path for a given track. Look at the example in the docs.

If you want to determine the folders set in the preferences, this bit of code should do it. It's crudely stripping out the relative path from the full path to give the base folder. I don't know how else you would do it.

Code: [Select]
var items = fb.GetLibraryItems();
items.OrderByPath();
var current = "";
var folders = [];
for (var i = 0; i < items.Count; i++) {    
    var temp = items.Item(i).Path.replace(fb.GetLibraryRelativePath(items.Item(i)), "");
    if (temp != current) {
        current = temp;
        folders.push(current);
    }
}
fb.ShowPopupMessage(folders.join("\n"));
Title: JScript Panel
Post by: WilB on 2015-12-19 09:44:30
  Just to confirm that fb.GetLibraryRelativePath is exactly what was required for my purposes and that it's working extremely well.

 
Title: JScript Panel
Post by: Falstaff on 2015-12-20 14:11:00
ok, thanx for pointing me to the right use
Title: JScript Panel
Post by: Scrummble on 2015-12-23 22:44:09
As I can see, the mouse scroll callback only supports the vertical wheel.
Is it possible to use horizontal scrolling in it?
Title: JScript Panel
Post by: marc2003 on 2015-12-24 04:27:19
A quick google suggests adding a new callback should be trivial. However, I've just got a new SSD with a fresh install of windows and I don't want to clutter it up with Visual Studio so you'll have to wait until I set up a dual boot or virtual machine.
Title: JScript Panel
Post by: marc2003 on 2015-12-26 13:48:50
@Scrummble, can you test this and see if it works (it's the dll only)

edit: link removed. JSplaylist is going mental with it.   

edit2: can you just confirm you're talking about a mouse wheel that tilts left/right? A bit more reading shows that some people are holding down shift while scrolling normally and this is something you can implement yourself.

Code: [Select]
//flags
var VK_SHIFT = 0x10;

function on_mouse_wheel(s) {
    if (utils.IsKeyPressed(VK_SHIFT)) {
        //scroll left/right
    } else {
        //scroll normally
    }
}
Title: Re: JScript Panel
Post by: WilB on 2016-01-10 18:14:14
While fb.GetLibraryItems() works extremely well on many queries and is an excellent addition, there are some queries it can’t handle resulting in a crash. So I was wondering if this was something that you were able to fix. Current workaround is to use catch error. Here’s hoping there’s a simple fix... Just putting the below in a panel causes the indicated crashes for me.

plman.GetQueryItems(fb.GetLibraryItems(), "%last_played% DURING LAST 2 WEEKS") // CRASH
plman.GetQueryItems(fb.GetLibraryItems(), "%last_modified% DURING LAST 2 WEEKS") // CRASH
plman.GetQueryItems(fb.GetLibraryItems(), "%artist% HAS beatles") // OK
plman.GetQueryItems(fb.GetLibraryItems(), "artist HAS beatles") // OK
plman.GetQueryItems(fb.GetLibraryItems(), "rating IS 5") // OK

Title: Re: JScript Panel
Post by: marc2003 on 2016-01-10 20:34:27
The C++ I copied from another component also uses a try/catch statement and when I compiled it with the try/catch removed, it crashed hard bringing down foobar with this error in the crash log:

Quote
System time operations not available in this context

I'm guessing it just needs updating to use something newer provided in the SDK.
Title: Re: JScript Panel
Post by: marc2003 on 2016-01-10 21:50:52
Oh noes, I made a breaking change. GetQueryItems should never have been a plman method and I apologise for that. It is now a fb method. For that reason, we are now on v1.1.0

https://github.com/19379/foo-jscript-panel/releases

Code: [Select]
v1.1.0
- CHG: GetQueryItems should be a "fb" method, not "plman".
- FIX: Fix crash when using GetQueryItems with dates as part of the query.
- CHG: Update Columns UI SDK to 6.5

I've added a note to the docs as well.

Code: [Select]
		fb.GetQueryItems(handle_list, query); (IFbMetadbHandleList)
/*
example1: var fav_playlist_items = fb.GetQueryItems(plman.GetPlaylistItems(plman.ActivePlaylist), "rating IS 5");
example2: var fav_library_items = fb.GetQueryItems(fb.GetLibraryItems(), "rating IS 5");
results are unsorted

NOTE: use try/catch to handle invalid queries. An empty handle list will be returned if the query is valid but there are no results.
*/
Title: Re: JScript Panel
Post by: Scrummble on 2016-01-12 01:36:32
In fact I did not get it when you mentioned "shift".
Have you ever seen a mouse with dual wheels? One wheel vertical and one horizontal, that's what I was talking about.
Personally I use a Macbook Air with Win10 on Parallel Desktop, and the touchpad supports horizontal scrolling, which works fine on Microsoft Edge, Chrome, Notepad2, Excel and Word (while ironically File Explorer and PowerPoint does not support this; ELPlaylist on fb2k even has a bug showing a blank area).
Title: Re: JScript Panel
Post by: marc2003 on 2016-01-12 03:17:08
Code: [Select]
v1.1.1
- ADD: New "on_mouse_wheel_h" callback for left/right scrolling. See callbacks.txt.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: WilB on 2016-01-12 19:09:09
Thanks for the speedy fix. Just to confirm that fb.GetQueryItems() seems to be working correctly now.  :)
Title: Re: JScript Panel
Post by: Bauble on 2016-01-30 21:54:14
Hi
After I installed 1.1.1 plugin through foobar interface and restarted foobar, I get this error:

Failed to load DLL: foo_jscript_panel.dll
Reason: A dynamic link library (DLL) initialization routine failed. 

what could be the reason? I never used JScript Panel before, this is first time I install it

ye and it shows "(component not loaded)" in component list

foobar 1.3.9
Title: Re: JScript Panel
Post by: marc2003 on 2016-01-31 09:03:51
If you're running Windows XP then that would be the problem. It requires Vista or later.

https://github.com/19379/foo-jscript-panel/wiki/Requirements-&-Installation
Title: Re: JScript Panel
Post by: Bauble on 2016-01-31 10:32:23
no, Windows 7 32 'N' version

and foobar without Column UI
Title: Re: JScript Panel
Post by: marc2003 on 2016-01-31 17:07:38
Well I cannot explain that. It should work on any version of windows 7.
Title: Status Bar sample script bug
Post by: Jailhouse on 2016-02-04 01:58:20
Hello,

I tried using the mouse scroll wheel to change the volume while playing with the Status Bar sample. The script lowers the volume when rolling the wheel both backward and forward. Using foobar's volume control in the notification area works as expected. I don't see an obvious error in the script, which is probably the only kind I can find right now given my current meager knowledge of JavaScript.

As an aside, I decided to install JScript Panel because of included Seekbar script sample; I hoped it might solve my problem with the foobar seekbar, which is that it's practically invisible from across the room. I'm happy to say that I successfully modified the script to create exactly what I needed. Many thanks, @marc2003, for making this possible.

Mark
Title: Re: Status Bar sample script bug
Post by: Jailhouse on 2016-02-06 06:16:32
I tried using the mouse scroll wheel to change the volume while playing with the Status Bar sample. The script lowers the volume when rolling the wheel both backward and forward.
I modified the Status Bar example to fill other needs. Setting the volume via the mouse wheel is still not working properly, but I'm keeping that functionality because I'll like it a lot when it works. (Or I might try adding another panel with the Volume sample script instead. You never know.)

The function involved is:
Code: [Select]
function on_mouse_wheel(s) {
if (!show_volume)
return;
if (s == 1)
fb.VolumeUp();
else
fb.VolumeDown();
I set the var s to 0, which reversed the effect, i.e., the volume only rises. I tried -1 and recreated the original behavior. I found Volume entries in interfaces.txt but haven't a clue at this time what to do with the information.

I'm running foobar on Windows 7 Home Premium and using the DUI.
Title: Recently played items list
Post by: Jailhouse on 2016-02-06 06:58:30
I've used two JScript panels to replace five Text Display panels, added panels using the playback buttons and seekbar sample scripts, and got the status bar panel I've been referring to above configured to my liking. (The Status Bar playlist track count has already become very useful.) I really like this thing!  ;D

I sometimes hear a song I like (or not), but don't know what it is and can't drop what I'm doing to check before the track ends. When I was using Zune (gack) I could simply go back to the previous track or two to find out what I was listening to. However, foobar doesn't work that way. That may be the only advantage Zune has over fb2k.

While hacking away at the sample scripts I'm using, I got to thinking it might well be possible to create a list of recently-played tracks in JScript Panel. Am I correct? Would it be difficult? (For me, probably yes, even if it's a relatively simple thing. I have much to learn.)
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-06 13:39:14
Can you try and see if this works...

Code: [Select]
function on_mouse_wheel(a, b) {
if (!show_volume)
return;
if (b > 0)
fb.VolumeUp();
else
fb.VolumeDown();
}

As for getting a list of recently played tracks, install foo_playcount. Then after playing some tracks, you can use the Library menu>Playback Statistics>Show recently played.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-02-06 22:11:34
Can you try and see if this works...
[snip]
As for getting a list of recently played tracks, install foo_playcount. Then after playing some tracks, you can use the Library menu>Playback Statistics>Show recently played.

That works a treat!

I'll check out foo_playcount. I'm still curious, though, if you think it's possible to display a dynamic recently-played list using JScript Panel.

Thank you.
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-11 13:01:46
Code: [Select]
v1.1.2
- FIX: Fix on_mouse_wheel not being called with certain trackpads.

https://github.com/19379/foo-jscript-panel/releases

@Jailhouse, this should fix the volume problem you were having. Reverting back to the original script should work.

As for tracking plays with Jscript Panel, of course it's possible. I just don't think it's worth the effort when foo_playcount does it as well.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-02-11 15:57:57
Code: [Select]
v1.1.2
- FIX: Fix on_mouse_wheel not being called with certain trackpads.

https://github.com/19379/foo-jscript-panel/releases

@Jailhouse, this should fix the volume problem you were having. Reverting back to the original script should work.

The original script works fine now. Thanks.

Quote
As for tracking plays with Jscript Panel, of course it's possible. I just don't think it's worth the effort when foo_playcount does it as well.

I see your point, but there are other dynamics here: I would like to see the list at a glance; I don't want to install any more components than I have to, and I already have JScript Panel; most important, working toward a goal of my choosing will help me to learn and understand more quickly as I'll be more interested in the result.
Title: Odd behavior in DUI playlist apparently due to JScript Panel
Post by: Jailhouse on 2016-02-13 05:19:28
While working with some of the sample scripts for JScript Panel (JSP), I noticed that when playing tracks in random order the track being played was shown at either the top of the DUI playlist window or at the bottom, depending on its location in the list relative to the previous track. Normally, the current track is displayed in the middle of the window where it's easy to find; a nice touch.

I suspected JSP might have had something to do with this since it's the only third-party component I'm using. I have subsequently found that if I remove all the panels and restart foobar, the playlist window updates normally. If I then restore the panels, the window still updates as it should until I restart foobar, upon which the misbehavior returns. I do not have to interact with the panels in any way, including moving the cursor over them, for this to happen.

I am using the following scripts, in order of installation:

I first noticed the problem as I was working on the second script, but I can't say for certain that it wasn't happening from the time I was working on seekbar. I have modified the first three scripts to remove the bits I didn't need and change formatting. I've been careful, but I'm open to the possibility that I may have inadvertently become a troublemaker.

It just occurred to me that I did not test removing panels individually. I'll be happy to do so upon request.
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-13 13:38:40
I have been able to reproduce that but not reliably. Re-arranging panels can make it work again and then it stops again - all without restarting foobar.

Also, the following playlist views are unaffected so I feel there is nothing I can do about this.

EsPlaylist (default UI and columns UI)
SimPlaylist (default UI)
NGplaylist (columns UI)
JSplaylist (WSH panel mod script by Falstaff modded by me for JScript panel)

Even if other playlist views were affected, I still don't think I could do anything about it because I wouldn't know where to begin trying to debug it.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-02-14 04:16:33
I had one instance where I booted my PC and when I started foobar the playlist functioned normally, but the problem returned upon the next foobar start. Other than that, starting foobar with any panels installed triggers the issue, and starting with no panels solves it.

Even if other playlist views were affected, I still don't think I could do anything about it because I wouldn't know where to begin trying to debug it.
I imagine this problem would be easier to debug if it would throw an error or cause foobar to crash. I'm hoping you're like me and you suddenly come up with a possible solution out of the blue. I seem to do my best thinking subconsciously.

I also imagine that with this being a cosmetic issue that doesn't affect the playlist's functionality and isn't a bug in foobar, Peter isn't likely to be very interested in looking into it and so calling attention to it in the Support forum probably wouldn't be useful.

Since you mentioned JSplaylist, I think I'll look into that. It seems that in time my entire foobar GUI will be composed of JScript panels.
Title: Re: JScript Panel
Post by: terrazac on 2016-02-14 18:33:15
Hi, I want to add a new colum to the playlist (LRC-TXT-N/A) to show if there is a .lrc file or a .txt file or neither in the same directory of the .mp3 file. I think will be useful to know wich songs have timed lyrics, wich don't. You know you should want to keep  singing all day long. I try to do that with the title formating options but ... . It is that possible with Jscript?
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-14 21:05:50
Yes, it's possible. Next you'll be asking how...  :P
Title: Re: JScript Panel
Post by: colagen on 2016-02-14 23:38:07
Hi,

A user of this forum ask me if i was willing to use in one of my script a function available in a wsh panel mod made by a Russian guy, which allow to save a GdiImage to the disk, as jpg, bmp, png, gif, or tiff
It's great to make a cover cache, and the code source of his mod is available online, i tried and it seems to work quite well, he added a SaveAs method (like the Resize() method for example) to the IGdiBitmap object.
@Marc2003, are you willing to add it to your jscript component ? It should be just a copy/pastle game, by searching the SaveAs reference in the provided files.

The code source of his component is here : https://github.com/ttsping/foo_uie_wsh_panel_mod_plus
And if you want to browse only the files containing the SaveAs method, there is only 3 files, and they are here http://www.mediafire.com/download/9gzlozp4lt27pzg/script_interface_impl_with_SaveAs.zip

Maybe there is others good new functions in his component, but i didn't really browse the repository, and the component may be buggy (i don't know), so it's probably a bad idea to copy everything.

And the doc of this method is here :

      SaveAs(path, [format = "image/png"]); (Boolean)
      // format:
      // default - "image/png",
      // supported - "image/bmp"
      //     "image/jpeg"
      //     "image/gif"
      //        "image/tiff"
      //  e.g.: var img = gdi.CreateImage(1, 1);
      // img.SaveAs("D:\\img.png","image/png");   
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-15 16:16:07
I'm pretty sure he's Chinese, not Russian. Just look at the github commits he's made in the last 2 days. Anyway, I will consider adding this in the next day or so..
Title: Re: JScript Panel
Post by: colagen on 2016-02-15 18:33:25
Oh yes, possible, i don't even remember why i though he was russian, i'm pretty sure he is a human, and one who know how to write a c++ function, that's all i'm sure about : )
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-15 18:53:20
Remember that on_mouse_wheel issue you had and you provided me with some extra code so it returns 3 arguments. I've since updated the first argument so can you test and see if it works for you. If so, I can then tidy up by removing the other two.
Title: Re: JScript Panel
Post by: colagen on 2016-02-15 19:33:47
Nope, it doesn't fix it, if i remove the second and third argument, it scroll, but way too quickly.
My trackpad trigger on_mouse_wheel events repeatedly with small values, and step is an integer, 1 or -1, so one scroll with my trackpad make something like ten calls to on_mouse_wheel, with step equal to 1 or -1
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-15 19:38:02
Fairy nuff. I'll leave it in.
Title: Re: JScript Panel
Post by: elia_is_me on 2016-02-16 01:28:05
Hi,

A user of this forum ask me if i was willing to use in one of my script a function available in a wsh panel mod made by a Russian guy, which allow to save a GdiImage to the disk, as jpg, bmp, png, gif, or tiff
It's great to make a cover cache, and the code source of his mod is available online, i tried and it seems to work quite well, he added a SaveAs method (like the Resize() method for example) to the IGdiBitmap object.
@Marc2003, are you willing to add it to your jscript component ? It should be just a copy/pastle game, by searching the SaveAs reference in the provided files.

The code source of his component is here : https://github.com/ttsping/foo_uie_wsh_panel_mod_plus
And if you want to browse only the files containing the SaveAs method, there is only 3 files, and they are here http://www.mediafire.com/download/9gzlozp4lt27pzg/script_interface_impl_with_SaveAs.zip

Maybe there is others good new functions in his component, but i didn't really browse the repository, and the component may be buggy (i don't know), so it's probably a bad idea to copy everything.

And the doc of this method is here :

      SaveAs(path, [format = "image/png"]); (Boolean)
      // format:
      // default - "image/png",
      // supported - "image/bmp"
      //     "image/jpeg"
      //     "image/gif"
      //        "image/tiff"
      //  e.g.: var img = gdi.CreateImage(1, 1);
      // img.SaveAs("D:\\img.png","image/png");   

Maybe you mean ttsping's WSH Panel Mod Plus, but he is not a 'Russion' guy...

and his component is not buggy at all, because we've used&tested  it for a long time and it works well. ttsping decided to extend wsh_panel_mod 1.5.6 after wang t.p. did not appear in public for years.(It's a tradition in China that people like to do some interesting things in their school days and disappear after they find a job)

ttsping had released a public version of wsh_panel_mod_plus in github days ago which you may have already know.
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-17 11:25:55
Code: [Select]
v1.1.3
- ADD: IGdiBitmap SaveAs method.

https://github.com/19379/foo-jscript-panel/releases

My version of the docs:

Code: [Select]
		SaveAs(path, [format]); (boolean)
/*
path: full path including file extension. the parent folder must already exist.
format:
"image/png" (default if omitted)
"image/bmp"
"image/jpeg"
"image/gif"
"image/tiff"

example:
var img = utils.GetAlbumArtEmbedded(fb.GetFocusItem().RawPath, 0);
if (img)
img.SaveAs("D:\\export.jpg", "image/jpeg");
*/
Title: Re: JScript Panel
Post by: colagen on 2016-02-19 13:18:57
Thanks a lot, i build a cache system for my layout using it, it work perfectly, and now foobar is a quite a lot faster, it's much faster to load an already resized image directly instead of using the GetAlbumArt functions
Title: Re: JScript Panel
Post by: terrazac on 2016-02-19 20:53:25
Reply #85 – 14 February, 2016, 01:33:15 PM
Hi, I want to add a new colum to the playlist (LRC-TXT-N/A) to show if there is a .lrc file or a .txt file or neither in the same directory of the .mp3 file. I think will be useful to know wich songs have timed lyrics, wich don't. You know you should want to keep  singing all day long. I try to do that with the title formating options but ... . It is that possible with Jscript?


Reply #86 – 14 February, 2016, 04:05:50 PM
Yes, it's possible. Next you'll be asking how...  :P


Not really I worked a litlle around and I doit in this way:

if ( this.metadb.path.indexOf(".mp3")){
  texto = this.metadb.path.replace(".mp3",".lrc");
}
  if (utils.ReadTextFile(texto) ) {
gr.GdiDrawText("LRC", gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
} else {
gr.GdiDrawText(this.title, gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
}

I insert this in your code at your old wsh script and works but I want it in your new Jscrip.... but I can't get it work...  why?
because this:

El objeto no acepta esta propiedad o método (The object doesn't accept the method o argument)
File: <main>
Line: 520, Col: 9
<source text only available at compile time>

and the line 520 is a // commente but the 521 is:

 521        fb.CreateAutoPlaylist(total, "Media Library", "ALL", "%album artist% | $if(%album%,%date%,'9999') | %album% | %discnumber% | %tracknumber% | %title%", 0);

I try to skip that line but later become other problems. What I doing bad?
Title: Re: JScript Panel
Post by: terrazac on 2016-02-19 20:57:59
Reply #85 – 14 February, 2016, 01:33:15 PM
Hi, I want to add a new colum to the playlist (LRC-TXT-N/A) to show if there is a .lrc file or a .txt file or neither in the same directory of the .mp3 file. I think will be useful to know wich songs have timed lyrics, wich don't. You know you should want to keep  singing all day long. I try to do that with the title formating options but ... . It is that possible with Jscript?


Reply #86 – 14 February, 2016, 04:05:50 PM
Yes, it's possible. Next you'll be asking how...  :P


Not really I worked a litlle around and I doit in this way:

if ( this.metadb.path.indexOf(".mp3")){
  texto = this.metadb.path.replace(".mp3",".lrc");
}
  if (utils.ReadTextFile(texto) ) {
gr.GdiDrawText("LRC", gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
} else {
gr.GdiDrawText(this.title, gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
}

I insert this in your code at your old wsh script and works but I want it in your new Jscrip.... but I can't get it work...  why?
because this:

El objeto no acepta esta propiedad o método (The object doesn't accept the method o argument)
File: <main>
Line: 520, Col: 9
<source text only available at compile time>

and the line 520 is a // commente but the 521 is:

 521        fb.CreateAutoPlaylist(total, "Media Library", "ALL", "%album artist% | $if(%album%,%date%,'9999') | %album% | %discnumber% | %tracknumber% | %title%", 0);

I try to skip that line but later become other problems. What I doing bad?

If there is a better way to do it, I would like to Know of course!!!!
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-21 10:27:02
fb.CreateAutoPlaylist doesn't exist in JScript panel - it has been replaced with plman.CreateAutoPlaylist. Details of other changes here...

https://github.com/19379/foo-jscript-panel/wiki/Updating-WSH-Panel-Mod-scripts-for-JScript-Panel

An updated version of Br3tt/Falstaff's JSplaylist for JScript Panel can be found here..

https://github.com/19379/jsplaylist-mod

Updated version of JSSmoothPlaylist can be found here..

http://www.deviantart.com/art/JS-Smooth-Playlist-571375892

If you're not using either of these scripts then you will have to update it yourself.
Title: Re: JScript Panel
Post by: garudaishaya on 2016-02-25 10:05:02
how can i change the color of the themed seek bar?
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-25 12:13:33
If you want to change colours, don't use a themed seekbar.
Title: Re: JScript Panel
Post by: garudaishaya on 2016-02-26 07:26:49
shame on me!
I just like to change the green color of the progress bar for grey
thanks anyway
Title: Re: JScript Panel
Post by: terrazac on 2016-02-27 15:33:33
Hi, I am capable to display the texts LRC, TXT or N/A if the lyrics file are next to the mp3 file but I want to write them inside a the tagg COMMENT to be able to sort all the track by LRC or TXT, etc.

I can have the tagg "COMMENT" with:

gr.DrawString(fb.TitleFormat("%comment%").EvalWithMetadb(this.metadb) , g_font, this.text_colour_default, columns.rating_x + 200, this.y + 3, cw + 1, cTrack.height + cTrack.parity, lc_stringformat);

but how can I write to the tagg "Comment" from jscript?, something like:

%comment% = "LRC"

Is it posible? and How?
Title: Re: JScript Panel
Post by: ohyeah on 2016-02-27 16:31:22
Hi, I am capable to display the texts LRC, TXT or N/A if the lyrics file are next to the mp3 file but I want to write them inside a the tagg COMMENT to be able to sort all the track by LRC or TXT, etc.

I can have the tagg "COMMENT" with:

gr.DrawString(fb.TitleFormat("%comment%").EvalWithMetadb(this.metadb) , g_font, this.text_colour_default, columns.rating_x + 200, this.y + 3, cw + 1, cTrack.height + cTrack.parity, lc_stringformat);

but how can I write to the tagg "Comment" from jscript?, something like:

%comment% = "LRC"

Is it posible? and How?
this.metadb.UpdateFileInfoSimple("COMMENT", "LRC");
you may have to edit the text  file "LargeFieldsConfig.txt" (installdir) , adding "comment" to basic field or comment it in the spam field,  im not sure.
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-27 17:21:50
Writing tags from a script designed as a playlist viewer is a really bad idea - especially when called from inside on_paint.

Really, you want a bit of code that will loop through all playlist/library items just once. Also, rather than updating each file individually, you should build up a single handle list and use UpdateFileInfoSimple on that. Something like...

Code: [Select]
var items = plman.GetPlaylistItems(plman.ActivePlaylist); //get all active playlist items
var items_to_tag = plman.GetPlaylistItems(-1); //using -1 here gives us an empty handle list to start with
for (var i = 0; i < items.Count; i++) {
var m = items.Item(i);
if (some check for lrc file using m.Path)
items_to_tag.Add(m); //add current track to list of items to be tagged
}
if (items_to_tag.Count > 0)
items_to_tag.UpdateFileInfoSimple("COMMENT", "LRC");
Title: Re: JScript Panel
Post by: terrazac on 2016-02-28 17:46:16
yes you are right. Thank you a lot.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-03-16 00:18:59
Quote
[From Reply #82] I noticed that when playing tracks in random order the track being played was shown at either the top of the DUI playlist window or at the bottom, depending on its location in the list relative to the previous track. Normally, the current track is displayed in the middle of the window where it's easy to find [...]

I have discovered that doing the following restores the normal playlist behavior:


I'm using the JScript Panel controls for playback. I don't know if using the foobar2000 controls makes a difference, nor if clicking Play instead of Next does so. (Since the issue occurs sporadically, so does testing.)

@marc2003, I hope this might provide some clue as to why the problem happens in the first place. I'm not holding my breath.  :)

I'm hoping the problem stops occurring once I stop modifying the panel script(s).
Title: Re: JScript Panel
Post by: marc2003 on 2016-03-16 07:44:08
I hope this might provide some clue as to why the problem happens in the first place.

Nope!

Quote
I'm not holding my breath.  :)

Good. You'd suffocate if you did.

Quote
I'm hoping the problem stops occurring once I stop modifying the panel script(s).

I already reproduced the issue using my own scripts so it's not you. I tested blank panels and that was fine so it's not the presence of the component itself.

You have 3 choices:

1) Use an alternative playlist viewer.
2) Don't use JScript Panel/my scripts.
3) Live with the issue.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-03-16 16:28:51
It seemed to me that the problem didn't occur at any time except just after I'd modified a script. So of course when I started foobar2000 for the first time today, there it was. Another hypothesis blown to bits. Moomph.

Quote
2) Don't use JScript Panel/my scripts.

You can't get rid of me that easily.  ;)  I'm getting foobar2000 set up just the way I want it using your scripts. I'm also learning JavaScript, which is fairly new to me (old dog/new trick). I'm having too much fun to quit!

Quote
3) Live with the issue.

I was doing that anyway, but it's easier now that I have a simple method to shoo it away.
Title: Re: JScript Panel
Post by: marc2003 on 2016-04-30 09:00:49
Code: [Select]
v1.1.4
- FIX: main preferences keyboard shortcuts were never processed in columns UI
       when JScript Panel had focus. More details here:
       https://github.com/19379/foo-jscript-panel/wiki/Keyboard-Shortcuts

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: always.beta on 2016-04-30 12:23:17
Would you be interested in three callback combined into one?  "on_library_items_added() + on_library_items_removed() + on_library_items_changed() " >> on_library_changed()
Title: Re: JScript Panel
Post by: marc2003 on 2016-04-30 12:48:39
That is a few lines of code you can add yourself...

Code: [Select]
function on_library_items_added() {on_library_changed();}
function on_library_items_removed() {on_library_changed();}
function on_library_items_changed() {on_library_changed();}
function on_library_changed() {
    //your code here
}
Title: Re: JScript Panel
Post by: always.beta on 2016-04-30 14:55:36
Thank you very much for let me know it.
Title: Re: JScript Panel
Post by: widerock on 2016-05-02 00:27:26
I'm currently using "jsplaylist-mod".

I got sometimes this error mesage.

Quote
JScript Panel (JSPlaylist v1.3.2 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript Runtime Error:
'this.groups[...].collapsed' is null or not an object.
%foobar_path%\js_marc2003\jsplaylist\js\WSHplaylist.js
Line: 1926, Col: 9
<source text only available at compile time>

This happens within the podcatcher playlist when I try to change the podcast source from "Podcatcher Feed Manager" several times.
There wasn't any problem before I installed 'podcatcher plugin'.

It would be great if this can be fixed without removing 'podcatcher plugin.

Title: Re: JScript Panel
Post by: marc2003 on 2016-05-02 03:33:14
Well I don't know what has happened to Falstaff and I'm not familiar with podcatcher either. Since my internet allowance is very small/expensive, I won't be trying it.

I've still had an attempt at fixing it but can't test. Save this inside js_marc2003\jsplaylist\js

edit: stale link removed. main zip will be updated soon
Title: Re: JScript Panel
Post by: widerock on 2016-05-02 03:52:40
Well I don't know what has happened to Falstaff and I'm not familiar with podcatcher either. Since my internet allowance is very small/expensive, I won't be trying it.

I've still had an attempt at fixing it but can't test. Save this inside js_marc2003\jsplaylist\js

https://raw.githubusercontent.com/19379/jsplaylist-mod/test/js_marc2003/jsplaylist/js/WSHplaylist.js

This solved the problem perfectly. Thank you for your work.
Title: Re: JScript Panel
Post by: marc2003 on 2016-05-02 04:07:09
Good stuff. The main zip has been updated.

https://github.com/19379/jsplaylist-mod/releases

edit: only just noticed this is the component thread. To widerock and anyone else, please keep any further issues like this in the script thread...

https://hydrogenaud.io/index.php/topic,110516.0.html
Title: Re: JScript Panel
Post by: Falstaff on 2016-05-03 18:28:02
Well I don't know what has happened to Falstaff ...

I'm fine, just too busy this year to code scripts for foobar2000 ... will be back one day, but i'm still following JScript component changes ;)
Title: Re: JScript Panel
Post by: TomPro on 2016-07-04 13:01:19
Hello and thanks for this plug in. I noticed it for some days in the German user forum for foobar and began strictly began to transform my wsh scripts and while i do so i find a bug.

If you use a script with tooltip and the tooltip is shown, and then the script crashed, the tooltip stay on the window until you exit and restart foobar. If you run the script directly after crashing, and a tooltip would be activated, the you have two tooltip, because the first stayed permanent. And when the script crashed while the 2nd tooltip is showing it stays until foobar would be exit. Same with a 3rd, 4th and so on.

All these "crashed" tooltips are in front of all windows, from every opened program.

My German is no good because i am a dyslexic. Hope my German English was good enough to explain the problem.

A Little Question at the End, can i use the reload function on right click in a script like:
window.showProperties()
window.showConfigure()

Title: Re: JScript Panel
Post by: marc2003 on 2016-07-05 02:04:08
Sorry but I don't think I can fix that. I know nothing about C++ and all the features I've added were easy based on the code that was already there. All I can suggest is not using tooltips until you've fixed your scripts.

window.Reload() is already documented...

https://github.com/19379/foo-jscript-panel/blob/712fe71f3d2d85727132ca8ba85ebea0912c09b7/foo_jscript_panel/docs/Interfaces.txt#L875L876
Title: Re: JScript Panel
Post by: TomPro on 2016-07-05 10:03:00
I know nothing about C++ .
Me too, but you know how to make from an ascii c++ text a foobar component ;-). You know more then I B-).

Sorry but I don't think I can fix that. ... andall the features I've added were easy based on the code that was already there.
Because I have the dyslexic think i can't remember the exact writing of words of any language and so for programming language. So my way to program things is allways:
try and error
read the error code
look in the help files
change the mistake
try and error again....
I like spell checks ;->

Sometimes i remember some basics sometimes not. It needs a long time to program something, but i know the structure or the idea in the back, and script languages are easy cause of the compiling by running. Doing the things so, maybe it could work this way:
There is an Error work around in the script shown the red window with the :-( and the pop up of an Window (think it is from you).
I think there is a function to Dispose() the tooltip. Could it help to run these Dispose() function before you do the other things.

All I can suggest is not using tooltips until you've fixed your scripts.
That's a good Tip, thank you.

window.Reload() is already documented...
Thanks, I don't have read anything so far, that's my mistake ;-)
Title: Re: JScript Panel
Post by: marc2003 on 2016-07-05 11:17:36
I think I've fixed this. I'll post an updated component later on today.
Title: Re: JScript Panel
Post by: marc2003 on 2016-07-05 16:09:44
Code: [Select]
v1.1.4.1
- FIX: Prevent old tooltips lingering after script error.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: TomPro on 2016-07-06 08:56:13
Thanks :-D
Title: Re: JScript Panel
Post by: orbtwin on 2016-07-24 20:09:18
hello everybody...

first of all i'm totally newbie with jscript and samples...
i'm replacing old biography panel...don't work anymore downloading or showing info from last.fm

how can i download the artists bio (bio.www.last.fm.json) and picture to a custom folder? this is empty...i want to download to it 
and rename into $lower(%artist%) ...because i'm using another panel that is using this image.

thanks!
Title: Re: JScript Panel
Post by: johnbecker on 2016-08-24 02:30:05
I'm on the same boat as orbtwin, I used the biography panel mainly to fetch album art and artist bio and picture, saving them to the same folder as the file.

I tried to understand the code to see if I would be able to brute force it in a way to get the images and save the data. After a few minutes trying to make some sense out of it I realized I would not be able to just change a few lines and get what I wanted.

Can anyone share some light on how to make a simple script to do that? Something like: on song change, get data from lastfm and save to the song folder (overwriting or checking if file exists). Pretty simple, it seems. Sadly, programming anything beyond "hello world" is too hard. :(

Thanks
Title: Lastfm biographtyJScript
Post by: YOGAM on 2016-09-08 10:48:27
I guess you're talking about the lastfm biography vscript Marc2003 created.

Yes. I noticed it doesn't work anymore.
It's especially annoying because, the script also seems to randomly erase biography datas already stored in the local folder (I guess it happens when the script tries to update biography datas, and fail to do so).

Has someone an idea what might have happened ?

If it's impossible to make the script work again, I'd like, at least, find a way to avoid losing biography datas already stored in local forder (I'm quite sure that was an issue Marc2003 fixed this issue in the last version of the script he made available. Unfortunately, it's not on Github anymore, but that means there is a way to solve the "erasing datas" problem).

Thanks !
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-08 15:48:08
All I can do is show evidence of it working for me...

http://i.imgur.com/Ho17Cx0.jpg

I don't care if it doesn't work for anyone else.
Title: Re: JScript Panel
Post by: crouch on 2016-09-09 01:18:27
All I can do is show evidence of it working for me...

http://i.imgur.com/Ho17Cx0.jpg


Do you have a backup for your scripts? new to foobar2k and found out about you but couldnt do anything cause you Github was down :(

I don't care if it doesn't work for anyone else.
Title: Re: JScript Panel
Post by: kode54 on 2016-09-09 01:45:42
I think he intentionally deleted his Gists and repositories for those scripts. I do know that Wikipedia does not arbitrarily delete content unless it violates their rules somehow, and if an account holder themselves violates any rules, they usually suspend the account but don't delete anything.
Title: Re: JScript Panel
Post by: crouch on 2016-09-09 01:58:31
I think he intentionally deleted his Gists and repositories for those scripts. I do know that Wikipedia does not arbitrarily delete content unless it violates their rules somehow, and if an account holder themselves violates any rules, they usually suspend the account but don't delete anything.

so theres no way to get those scripts then?
Title: Re: JScript Panel
Post by: MachineHead on 2016-09-09 02:14:50
so theres no way to get those scripts then?

July 6 version (v4.1) here. (https://drive.google.com/open?id=0B5eq8KbiKEdFME5DWmJOcFRHRVk)
Title: Re: JScript Panel
Post by: YOGAM on 2016-09-09 08:55:00

I don't care if it doesn't work for anyone else.
Fair enough.
I would probably have put it differently, but, hey... it has the merit of being clear.
Title: Re: JScript Panel
Post by: YOGAM on 2016-09-09 08:58:00
Thank you Machinehead !
Title: Re: JScript Panel
Post by: davideleo on 2016-09-12 13:22:31
JS Smooth Playlist Manager: http://fav.me/d9g6kss (http://fav.me/d9g6kss)

Is it possible to have a transparent background with this script? Checking the pseudo transparent option in the panel configuration window doesn't seem to affect the panel appearance.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-20 11:17:00
Quote
v1.1.5
- ADD: plman.IsPlaylistLocked(playlistIndex). See interfaces.txt.
- ADD: on_playlists_changed is now called when a playlist's lock
      status changes through the use of components such as foo_utils or
      foo_playlist_attributes. See callbacks.txt
- CHG: Existing samples moved in to new "basic" subfolder.
- ADD: Add new "complete" samples folder containing some more feature complete
      samples.
- ADD: Add "jsplaylist-mod". Since Br3tt's excellent JSplaylist doesn't work
      with JScript Panel, this updated "mod" version has been created.

https://github.com/19379/foo-jscript-panel/releases

Note the added samples are only offline scripts from my previous packages. Nothing accesses the internet.
Title: Re: JScript Panel
Post by: Air KEN on 2016-09-20 12:31:17
Hi :)
Is there a problem to distribute the Wingdings 2 (wingdng2.ttf) and Wingdings 3 (wingdng3.ttf) fonts?

Wingdings 2 - Version 1.10
https://www.microsoft.com/typography/fonts/font.aspx?FMID=665
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-20 13:18:41
I've removed the fonts.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-20 18:33:29
Code: [Select]
v1.1.5.1
- ADD: Add "Open component folder" to default right click menu.
       This provides quick access to the docs and samples.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: always.beta on 2016-09-21 16:00:44
WSH Mod Plus component  is added a new interface: IGdiBitmap.StackBlur() . The effect of StackBlur is better than BoxBlur.
Could you add this interface in jscript_panel ?
Example: IGdiBitmap.StackBlur([0, 255]radius, [1, 20]core = 1);  "core = 1" represents the number of threading.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-22 11:43:26
I don't know how to do that by myself and that code isn't in the source for WSH panel mod plus on github.
Title: Re: JScript Panel
Post by: zeremy on 2016-09-22 12:40:27
I don't know how to do that by myself and that code isn't in the source for WSH panel mod plus on github.

@marc2003
It is in the devel branch.

https://github.com/ttsping/foo_uie_wsh_panel_mod_plus/commit/fa30a878fa6187fe7ecdd087bb2c04dca4f94c6f
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-22 13:02:48
Ah, thanks for that.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-22 19:25:45
Code: [Select]
v1.1.6
- ADD: IGdiBitmap StackBlur method. See docs\interfaces.txt and
       samples\basic\StackBlur.txt.
- CHG: Update ApplyMask sample.

https://github.com/19379/foo-jscript-panel/releases

There is no threads option. It should determine that by itself.
Title: Re: JScript Panel
Post by: always.beta on 2016-09-23 09:33:28
Thank you marc2003.
So, if Falstaff has time to update his script, he will be able to use the new interface in the JSS script.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-23 17:48:20
Falstaff might not want to use it!!

I'll probably update jsplaylist-mod with it though.
Title: Re: JScript Panel
Post by: tr0ner on 2016-09-30 22:19:57
Hello all,

I installed JScript Panel as a replacement to biography view and set up a window for it in columns ui.
I want to get it to automatically show album covers from the web. So I tried to import GetAlbumArtV2.txt and also album art.txt. Album covers are displayed if they are embedded into the mp3 files but it does not seem to get / display covers from the web.

Can anyone let me know what I'm doing wrong?
Thank you very much in advance.

Title: Re: JScript Panel
Post by: marc2003 on 2016-10-21 16:58:27
Code: [Select]
v1.1.6.1
- CHG: Minor changes to Console logging on startup.
- ADD: The "complete" samples folder has 2 new scripts: "thumbs.txt" and "text reader.txt"
       Thumbs allows the display/cycling of multiple images in a given folder. Text reader
       displays the contents of any plain text file. Title formatting can be used to
       specify the folder/file paths.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: WilB on 2016-11-11 19:26:58
Is it possible for JScript panel to determine whether a visualization is actually being displayed? I am particularly interested in the YouTube Video player pop-up ("View\Visualizations\YouTube Video"). I can toggle it on/off with a button, but it seems the on/off state cannot be determined. Consequently it sometimes gets out of sync with other changes in the layout view, i.e. shows when not wanted & hides when wanted.

Perhaps this would require a new callback that would cover all visualizations, if within your skill set?

Thanks for your consideration.
Title: Re: JScript Panel
Post by: marc2003 on 2016-11-11 20:38:04
No, I don't think so. All current callbacks are provided the SDK itself and I'm almost certain nothing like that would exist for any visualisation windows - especially 3rd party ones.

I've been able to add/modify what is already there because of the existing code/notes. Hacking something together outside of that would be way beyond what I'm capable of.
Title: Re: JScript Panel
Post by: zeremy on 2016-11-12 18:53:15
Is it possible for JScript panel to determine whether a visualization is actually being displayed? I am particularly interested in the YouTube Video player pop-up ("View\Visualizations\YouTube Video"). I can toggle it on/off with a button, but it seems the on/off state cannot be determined. Consequently it sometimes gets out of sync with other changes in the layout view, i.e. shows when not wanted & hides when wanted.

Perhaps this would require a new callback that would cover all visualizations, if within your skill set?

Thanks for your consideration.

I use utils.WriteIni to save the window state (on or off).
Of course if the video window state is changed not with the button but from the menu the state gets messed-up.

Code: [Select]
//settings ini
ini_file = fb.FoobarPath + "zeremy\\settings.ini";

read_ini_video = function (k) {
return utils.ReadINI(this.ini_file, "video_window", k);
}

function vid0mode() {
video_window_state = read_ini_video("state");
video_window_mode = read_ini_video("mode");
if (video_window_state == "ON") {
utils.WriteIni(this.ini_file, "video_window", "state", "OFF");
buttons.vid0.state = ButtonStates.normal;
fb.RunMainMenuCommand("View/Visualizations/Youtube Video");
} else {
utils.WriteIni(this.ini_file, "video_window", "state", "ON");
buttons.vid0.state = ButtonStates.down;
fb.RunMainMenuCommand("View/Visualizations/Youtube Video");
}
}

Title: Re: JScript Panel
Post by: zeremy on 2016-11-13 18:20:26
In WSH Panel Mod Plus interfaces there is
STDMETHODIMP GetWND(BSTR class_name , IWindow** pp); (https://github.com/ttsping/foo_uie_wsh_panel_mod_plus/blob/master/foo_uie_wsh_panel_mod_plus/script_interface_impl.h#L595)

You can call the window class visibility state STDMETHODIMP IsVisible(VARIANT_BOOL * p); (https://github.com/ttsping/foo_uie_wsh_panel_mod_plus/blob/master/foo_uie_wsh_panel_mod_plus/script_interface_impl.h#L765) 

For Youtube Video
fb.trace(utils.GetWND("{C462426D-132B-49AB-9B10-A7F77095A356}").IsVisible());



Title: Re: JScript Panel
Post by: TheQwertiest on 2016-11-14 12:19:33
Is it possible for JScript panel to determine whether a visualization is actually being displayed? I am particularly interested in the YouTube Video player pop-up ("View\Visualizations\YouTube Video"). I can toggle it on/off with a button, but it seems the on/off state cannot be determined. Consequently it sometimes gets out of sync with other changes in the layout view, i.e. shows when not wanted & hides when wanted.

Perhaps this would require a new callback that would cover all visualizations, if within your skill set?

Thanks for your consideration.

Yeah, I feel your pain, I've a similar problem myself (not only with YT)...

PS: I will try to make some sound arguments for my feature request for Library Tree soon :)

No, I don't think so. All current callbacks are provided the SDK itself and I'm almost certain nothing like that would exist for any visualisation windows - especially 3rd party ones.

I've been able to add/modify what is already there because of the existing code/notes. Hacking something together outside of that would be way beyond what I'm capable of.

Actually, I think it could be covered by a different not visualizations-related check: we need an ability to get the state of the main menu item (e.g. whether it's checked (like radio-button-checked)), this way we can check any item we want, including visualizations. It's like CheckMenuRadioItem, but with arguments from RunMainMenuCommand.

I've found some callbacks in SDK that might be related to this (it should be the same for context menu and main menu):
https://github.com/19379/foo-jscript-panel/blob/master/foobar2000/SDK/menu_helpers.h#L13

This one looks suspiciously close to what we need.
Title: Re: JScript Panel
Post by: WilB on 2016-11-14 13:14:30
Just a heads up: since marc2003 indicated he wasn't able to add the ability to get the "visible" vs "hidden" status of visualizations, I asked 3dyd if the property could be provided by foo_youtube.  I now have test version of foo_youtube that's working well. Of course it only applies to the foo_youtube popup visualization, but in this case it should work generally - not just with JScript panel. Hopefully, it will be in the next release of foo_youtube.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-11-14 15:36:55
It's like CheckMenuRadioItem, but with arguments from RunMainMenuCommand.
That is wrong, there is no similar function yet.
Title: Re: JScript Panel
Post by: marc2003 on 2016-11-14 18:47:26
Code: [Select]
v1.1.6.2
- FIX: plman.AddLocations: Original order of files in array is now maintained.
- CHG: plman.AddLocations: Progress dialog stays hidden for short operations.

https://github.com/19379/foo-jscript-panel/releases

@WilB, if you still see a progress dialog, there is nothing else I can do. The SDK function doesn't accept any other parameters that will change the behaviour.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-11-15 09:45:43
@marc2003 : Actually it was much simpler than that - mainmenu_commands class has get_display method, which return flags:

Code: [Select]
class NOVTABLE mainmenu_commands : public service_base {
public:
enum {
flag_disabled = 1<<0,
flag_checked = 1<<1,
flag_radiochecked = 1<<2,
flag_defaulthidden = 1<<3,
sort_priority_base = 0x10000,
sort_priority_dontcare = 0x80000000,
sort_priority_last = ~0,
};
...
virtual bool get_display(t_uint32 p_index,pfc::string_base & p_text,t_uint32 & p_flags) {p_flags = 0;get_name(p_index,p_text);return true;}
...
};

I can make a pull request with the implementation, if you want.

PS: Component fails to build under VS2015 unless I change default values from float to integer in DrawImage and FillGradRect methods in script_interface.h:
before:
Code: [Select]
__interface IGdiGraphics: IGdiObj
{
...
STDMETHOD(DrawImage)(IGdiBitmap * image, float dstX, float dstY, float dstW, float dstH, float srcX, float srcY, float srcW, float srcH, [defaultvalue(0.0)]float angle, [defaultvalue(255)]BYTE alpha);
...
STDMETHOD(FillGradRect)(float x, float y, float w, float h, float angle, VARIANT color1, VARIANT color2, [defaultvalue(1.0)] float focus);
... 
};
after:
Code: [Select]
__interface IGdiGraphics: IGdiObj
{
...
STDMETHOD(DrawImage)(IGdiBitmap * image, float dstX, float dstY, float dstW, float dstH, float srcX, float srcY, float srcW, float srcH, [defaultvalue(0)]float angle, [defaultvalue(255)]BYTE alpha);
...
STDMETHOD(FillGradRect)(float x, float y, float w, float h, float angle, VARIANT color1, VARIANT color2, [defaultvalue(1)] float focus);
... 
};
Title: Re: JScript Panel
Post by: marc2003 on 2016-11-15 13:58:58
First of all, no changes are required to make it compile with VS2015. I use it myself.

Secondly, I have no idea what you're trying do checking menu radio/check boxes. None of the visualisations have any that you can query.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-11-15 15:14:42
First of all, no changes are required to make it compile with VS2015. I use it myself.
I dunno, may be it is system specific bug, because there was only a single report a lot of time ago in WSH Panel Mod thread with the same problem as mine: https://hydrogenaud.io/index.php/topic,70363.msg722027.html#msg722027

For some reason midl treats float values as strings when generating .idl files (i.e. it changes 1.0 to "1.0"), which results in a compile error.

Secondly, I have no idea what you're trying do checking menu radio/check boxes. None of the visualisations have any that you can query.
I've made a >>pull request<< (https://github.com/19379/foo-jscript-panel/pull/1) that hopefully is easier to understand than my rambling here =)
Title: Re: JScript Panel
Post by: WilB on 2016-11-15 16:32:12
@marc2003: Thanks for the upgrade to plman.AddLocations.

Its a great improvement. I haven't seen the progress dialogue.

However, foobar2000 add locations seems to ensure that all the added items are visible and also automatically sets focus to the first added item. Is it possible that plman.AddLocations can have, or have options, for that behaviour? As it is items can be added at the end of a playlist where they can't be seen.

I couldn't resolve this in the normal way by putting plman.EnsurePlaylistItemVisible and/or plman.SetPlaylistFocusItem after plman.AddLocations. It seemed as though plman.EnsurePlaylistItemVisible / plman.SetPlaylistFocus actually ran before the tracks were added to the playlist (e.g. I could get them to work if I used them with a short timer delay, but that's not an ideal solution).
Title: Re: JScript Panel
Post by: marc2003 on 2016-11-15 17:46:41
Yes, the operation is asynchronous which means any code in your script will run immediately without knowing or caring when it's going to finish.

However, you can detect when tracks are added to a playlist using on_playlist_items_added. Obviously you don't want code inside this triggering every time tracks are added to a playlist so you can use a variable something like this...

Code: [Select]
var focus = -1;

function add_tracks() {
    //before adding tracks, count existing ones so we know the index to select.
    focus = plman.PlaylistItemCount(plman.ActivePlaylist);
    plman.AddLocations(plman.ActivePlaylist, files);
}

function on_playlist_items_added() {
    if (focus < 0) return; //don't do anything unless we know plman.AddLocations has just run
    plman.SetPlaylistFocusItem(plman.ActivePlaylist, focus);
    focus = -1; // reset the value so this code doesn't run next time tracks are added normally
}
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-10 09:43:28
Code: [Select]
v1.1.7 Beta 1
- FIX: Remove trailing space in "Console" when using fb.Trace.
- FIX: Thumbs sample. Fix issue where using %profile% in the "Custom folder"
       setting would fail if the profile path contained special title formatting
       characters like %()[]'
- CHG: Remove "Grab focus" and "Delay load" from "Configuration" window. Both
       options are forced on for all panels. Don't want to give a panel focus?
       Don't click it! Let me know if you think "Delay load" on all panels has
       noticeable side effects.
- CHG: Some internal refactoring which is why we have a beta. I need more users
       to test I didn't break anything!

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: tedgo on 2016-12-10 12:22:03
Sorry, but force "Grab focus" to all panels without an option to disable it is a bad idea...

For example: i have some pure button panels and why should they get focus at all?
Once i click a button i am forced to click in the playlist again to give it the "focus" back or the key buttons will no longer work...
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-10 13:25:32
Fair point. It has been reverted.
Code: [Select]
v1.1.7 Beta 2
- FIX: Remove trailing space in "Console" when using fb.Trace.
- FIX: Thumbs sample. Fix issue where using %profile% in the "Custom folder"
       setting would fail if the profile path contained special title formatting
       characters like %()[]'
- CHG: Remove "Delay load" from "Configuration" window.
- CHG: Remove "Grab focus" from "Configuration" window. Beta 1 only, reverted in Beta2.
- CHG: Some internal refactoring which is why we have a beta. I need more users
       to test I didn't break anything!

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-17 21:46:41
Code: [Select]
v1.1.7
- FIX: Remove trailing space in "Console" when using fb.Trace.
- FIX: Text Reader sample. Ensure "Open containing folder" works when specifiying
       a folder rather than a full path to a file.
- FIX: Thumbs sample. Fix issue where using %profile% in the "Custom folder"
       setting would fail if the profile path contained special title formatting
       characters like %()[]'
- CHG: Remove "Delay load" from "Configuration" window.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: vanhoivanbinh on 2016-12-22 03:35:12
Thank you, Marc2000 for saving my life
the Jscript panel is so cool
I have embedded your script to my foobar2000 and it works well
One thing is that when I try to do library import for my last.fm, it seems that the playcount does not update ( i have all last.fm username, password, API )
The library import (run in seperated windows) seems no problem, no error etc but.
Right now, my last.fm playcount is higher than ones in my foobar2000 library
Moreover, the love function is gone
Previously, I have removed the custom_db component as it's making never-ending-crash 

Could you advice what should I do for this situation

Thank you!!!!!!!
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-24 03:57:02
Well foo_customdb was never optional - it was absolutely essential to make it work. Anyway, it doesn't matter as I don't support that script any more. Use foo_softplaylists to love/unlove tracks.
Title: Re: JScript Panel
Post by: extratype on 2016-12-25 16:04:23
Found a bug where ALL windows freeze, so I have to force restart the system.
I did some experiments and concluded gr.gdiDrawText is a culprit... or maybe Windows.

Steps to reproduce:
1. Windows 10 version 1607 x64
2. Install this skin: http://alibalicou.deviantart.com/art/Eole-608641604
3. Play a music with title containing some non-ANSI characters.
(ex) Track title: ごめんね、いいコじゃいられない。 Album title: TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」
4. Repeatedly minimze and restore the foobar2000 window.
Tested on both real/virtual machine.

EDIT: I was unable to reproduce this bug in Windows 7 x64. So this bug is due to Windows 10... well how do I report it to Microsoft and let they fix it? sigh...
Title: Beginner Questions
Post by: vince_57 on 2016-12-26 04:34:54
Thank you for a fantastic foobar component.
Using your complete sample playback buttons, I added a mute button (don't laugh - took me about 2 days and a JavaScript reference book)
As someone who knows nothing about jscript, I would appreciate knowing if what I did makes "sense" or is there a much better/cleaner way to achieve this type of button (display a different image depending on the state & change the tooltip depending on the state). Here is what I did:
1) Defined new variables:
Code: [Select]
var WhichMute = "buttons\\mute.png"; //Initialize the mute button to Not Muted image
var IsMuted = false; //Initialize mute stae = Not muted
2)Added a new button to buttons.update function:
Code: [Select]
 
this.buttons.mute = new _.button(bs*5, 5, bs, bs,
{normal : WhichMute},
function () { MyVolumeMute(); },
IsMuted ? "Mute On" : "Mute Off");
3) Add a function to determine the current volume state & set the desired image
Code: [Select]
function MyVolumeMute()
{
if(fb.Volume == -100)
{
     WhichMute = "buttons\\mute.png";
fb.VolumeMute();
IsMuted = false;
}
else
{
WhichMute = "buttons\\muted.png";
fb.VolumeMute ();
IsMuted = true;
}
buttons.update();
window.Repaint (); //If I don't do this, icon does not change unless I move mouse off image
}

Thanks for your help.




Title: Re: JScript Panel
Post by: marc2003 on 2016-12-26 06:12:54
@extratype, Not that I can do anything because I don't have windows 10, are you able to reproduce with a single instance of JScript panel in your layout containing just this code?

Code: [Select]
var font = gdi.Font("Segoe UI", 16); // assuming Segoe UI is still default on 10??

function on_paint(gr) {
    gr.GdiDrawText("Track title: ごめんね、いいコじゃいられない。 Album title: TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」", font, 0, 0, 0, window.Width, window.Height, 0);
}

@vince_57, I really need to add some notes about customising buttons that would help people out.

First of all, those relative paths should only be used for images I bundle with the component. If you upgrade the component, any of your own custom images added to those folders would be lost. Instead, you should keep your images folder separate and specify the full path to it. My button code is already designed to handle full paths or my own relative paths.

Code: [Select]
{normal : fb.ProfilePath + "my_images\\mute.png"}

Always use fb.ProfilePath as that points towards your configuration folder (%appdata%\foobar2000) in normal installation mode or the program folder in portable mode. Obviously you'll need to create the folders/move images as necessary.

As for your own button, it does have issues.

1) You're assuming the volume is always going to be unmuted when the script initialises. I think this is a mistake.
2) There are so many different ways of changing the volume such as using keyboard shortcuts, sliders, media keys, other buttons, scrolling your mouse over the volume indicator on the status bar etc...

It seems you missed the clues already included with the script for how the play/pause button updates itself without special code inside the button click function. Note the on_playback_starting, on_playback_pause and on_playback_stop functions.

Code: [Select]
function on_playback_stop() {
buttons.update();
window.Repaint();
}

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

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

All these functions prefixed with on_ are special functions called callbacks and they are triggered by foobar itself no matter how the playback state changes. Again there are many more ways than just clicking your own custom button.

Luckily there is one for when the volume changes so we just need to copy the same code in to it...

Code: [Select]
function on_volume_change() {
buttons.update();
window.Repaint();
}

So now you can simplify your button back to something like...

Code: [Select]
    this.buttons.mute = new _.button(bs * 4, 0, bs, bs, {normal : fb.Volume == - 100 ? fb.ProfilePath + "my_buttons\\muted.png" : fb.ProfilePath + "my_buttons\\mute.png"}, function () { fb.VolumeMute(); }, fb.Volume == - 100 ? "Unmute" : "Mute");




Title: Getting Started With JScript (Customizing Buttons)
Post by: vince_57 on 2016-12-26 16:33:07
marc2003;
Thank you for your response - I just "felt" like my way to add a button was a bit funky.
It seems like your JScript Panel is designed for folks who are already knowledgeable and not for rank beginners like me (I did some programming in Fortran and C, in a non-GUI environment many, many years ago).
So, for someone like me who does not know JavaScript, or Windows "event driven" programming, or C++, or etc, would you say to them:
1)You are in way over your head & should stop asking questions
2)You need to 1st learn x,y,z  topics (here are some good references), then understand the JScript Panel and foobar specific implementation by studying a,b,c, and then come back to this forum
3) Something else?
Thanks
==================================================================
Just to show you how confused I am, here are my notes as I was installing/experimenting with JScript Panel
JScript Panel is a component for foobar2000 (aka fb2k)
After installing JScript Panel component, it is added to the fb2k window by right-click on an available (or create a new) fb2k panel, and in the Add New UI Element dialog, go to the section Utility, and select JScript Panel.
JScript panel allow you to create and run programs written in the Microsoft JScript language ?
JavaScript is a programming language available in web browsers  (Internet Explorer, Firefox, etc). The web browser contain a JavaScript interpreter to parse and run the JavaScript programs, which can be written in plain text with a simple text editor like notepad. JScript is a Microsoft implementation of JavaScript.
JScript Panel statements use the same syntax as the JavaScript language (?)
JScript Panel does not support all of the standard functions available with javascript, because javascript assumes it is running within a web browser(?)
For example, if you  enter & run the following code in the JScript Panel Configuration, you will get the "Aw, crashed :(" display:
alert("Hello World");
The error message states: The value of the property 'alert' is null or undefined, not a Function object.
It would seem logical that any JavaScript statement related to html would also not work in JScript Panel

foobar components are implemented as a .dll file. The name always starts with foo_.
The actual JScript panel component is foo_jscript_panel.dll and is located in the folder \user-components\foo_jscript_panel\.  The location of the folder \user-components depends on whether foobar was installed as a "Standard Installation" or "Portable Installation"
The DLL for JScript Panel (foo_jscript_panel.dll) is 2 to 3 times larger most of the foobar2000 system installed DLLs (foo_albumlist.dll, foo_converter.dll, etc)
Filetypes
A .js file is a javascript file. A .js filetype will be interpreted by JScript panel, and the javascript commands executed
A .txt file is a text file which can contain javascript statements or just "normal" text
If you paste the contents of a .txt file which contains javascript statements into the JScript Panel Configuration, or Import the .txt file containing javascript statements, it has effectively become a .js file

What programming language is used in JScript Panel:
What is the ECMA Script engine used by JScript panel?
In the JScript Panel Configuration there is an option for Script Engine: JScript9 or JScript, which seems to indicate the engine is the Microsoft JScript IE9-11 or some earlier version of Microsoft JScript (5.8?)
But when I look at the file, jscript.api, it shows "http://developer.mozilla.org/en/docs/Core_JavaScript_1.5", which seems like the earlier version of JavaScript from Mozilla as implemented in Firefox 1.0?

If I want to learn the basic syntax, etc of the scripting language used in JScript Panel, should I study a reference on JScipt Version 9, JavaScript, JavaScript Version 1.5, or something else?

Where is the ECMA Script engine used by JScript panel?
Is the engine built into JScript Panel or does JScript panel use some engine already installed elsewhere?

I am confused about the various files included with JScript panel, particulalrly about .txt files which are not code (and can't be used in a script) and .txt files which really are code (and can be pasted in the jScript Panel Configuration window or imported when my script is run).
In the foo_jscript_panel folder there are several files and sub-folders:
\docs: Contains .txt files
\samples
CHANGELOG.txt: List of JScript Panel versions and changes/fixes made in each version
foo_jscript_panel_dll: The actual JScript Panel Panel component
interface.api: A list of the custom functions available in JScript Panel (not part of the javascript language). These are the JScript panel functions which interface with foobar2000 and Windows (the operating system)
jscript.api: A list of the javascript language functions available in JScript Panel. Not all of the javascript functions are made available in JScript Panel
Both of the .api files (interface.api and jscript.api) are not code, and are not needed for JScript panel to work.  I think they are documenting what is made available in JScript panel
LICENSE.txt: License info. for the JScript Panel program.
License - <Name>.txt : License information for any samples included in the JScript Panel installation. For example: LICENSE - BoxBlurFilter.txt is the livcense info. for the sample script BoxBlur.txt

Looking at the files in the \docs directory:
What is the purpose of the file jscript.api?
Is this file for documentation only & is a complete list of jscript (javascript?) APIs supported by JScript panel?

What is the purpose of the file interface.api?
Is this file for documentation only & is a complete list of the non-jscript/javascript APIs supported by JScript panel?
Is the naming convention in interface.api an indication of what the "actual" API & SDK is?
fb. = Functions that interface to foobar2000 APIs. Normally, accessing these functions requires the SDK for that program and a program (written in C++?) to call the fb2k SDK API
gdi. = Functions that interfaces to various classes in the Windows SDK .GDI(+?) API
gr. = Same as gdi. but are used "in on_paint" (?)
plman. = interfaces to foobar2000 SDK playlist_manager Class API
window. = interfaces to the Microsoft Windows SDK API

What is the purpose of Flags.txt?
Some of the Windows APIs allow for multiple values in a parameter. This file lists those APIs supported by JScript which use these multiple-value parameters.
Using the first line in flags. txt as an example:  // Flags, used with GdiDrawText()
The values shown should be used whenever I use GdiDrawText() in a script. Does this actually apply to  gr.GdiDrawText (as listed in interface.api)?
Each line like: var DT_TOP = 0x00000000;  sets the value for each of the parameter mutliple values.

It looks like, I can import the entire flags.txt or just use the parts of flags.txt for the APIs I actually use in the script?

What is the purpose of the file interface.txt?
Is this file for documentation only and shows the details of the available "methods" & parameters used by each JScript Panel API?
It looks like the interface "groupings" match to the names used in interface.api. So:
interface IFbUtils {.. Is the I(nterface) for Fb(2k) for the Utils group

What is the purpose of Helpers.txt?
This file shows some potentially "helpful" code that can be used in a script. This helpful code includes:
-The values needed to set a specific color color - allows a script to specify a color using a nice English description like "Aqua" instead of 0xFF00FFFF.
-Useful "standalone" functions not related to another function?? For example:?
-"Helper" functions. " A helper function is a function that performs part of the computation of another function. Helper functions are used to make your programs easier to read by giving descriptive names to computations. They also let you reuse computations, just as with functions in general."
For example, the function in helpers.txt function stringFormat(), looks like it sets values for the optional parameter flags, as used in the gr.DrawSting API?

What Is the purpose of Callbacks.txt?
Is this file for documentation only and lists the "callback" functions available in JScript Panel?
"A callback function, also known as a higher-order function, is a function that is passed to another function (let’s call this other function “otherFunction”) as a parameter, and the callback function is called (or executed) inside the otherFunction."
For example, in the callbacks.txt is the line: function on_mouse_move(x, y, mask) {}
In one of the sample scripts, playback buttons.txt,  is the line: function on_mouse_move(x, y) {buttons.move(x, y);}
So the playback buttons script is calling the (callback) function on_mouse_move and passing the function buttons.move as a parameter to on-mouse_move ?
From marc2003: All these functions prefixed with on_ are special functions called callbacks and they are triggered by foobar itself no matter how the playback state changes.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-12-26 20:14:39
@marc2003 The Win 10 default system font is Verdana.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-12-26 20:25:03
If I want to learn the basic syntax, etc of the scripting language used in JScript Panel, should I study a reference on JScipt Version 9, JavaScript, JavaScript Version 1.5, or something else?
I learned from w3schools.com's JavaScript tutorial (http://www.w3schools.com/js/). Search on "learn javascript" to find other sources.
Title: Learning Java
Post by: vince_57 on 2016-12-26 22:35:31
I learned from w3schools.com's JavaScript tutorial (http://www.w3schools.com/js/). Search on "learn javascript" to find other sources.
Jailhouse: Thanks for the link.
Is it correct to say that certain elements of JavaScript do Not work in JScript panel?
Specifically:
1) Anything to do Output (alert, write, etc)
2)Anything to do with Debugging (console.log, debugger)
3) Anything which involves HTML, Browser, Ajax, or JSON
Title: Re: JScript Panel
Post by: vanhoivanbinh on 2016-12-27 01:49:41
Well foo_customdb was never optional - it was absolutely essential to make it work. Anyway, it doesn't matter as I don't support that script any more. Use foo_softplaylists to love/unlove tracks.
Thank you, Marc2000 for you kindly answer
What would happen for the playcount sync between Last.fm and foobar2000 in the JScript?
Do you plan to bring that function back?
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-27 05:13:44
@vince_57

The jscript/interface api files exist only to provide auto-complete functionality when typing in the configuration window. You should ignore them.

(https://i.imgur.com/0MI9P3o.png)

As for javascript language support, yes we are stuck several generations behind what current javascript developers are working with. We are stuck with JScript 5.8/Javascript 1.5. This is basically IE8 levels of support. While the JScript9 option in the configuration window can provide slightly faster performance, there are no language improvements or changes.

While we don't have functions like alert or console.log, we do have alternatives. We can output message to the foobar2000 Console using fb.trace(message);. If you really wanted to, you can use this little snippet to have console.log available...

Code: [Select]
var console = {
log: function (msg) {
fb.trace(msg);
}
};

console.log("Hello world!");
console.log(2 * 5);

You can display popup windows using this bit of code...

Code: [Select]
fb.ShowPopupMessage("hello");
//code here will execute immediately even with the popup window still open

If you want the behaviour to more like alert, you can do this:

Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.popup("hello", 0); //0 is the code for displaying just an OK button
//code here won't execute until the window is dismissed.

There is no problem with making web requests and working with JSON. I do this a fair bit myself such as using the musicbrainz API like this...

http://i.imgur.com/pu2wL2W.png

Of course when it comes to displaying text in the panel itself, this is only possible using the gdiDrawText or DrawString functions which are C++ but we can pass text, fonts, colours, etc via our script.

Do you plan to bring that function back?

No.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-27 12:26:54
We are stuck with JScript 5.8/Javascript 1.5. This is basically IE8 levels of support.
I think, I might be able to add full JScript9 support to JScriptPanel by wrapping all the JSRT API calls into WSH style calls. This will come at the cost of losing support of Windows versions below Windows 7 though. But we will have much more up-to-date JScript =)
Title: Re: JScript Panel
Post by: arch21 on 2016-12-27 12:54:50
hi, how to access installation path for import? so far, I only notice %fb2k_profile_path% and also %fb2k_component_path%.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-27 13:17:54
hi, how to access installation path for import? so far, I only notice %fb2k_profile_path% and also %fb2k_component_path%.
%fb2k_path%
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-27 13:21:17
docs\preprocessors.txt (https://github.com/19379/foo-jscript-panel/blob/133af6edb43598179cc7dd60ea4f4135a2a92457/component/docs/Preprocessors.txt#L18L19)

Using %fb2k_path% really isn't advisable though. %fb2k_profile_path% already points at the program folder when using foobar2000 in portable mode and you shouldn't be placing user files inside program files\foobar2000 if using standard mode.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-27 15:14:12
@marc2003: there is actually a simpler way to enable JScript9 (though probably only features from old Chakra engine(i.e. ECMA5 and not ECMA6) are available):

When using cls id for JScript9 you also must change JS language version to a higher value (it might not available on windows lower than Windows 7)

foo_jscript_panel\host.cpp:
ScriptHost::InitScriptEngineByName
Line 892: scriptLangVersion.lVal = SCRIPTLANGUAGEVERSION_5_8;

SCRIPTLANGUAGEVERSION_5_8 (which is 2) should be replaced by 3

Tested with Date.now() and String.prototype.trim() methods, that are not available in the ECMA3 and consequently in the current JScriptPanel build.

Getting ECMA6 will be much harder, because it requires to either rebase whole JScriptPanel on JSRT or make a WSH wrapper around JSRT (which will be slower than the former). Both are feasible, but since ECMA6 (i.e. new Chakra engine) is available only on Windows 10, I don't think I'll bother with it for now, because my main PC is Windows 7 =)

PS: I've not yet tested on Windows 7 though, but it should work, since old Chakra(ECMA5) is available via jscript9.dll, which is supplied with IE11, which is available on Win7. New Chakra engine (ECMA6) is Win10 exclusive, because the corresponding chakra.dll is supplied only with Edge.
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-27 15:54:44
Assuming that all works out, that's a really nice find. Thanks. I'll do some testing later/tomorrow.

I'm using windows 8.1 myself and have no interest in windows 10.
Title: More Basic Question
Post by: vince_57 on 2016-12-27 19:35:49
@marc2003
Please don't do anything that would break JScript Panel on Windows7 (I use Win7Pro).
Since you didn't reply to my questions with "1)You are in way over your head & should stop asking questions"  :( , I have some more newbie questions.
1) Is it correct to think of JScript Panel as an SDK for foobar and Windows? That is, in addition to supporting javascript/jscript statements, JScript Panel has it's own APIs which allow me to interface to the foobar2000 SDK API's and the Windows SDK API's.
2)Thanks for clarification on the purpose of the .api files. Should I be using Interfaces.txt as my reference to all available JScript Panel APIs (similar to the Windows API Index at https://msdn.microsoft.com/en-us/library/ff818516(v=vs.85).aspx) ?
3)I did not really understand your discussion with TheQwertiest about JScript9, but it seems like the answer to the question "Where is the ECMA Script engine used by JScript panel?" is that the Script engine is built into JScript Panel & does not depend on any external engine (web browser). ?

The WScript.Shell "object" (?) is cool. I found some info at TechNet, and used WshShell.run to kick off another application from within JScript Panel!
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-28 06:16:24
@TheQwertiest, it works on Vista with IE9 so that's an added bonus. And no code changes are required if it's not supported. I tested Vista with IE7 and that works as expected without the extra goodies.

@vince_57, no I won't be breaking windows 7.

1) pretty much
2) yes, interfaces.txt and callbacks.txt are the most important files in the docs folder
3) until now, the underlying browser didn't really matter except the minimum requirement for working with the native JSON object was IE8. With the upcoming changes, IE9 or later will be required to use the newer ES5 features. like function.prototype.bind and array.prototype.map. I'll list more when I publish the updated component.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-28 09:41:46
it works on Vista with IE9 so that's an added bonus. And no code changes are required if it's not supported. I tested Vista with IE7 and that works as expected without the extra goodies.
That's good to hear!
Does anyone still uses Win Vista nowadays? =)

Btw, changing JS version to 3 via SetProperty only makes sense, when ScriptEngine is set to JScript9, otherwise it won't do anything (i.e. it won't enable ES5).
So, I think moving SetProperty under if (wcscmp(engineName, L"JScript9") == 0) might be a good idea.

And if I may, a few suggestions to consider:
1. Removing fallback to JScript in InitScriptEngineByName and returning error instead. So the component users won't think that JScript9 is enabled, while it is actually not.
2. Adding additional comboboxes to ScriptEngine dialog: smth like JScript9 (ES3 + json) and JScript9 (ES5).
3. Adding IE version detection, so ScriptEngine dialog could show only available ScriptEngines (JScript9 (ES5) and JScript for IE >= 9, JScript9 (ES3 + json) and JScript for lower versions).

If you want, I can make a PR for those.
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-28 10:14:02
I've already made the changes (https://github.com/19379/foo-jscript-panel/commit/a39c3d56d23a93f80fccbfbebb97f9e309509234). The combo box is gone and JScript9+ES5 will be default for everyone if it's available. This is probably going to be 99.99% of users.

I've renamed the function because it doesn't take an "engineName" parameter any more.

https://github.com/19379/foo-jscript-panel/blob/a39c3d56d23a93f80fccbfbebb97f9e309509234/foo_jscript_panel/host.cpp#L846

As I mentioned already, the fallback works fine on Vista with IE7 (JScript 5.7) even with your change.

edit: you will get full credit for this on the releases page and in the changelog.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-28 10:30:10
I've already made the changes (https://github.com/19379/foo-jscript-panel/commit/a39c3d56d23a93f80fccbfbebb97f9e309509234). The combo box is gone and JScript9+ES5 will be default for everyone if it's available. This is probably going to be 99.99% of users.

I've renamed the function because it doesn't take an "engineName" parameter any more.

https://github.com/19379/foo-jscript-panel/blob/a39c3d56d23a93f80fccbfbebb97f9e309509234/foo_jscript_panel/host.cpp#L846

As I mentioned already, the fallback works fine on Vista with IE7 (JScript 5.7) even with your change.
Great minds think alike 8)

edit: you will get full credit for this on the releases page and in the changelog.
Thanks! Glad to be of help =)
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-28 15:45:19
Great minds think alike 8)

What I did was the complete opposite of what you said!!  :o

Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-28 15:56:04
What I did was the complete opposite of what you said!!  :o
Yeah, I should stop replying before waking up completely... By the time I noticed the incongruity of my reply, it was too late to edit my post -_-""
Title: Callbacks.txt Basic Questions
Post by: vince_57 on 2016-12-29 04:35:39
Spent most of the day reading about Windows User Interface, Messages , & Message Queues.
I used your fb.ShowPopupMessage in most of the various callbacks defined in callbacks.txt, like:
Code: [Select]
function on_mouse_lbtn_down()
{ fb.ShowPopupMessage ("Code invoked when mouse left button is pressed: See function on_mouse_lbtn_down");}

function on_volume_change()
{   fb.ShowPopupMessage("Code Invoked When Volume Changes: See function on_volume_change", "Volume Changed", 1);}
to test what I think was going on (When I did this for function on_paint() I locked up foobar with a never-ending display of popups  :o )
I have some "sanity" test questions I would appreciate help with:
Using the specific JScript Panel callback of  function on_mouse_lbtn_down(x, y, mask) {}:
1) Is this callback the JScript Panel equivalent of the Windows message WM_LBUTTONDOWN?
2) Are the x,y values the same as the "lparam" parameter after being processed by GET_X_LPARAM and GET_Y_LPARAM?
3) Is the mask value the same as the "wParam" parameter, and is that what is being defined in Flags.txt in the section "// Mask for mouse callbacks"
4) The Windows MSDN docs. describes a bunch of coding that a Windows program needs to do for WM_LBUTTONDOWN.
Is JScript Panel taking care of all this coding under the covers, and providing the (much) gentler/kinder "on_mouse_lbtn_down"?
Here is what MSDN says happens when the left mouse button is pressed:
    The operating system places a WM_LBUTTONDOWN message on the message queue.
    Your program calls the GetMessage function.
    GetMessage pulls the WM_LBUTTONDOWN message from the queue and fills in the MSG structure.
    Your program calls the TranslateMessage and DispatchMessage functions.
    Inside DispatchMessage, the operating system calls your window procedure.
    Your window procedure can either respond to the message or ignore it.

Assuming I understand, I have a greater appreciation  :) for what your code is doing to make these callbacks user friendly  (I don't need to write code for a message queue, no code for translate/dispatch message, no code to separate out the x,y values, etc.)
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 08:46:46
Code: [Select]
v1.2.0 Beta 1
ADD: If your computer has IE9 or later installed, newer ECMAScript5 features
     are now available. Many thanks to TheQwertiest for discovering how to do this.
CHG: The "JScript engine" option has been removed from the "Configuration" window.
     JScript9 is always used if available but will fall back if not.
ADD: utils.version reports the component version. See docs\interfaces.txt.
FIX: A previous window.RepaintRect bug with JScript9 reported by Wilb has now been fixed.

https://github.com/19379/foo-jscript-panel/releases

Forcing JScript9 may reveal previously unknown bugs - that's why this is a beta! Please report any problems.
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 08:48:31
@vince57, have a look at...

https://github.com/19379/foo-jscript-panel/blob/a39c3d56d23a93f80fccbfbebb97f9e309509234/foo_jscript_panel/js_panel_window.cpp#L846
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-29 10:32:43
Forcing JScript9 may reveal previously unknown bugs - that's why this is a beta! Please report any problems.
With my scripts the only changes I've noticed are stricter rules on Java Script: some implicitly declared variables have their visibility scope reduced, which resulted in errors; calls to named IIFE started to work inconsistently, i.e. sometimes calling IIFE may result in Undefined function error. Both are considered bad practices though =)

I could not find any meaningful difference performance-wise with ES3 Jscript9, probably because Script Engine language version only limits available keywords.

PS: And it seems that, despite all the other ES5 features being implemented, Strict Mode (i.e. "use strict" ) is still not supported by the engine =(
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 11:00:15
For those you who have a string.prototype.trim "polyfill" in your own scripts, you may wish to check and use the native version if it's present...

Code: [Select]
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
};
}

If you know you're using IE9 or later everywhere, you could remove it entirely.

Here's some of the other ES5 stuff available...

https://msdn.microsoft.com/library/ff974378.aspx#_ecmascript
Title: Re: JScript Panel
Post by: zeremy on 2016-12-29 11:46:23

Forcing JScript9 may reveal previously unknown bugs - that's why this is a beta! Please report any problems.

stricter rules on Java Script have broke jsplaylist-mod from your sample directory.
Tested on clean foorbar2000 installation 1.3.14 with Win10.
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 12:01:25
Argh, that would be crazy Falstaff's coding style   :D

Code: [Select]
if (something) {

}; else { // <--this semi-colon is the problem

}

Thanks for spotting. I guess testing all included scripts would have been a wise idea.
Title: Re: JScript Panel
Post by: zeremy on 2016-12-29 12:05:15
Argh, that would be crazy Falstaff's coding style  :D

Code: [Select]
if (something) {

}; else { // <--this semi-colon is the problem

}

Thanks for spotting. I guess testing all included scripts would have been a wise idea.

And

Code: [Select]
  try {
                 }; catch(e) {          
                };
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 12:13:01
All fixed. Changes will be uploaded soon.
Title: Re: JScript Panel
Post by: extratype on 2016-12-29 13:45:50
@marc2003 From your suggestion I realized the bug occurs only during playing, so I tracked every settings related to playing.
Through dozens of test sessions I tried to find the exact triggers to the bug.

1. Install foobar2000 and jscript panel plugin. (Columns UI not required)
2. Leave a jscript panel and delete everything else.
3. Configure the panel
font = gdi.Font("Segoe UI", 12);
function on_paint(gr){
   gr.GdiDrawText("井美空  -  TVアニメ「キルラキル」ED", font, 0, 0, 0, window.Width, window.Height, 0);
}
4. Rename the foobar2000 window title by setting the title format or forcing with an external tool: 沢
5. Repeatedly minimze and restore the foobar2000 window.

The original window title from the Eole skin was:
沢井美空  -  TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」  -  01 : ごめんね、いいコじゃいられない。  -  2013
If the above steps don't work, use this for the GDI text and the window title. It's more likely for Windows 10 to freeze. Also the font size should be 11 or 12. FYI, I used Windows 10 Enterprise x64 build 14393.576 Korean.

A workaround for now is just to fix the foobar2000 window title. I set the title format just "foobar2000"
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 15:07:08
Well like I said, I don't have windows 10 so can't investigate myself. At least you have a workaround.

@zeremy I've updated the component on github with a fixed jsplaylist. The version hasn't been bumped because there are no component changes.

I checked and Falstaff/Br3tt's JS Smooth scripts on deviantart have the same issue. Users of those should avoid this component for now.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-29 15:32:37
Through dozens of test sessions I tried to find the exact triggers to the bug.
I could not reproduce it on Windows 10 Enterprise x64 build 10586.713. It might be caused by different version of Windows or 3rd party software.
Test theme:
Spoiler (click to show/hide)

Title: Re: JScript Panel
Post by: extratype on 2016-12-29 15:57:27
I could not reproduce it on Windows 10 Enterprise x64 build 10586.713. It might be caused by Windows or 3rd part software.
Spoiler (click to show/hide)
Oops, I was a bit speculative, I can't reproduce it on a fresh install.
UPDATE: The bug occurred after updated to 14393.576 but suddenly disappeared after a forced reboot.
Title: JScript Panel Beta1 V1.2.0
Post by: vince_57 on 2016-12-29 17:27:35
1)Just installed V1.2.0 Beta1 and noticed that in \samples\complete\js, playback buttons is missing. Any reason why this sample was removed (I used the V1.1.7 sample, changed the icons, & added a few more buttons as a sort of control panel for my foobar layout)?
2) Maybe a silly question, but I have to ask: Have you thought about/is is "possible" to separate JScript panel from foobar & make it a standalone program?  I am using using your code to learn JavaScript, understand windows & other non-foobar stuff.  It would be really cool to allow folks to write JScript programs which can create a window & use your "friendly" APIs without having to learn C++.
3)Thanks for the js_panel_window.cpp - I had no idea you made your source code available.  I don't "speak" C++, but this answers many questions I had about the callbacks.


Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 17:39:23
1) It was never in the \js folder. It's in the parent folder along with all the other samples.
2) Nope. Perhaps look at something like autoit..  https://www.autoitscript.com/site/autoit/
3) Well it's not really my code. Someone else wrote 99% of it. I just maintain it since they abandoned it years ago.
Title: Re: JScript Panel
Post by: vince_57 on 2016-12-29 17:54:11
@marc2003
Quote
It was never in the \js folder
:-[ Sorry, I renamed your sample to .js so I could import it during the preprocessor & use Notepad++ to see the code better

Is there a better/easier way to write/debug scripts? Currently, I have a foobar widow with like 20 JScript panels, each having different code.
I use Notepad++ to edit the code, then go to the foobar panel with the changed code, right-click & select reload to see what I messed up.
Is there a way to sort of pre-interpret the code for stupid mistakes (missing }, ; , etc) 1st, without having to reload the JScript panel
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 17:59:32
You can get Notepad++ to highlight .txt files like .js files. It also makes the docs easier to read. Go to Settings>Style Configurator and select Javascript in the left column. Now add txt to the user ext: box.

(https://i.imgur.com/RF9Romz.png)

Title: Re: JScript Panel
Post by: vince_57 on 2016-12-29 18:06:16
Thanks for the Notepad++ tip!
So do you develop/debug your own scripts using the 1."Edit code in notepad++", 2,"Reload JSctipt Panel in foobar" method?
Title: Re: JScript Panel
Post by: extratype on 2016-12-30 08:48:09
It turns out I have missed one more step: go to taskbar settings, set combine taskbar buttons option to combine when taskbar is full
Alternatively add this to registry and restart the explorer:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"TaskbarGlomLevel"=dword:00000001

That's it! I could reproduce the bug also in build 14393.0
It is easier to trigger it when
沢井美空  -  TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」  -  01 : ごめんね、いいコじゃいられない。  -  2013
is used for both gdi text and window title
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-01 07:35:21
Code: [Select]
v1.2.0 Beta 2
ADD: If your computer has IE9 or later installed, newer ECMAScript5 features
     are now available. Many thanks to TheQwertiest for discovering how to do this.
CHG: The "Script engine" option has been removed from the "Configuration" window.
     The newer Chakra engine is always used if available but will fall back to
     JScript if not.
ADD: utils.version reports the component version. See docs\interfaces.txt.
CHG: Minor tweaks to Configuration window.
FIX: Update samples\jsplaylist-mod so it works with Chakra engine. Thanks to zeremy
     for reporting.
FIX: A previous window.RepaintRect bug reported by Wilb has now been fixed.
FIX: Zap a few more compiler warnings.

Using the Chakra engine may reveal previously unknown bugs - that's why this is a beta!

Some of the newer ECMAScript5 features are documented here: https://msdn.microsoft.com/library/ff974378.aspx#_ecmascript

As mentioned in the script thread, I've updated Falstaff/Br3tt's JS Smooth scripts here: https://github.com/19379/JS-Smooth-Scripts-By-Br3tt

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: always.beta on 2017-01-01 14:51:44
Could you add the console to the configuration window? Like wsh plus. That would be more convenient.
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-02 00:19:10
Nope. There is nothing wrong with the existing Console window/panels.
Title: Re: JScript Panel
Post by: elia_is_me on 2017-01-07 10:15:47
You can get Notepad++ to highlight .txt files like .js files. It also makes the docs easier to read. Go to Settings>Style Configurator and select Javascript in the left column. Now add txt to the user ext: box.

(https://i.imgur.com/RF9Romz.png)

The original docs from Wang.T.P is in Java syntax. If you referred to the first line of `interface.txt` you would find the format settings there.
Title: Re: JScript Panel
Post by: elia_is_me on 2017-01-07 10:17:46
Could you add the console to the configuration window? Like wsh plus. That would be more convenient.

I just think that JS Panel does not need to be the same with WSH Panel Plus....
Marc seems to make it simple and I agree it's good.
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-09 01:05:26
v1.2 has been released - no changes from Beta2 except there is no expiration.

Code: [Select]
ADD: If your computer has IE9 or later installed, newer ECMAScript5 features
     are now available. Many thanks to TheQwertiest for discovering how to do this.
CHG: The "Script engine" option has been removed from the "Configuration" window.
     The newer Chakra engine is always used if available but will fall back to
     JScript if not.
ADD: utils.version reports the component version. See docs\interfaces.txt.
CHG: Minor tweaks to Configuration window.
FIX: Update samples\jsplaylist-mod so it works with Chakra engine. Thanks to zeremy
     for reporting.
FIX: A previous window.RepaintRect bug reported by Wilb has now been fixed.
FIX: Zap a few more compiler warnings.

Some of the newer ECMAScript5 features are documented here: https://msdn.microsoft.com/library/ff974378.aspx#_ecmascript

As mentioned in the script thread, I've updated Falstaff/Br3tt's JS Smooth scripts here: https://github.com/19379/JS-Smooth-Scripts-By-Br3tt

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-01-09 09:21:41
It turns out I have missed one more step: go to taskbar settings, set combine taskbar buttons option to combine when taskbar is full

It is easier to trigger it when
沢井美空  -  TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」  -  01 : ごめんね、いいコじゃいられない。  -  2013
is used for both gdi text and window title

Still could not reproduce on 10586.713 even with your additional changes to scenario :\
Most likely it is a MS bug, but I don't have the latest Win10 ISO on hand, so I can't test it thoroughly.
Title: Re: JScript Panel
Post by: evillive on 2017-01-20 20:28:54
Where can I find 1.1.7 relese? With 1.2 my foobar is unstable and I want to try older version of  JScript Panel to check.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-01-20 21:50:54
Where can I find 1.1.7 relese? With 1.2 my foobar is unstable and I want to try older version of  JScript Panel to check.
https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: evillive on 2017-01-21 10:25:00
Where can I find 1.1.7 relese? With 1.2 my foobar is unstable and I want to try older version of  JScript Panel to check.
https://github.com/19379/foo-jscript-panel/releases
Ther's no foobar component only source code, I'm not familiar with compiling etc. Can someone uplod 1.1.7 foobar component? Thanks in advance.
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-21 11:25:07
Well I don't have any old versions lying around and I don't have Visual Studio installed at the moment.

Can you post an example of a script you're having problems with? By "unstable", do you mean script errors (Aw, crashed) or something a lot more serious like affecting/crashing foobar itself?

edit: if you really must go back, this theme contains v1.1.6

http://tedgo.deviantart.com/art/DarkOne4Mod-v1-637189138

Using 7-zip, browse inside the 7z file then inside the .bck file within.
Title: Re: JScript Panel
Post by: evillive on 2017-01-21 12:22:00
Well I don't have any old versions lying around and I don't have Visual Studio installed at the moment.

Can you post an example of a script you're having problems with? By "unstable", do you mean script errors (Aw, crashed) or something a lot more serious like affecting/crashing foobar itself?

edit: if you really must go back, this theme contains v1.1.6

http://tedgo.deviantart.com/art/DarkOne4Mod-v1-637189138

Using 7-zip, browse inside the 7z file then inside the .bck file within.

Thanks!
My foobar is highly customized so maybe jscript panel has some conflict in it.
It hangs during installation of jscript panel and hangs when I'm closing foobar either.

But I'm little confused because today is working almost fine. Anyway will try 1.1.6 version and will post how it's behave on it.
Title: Re: JScript Panel
Post by: arch21 on 2017-01-21 14:02:00
Where can I find 1.1.7 relese? With 1.2 my foobar is unstable and I want to try older version of  JScript Panel to check.
http://www.mediafire.com/file/mqv1ld9uang7f7c/foo_jscript_panel-v1.1.7.fb2k-component
Title: Re: JScript Panel
Post by: evillive on 2017-01-21 17:40:16
Thanks for your help.

Problem with my foobar is probably coincidence and JScript Panel is fine. Freezes occurs randomly while closing foobar (not every time, rather rarely). I'm thing it's related to buffer or disk write/read processes ... perhaps disk fault.
Title: Re: JScript Panel
Post by: nikolai4ik on 2017-01-29 14:00:07
I suddenly started getting this error though nothing (neither foobar nor script) was modified

Quote
JScript Panel (Last.fm Artist Info/User Charts/Recent Tracks by marc2003)
JavaScript runtime error:
Unable to get property 'innerText' of undefined or null reference
File: C:\Users\username\AppData\Roaming\foobar2000\js_marc2003\js\list.js
Line: 695, Col: 9
<source text only available at compile time>

Updated to 1.2 and another error started appearing too
Quote
JScript Panel (JS Smooth Browser v20151114-1630-340 by Br3tt aka Falstaff >> http://br3tt.deviantart.com)
JavaScript compilation error:
Syntax error
File: C:\Users\RivaGe\AppData\Roaming\foobar2000\js_br3tt\jssb\js\JScommon.js
Line: 540, Col: 8
    }; else {

Confused about the first error, why would list.js be missing innertext if I haven't touched it? Any solutions? :(
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-30 08:11:51
1) Well I don't support that script any more but I think if you scrobble something using the same account you're viewing for the charts, it should prevent that error.

2) This goes to show no one reads the download page.... go back and look again.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: nikolai4ik on 2017-01-31 19:17:53
Wow haha my bad, I skimped through the changelog and as always I didn't find any familiar words I just downloaded it without reading lower. Thanks and sorry :)

btw shame about last.fm script, I am using same account and this error occurs.
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-31 19:47:56
I dug around in my old files git history and found a copy which may fix your issue...

https://gist.githubusercontent.com/19379/a6f823ad7e0ba3177746e343caddf24a/raw/62cd2c843bc78236fe99ea677c3d4ed8768c5469/list.js

Try replacing list.js inside the js_marc2003\js folder. Make a backup of the old file first just in case.
Title: Re: JScript Panel
Post by: arhipov_rp on 2017-02-02 20:10:35
There is problem with JS Smooth Browser (downloaded from here https://github.com/19379/JS-Smooth-Scripts-By-Br3tt) and JScript Panel v1.2. Genre list in Smooth Browser is not the same as Album list. Can this be fixed?
Title: Re: JScript Panel
Post by: marc2003 on 2017-02-03 01:48:42
Is it definitely set in Library mode and not playlist? I don't know much else about it as I don't use day to day but it seemed to list all genres when I tested it just now.

edit: I see it doesn't appear to support multi-value tags. You'll have to ask @Falstaff about that.

http://br3tt.deviantart.com/art/JS-Smooth-Browser-571376160
Title: Re: JScript Panel
Post by: marc2003 on 2017-02-04 21:57:49
This component is now live on the official component repository. There have been no changes since the last release but future updates will be available via the built-in update mechanism.

http://www.foobar2000.org/components/view/foo_jscript_panel
Title: Re: JScript Panel
Post by: juniiflow on 2017-02-07 22:47:58
js_br3tt\jssp\js\JScommon.js
Line: 540, Col: 8
    }; else {

How to fix?
Title: Re: JScript Panel
Post by: marc2003 on 2017-02-08 01:02:15
Replace all files and update scripts in panels with this...

https://github.com/19379/JS-Smooth-Scripts-By-Br3tt
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-02-08 08:19:35
This component is now live on the official component repository. There have been no changes since the last release but future updates will be available via the built-in update mechanism.

http://www.foobar2000.org/components/view/foo_jscript_panel
Congratulations! It was long due =)
Title: Re: JScript Panel
Post by: Coreda on 2017-02-19 07:25:41
Just noticed the JSPlaylist mod (https://github.com/19379/jsplaylist-mod/) is no longer at marc2003's Github repo. Any reason for this? It's a port of panel I'm constantly recommending to others.

Noticed this as I had a question about how to force group sorting, since I found it doesn't appear to auto apply the group sorting settings but manually requires it to be applied each time. I'd only just discovered this as most of my library is naturally sorted via filenames but some recent directories have filenames whose naming differs from the track number order and I discovered the panel sorted them by the filename order instead.
Title: Re: JScript Panel
Post by: marc2003 on 2017-02-19 07:34:40
JSplaylist is now bundled with the component itself.

https://github.com/19379/foo-jscript-panel/tree/master/component/samples
Title: Re: JScript Panel
Post by: Coreda on 2017-02-19 08:21:14
JSplaylist is now bundled with the component itself.

https://github.com/19379/foo-jscript-panel/tree/master/component/samples

Ah, good to know.

With regard to force sorting in the panel, any ideas? I find I have to right-click the columns header>Groups>Apply group sorting to override the filename sorting and apply track number order, but the option doesn't seem to be able to be permanently set.

Title: Re: JScript Panel
Post by: marc2003 on 2017-02-19 10:35:25
It's never been a playlist viewer's job to sort or "force" sort. How a playlist is originally sorted depends entirely on how the files were added in the first place. If you're adding from the File menu or drag/dropping from explorer, check the setting under File>Preferences>Shell Integration>Sort incoming files by. If you're using Album list, the playlist items are always sorted the same way they are displayed. Other 3rd party library viewers may have their own sorting preferences.

This has never been something any other playlist viewer has dealt with so I'm unsure why you're questioning it now.
Title: Re: JScript Panel
Post by: Coreda on 2017-02-19 11:33:06
How a playlist is originally sorted depends entirely on how the files were added in the first place. If you're adding from the File menu or drag/dropping from explorer, check the setting under File>Preferences>Shell Integration>Sort incoming files by. If you're using Album list, the playlist items are always sorted the same way they are displayed. Other 3rd party library viewers may have their own sorting preferences.

Turned out to be the Facets component sort order. Apologies for the mix-up. Was due to having previously always formatted the collection using filenames that naturally sort, and seeing how carefully I customized the JSPlaylist panel title formatting wondered why it wasn't following the order there. Had I noticed it in a default playlist panel I probably would have realized the source of the issue sooner. Thanks.
Title: Re: JScript Panel
Post by: wcs13 on 2017-03-13 14:24:06
So, abour JScript Smooth Playlist Manager, here's a feature request : folders.
And by this I mean a way to hierarchically group playlists in a tree view. Virtual folders containing playlists.
Example : Folder name = "New Year's Party" and then 3 sub-playlists : "Ambient", "Slow & Sexy", "Fast & Furious".
You get the idea.
Thanks.
Title: Re: JScript Panel
Post by: colagen on 2017-03-20 12:00:36
Hi,

I wondered : can't we find a generous developper who would be willing to add the ability to drag a list of tracks outside a Jscript panel ? It's clearly the big missing feature of this component. I've got no idea of the time it would take to code it, i tried to take a look myself, i saw that the initial developper began this task (there is a bunch of lines related to that in some files), but i'm completely not able to finish the work myself, so i gave up.
Title: Re: JScript Panel
Post by: widerock on 2017-03-21 01:58:12
I'd like to know if there is any method to import different 'js file' according to "if" condition.

What I want to to is that one specific panel show differnet JScript after getting notified with "function on_notify_data(name, info)"
The below is something what I'd like to do.
Code: [Select]
function on_notify_data(name, info) {
    switch(name) {
        case "chk_yt":
            if(info == "youtube") {
                 here I'd like to import "biography.js"
            } else {
                here I'd like to import "playlist view.js"
            }
       }
}
I'm not sure if this kind of thing is possle or not. Any comment or tip would be appreciated.
Title: Re: JScript Panel
Post by: marc2003 on 2017-03-21 07:30:02
Yes, I've done this before - with a little help from foosion...

Code: [Select]
// ==PREPROCESSOR==
// @author "marc2003 / foosion"
// @name "Panel Receiver"
// ==/PREPROCESSOR==

var script = window.GetProperty("current_script", "path\\to\\biography.js");
var pre = "";
var text = utils.ReadTextFile(fb.ProfilePath + script);
var lines = text.split("\n");
if (lines[0].indexOf("// ==PREPROCESSOR==") == 0) {
for (var i = 0; i < lines.length; i++) {
if (lines[i].indexOf("// @import") == 0) {
var fq = lines[i].indexOf("\"") + 1;
var lq = lines[i].lastIndexOf("\"") - fq;
var file = lines[i].substr(fq, lq).replace("%fb2k_profile_path%", fb.ProfilePath).replace("%fb2k_component_path%", fb.ComponentPath);
pre += utils.ReadTextFile(file) + "\n";
} else if (lines[i].indexOf("// ==/PREPROCESSOR==") == 0) {
break;
}
}
}
eval(pre + text);
(function (global) {
var original_callback = global.on_notify_data;
global.on_notify_data = function (name, info) {
if (name == "load_script") {
if (utils.FileTest(fb.ProfilePath + info, "e")) {
window.SetProperty("current_script", info);
window.Reload();
}
} else if (original_callback) {
original_callback(name, info);
}
}
})(this);

The only thing you should edit is the default script it loads on the first line...

Code: [Select]
"path\\to\\biography.js"

It must be in subfolder of your profile path.

Then in your other panel...

Code: [Select]
window.NotifyOthers("load_script", "path\\to\\biography.js");
or
Code: [Select]
window.NotifyOthers("load_script", "path\\to\\playlist view.js");

Again these must be relative in your profile folder.
Title: Re: JScript Panel
Post by: widerock on 2017-03-21 09:37:50
Yes, I've done this before - with a little help from foosion...
Thank you very much, marc2003 & foosion.
I've succeeded in setting up my foobar as I wanted.
I have one more question.
Could you let me know how to check if 'the current playlist name' includes a specific string such as "Library"?
Title: Re: JScript Panel
Post by: marc2003 on 2017-03-21 09:55:37
Code: [Select]
var playlist_name = plman.GetPlaylistName(plman.ActivePlaylist);
if (playlist_name.toLowerCase().indexOf("library") > -1) {
    //do something
}
Title: Re: JScript Panel
Post by: widerock on 2017-03-21 14:53:27
Thank you, marc2003. That is exactly what I wanted.
Title: Re: JScript Panel
Post by: marc2003 on 2017-03-22 12:44:39
edit: WINE setup instructions removed. They can now be found here:

https://github.com/19379/foo-jscript-panel/wiki/WINE



Title: Re: JScript Panel
Post by: randomuser on 2017-04-01 23:39:19
Hi guys! I was previously ranting in ColumnsUI subforum, hope you don't mind seeing me here too :)
Problem was net radio stream not showing artist/title correctly, not sure is it exactly CUI, PSS, ELP or something else.
Then I used Falstaff's JScript playlist and there it was
Code: [Select]
fb.TitleFormat("%title%").Eval(true)
Tested that in old WSH panel, shows exactly what it should show (title).
Maybe someone could give a hint, why or how this script version works differently compared to usual titleformat %title%?
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-02 02:08:50
I could give a technical answer explaining the difference but what's the point? You have a problem with some other component you can't even identify so nothing I say is going to help.
Title: Re: JScript Panel
Post by: randomuser on 2017-04-02 02:40:17
Ok, fair enough.
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-24 10:47:52
Since the Last.fm Charts API is working again, I've decided to restore the sample along with Musicbrainz...

Code: [Select]
v1.2.0.1
- CHG: Minor code cleanups but no new component features for now.
- ADD: Add Last.fm Similar Artists / Charts & Musicbrainz samples.

https://github.com/19379/foo-jscript-panel/releases

It's also on the official component repository here: http://www.foobar2000.org/components/view/foo_jscript_panel
If you have a previous version installed, you can update from the Help menu>Check for updated components.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-04-24 12:59:20
Since the Last.fm Charts API is working again, I've decided to restore the sample along with Musicbrainz...

Code: [Select]
v1.2.0.1
- CHG: Minor code cleanups but no new component features for now.
- ADD: Add Last.fm Similar Artists / Charts & Musicbrainz samples.
Nice! Finally I can retire the old script folder (/js_marc2003) and use the one in the component!

PS: Since my PM was blocked, I'll try asking here: you've included your lastfm API key in the script - was it intentional?
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-24 13:07:07
Just be aware the new script doesn't have top tracks/albums. It only has similar artists/charts.

And yes, the API key is included on purpose. I would have given instructions on how to use your own if I didn't!
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-04-24 14:23:39
Just be aware the new script doesn't have top tracks/albums. It only has similar artists/charts.
Actually, these are the only features that I'm using =)
And yes, the API key is included on purpose. I would have given instructions on how to use your own if I didn't!
I thought it might be so, but better safe than sorry...
Title: Re: JScript Panel
Post by: seriousstas on 2017-04-26 13:48:16
marc2003
Please return, if possible :
on_tooltip_custom_paint()
thnx!
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-26 16:13:28
Nope, that is not coming back. Look at the extra parameters you can pass to window.CreateTooltip if you want custom font/size/style.
Title: Re: JScript Panel
Post by: seriousstas on 2017-04-26 20:36:50
On_tooltip_custom_paint ()
allows  to make the hint still.
Without this function - it is impossible, moves ..
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-26 22:53:40
It appears in the editor because I forgot to update the "autocomplete" file at the same time I removed it. I realised this mistake back in March.

https://github.com/19379/foo-jscript-panel/commit/d45bcf5358ad4f11b8bfcabb0b146f07b14dce4b

You can save this updated file in your component folder - overwriting the existing file.

https://raw.githubusercontent.com/19379/foo-jscript-panel/master/component/interface.api

If you don't like the change, use WSH panel mod as before or even WSH panel mod PLUS.
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-28 20:58:38
Code: [Select]
v1.2.1
- FIX: Fix bug where the playing item handle was never sent to the
       "on_playback_edited" callback even though the docs said it would.
- FIX: Tidy up docs and auto-complete hints for "on_metadb_changed"
       and "on_selection_changed". Specifically, "on_metadb_changed" always
       receives a "handle list" and never a "handle" as the first argument.
       "on_selection_changed" never receives a "handle" argument. This behaviour
       is consistent with WSH panel mod having the "v1.4" @feature preprocessor set
       as documented here:
       https://git.io/v9cVw
       https://git.io/v9cVD

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: Jailhouse on 2017-04-28 21:51:44
Check for updated components gives me, "No updates are available at this time."

It's only been a bit less than an hour since your post here. How long does it generally take before fb2k finds a new version?
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-28 21:59:33
If you'd visited the components site, you'd see I forgot to upload it. But it's there now!

edit: just had to re-upload the files because of a typo in changelog.  :-[
Title: Re: JScript Panel
Post by: Jailhouse on 2017-04-28 22:48:20
One of those days, eh? But no harm done; after all, it took me three days to notice that the last version had been uploaded. In comparison, my update today felt like getting it instantaneously.
Title: Re: JScript Panel
Post by: KoO on 2017-05-07 08:07:27
@marc2003
On the subject of Foobar on Linux..
Been tiring to get jscript 1.2.1 to run jsplaylist-mod and Library Tree 1.3.3 both just crash.

After i run these commands I get this for both

sh winetricks gdiplus_winxp
wine cmd.exe /c echo '%ProgramFiles%' returned empty string, error message "wine: WINEARCH set to win32 but '/home/koo/.wine' is a 64-bit installation."

sh winetricks wsh57 fontsmooth=rgb msscript ie8
wine cmd.exe /c echo '%ProgramFiles%' returned empty string, error message "wine: WINEARCH set to win32 but '/home/koo/.wine' is a 64-bit installation."

---------------------------------------------------------
I have everything installed as stated above..
wine 2.7
MX-16 x64 Linux =Debian
Foobar 1.3.15 full installed with wine.(Tried my Foo portable from windows scripts crash)
architecture i386 and installed

All the standard components for foo run fine UI,NG,Albumlist and so on...

Using wine is new to me the only reason I have it installed is to run FooBar.I no interest installing anymore windows programs in wine.If foobar was native linux I would not need wine at all.I have tried most of the linux media players. Foo is God

If you can help all good if not I and live with a standard Foobar columns UI...

Thanks to You and all the Foo modder and scriptwriters out their...





Title: Re: JScript Panel
Post by: marc2003 on 2017-05-07 11:11:43
Try deleting your .wine folder and running winecfg again. It looks like you may have used an existing terminal window that was already open when you edited your .bashrc file with export WINEARCH=win32
Title: Re: JScript Panel
Post by: KoO on 2017-05-08 04:28:39
@marc2003
Thanks very much for the reply
.Will do later tonight..

Have you ever had anything to do with DeadBeef ?
If that player had and Album List & Library Tree.X
It is by far the best Linux media player.{That my opinion anyway}

Foo is God
Title: Re: JScript Panel
Post by: Viewmax on 2017-05-17 12:39:43
I need two custom buttons for my foobar2000. One of them to set volume to -10db and another button to set volume to -30db.
Is it possible with this component? I'm not developer at all :(

P.S.: Didn't know where to post, so I got reply here https://hydrogenaud.io/index.php/topic,110516.new.html
Title: Re: JScript Panel
Post by: marc2003 on 2017-05-18 07:02:26
Code: [Select]
v1.2.2
- ADD: Add new "on_main_menu" callback. 10 main menu items have been created
       meaning you can now bind them to global keyboard shortcuts, standard
       toolbar buttons, etc and have them run your own custom code. See
       docs\callbacks.txt

From callbacks.txt

Code: [Select]
function on_main_menu(index) {}
/*
On the main menu>File>JScript Panel, there are 10 menu items and whichever number
is selected is sent as the "index" to this callback. Being main menu items now means you
can bind them to global keyboard shortcuts, standard toolbar buttons, panel stack splitter
buttons, etc. Remember to think carefully about where you use this code as you probably only
want it to run once and so don't include it in common files and scripts where you might have
multiple instances. Also, you should avoid sharing scripts containing this code so as not
to conflict with what other users may already be using.
Example:

function on_main_menu(index) {
switch (index) {
case 1: // triggered when File>Jscript Panel>1 is run
do_something();
break;
case 2: // triggered when File>Jscript Panel>2 is run
do_something_else();
break;
}
}
*/

https://github.com/19379/foo-jscript-panel/releases

Also available on the official components site or updating through foobar itself.
Title: Re: JScript Panel
Post by: easonjim on 2017-05-27 10:13:01
@marc2003
Dear marc2003,
I just started learning to use JScript Panel, there are several questions you would like to ask about your.
1, why do I use JScript when these syntaxes will be prompted for errors: import System.Windows.Forms;
2, if I want to introduce the System command space, I need to do?
3, "// @import "%fb2k_component_path%samples\complete\js\albumart.js"",like this is the expression of the introduction of documents, but I can not find such a grammar in the official JScript document, is this is their own custom?

Thanks you.
Title: Re: JScript Panel
Post by: marc2003 on 2017-05-27 14:15:28
1) This only supports javascript. That looks like .net??
2) Not possible, see 1.
3) It's unique to the component. See docs\preprocessors.txt

https://github.com/19379/foo-jscript-panel/blob/master/component/docs/Preprocessors.txt
Title: Re: JScript Panel
Post by: easonjim on 2017-05-27 20:29:51
@marc2003
Dear marc2003,
Thanks very much for the reply.
I get it now. Thank you.
Title: Re: JScript Panel
Post by: cliffflip on 2017-06-01 08:32:00
Hi marc,
what happens to your "thumbs" script? From your latest scripts, if I copy the contents of "thumbs.txt" from 'sample' directory, it won't download and show the currently now playing artist pictures, even when I set it to auto-download and use 'download now' option. If I use "thumbs.txt" from 'sample\complete', it only shows album art or whatever image included in the folder of the currently playing track.

Thanks in advance!
Title: Re: JScript Panel
Post by: marc2003 on 2017-06-10 00:26:27
Code: [Select]
v1.2.3
- ADD: Add fb.ReplaygainMode. Can be used to retrieve or set the value. See
       docs\interfaces.txt
- CHG: Hide JScript Panel main menu items. Given they're meant for binding to
       to keyboard shortcuts/standard buttons, there is no need for them to be
       visible. Hold Shift if you really want to access them from the menu.
- FIX: Fix MakeUnion handle list method and update docs with examples for
       MakeUnion, MakeDifference and MakeIntersection methods.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: seriousstas on 2017-06-29 07:43:23
marc2003
Use it in conjunction with foo_uie_mega_panel_splitter.(MPS)
Noticed - on the latest versions, starting with 1.2 scripts are loaded with a delay (50-500ms ..)
As a consequence - I see a white screen sometimes .. And for example with version 1.1.4 - always a quick start ..
Title: Re: JScript Panel
Post by: marc2003 on 2017-07-01 15:57:37
Yes, I see a flash of blank white panel when using Panel stack splitter (not using mega splitter) but it never happens with default UI or columns UI so I figured it was an issue with that component. As for script startups, mine are between 10-40ms . I can live with that and no one else has complained during the last 6 months....
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-07-03 09:53:35
marc2003
Use it in conjunction with foo_uie_mega_panel_splitter.(MPS)
Noticed - on the latest versions, starting with 1.2 scripts are loaded with a delay (50-500ms ..)
As a consequence - I see a white screen sometimes .. And for example with version 1.1.4 - always a quick start ..
What OS do you have and what is your IE browser version?

PS: I dunno about MPS, but in PSS you can avoid having white background if you draw background directly in PSS Script (i.e. PerTrack Script), because PSS panel load times are miniscule (especially when compared to complicated JScript's scripts).
Title: Last.Fm: Library Search for Similar Artists
Post by: fuffi on 2017-07-21 00:59:05
Since the Last.fm Charts API is working again, I've decided to restore the sample
Code: [Select]
v1.2.0.1
- ADD: Add Last.fm Similar Artists / Charts & Musicbrainz samples.

Thank you,

how would it be possible to have a library search when clicking on any artists in the Similar Artists window? (and for the tracks in the User Charts)

I remember there was a time (but maybe another component), we could choose between "open the last.fm artists site" *or* "list all music from the selected artist". but thats a long time ago.
I also remember, there was a little help on the github issues, but could'nt find it anymore.

Any help would be ... helpful, i guess :-)




Title: Re: JScript Panel
Post by: marc2003 on 2017-07-21 22:39:48
Added (https://github.com/19379/foo-jscript-panel/commit/5e450c9538aa36a9dfb51650d8f938ab37834be3) for the next release.

If you really can't wait, save this inside the component folder\samples\complete\js

https://raw.githubusercontent.com/19379/foo-jscript-panel/master/foo_jscript_panel/samples/complete/js/list.js

Note: it only works in similar artists and when the charts are displaying artist only. It won't work in chart album/track mode.
Title: Re: JScript Panel
Post by: hyydrogen on 2017-07-25 19:11:01
Hi.

I have a bit strange question. I am trying to run foobar2000 on an old Windows XP laptop. That Windows version is supported by foobar2000 but not by JScript Panel. Is there any way to get JScript Panel that would work on Windows XP?

Thanks in advance.
Title: Re: JScript Panel
Post by: marc2003 on 2017-07-27 07:54:44
I suspect someone who is competent could make it work but I don't know how.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-07-27 11:47:11
Hi.

I have a bit strange question. I am trying to run foobar2000 on an old Windows XP laptop. That Windows version is supported by foobar2000 but not by JScript Panel. Is there any way to get JScript Panel that would work on Windows XP?

Thanks in advance.
You can try the following:
https://support.microsoft.com/en-us/help/949140/when-i-run-a-script-in-windows-script--i-receive-an-error-message-libr

Not sure if it will help though, since I don't have a VM with WinXP to test it with.
Title: Re: JScript Panel
Post by: marc2003 on 2017-07-27 19:20:04
^That won't be an issue as the original WSH panel mod runs fine on XP. I was also releasing updated versions of WSH panel mod which also ran under XP.

Basically, all the problems started when I upgraded from VS2013>2015, updated to the latest foobar2000 SDK and also updated WTL at the same time. I remember lots of compiler errors which magically went away when I dropped the XP toolset. This was at the same time I was releasing JScript Panel as "new" component so I didn't have to care about breaking any upgrades and took the easy way out. Like I say, someone competent would have seen the errors and probably fixed it in 5 minutes.  :P
Title: Re: JScript Panel
Post by: hyydrogen on 2017-07-27 20:16:22
I couldn't apply that scripting component, I already have newer version installed.

Anyway, on Windows XP I receive the following message

Failed to load DLL: foo_jscript_panel.dll
Reason: The specified procedure could not be found.

I also tried running foobar2000 on Linux Zorin, latest version through Wine. foobar2000 runs OK, but JScript Panel crashes ("Aw, crashed" message displayed.)

Title: Re: JScript Panel
Post by: marc2003 on 2017-07-27 20:19:26
Here are some complete setup instructions for use with WINE...

https://github.com/19379/foo-jscript-panel/wiki/WINE
Title: Re: JScript Panel
Post by: fuffi on 2017-08-05 20:46:21
If you really can't wait, save this inside the component folder\samples\complete\js
https://raw.githubusercontent.com/19379/foo-jscript-panel/master/foo_jscript_panel/samples/complete/js/list.js
Thank you very much.
I will wait, because I'm too helpless staring of this crash-message, after doing the simple task you have written...
Code: [Select]
JScript Panel (Last.fm Similar Artists / User Charts by marc2003)
Laufzeitfehler in JavaScript:
Das Objekt unterstützt die Eigenschaft oder Methode "scale" nicht
File: E:\m\portable\foobar2000\user-components\foo_jscript_panel\samples\complete\js\list.js
Line: 977, Col: 3
<source text only available at compile time>
Title: Re: JScript Panel
Post by: garbanzo.bean on 2017-08-07 20:10:30
Does anyone have a script for a simple button to toggle between Default and Shuffle (tracks) playback modes? Thanks!
Title: Re: JScript Panel
Post by: marc2003 on 2017-08-09 05:05:54
Code: [Select]
v1.2.3.1
- CHG: No component changes except a version bump. All changes are to samples.
- ADD: Last.fm Bio, Allmusic, Listenbrainz samples. "Thumbs" can download images
       from Last.fm again but only manually.
- FIX: Most samples are now DPI aware so text/tooltips should increase inline
       with other desktop elements. For existing users, each panel script should
       be re-imported from the "samples\complete" folder.

https://github.com/19379/foo-jscript-panel/releases

late edit: It's now on the components site as well.
Title: Re: JScript Panel
Post by: marc2003 on 2017-08-24 09:46:45
Code: [Select]
v1.2.3.3
- CHG: No component changes except a version bump.
- FIX: Fix typo in "musicbrainz.txt". Thanks to zeremy for spotting.
- CHG: Listenbrainz now has caching/retry support. It's my first attempt
       at this so please report any issues! I also need reports of any
       code 400 errors from the server as the script will need updating
       before these tracks can be submitted successfully.
- ADD: Br3tt's JS Smooth scripts are now bundled with the component and the
       separate repository has been nuked.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: miras on 2017-08-24 18:31:02
Hi There! Great fan of your work marc2003
I'm upgrading my foobar skin (wsh to jscript) and I really want to change my graphical browser to Js Smooth Browser, much more pretty and fluid. But Smooth Browser don't have keyboard navigation. Any chance of adding keyboard arrows navigation?

Title: Re: JScript Panel
Post by: marc2003 on 2017-08-24 23:31:10
I'll have a look but from the post right above yours, you can see I'm not the original author....
Title: Re: JScript Panel
Post by: fuffi on 2017-08-25 00:25:32
Does anyone have a script for a simple button to toggle between Default and Shuffle (tracks) playback modes? Thanks!
I have spottet this sample: ...user-components\foo_jscript_panel\samples\basic\PBOButton(Menu).txt
named: "Playback Order Button (Popup Menu)"

Theoretical question about buttons:
Would it be possible (and how)  to replace all the f2k-default buttons with JScript Panels? Is it even possibe to hide the default f2k buttons and use only JScript Panels instead? (I'm using ColummsUI)
I have seen some examples for functions like volume or the playbar, so I guess, it is possible to ADD more buttons, but would there be an impact in speed, when adding very much buttons?

I'm asking, because I have about 40 customized buttons and the space is getting low... It seems not to be possible to add another buttonbar to f2k via columns UI, so I'm thinking about adding those buttons as JScript Panels and maybe have the benefit of flexibility in placing out of the button toolbar.

anyone using JScript Panels for buttons? Standard f2k buttons *and* customized buttons (like, i.e. starting foo_runservices or other actions) defined in foobar?

Thanks!
Title: Re: JScript Panel
Post by: marc2003 on 2017-08-25 12:14:46
You should be able to add multiple instance of columns UI buttons to your toolbar. Just hold shift when selecting it. Otherwise, unchecking will hide them but you'd lose the custom ones I think??

Really there's no reason why you can't have rows and rows of buttons if you want.
Title: Re: JScript Panel
Post by: aloola on 2017-09-01 13:40:48
hello, I'm using newest version and I got this error when playing a track with a super long artist field. Last.fm Bio and thumbs got crashed. :))


Code: [Select]
JScript Panel (Last.fm Bio by marc2003)
JavaScript runtime error:
Path not found
File: D:\Application\foobar2000\user-components\foo_jscript_panel\samples\complete\js\helpers.js
Line: 108, Col: 4
<source text only available at compile time>

the file's title and artist looks like this
 "M@STERPIECE (MOVIE VERSION)" by "Amami Haruka (CV: Nakamura Eriko), Hoshii Miki (CV: Hasegawa Akiko), Kisaragi Chihaya (CV: Imai Asami), Takatsuki Yayoi (CV: Nigo Mayako), Hagiwara Yukiho (CV: Asakura Azumi), Kikuchi Makoto (CV: Hirata Hiromi), Futami Ami/Mami (CV: Shimoda Asami), Minase Iori (CV: Kugimiya Rie), Miura Azusa (CV: Takahashi Chiaki), Shijou Takane (CV: Hara Yumi), Ganaha Hibiki (CV: Numakura Manami)"
Title: Re: JScript Panel
Post by: Tropoje on 2017-09-03 09:45:14
Hello
I'm using foobar CUI. I am new in JScript Panel. I was recently interested in JScript Panel components and especially JS Smooth Playlist. Is it possible to add more information to view next to the album art ?. I have several different releases of the same disc. Other catalog number, publisher, year of reissue, etc. I would like to add this information to the view. Of course, everything is tagged correctly.

(https://i.imgur.com/K2JQRno.jpg)

Best regards
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-04 18:40:34
@aloola, bug fixed in next version

@Tropoje, the original script author doesn't post here at the moment and I don't think anyone else can help with that.
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-06 18:59:51
Code: [Select]
v1.2.4
- ADD: Add utils.ColorPicker which is a popup dialog for selecting colours.
       See docs\interfaces.txt, samples\basic\Color Picker.txt
- FIX: Fix various bugs in samples\complete folder.
- CHG: Listenbrainz sample now has an on/off toggle on the menu.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: fuffi on 2017-09-08 02:00:47
Hi marc2003,
Code: [Select]
- CHG: Listenbrainz sample now has an on/off toggle on the menu.
This project was new to me, so I signed in to add some listens to it in addition to all my last.fm scrobbles. Good thing, thanks for supporting it!

After reviewing my listens on the listenbrains site, I recognized, that they're "incomplete", because I save remix/version info in the COMMENT Tag, which seems not to be submitted. (also, I did not found any option to tell what should be submitted by the script. Please forgive me, being a old n00b which can't analyze/understand all of your (greatly apreciated!) coding to change it myself without bothering you...)

Maybe you can add Field remappings, like in foo_audioscrobbler ?

foo_audioscrobbler settings: (https://picload.org/thumbnail/dgglodcl/1.jpg) (https://picload.org/view/dgglodcl/1.png.html)

My scrobbles in last.fm: (https://picload.org/thumbnail/dgglodcr/l.jpg) (https://picload.org/view/dgglodcr/l.png.html) (with remix information)
My listens on listenbrains: (https://picload.org/thumbnail/dgglodca/s.jpg) (https://picload.org/view/dgglodca/s.png.html) (without remix information)



Title: Re: JScript Panel
Post by: marc2003 on 2017-09-09 11:01:08
The script doesn't use title formatting and I'm not updating it for now.
Title: Re: JScript Panel
Post by: fuffi on 2017-09-09 23:37:51
Thanks,
foo_audioscrobbler is sufficient then, also, it is possible to import last.fm history to listenbrains....

Another question (about building buttons via JScript)
You should be able to add multiple instance of columns UI buttons to your toolbar. Just hold shift when selecting it. 
Really there's no reason why you can't have rows and rows of buttons if you want.
Is it possible to give the buttons different behaviour, when ALT+click or CTRL+click on it?
That would be useful to add some activate/deactivate-functions or insert/remove-buttons.
Title: Re: JScript Panel
Post by: fuffi on 2017-09-10 01:54:18
Another thingy,
thank you for the updates on the autoplaylist script. Its clearly an improve in usablility to have a contextmenu to choose from opened when clicking on a list, and not directly start the query automaticly.  nice one!

But since the config file is in JSON format, its not easy sortable (via texteditor) anymore. (which I did to have the lists sorted the way I need them)

I have about 100 entries and new lists are added at the bottom, not where I like them to be :-)

Can you consider to add some drag'n'drop or dialogue for letting the user move entries to sort them somehow ?
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-10 05:36:26
You can customise the buttons with a bit of scripting. Taking the example from the menu button script...

Code: [Select]
buttons.buttons.menu = new _.button(0, 0, 36, 36, {normal : 'misc\\foobar2000.png'}, function () { _.menu(0, 36); }, 'Menu');

You could replace it with...

Code: [Select]
buttons.buttons.menu = new _.button(0, 0, 36, 36, {normal : 'misc\\foobar2000.png'}, function () {
var VK_SHIFT = 0x10;
var VK_CONTROL = 0x11;
var VK_ALT = 0x12;

if (utils.IsKeyPressed(VK_SHIFT)) {
fb.ShowPreferences();
} else if (utils.IsKeyPressed(VK_CONTROL)) {
fb.ShowConsole();
} else {
_.menu(0, 36);
}
}, 'Menu');

As for autoplaylists, I never really imagine people adding that many entries. I'm too lazy for drag/drop but I have added an option to move items up/down from the menu.

(https://i.imgur.com/mNEL20e.png)

Obviously this is still going to be a bit cumbersome for you...

But if you use Notepad++, you can edit quite easily using the JStool plugin. After installing, press Ctrl+Alt+M with an open JSON document and you get something like this...

(https://i.imgur.com/9uReF8g.png)

Title: Re: JScript Panel
Post by: fuffi on 2017-09-10 21:38:34
Great help, for the buttons, thank you!
As for npp, I already installed the plugin to "read" the config easy and change small typos, but was too cowardly for sorting multiple lines. Will try.
The Move/Up/Down item will also help. Thank you! Its better than nothing and lazyness is very important those fast paced days... :-)
Keep up the lazyness and the good work ;-)
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-12 11:01:31
I'm currently breaking stuff for the next version. A preview of what I'm doing can be read here...

https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes

@WilB, you might be interested since I'm nuking UpdateFileInfoSimple !! I hope the replacement makes sense to you.
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-15 10:44:49
Code: [Select]
v1.3.0-Beta-1
- CHG: Support for IE7/IE8/WINE users has been dropped. Your computer
       must have IE9 or later installed.
- CHG: The "UpdateFileInfoSimple" handle and handle list methods are
       now gone.
- ADD: A new "UpdateFileInfoFromJSON" method has been added. See
       https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes#v130
       If anyone needs help with this, just ask.
- ADD: You can now create an empty handle list with fb.CreateHandleList()
       See docs\interfaces.txt

https://github.com/19379/foo-jscript-panel/releases

Users of @WilB 's bio script who use it to update tags should avoid for now. Also, anyone else who uses the component to update tags should read this link to find out what is broken and how to update.

https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes#v130 << this has had notable changes since I posted the first draft the other day

If anyone has trouble understanding it, then ask for help.

This update will only be available on github. I'm not posting it on the official components site because I don't want people blindly updating to it!

edit: renamed Alpha to Beta,  :P
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-22 04:09:06
Beta version is now final. Details in previous post.

Because of the breaking changes, v1.2.4 will remain available on the official components site and on the github releases page.
Title: Re: JScript Panel
Post by: cFlavien on 2017-09-23 10:50:04
Hi, from today I have this error :
Quote
JScript Panel (Menu Button by marc2003)
Erreur d’exécution JavaScript:
Un composant ActiveX ne peut pas créer un objet
File: E:\Ma LiberKey 5\MyApps\foobar2000\js_marc2003\js\helpers.js
Line: 45, Col: 1
<source text only available at compile time>
I have update with last version but same error
Quote
JScript Panel (Menu Button by marc2003)
Erreur d’exécution JavaScript:
Un composant ActiveX ne peut pas créer un objet
File: E:\Ma LiberKey 5\MyApps\foobar2000\user-components\foo_jscript_panel\samples\complete\js\helpers.js
Line: 560, Col: 1
<source text only available at compile time>
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-23 11:47:35
You generally don't see ActiveX errors with this component and any version of Windows unless something is really broken or perhaps something is interfering like an over-zealous security application??? Can you think anything just installed/changed recently?

What is the output of this script alone in a panel??

Code: [Select]
var arr = ['htmlfile', 'Shell.Application', 'WScript.Shell', 'Scripting.FileSystemObject', 'ScriptControl'];

for (var i = 0; i < arr.length; i++) {
try {
var obj = new ActiveXObject(arr[i]);
if (arr[i] == 'ScriptControl')
obj.Language = 'VBScript';
fb.Trace(arr[i] + ' tested OK!');
} catch (e) {
fb.Trace(arr[i] + ' not OK!')
}
}

Check the Console. I get...

Code: [Select]
htmlfile tested OK!
Shell.Application tested OK!
WScript.Shell tested OK!
Scripting.FileSystemObject tested OK!
ScriptControl tested OK!
Title: Re: JScript Panel
Post by: cFlavien on 2017-09-23 12:57:33
Quote
htmlfile tested OK!
Shell.Application tested OK!
WScript.Shell tested OK!
Scripting.FileSystemObject tested OK!
ScriptControl not OK!
JScript Panel ({9D1E0696-2F50-42AE-95E5-8B494D9D0A40}): initialised in 10 ms

I do not install anything more than the update nvidia drivers, nodejs, git !
before sending the message I desintaler last update windows update (KB)
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-23 13:23:12
Well sorry but I have no idea how to fix that. Something has been corrupted or is being blocked??

But you can use most of my scripts without it You can browse to samples\complete\js\helpers.js and comment out these lines... (around 560 according to your previous post)

Code: [Select]
//var vb = new ActiveXObject('ScriptControl');
//vb.Language = 'VBScript';

This will break anything that requires a popup dialog for user input so my autoplaylists script would be unusable.

edit: maybe you could try running this from an administator command prompt (assuming 64bit windows??)

Code: [Select]
c:\windows\syswow64\regsvr32 c:\windows\syswow64\msscript.ocx
Title: Re: JScript Panel
Post by: cFlavien on 2017-09-23 14:55:20
works by deleting both lines! Thank you
I have tried with a new foobar2000 installation and even error.

Note I use Windows 10 x64, it had always worked until today. Maybe because of an IE update. I had IE11 installed but I removed it to try to correct the error.

ps: I would like to suggest a new design for "CD Javel Case Modern". (I use it)

edit : Can't load module
I have no file msscript.ocx in syswow64
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-23 15:29:06
I'm on windows 10 fully updated. I guess you could look at this for restoring any missing files...

https://support.microsoft.com/en-gb/help/4026529/windows-10-using-system-file-checker
Title: Re: JScript Panel
Post by: Jailhouse on 2017-09-24 06:02:56
@marc2003
Now that you're using Windows 10, might you consider looking into updating to ECMAScript 6?
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-24 06:37:57
You've already posted in a previous discussion about how it isn't possible...  ;D

https://hydrogenaud.io/index.php/topic,110516.msg919089.html#msg919089

I guess you could code in ES6 and transpile it with something like babel? Just don't ask me how. I'm aware of it but I've never used it.

Title: Re: JScript Panel
Post by: Jailhouse on 2017-09-25 15:12:25
You've already posted in a previous discussion about how it isn't possible...  ;D
I couldn't have posted about how it's not possible because that's over my head. I did read the posts--then forgot all the technical explanations, retaining only that you and TheQuertiest were using Windows 8.1 and 7, respectively, and somehow concluding that it might be possible when you could test it. Sometimes, it's hell getting old.

Quote
I guess you could code in ES6 and transpile it with something like babel?
Or, to paraphrase myself, I can code JScript Panel in ES5 and like it. :)
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-25 15:43:28
Even though it might break for a handful of users, I've decided to go ahead and stick the latest version on the official components site.

If people really are stuck on Vista/7 which they cannot upgrade to IE9 or are using WINE, they can safely downgrade to v1.2.4 which is still available on github (https://github.com/19379/foo-jscript-panel/releases/tag/v1.2.4).
Title: Re: JScript Panel
Post by: Inhibited on 2017-09-29 16:00:35
@marc2003

Hi Marc,

I'm playing around with your 'rating' script in conjunction with js-smooth browser but have a minor issue.

When I rate a song, then rate the next track, it overwrites the first rating.
I can change it successfully by selecting, deselecting and selecting again the second track I want to rate.

But I'm wondering if there's a more elegant way to refresh the rating when changing track?

Don't worry if it's too much, and thank you for your work all the same!
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-30 03:24:52
Sorry, I have no idea what you're talking about.

All I can say is check the right click selection mode setting on the rating script. The first option means it will always be focused on the playing item even if something else is selected. Option 2 will always focus on the selected track and the tooltips you get when hovering it always show the artist/title so you should always know before clicking it.
Title: Re: JScript Panel
Post by: juniiflow on 2017-10-18 11:49:38
What's the font for the play button? https://github.com/19379/foo-jscript-panel/tree/master/foo_jscript_panel/samples/jsplaylist-mod
I though it was guifx, but it doesn't seem to work
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-18 12:06:09
Wingdings 3, characters u and w
Title: Re: JScript Panel
Post by: juniiflow on 2017-10-18 13:27:09
Yeah, I came back to share the fonts after finding out it was those, anyway you can download them on megafonts.net (don't know if I am allowed to link them)

It seems to be for everything though @marc2003 (play/check), anyways thanks really appreciate it.
Title: Re: JScript Panel
Post by: OwlPants on 2017-10-25 02:46:48
Hi,

I was wondering if there was a way to access the panel outside of the foobar application because
I was trying to see if I could things such as "fb.Play()" outisde of the application and I couldn't find
a way.

Thank you
 
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-25 08:56:36
You can use the command line to run simple playback commands and execute menu items. See foobar2000.exe /?

I guess for complex bits of code, you could trigger the JScript Panel menu commands to run code inside the on_main_menu callback.

https://github.com/19379/foo-jscript-panel/blob/d9db86494ec68d48c6812c458a29fa20dea1c4f1/foo_jscript_panel/docs/Callbacks.txt#L59L80
Title: Re: JScript Panel
Post by: OwlPants on 2017-10-25 21:57:29
Thanks, i'll look into it  :)
Title: Re: JScript Panel
Post by: OwlPants on 2017-10-26 03:16:07
How would you refer to the box created if I
want to add an event listener e.g. (what could I put in place of "element"?)

Code: [Select]
element.addEventListener('keydown', function(ev){
console.log(ev.which);
});

var e = new KeyboardEvent('keydown',{'keyCode':75,'which':75});
console.log(e);
element.dispatchEvent(e);
break;

Thanks
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-26 06:51:25
fb.Trace is the component's equivalent to console.log. If you want to use console.log in your script, you can write your own function like this...

Code: [Select]
var console = {
    log: function (message) {
        fb.Trace(message);
    }
}

And you can't use html/DOM stuff like addEventListener. You'll need to use the on_key_up and on_key_down callbacks from docs\callbacks.txt

Code: [Select]
var console = {
log: function (message) {
fb.Trace(message);
}
}

function on_key_down(vkey) {
if (vkey == 75) {
console.log("You pressed k");
}
}

https://github.com/19379/foo-jscript-panel/blob/d9db86494ec68d48c6812c458a29fa20dea1c4f1/foo_jscript_panel/docs/Callbacks.txt#L40L50

Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-10-31 13:57:19
Hi Marc
I've modified my existing script, that tidies new tracks, to use your new tag update method - all working fine. However one function in my script removes unwanted tags. Currently I have a fixed list of required tag names and loop through all files and all tags, either removing or skipping them according to this list. It occurs to me that there must be a better way to do this, any ideas?

Cheers and once again thanks for your work so far.
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-31 16:28:18
Are you using the GetFileInfo handle method to get all tags from each file? If so, I don't think there is anything else you can do to improve it. I assume you can't know the bad tags in advance if the files are from random sources so your only choice is to loop through them.
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-10-31 17:02:01
Hi Marc
Thanks for the quick reply. Yes I'm using GetFileInfo as you thought.

One idea could be for you to modify UpdateFileInfoFromJSON to allow it to either add/overrite existing tags as now with a switch to remove all tags not in the array.

Just a thought!
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-31 17:41:17
This component provides the bare metal required to do it yourself!! You can read the tags from each handle as you loop through and build a new handle list if it contains tags that aren't on your "good" list.

Consider using the difference function built in to the lodash library that I use and is already bundled with the component..

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"
// ==/PREPROCESSOR==

https://lodash.com/docs/3.10.1#difference


Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-11-01 11:12:55
Hi marc
I've come up with this to remove any unwanted tags from the list of files;

Code: [Select]
    var toKeepArray=["band", "album","artist","composer","date","genre","title","tracknumber", 
    "totaltracks", "disctype", "disctitle", "discnumber", "totaldiscs", "album artist", "musicbrainz_artistid", "musicbrainz_albumid"];
   
// Loop thru all metadb fields in this file to see which ones to keep/delete
// Firstly forms an array of all unwanted unique tag names
    var foundArray=[];
    for (var trk = 0; trk < l_handles.Count; trk++) {
        var track_metadb = l_handles.Item(trk);
        var track_fileinfo = track_metadb.GetFileInfo();

        for (flds = 0; flds < track_fileinfo.MetaCount; flds++) {
            foundArray.push(track_fileinfo.MetaName(flds));
        }
    }
// Only want one of each
    var uniqArray=_.uniq(foundArray, false);
// Now get the names of tags to remove   
    var difArray=_.difference(uniqArray, toKeepArray);
// Loop through unwanted array to form object with properties
    if (difArray.length > 0) {
        var tagobj = {};
        for (itm = 0; itm < difArray.length; itm++) {
            tagobj[difArray[itm]] = "";
        }
        var str = JSON.stringify(tagobj);
        l_handles.UpdateFileInfoFromJSON(str);
    }

However it doesn't seem to work. Any ideas would be greatfully received.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-01 11:39:43
You'll want to use toLowerCase() here...

Code: [Select]
foundArray.push(track_fileinfo.MetaName(flds).toLowerCase());

MetaName seems to return differently cased strings depending on tagging format.


Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-11-01 12:49:32
I've tried hard-coding the exact tag names to be removed (both in lower and upper cases) and still I can't get it to remove the tags. I've checked the resultant str variable and it contains both upper and lower case versions - sill doesn't work.

PS these are mp3 files using ID3v2.3 formatted tags if that makes any difference.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-01 13:09:30
The case doesn't matter when constructing your object - it matters when using the difference function because uppercase/lowercase values are different in javascript..

Code: [Select]
var a = ["test"];
var b = ["TEST"];

var c = _.difference(a, b);

fb.trace(c); //test

c would be an empty array if the cases were the same which is what you want. I used toLowerCase to match your hardcoded values.

I tested the code and it works for me...

Before:
(https://i.imgur.com/vymwMP2.png)

After:
(https://i.imgur.com/CFgv1OQ.png)

Code:
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"
// ==/PREPROCESSOR==

function on_mouse_lbtn_dblclk() {
    var l_handles = plman.GetPlaylistItems(plman.ActivePlaylist);
   
     var toKeepArray=["band", "album","artist","composer","date","genre","title","tracknumber",
    "totaltracks", "disctype", "disctitle", "discnumber", "totaldiscs", "album artist", "musicbrainz_artistid", "musicbrainz_albumid"];
  
// Loop thru all metadb fields in this file to see which ones to keep/delete
// Firstly forms an array of all unwanted unique tag names
    var foundArray=[];
    for (var trk = 0; trk < l_handles.Count; trk++) {
        var track_metadb = l_handles.Item(trk);
        var track_fileinfo = track_metadb.GetFileInfo();

        for (flds = 0; flds < track_fileinfo.MetaCount; flds++) {
            foundArray.push(track_fileinfo.MetaName(flds).toLowerCase());
        }
    }
// Only want one of each
    var uniqArray=_.uniq(foundArray, false);
// Now get the names of tags to remove  
    var difArray=_.difference(uniqArray, toKeepArray);
// Loop through unwanted array to form object with properties
    if (difArray.length > 0) {
        var tagobj = {};
        for (itm = 0; itm < difArray.length; itm++) {
            tagobj[difArray[itm]] = "";
        }
        var str = JSON.stringify(tagobj);
        l_handles.UpdateFileInfoFromJSON(str);
    }
}

Blank white panel, double click to process all tracks in active playlist.
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-11-01 14:35:47
Hi marc
Thanks for your help on this.

I think I may have mis-understood the meaning of 'clearing existing tags'. I had thought that the tags with the unwanted names would not appear in the properties list. Your code leaves them behind but sets them to null or "" (not sure).
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-01 14:45:05
No, those tags appear in my properties dialog because they are configured in my advanced preferences. They really don't exist in the file.

Look at "comment" and "album artist". Both are empty before and after.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-01 15:41:10
Just to expand on my previous post (I was out earlier on mobile so couldn't link/do screenshots), the tags appearing in my Properties dialog are defined here...

(https://i.imgur.com/ceNiq49.png)

And the C++ code in the component always deletes all fields sent before attempting to add anything..

https://github.com/19379/foo-jscript-panel/blob/4d36208d172df751773ca353e41c8b62d152e3b1/src/script_interface_impl.cpp#L778

It's only on these following lines when it's determined that the values aren't empty that tags are written...

https://github.com/19379/foo-jscript-panel/blob/4d36208d172df751773ca353e41c8b62d152e3b1/src/script_interface_impl.cpp#L785L786
https://github.com/19379/foo-jscript-panel/blob/4d36208d172df751773ca353e41c8b62d152e3b1/src/script_interface_impl.cpp#L792L793
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-11-01 15:48:25
Hi marc
I understand the tags in advanced properties - thanks for the clarification.

I can't get the object method to work so what I did was to generate the object containing tags to be removed and then used _.assign to 'add' it to each object in the array solution and it works fine.

Not sure what I was doing wrong but thanks to you I now have a working solution.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-11 16:14:29
Hey @marc2003 !
I'm trying to change value of the metadata via following code:
Code: [Select]
var file_info = metadb.GetFileInfo();
var rating_meta_idx = file_info.MetaFind('RATING');
if (rating_meta_idx === (-1 >>> 0)){
  file_info.MetaAdd('RATING',new_rating );
}
else {
  file_info.MetaSet(rating_meta_idx,new_rating );
}
But it seems, that this code does not actually modify the file, i.e. it only saves to FileInfo structure and does not save the changes to the file itself.

The following code works properly though:
Code: [Select]
var handle = fb.CreateHandleList();
handle.Add(metadb);
  handle.UpdateFileInfoFromJSON(
  JSON.stringify({
    'RATING': new_rating
  })
);

Am I missing something?
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-11 16:51:03
Funnily enough, I figured those methods were pointless and removed them several days ago.

https://github.com/19379/foo-jscript-panel/commit/4d36208d172df751773ca353e41c8b62d152e3b1

They were obviously part of WSH panel mod but I've never seen them used before.

edit: I suspect they could be used if I added additional methods which do the "writing" part but you know I'm what like... I don't like having multiple ways of doing the same thing and I'm incredibly lazy and incompetent.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-11 17:33:33
Funnily enough, I figured those methods were pointless and removed them several days ago.
They were obviously part of WSH panel mod but I've never seen them used before.
I see, thanks! As long as I have a way to view and edit tags, I don't really care how I achieve that.

Quote
edit: I suspect they could be used if I added additional methods which do the "writing" part but you know I'm what like... I don't like having multiple ways of doing the same thing and I'm incredibly lazy and incompetent.
I'm glad though that we have someone that lazy and incompetent to develop this component :D
Title: Re: JScript Panel
Post by: MojoBass on 2017-11-12 09:13:58
I am trying to use this https://pastebin.com/uJ5fjXW7 (https://pastebin.com/uJ5fjXW7)  code from ExtremeHunter in a JS Panel to show the current Playlist. It is doing what is expected, however crashes eg when jumping to next title ("getPlaylistInfo" is undefined).
Can anyone help how to get this running properly (or suggest an alternative)?
Thanks, MojoBass
Title: Re: JScript Panel
Post by: always.beta on 2017-11-12 10:53:33
however crashes eg when jumping to next title ("getPlaylistInfo" is undefined).
(function getPlaylistInfo() {
...
})();
==Try the following.==
function getPlaylistInfo() {
...
};
getPlaylistInfo();
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-12 11:11:46
^Yep, that is exactly it. Enforcing the use of the chakra javascript engine in IE9 or above breaks those types of functions.
Title: Re: JScript Panel
Post by: MojoBass on 2017-11-12 12:10:13
Great, works perfect!
Thanks to you, always.beta and marc2003 !! Great community here!
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-14 14:50:19
Quick heads up about the next release (no idea when it's coming out as I haven't added anything yet!!)

I''ve removed the gdi.CreateStyleTextRender method. Anything based on the glow text sample.txt script will no longer work.

Code: [Select]
		gdi.CreateStyleTextRender([pngmode]); (IStyleTextRender)
// pngmode: boolean, default false.
// see samples\basic\Glow Text Sample.txt

interface IStyleTextRender {
Methods:
// ---- outline mode ----
OutLineText(text_color, outline_color, outline_width);
DoubleOutLineText(text_color, outline_color1, outline_color2, outline_width1, outline_width2);
GlowText(text_color, glow_color, glow_width);

// ---- shadow ----
EnableShadow(enable);
ResetShadow();
// it's recommended to call ResetShadow() directly after EnableShadow()
Shadow(color, thickness, offset_x, offset_y);
// default shadow, used in solid shadow colour
DiffusedShadow(colour, thickness, offset_x, offset_y);
// soft shadow

// while using DiffusedShadow(), these two methods below are useful
SetShadowBackgroundColor(colour, width, height);
SetShadowBackgroundImage(img);

// ---- Render ----
// Not recommended if the flags contains something like "center". it won't
// work properly because of the lack of width and height information.
RenderStringPoint(g, str, font, x, y[, flags]);
RenderStringRect(g, str, font, x, y, w, h[, flags]);
SetPngImage(IGdiBitmap);
// Only in pngmode, the image should be a transparent image created by gdi.CreateImage().
}
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-15 13:38:46
Hey again @marc2003 !
I've found an inconsistency in the interface description and it's implementation:
In interfaces.txt plman.IsPlaylistItemSelected is described to have boolean return type, but actually it has a UINT return type.
Code: [Select]
fb.trace(typeof plman.IsPlaylistItemSelected(plman.ActivePlaylist, 0) === "boolean");
// false
This causes some checks to fail, when strong comparison is used with other bool values (i.e. '===', instead of '==').
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-15 13:51:00
Well spotted. It was added before my time but it should be fixed now (https://github.com/19379/foo-jscript-panel/commit/160f3677cd4edc6be038ab70c1c8301af0325dda).
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-15 13:55:57
Thanks =)

To anyone using IntelliJ WebStorm or IDEA to create\edit scripts:
I've made a JSDoc'd version of JScript's interface.txt (with param and return types specified), which can be used as plugin in IDEA/WebStorm.
This will remove all the undefined symbol warnings and will also provide some type checks, when using JScript interface.

Instructions:
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-15 14:05:58
Do you really need the Ultimate edition for Javascript support??
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-15 14:11:25
Do you really need the Ultimate edition for Javascript support??
Regretfully, yeah.

There is WebStorm IDE from the same dev ( https://www.jetbrains.com/webstorm ), which contains only JavaScript features from IDEA Ultimate, but has price that is much more humane ( https://www.jetbrains.com/webstorm/buy/#edition=personal ).

PS: There is a very simple way to activate Ultimate IDEA semi-permanently though (which I can't discuss here, but PM me if interested).
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-15 14:35:04
Thanks but I'll pass. I'll continue slumming it with Notepad++ for now.  :P
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-15 15:40:35
@marc2003 :
Btw, what about interface methods that can return -1? Shouldn't their return type be INT instead of UINT? Otherwise the return value of -1 will be equal to UINT_MAX and thus will require workarounds for strong comparisons with -1:
Code: [Select]
// Example

fb.trace(file_info.MetaFind('AZAZA') === -1, file_info.MetaFind('AZAZA') === (-1 >>> 0));
// false true
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-15 16:27:51
MetaFind and InfoFind don't return -1. This is directly from the foobar2000 SDK...

https://github.com/19379/foo-jscript-panel/blob/133af6edb43598179cc7dd60ea4f4135a2a92457/foobar2000/SDK/file_info.h#L99L100

I did clarify the docs (https://github.com/19379/foo-jscript-panel/blob/e2793273655621c9b162ea4575313582462b52bd/foo_jscript_panel/docs/Interfaces.txt#L1277L1285) the other day when I realised it wasn't clear...

Quote
InfoFind(name);
// returns idx. if found the value will be lower than InfoCount

MetaFind(name);
// returns idx. if found the value will lower than MetaCount
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-17 03:42:27
I've been checking the docs and there is some inconsistency where some methods return 4294967295 (or Math.pow(2, 32) -1) for things that aren't found and others are returning -1. I shall be making this consistent in the next update by using -1 for all because it's what people are used to when using Javascript.

edit: I've updated the Breaking Changes page on the wiki with the upcoming changes...

https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes#v131
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-17 12:31:06
v1.3.1 Beta1 (final release notes a few posts down)

Unfortunately, nothing new but fixes a few things and updates the docs to be more consistent. It's a beta because it has a few internal changes and I might not have caught everything.

https://github.com/19379/foo-jscript-panel/releases

My own "status bar.txt" sample in the "complete" folder was broken by this update so anyone else using it will need to re-import.
Title: Re: JScript Panel
Post by: Decalicatan_Decalicatan on 2017-11-18 19:25:03
Out of curiosity, is there a reason why to remove the  IStyleTextRender interface?

Also, do you know if it possible, in a JS Smooth Playlist panel to reorder the tracks within playlist withdrag n' drop ? I can't do it. Too bad because it's possible with JSPlaylist (which is... not smooth sadly).
Maybe only Falstaff could tell...

Thanks anyway for your great component!
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-19 05:14:34
The styletextrender thingy required an entire 3rd party project to be part of the Visual Studio solution and I selfishly got rid of it because I never use it. I know I should try and be more considerate of others but I'm mean!!  ;D WSH panel mod still works and there is WSH panel mod plus which shares many of the newer features with JScript Panel.

As for the playlist, you know the answer. They both use the same component!
Title: Re: JScript Panel
Post by: J.Fleming on 2017-11-20 09:03:03
Any chance of a non SSE2 build?

(http://tommycatkins.com/2017/jscript_nonsse2.png)

:(

I thought maybe version 1.1.0 might work, but sadly, the author has removed all binaries on Github earlier than version 1.2.4.

Edit - I'm trying to run this on a XP machine. Saw in the changelog that 1.3.0 drops IE8/IE7/WINE support. So I tried 1.2.4 and got the same error. It's SSE2 related. Wish I knew how to compile it so I could try to do so with SSE2 requirement disabled.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-20 09:45:48
This component has never ran on XP. Older versions with support for IE7/IE8 still required Vista or above.

The component it was based on (WSH panel mod) still runs on XP because it hasn't been updated since 2012...

https://code.google.com/archive/p/foo-wsh-panel-mod/downloads
Title: Re: JScript Panel
Post by: J.Fleming on 2017-11-20 09:52:04
OK, that makes sense, thanks! :)
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-23 08:43:30
Code: [Select]
v1.3.1
- FIX: Fixed a bug where plman.IsPlaylistItemSelected didn't return a proper boolean
       value. Thanks to TheQwertiest for reporting.
- FIX: Fixed a bug where plman.ShowAutoPlaylistUI didn't always return the correct
       boolean value.
- CHG: plman.MovePlaylistSelection now returns a boolean value to indicate success
       or failure.
- CHG: Update docs for consistency with actual component behaviour. Some methods
       which returned useless values have been updated to return nothing.
- CHG: On failure, these now return -1
       IFbFileInfo InfoFind
       IFbFileInfo MetaFind
       IFbMetadbHandleList BSearch
       IFbMetadbHandleList Find
       plman.ActivePlaylist
       plman.CreateAutoPlaylist
       plman.PlayingPlaylist
       This could potentially break some existing scripts. See
       https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes#v131
- CHG: Remove the whole IStyleTextRender interface. Anything that uses
       gdi.CreateStyleTextRender or was based on "glow text sample.txt"
       will no longer work
- CHG: Remove these IFbPlaylistRecyclerManager properties/methods:
       Id
       FindById
       RestoreById

No changes since beta.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: carp on 2017-11-23 13:00:49
With 1.3.1 and DarkOne4Mod, I now get the following error:

JScript Panel (DarkOne4Mod - Cover Panel v1.0 build20160929 by tedGo, includes partial code by T.P Wang)
Laufzeitfehler in JavaScript:
Das Objekt unterstützt die Eigenschaft oder Methode "CreateStyleTextRender" nicht
File: <main>
Line: 10, Col: 1
<source text only available at compile time>

Ist there a chance to correct this error?
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-23 13:06:31
With 1.3.1 and DarkOne4Mod, I now get the following error:

JScript Panel (DarkOne4Mod - Cover Panel v1.0 build20160929 by tedGo, includes partial code by T.P Wang)
Laufzeitfehler in JavaScript:
Das Objekt unterstützt die Eigenschaft oder Methode "CreateStyleTextRender" nicht
File: <main>
Line: 10, Col: 1
<source text only available at compile time>

Ist there a chance to correct this error?

See post above you:
Quote
- CHG: Remove the whole IStyleTextRender interface. Anything that uses
       gdi.CreateStyleTextRender or was based on "glow text sample.txt"
       will no longer work
Title: Re: JScript Panel
Post by: carp on 2017-11-23 13:44:14
Thanks! So I have to wait for Tedgo to update his DarkOne4Mod. Is the previous version 1.3.0 of JScript Panel still available as a foobar2000 component?
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-23 13:56:22
Replace the code in the panel with this...

https://pastebin.com/tLqCXvH3
Title: Re: JScript Panel
Post by: carp on 2017-11-23 14:17:45
Thank you marc2003! This works!  :)
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-24 10:15:48
Encountered a small bug in panel properties:
If you select an entry and then scroll, the entry's value will remain at the same (but wrong) place. For example:
(http://i.imgur.com/pwQUrUO.gif) (https://imgur.com/pwQUrUO)
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-24 11:30:05
I find that pretty hard to reproduce but I do get the occasional flicker.

FWIW, it looks like 3rd party PropertyList (https://github.com/19379/foo-jscript-panel/tree/master/PropertyList) library is to blame but I have no idea how to fix it.
Title: Re: JScript Panel
Post by: widerock on 2017-11-24 13:41:43
- CHG: Remove the whole IStyleTextRender interface. Anything that uses
       gdi.CreateStyleTextRender or was based on "glow text sample.txt"
       will no longer work

Is there anything to replace " gdi.CreateStyleTextRender" thing?
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-24 20:30:11
I find that pretty hard to reproduce but I do get the occasional flicker.
I can consistently reproduce it though. The easiest way:
1. Open property list that is big enough to have scrollbar.
2. Click on top item to make it 'blue'.
3. Click on 'arrow down' button on scrollbar.
Result: value of first item is wrong now and matches the selected 'blue' item.

FWIW, it looks like 3rd party PropertyList (https://github.com/19379/foo-jscript-panel/tree/master/PropertyList) library is to blame but I have no idea how to fix it.
I've tried debugging a bit (lib is back from 2003, lol), but couldn't find the exact source of the problem. I've managed to prevent the bug from happening by removing "bHandled = FALSE" from OnLButtonUp method (PropertyList.h:605). But that's just brute-force programming -_-. This lib should be probably replaced some day with the more robust one (and may be a bit younger than 14 years old).
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-24 21:34:37
I've managed to prevent the bug from happening by removing "bHandled = FALSE" from OnLButtonUp method (PropertyList.h:605).

Doing that results in crazy buggy behaviour.  :o  :o 
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-25 04:32:43
Code: [Select]
v1.3.2
- FIX: Improved handling of utf8 files without BOM. This affects files loaded
       via the PREPROCESSOR section and the Configuration window>Tools>Import button.
       They should now be treated the same as files with BOM.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: MordredKLB on 2017-11-27 20:15:23
Is there anything to replace " gdi.CreateStyleTextRender" thing?
I have the same question. My theme is using a bunch of TextRender stuff (GlowText, Shadow, RenderStringRect, etc.) and that's broken now. I had to roll back to 1.2.4 because I'm not sure what, if any, alternatives I've got.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-29 13:26:05
Since I can't help myself breaking things, I've removed the component from the official repository. At least now people can't blindly update using the components updater.

If people want to update, they should check the changelog and download manually from github.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-01 10:33:08
Yay for fb.AlwaysOnTop!
Btw, do you know if it's possible to make on_main_menu_command_status_changed callback with fb2k api?
Title: Re: JScript Panel
Post by: widerock on 2017-12-01 15:31:11
Recently, I've got this message.

JScript Panel (JS Smooth Browser v20151114-1630-340 by Br3tt aka Falstaff >> http://br3tt.deviantart.com)
JavaScript Runtime error:
Overflow
foo_jscript_panel\samples\js-smooth\js\jssb.js
Line: 1090, Col: 3
<source text only available at compile time>

I've looked into that line.
Code: [Select]
this.cursorImage_normal = gdi.CreateImage(this.cursorw, this.cursorh);

Could anyone let me know how I can fix it?
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-01 15:33:24
Yay for fb.AlwaysOnTop!
Btw, do you know if it's possible to make on_main_menu_command_status_changed callback with fb2k api?

I can't give a definitive answer but I'm pretty sure it's not possible.

However, it looks like other components may use the config_object API and that would give other components (like JScript Panel) the option to read/write/get notified of their settings changes. Of course they'd have to make this public knowledge if it's already implemented.
Title: Re: JScript Panel
Post by: elia_is_me on 2017-12-02 11:29:30
ok, just forget it...
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-02 11:41:40
No. If you don't want to use the preprocessor, that's your problem - not mine.
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-02 15:42:54
Recently, I've got this message.

JScript Panel (JS Smooth Browser v20151114-1630-340 by Br3tt aka Falstaff >> http://br3tt.deviantart.com)
JavaScript Runtime error:
Overflow
foo_jscript_panel\samples\js-smooth\js\jssb.js
Line: 1090, Col: 3
<source text only available at compile time>

I've looked into that line.
Code: [Select]
this.cursorImage_normal = gdi.CreateImage(this.cursorw, this.cursorh);

Could anyone let me know how I can fix it?

I can't reproduce this at all?? I thought it might be related to panel size but even resizing as small as possible doesn't do anything.

Does it error on startup or is it some time later?
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-03 09:27:03
Code: [Select]
v1.3.2.1
- ADD: Add fb.AlwaysOnTop property. Can be used to read or write the setting. A
       new "on_always_on_top_changed" callback has been added to detect when it
       changes via any other means such as using the menu, keyboard shortcuts, etc.

https://github.com/19379/foo-jscript-panel/releases


Title: Re: JScript Panel
Post by: widerock on 2017-12-03 13:24:28
Quote
I can't reproduce this at all?? I thought it might be related to panel size but even resizing as small as possible doesn't do anything.

Does it error on startup or is it some time later?

This happens on startup, and when I reload after startup, it's OK.
Title: Re: JScript Panel
Post by: J.Fleming on 2017-12-13 02:02:32
I need an older version of Jscript Panel that supports Foobar 1.2.4.

Sadly, the developer is one of those developers that completely obliterates all older versions of his work and only has the latest available, with no way to download older versions. That is not user friendly, at all.

If anyone knows of a place where I can download previous versions of Jscript Panel and not get nailed with malware I would greatly appreciate a reply or a PM if that's not allowed.


Edit - Looks like the component always needed 1.3. Would just delete the post, but the forums don't give users that option.
Title: Re: JScript Panel
Post by: praktis.pa.01 on 2017-12-13 08:34:34
What is the name of the global context in JScript Panel? I have been trying to use it alongside Webpack. I can make it work with a few hacks but if I can just straight up access the global variable I would take it.
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-13 11:04:55
Edit - Looks like the component always needed 1.3.

Well it was released over 3 years ago and my component has only been around for 2 years. :/

What is the name of the global context in JScript Panel? I have been trying to use it alongside Webpack. I can make it work with a few hacks but if I can just straight up access the global variable I would take it.

Sorry, I have no idea. I guess looking up windows script host would be your best bet.
Title: Re: JScript Panel
Post by: J.Fleming on 2017-12-14 02:45:16
Here's some info that may help someone (and public notes for myself; I tend to do that)...

I use the DarkOne v4 mod (https://tedgo.deviantart.com/art/DarkOne-v4-360862076). That was set up with Foobar 1.2.x - I had 1.2.4 - so I figured updating to Foobar 1.3.x would bomb it.

I had a test machine available so I just tried running the Foobar 1.3.17 installer over top of 1.2.4. The installer has an "Update" button so I clicked it and prayed.

It does in fact seem that DarkOne v4 all survives the update. Everything seems to look and work fine.

So, I was finally able to install the Jscript Panel v1.3.2.1 (https://github.com/19379/foo-jscript-panel/releases), and Biography 0.8.5.2 (https://hydrogenaud.io/index.php/topic,112913.msg945845.html#msg945845).

For DarkOne v4, there are two unused reserved panels on the right (nice foresight by the author), so I made a "BIO2" panel on one of the reserves, added the Jscript panel, then imported the Biography script. It seems to work great so far!

(https://tommycatkins.com/2017/DarkOnev4_Foobar1_3_17_JscriptBio.png)

To move the panel position, I right clicked the panel labels, selected "Splitter Settings...", temporarily cleared the "Forced Layout" check boxes for each of the panels, renamed the Jscript Panel to "BIO2", then right clicked and used "Move Up" and "Move Down" to adjust position. I placed BIO2 (Jscript / 0.8.5.2) next to BIO1 (old Biography with CDATA hex edit mod (https://hydrogenaud.io/index.php/topic,70955.msg923149.html#msg923149) - last.fm text works but not images). Finally I went back in to Splitter Settings and re-checked the "Forced Layout" check boxes.
Title: Re: JScript Panel
Post by: elia_is_me on 2017-12-14 16:27:03
What is the name of the global context in JScript Panel? I have been trying to use it alongside Webpack. I can make it work with a few hacks but if I can just straight up access the global variable I would take it.
global = this
Title: Re: JScript Panel
Post by: praktis.pa.01 on 2017-12-15 13:35:10
What is the name of the global context in JScript Panel? I have been trying to use it alongside Webpack. I can make it work with a few hacks but if I can just straight up access the global variable I would take it.
global = this

That only works when you're on the top level. If you're calling functions on different contexts (bound functions, as methods, etc), of course this will not point to the global object. In my case I was using a module loader/bundler. Sometimes you may need access to the global within those contexts.

Anyways, I've read a bit, I'm not too sure yet but I found out that the global object is not directly accessible. So there is no other way to access it other than the this keyword or a few quite ugly hacks like so:

Code: [Select]
// in non-strict mode
var _global = (function(){
    return this;
}).call(null);

Just posting as a reference to others who encounters the same problem.
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-15 18:31:31
A very minor release...

Code: [Select]
v1.3.2.2
- ADD: Component now reports version on script error.
- FIX: JSplaylist/JS Smooth playlist have been unable to tag files since v1.3.0
       when foo_playcount was missing.

https://github.com/19379/foo-jscript-panel/releases

I guess anyone using ratings in JSplaylist/JS Smooth playlist must be using foo_playcount because no one has reported the file tagging feature being broken.
Title: Re: JScript Panel
Post by: zeremy on 2017-12-16 11:10:23
A very minor release...

Code: [Select]
v1.3.2.2
- ADD: Component now reports version on script error.
- FIX: JSplaylist/JS Smooth playlist have been unable to tag files since v1.3.0
       when foo_playcount was missing.

https://github.com/19379/foo-jscript-panel/releases

I guess anyone using ratings in JSplaylist/JS Smooth playlist must be using foo_playcount because no one has reported the file tagging feature being broken.

Actually it sort of was reported https://hydrogenaud.io/index.php/topic,110516.msg945862.html#msg945862 , but I guess he is on your ignore list .. ;)
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-16 12:38:01
Ah yes, the good old ignore list. It's just about saved me from getting myself banned!!  :))
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-18 09:08:41
@marc2003 :
It seems that your git got taken down =(
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-18 15:19:24
Judging by the first post of this thread, it seems that marc2003 was either banned or moved to read-only on hydrogenaud.io.
Most likely enraged by such turn of events he deleted his git account (jscript included).
Though I doubt that we'll get the full story anyway...

A shame really, fb2k does not have that many active 3rd party component developers, especially in UI department...
Oh well, thanks @marc2003 for all your hard work! My fb2k experience would not even have been started without your component! =)
Title: Re: JScript Panel
Post by: Jailhouse on 2017-12-18 15:39:00
Damn.... It seems I deleted the last release of the component after installing it. Can someone link me to a copy?
Title: Re: JScript Panel
Post by: MojoBass on 2017-12-19 04:33:31
it seems that marc2003 was either banned or moved to read-only on hydrogenaud.io.
This is bad news :-(
Does anyone understand what has happened (was not even aware that someone can be 'banned' here - and by whom and for which 'crimes'?) ?
Any chance to bring Marc back?
Title: Re: JScript Panel
Post by: kode54 on 2017-12-19 05:59:12
He apparently went off his meds and/or experienced a psychotic break, as he felt the need to use harsh language to demoralise someone for daring to ask him to do something he didn't want to do, and was placed on moderator approval for what was supposed to be a few days. Instead, he decided to ask the staff to ban him, so his users would know he was being "censored" by the moderation team. When he didn't get that, he decided to edit some swearing into his old posts, through the combination of moderator preview, but also the free editing of the Developer profile. Now I see he has thrown a temper tantrum and deleted his Github again. Maybe he'll cool down and come to his senses again, maybe not.
Title: Re: JScript Panel
Post by: zeremy on 2017-12-19 07:04:08
Code: [Select]
Star articlePublish article	Re: script to update all music library to 1.3.2 — greynol  Collapse article	Dec 16, 20:53	0
I guess he has no reasonable answer other than he's opposed to rational and level-headed discussion(?).

Can you moderators enforce  rational and level-headed discussion in those vinyl topics also !!!!!
Title: Re: JScript Panel
Post by: redorb on 2017-12-19 09:05:26
Damn.... It seems I deleted the last release of the component after installing it. Can someone link me to a copy?
I could do that. Are we allowed to? Any mods around that can OK this?
Title: Re: JScript Panel
Post by: jazzthieve on 2017-12-19 09:30:40
Just go ahead, no problem uploading recent components. Only with outdated banned components mods might take issue.
Title: Re: JScript Panel
Post by: redorb on 2017-12-19 09:36:09
Just go ahead, no problem uploading recent components. Only with outdated banned components mods might take issue.
OK!
Here it is in a rar file: foo_jscript_panel-v1.3.2.2.rar
http://www.filedropper.com/foojscriptpanel-v1322
Title: Re: JScript Panel
Post by: MojoBass on 2017-12-19 12:16:27
@kode54: so marc2003 has still read-access here? (he can still see us?)
Title: Re: JScript Panel
Post by: MojoBass on 2017-12-19 12:24:44
ok, stupid question... everybody can read w/o registration :-)
@marc2003: Hope you'll be back soon!
Title: Re: JScript Panel
Post by: davideleo on 2017-12-19 14:07:51
He apparently went off his meds and/or experienced a psychotic break, as he felt the need to use harsh language to demoralise someone for daring to ask him to do something he didn't want to do, and was placed on moderator approval for what was supposed to be a few days. Instead, he decided to ask the staff to ban him, so his users would know he was being "censored" by the moderation team. When he didn't get that, he decided to edit some swearing into his old posts, through the combination of moderator preview, but also the free editing of the Developer profile. Now I see he has thrown a temper tantrum and deleted his Github again. Maybe he'll cool down and come to his senses again, maybe not.

I saw it coming :))  :))  :)) Sorry if this is not politically correct, but I find it hilarious. I have no idea what kind of person marc2003 actually is, but I picture him like a sort of Sheldon Cooper: a misanthropic sarcastic and hysterical geek. Interacting with him on the forum is like walking on eggshells, but at a safe distance it's pure fun.
Title: Re: JScript Panel
Post by: Jailhouse on 2017-12-19 16:35:00
Here it is in a rar file:
Appreciated, but I am without the ability to open it since I uninstalled an archiving application that kept crashing Windows Explorer. Can you create a zip file for me, or are you going to make me install 7-Zip?  ;D
Title: Re: JScript Panel
Post by: redorb on 2017-12-19 17:08:19
OK!
Here is the file:
http://www.filedropper.com/foojscriptpanel-v1322_2
Title: Re: JScript Panel
Post by: Jailhouse on 2017-12-19 22:25:05
@redorb  Got it, thanks. I feel much better now.
Title: Re: JScript Panel
Post by: kode54 on 2017-12-21 02:11:24
Sorry if this is not politically correct, but I find it hilarious.

I only speak from experience, but I don't recall my one major episode or any other minor episodes having an effect on my posting ability, other than merely silencing it, as I tended to stay offline when I was really in moods, because I didn't really have the competency to handle operating a computer properly while in those moods.

I know another developer who has exploded at people from mood swings, but they've mostly gotten that under control, and mostly stay away from places that make them angry.

I wonder if @marc2003  knows that his posts were not blocked, but merely invisible to all but the moderators for the <hours it would take them to approve something, and that the status was meant to be removed within a day or two? Such a problem.

I see he has attempted to lock himself out by setting his own email address to an invalid address. I can undo that.
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-21 04:01:47
This sucks. @marc2003 hope you come back. This component is easily one of the most useful out there, and you've benefited a lot of people with your work.

On the off chance that he's gone for good, did anyone fork the original repo?
Title: Re: JScript Panel
Post by: zeremy on 2017-12-21 07:30:33
This sucks. @marc2003 hope you come back. This component is easily one of the most useful out there, and you've benefited a lot of people with your work.

On the off chance that he's gone for good, did anyone fork the original repo?

@MordredKLB
You can find it @ http://foobar2000.ru/forum/viewtopic.php?p=67581#p67581 (http://foobar2000.ru/forum/viewtopic.php?p=67581#p67581)

@marc2003
Whatever you decide to do , I wish you the best.
Take a break , you deserve it.

@kode54
It would benefit all to send such misbehavior to the  dedicated recycle-bin of the forum instead of deleting it.
 
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-21 09:25:03
On the off chance that he's gone for good, did anyone fork the original repo?
I have a fork with commits up to v1.3.2.1 (w/o wiki and actual releases though): https://github.com/TheQwertiest/foo-jscript-panel
But v1.3.2.2 commits are lost :\

You can find it @ http://foobar2000.ru/forum/viewtopic.php?p=67581#p67581 (http://foobar2000.ru/forum/viewtopic.php?p=67581#p67581)
Regretfully they don't have v1.3.2.2 sources...
Title: Re: JScript Panel
Post by: davideleo on 2017-12-21 21:09:39

I only speak from experience, but I don't recall my one major episode or any other minor episodes having an effect on my posting ability, other than merely silencing it, as I tended to stay offline when I was really in moods, because I didn't really have the competency to handle operating a computer properly while in those moods.

I know another developer who has exploded at people from mood swings, but they've mostly gotten that under control, and mostly stay away from places that make them angry.

Why is it so hard for developers to keep calm on the internet? The most aggressive people I've met on the web (I'm not talking about marc2003, who is a pretty cool guy at the end of the day) were in forums about programming languages.
Title: Re: JScript Panel
Post by: kode54 on 2017-12-22 00:50:51
@kode54
It would benefit all to send such misbehavior to the  dedicated recycle-bin of the forum instead of deleting it.
I wasn't the moderator who deleted it (to the trash forum, which is hidden.) And said moderator had one of his own posts deleted for the same thing many months ago, which drove him away from the forum for four or five months.
Title: Re: JScript Panel
Post by: Peter on 2017-12-22 13:53:53
For reference, marc2003's full posting ability was restored a while ago ( by myself ) as mod preview was in my opinion by far unnecessary. I only wish I had gotten to this sooner.
Anyway, let's not drag the thread further off-topic from here on and hope for the best.
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-22 20:50:33
I have a fork with commits up to v1.3.2.1 (w/o wiki and actual releases though): https://github.com/TheQwertiest/foo-jscript-panel
But v1.3.2.2 commits are lost :\
That's a lot better than nothing. Sounded like v1.3.2.2 was a real minor release.

Hopefully marc2003 will restore the repo himself though, and we won't need to worry about this stuff.
Title: Re: JScript Panel
Post by: praktis.pa.01 on 2017-12-26 09:53:35
If worse comes to worse and jscript-panel is abandoned, do any of you want to collaborate on a new project?
Title: Re: JScript Panel
Post by: stardeath on 2017-12-26 21:11:28
seems like my local version is from the 2017-12-16, commit 20b1d71, i don't know if i will be able to keep git history, but i can make a zip of the source if someone is interested.
Title: Re: JScript Panel
Post by: MediterraneanMonkSeal on 2017-12-27 02:23:30
v2.0.0-dev???
https://github.com/marc2k3/foo_jscript_panel
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-27 09:05:42
seems like my local version is from the 2017-12-16, commit 20b1d71, i don't know if i will be able to keep git history, but i can make a zip of the source if someone is interested.
Can you create a format-patch from 'af50da9d8cb7176c2cd6877333316f5b90311740' to your latest commit, please?

E.g.:
Code: [Select]
git format-patch af50da9 --stdout > my.patch
Title: Re: JScript Panel
Post by: stardeath on 2017-12-27 20:18:35
here, another attempt : http://text-share.com/view/b5d73a88
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-27 20:31:27
hope this ok : https://nofile.io/f/7V0aVp7TNR2/foo-jscript-panel.patch
"File Not found" =(
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-28 05:43:33
v2.0.0-dev???
https://github.com/marc2k3/foo_jscript_panel
Seems like it. Development is continuing on it seems.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-28 09:00:16
here, another attempt : http://text-share.com/view/b5d73a88
This one is fine, thanks!

[EDIT]: Thanks to @stardeath we now have v1.3.2.2 repo with commit history and stuff =)
https://github.com/TheQwertiest/foo-jscript-panel/tree/vanilla
Title: Re: JScript Panel
Post by: J.Fleming on 2017-12-28 11:06:57
He apparently went off his meds and/or experienced a psychotic break, as he felt the need to use harsh language to demoralise someone for daring to ask him to do something he didn't want to do, and was placed on moderator approval for what was supposed to be a few days. Instead, he decided to ask the staff to ban him, so his users would know he was being "censored" by the moderation team. When he didn't get that, he decided to edit some swearing into his old posts, through the combination of moderator preview, but also the free editing of the Developer profile. Now I see he has thrown a temper tantrum and deleted his Github again. Maybe he'll cool down and come to his senses again, maybe not.

Thanks for chasing away a long standing contributor of useful scripts and mods for Foobar. Maybe use some diplomacy when communicating with a major contributor so as not to achieve this negative of a result?
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-28 11:22:38
Thanks for chasing away a long standing contributor of useful scripts and mods for Foobar. Maybe use some diplomacy when communicating with a major contributor so as not to achieve this negative of a result?
While I agree that situation in that thread could have been handled better, I'm strongly against preferential treatment you are talking about. We have forum rules for a reason. Adding exceptions to these rules will only make moderating much more subjective, potentially resulting in conflicts, flaming, bashing and etc which could have been avoided otherwise :\
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-28 15:16:52
Hey Qwertiest, how would you feel about adding a CheckFont style function to see if a font is loaded on a system. Seems cleaner than try/catch's and allows for smarter fallback.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-28 15:23:22
Hey Qwertiest, how would you feel about adding a CheckFont style function to see if a font is loaded on a system. Seems cleaner than try/catch's and allows for smarter fallback.
But we already have utils.CheckFont()? =)
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-30 03:59:16
But we already have utils.CheckFont()? =)
Haha, guess I never noticed since it was under Utils, and not GDI. Thanks!
Title: Re: JScript Panel
Post by: Mrakobes on 2018-01-09 21:32:53
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?
Title: Re: JScript Panel
Post by: jazzthieve on 2018-01-10 06:40:05
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?

I doubt he'll be very responsive. Read the posts on page 17. Also, you're asking a question about a script that's not even marc's. He's not the author of jsplaylist-mod.
Title: Re: JScript Panel
Post by: always.beta on 2018-01-10 06:42:38
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?
Drag to change the width of the cover column.
Title: Re: JScript Panel
Post by: Mrakobes on 2018-01-10 08:12:51
Drag to change the width of the cover column.
columns change the width and cover is not((
Title: Re: JScript Panel
Post by: Mrakobes on 2018-01-10 08:29:30
columns -> ststus -> visible>>>>checkboks! Thx
Title: Re: JScript Panel
Post by: Jailhouse on 2018-01-10 17:21:07
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?

I doubt he'll be very responsive. Read the posts on page 17. Also, you're asking a question about a script that's not even marc's. He's not the author of jsplaylist-mod.
It's in his Samples folder. It's his modified version of Br3tt's script.
Title: Re: JScript Panel
Post by: loz on 2018-01-10 19:44:02
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?

I doubt he'll be very responsive. Read the posts on page 17. Also, you're asking a question about a script that's not even marc's. He's not the author of jsplaylist-mod.
He's still active on the foobar2000 subreddit (as you can see here https://www.reddit.com/r/foobar2000/comments/7nmndb/jscript_panel_v2_beta/). May want to try there if you don't find what you're looking for here.
Title: Re: JScript Panel
Post by: jazzthieve on 2018-01-11 12:05:36
It's in his Samples folder. It's his modified version of Br3tt's script.

Yeah, I got some scripts too that I modified to my own desire, but they're not mine. As I said, marc's not the author of  jsplaylist-mod.
Title: Re: JScript Panel
Post by: Jailhouse on 2018-01-11 15:37:48
It's in his Samples folder. It's his modified version of Br3tt's script.

Yeah, I got some scripts too that I modified to my own desire, but they're not mine. As I said, marc's not the author of  jsplaylist-mod.
Which never kept him from supporting it in the past.
Title: Re: JScript Panel
Post by: jazzthieve on 2018-01-11 15:56:18
Is there anything meaningful you're trying to contribute here other that starting a useless discussion? He's not the author, period. And he's not here for now. Don't waste my or anyone else's time with useless discussion and next time before you comment ask yourself this "what useful information am I contributing here".  Have a nice day.
Title: Re: JScript Panel
Post by: colagen on 2018-01-24 18:47:43
Anyway, this jscript component work quite well now. The BIG thing missing in this component is the ability to drag a selection of songs out of a jscript panel, drag and drop is something quite essential to any UI (yes it's possible to drop into, but not to drag out). Maybe if one day a c++ developer come here and have some free time that he's willing to spend on this, then we'll have a component with everything in it : )
Title: Re: JScript Panel
Post by: jazzthieve on 2018-02-02 02:20:33
I can't seem to find the Recent Tracks script in the new 2.0.1 beta sample pack. It used to be included with lastfm artist info- user charts sample. Has it been moved to a separate script sample or has it been bumped out of the sample pack?
Title: Re: JScript Panel
Post by: colagen on 2018-02-08 23:50:31
Anyway, this jscript component work quite well now.

I must say, it work even better with the 2.0 update, thanks marc2003 if one day you read that! It's a lot faster with the Chakra script engine
Title: Re: JScript Panel
Post by: kode54 on 2018-02-09 02:41:22
I reset his account email address ages ago, so he'll be able to get back in, but he'll have to request that it send the activation mail again.
Title: Re: JScript Panel
Post by: rolf1955 on 2018-02-10 16:28:13
Since "JScript panel 2.01+" my "JS Smooth Playlist Manager" is not working any more.

Any ideas?

PS : Nice work!
Title: Re: JScript Panel
Post by: davideleo on 2018-02-13 10:40:25
Out of curiosity, how many of you are switching to version 2 or higher?
Right before marc2003 took over the project, there were quite a few unofficial WSH panel versions around and making sense out of the various script samples and contributions was kind of a mess. The advent of JScript panel put an end to this, and I happily resolved to align all of my scripts to the new standard. But now, since marc2003 left, I have the feeling the development is once again at random. At first I thought the best decision would be to stick to the last official JScript panel version, but now I see many are updating their scripts.
I learn a lot form other people's scripts and being familiar with the version they are using is crucial, let alone testing the scripts requires the right version of the component. So - my survey is especially addressed to the more active scripters - how are you dealing with marc2003's new developments?
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-02-13 12:20:00
how are you dealing with marc2003's new developments?
Most of the breaking changes are documented (https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes), so dealing with those is not that hard, unless, of course, your script does heavily rely on the removed\deperecated functionality.
All the other changes are usually documented in release changelogs.

Also only v2.+ of JScript utilizes new fb2k SDK, thus being the only option, if you want to fit more components before reaching the max component cap.
Title: Re: JScript Panel
Post by: davideleo on 2018-02-13 13:13:33
Most of the breaking changes are documented (https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes), so dealing with those is not that hard, unless, of course, your script does heavily rely on the removed\deperecated functionality.
All the other changes are usually documented in release changelogs.
Yes, that's understood. What I'm asking is whether you resolved to follow marc2003 updates (or maybe one of the new updates, but not the latest) or if you are sticking with JScript panel v1.3.2.2.


Also only v2.+ of JScript utilizes new fb2k SDK, thus being the only option, if you want to fit more components before reaching the max component cap.
I didn't really get this: what are the limitations I have with previous JScript panel versions? And what is the max component cap?
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-02-13 13:42:31
Yes, that's understood. What I'm asking is whether you resolved to follow marc2003 updates (or maybe one of the new updates, but not the latest) or if you are sticking with JScript panel v1.3.2.2.
Welp, to quote myself from CaTRoX release:
...
Added
  • Added compatibility fixes for vanilla JScript v2.0.0 component.
...
:D

@WilB migrated all his scripts to v2 as well.


I didn't really get this: what are the limitations I have with previous JScript panel versions? And what is the max component cap?
I have not researched it thoroughly, but from what I gathered:

Simplified description: potentially you can have no more than 128 components (actually less) that were build with static VC runtime (that is 99.9% of the components built with old fb2k SDK). Components with dynamic VC runtime do not count towards that limit (components built with new fb2k SDK usually use dynamic runtime).

Full description: https://hydrogenaud.io/index.php/topic,110142.msg907834.htm
Title: Re: JScript Panel
Post by: MojoBass on 2018-02-18 05:15:10
v2.0.4 released: https://github.com/marc2k3/foo_jscript_panel/releases/tag/v2.0.4 (https://github.com/marc2k3/foo_jscript_panel/releases/tag/v2.0.4)
Credits to marc2k3
Title: Re: JScript Panel
Post by: MojoBass on 2018-03-03 05:28:23
v2.0.5 released: https://github.com/marc2k3/foo_jscript_panel/releases/tag/v2.0.5 (https://github.com/marc2k3/foo_jscript_panel/releases/tag/v2.0.5)
Credits (again) to marc2k3
Title: Re: JScript Panel
Post by: rolf1955 on 2018-03-09 14:19:29
Since "JScript panel 2.01+" my "JS Smooth Playlist Manager" is not working any more.

Any ideas?

PS : Nice work!

Works! - Closed -
Title: Re: JScript Panel
Post by: seriousstas on 2018-03-27 13:45:23
Please RETURN EnableMenuItem
This is an important function and other replacements are not convenient - THANKS!
Title: Re: JScript Panel
Post by: MordredKLB on 2018-03-27 17:40:19
Please RETURN EnableMenuItem
This is an important function and other replacements are not convenient - THANKS!
It was a needlessly duplicated method and it won't be coming back. See the discussion starting here: https://hydrogenaud.io/index.php/topic,110516.msg954181.html#msg954181
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2018-03-28 11:52:23
Is it possible that some (hopefully short!) time in the future that we could use Lodash v 4.17.5 libraries with our scripts?
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-03-28 12:57:51
Is it possible that some (hopefully short!) time in the future that we could use Lodash v 4.17.5 libraries with our scripts?
But we can? =)
E.g. my theme uses it. For full v4.17.5 support you only need enabled Chakra engine + SetTimeout/SetInterval shims.
Of course all your scripts need to be updated to reflect lodash changes (since there are incompatibilities with v3.10.2 that is used in marc2003 samples).
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2018-03-28 13:18:56
This sounds great news. Just one question then. My scripts currently have the following line at the top;

// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"

Is there a file for the later Lodash library?
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-03-28 13:28:39
It can be downloaded from official repository and/or CDN (e.g. https://www.jsdelivr.com/package/npm/lodash)
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2018-03-28 14:11:19
Hi TheQwertiest
Thanks for the info. I've downloaded the .js file and have proved it's being used. Great.

I don't understand your earlier remark .....SetTimeout/SetInterval shims.

Could you point me in the right direction for this please.
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-03-28 14:40:47
AFAIK most browsers provide SetTimeout, SetInterval, ClearTimeout, ClearInterval methods, which are needed by the latest lodash. JScript can't provide these methods natively (in global namespace), they can be only accessed via window object (e.g. window.SetTimeout).
So for lodash to become fully functional you have to define these methods somewhere in global namespace through window.* methods.
Title: Re: JScript Panel
Post by: 62a on 2018-03-31 22:34:33
[deleted]
Title: Re: JScript Panel
Post by: year98 on 2018-08-29 23:17:43
Can I have a rudimentary question?
I want to add the follwing titleformat display in the seekbar at the center. I have no idea about jscript. I tried many combination and it all failed. Who can help?

$if(%isplaying%,%_time_elapsed% / %length%,)
https://github.com/marc2k3/foo_jscript_panel/blob/master/foo_jscript_panel/samples/complete/seekbar.txt
Title: Re: JScript Panel
Post by: TimsFong on 2018-09-02 15:04:33
v2.1.7 released:https://github.com/marc2k3/foo_jscript_panel/releases
Title: How to add an extra tag to the listenbrainz submission
Post by: fuffi on 2018-11-29 21:48:25
After reviewing my listens on the listenbrains site, I recognized, that they're "incomplete", because I save remix/version info in the COMMENT Tag, which seems not to be submitted. (also, I did not found any option to tell what should be submitted by the script. Please forgive me, being a old n00b which can't analyze/understand all of your (greatly apreciated!) coding to change it myself without bothering you...)

Maybe you can add Field remappings, like in foo_audioscrobbler ?
The script doesn't use title formatting and I'm not updating it for now.
Hello,
finally, I managed to add my own "feature wish".

If anybody is interested, here is the code. If not, I'll use it as a public note to myself in case updates will overwrite my addition and I'm wondering, why the scrobbles/listens not containing any remix information anymore...  ;-)

How to use it?

Open
Code: [Select]
listenbrainz.js
which is commonly found in
<f2k install dir>\user-components\foo_jscript_panel\samples\complete\js\listenbrainz.js

find the code
Code: [Select]
			var payload = {
track_metadata : {
artist_name : _.first(tags.artist),
release_name : _.first(tags.album),
track_name : _.first(tags.title)
}
};
This is the place where the submitted tags to the listenbrainz server are "generated".

Now add those following lines after the block of code from above. Thats a line after "};"
Code: [Select]
	if (tags.comment) { // fuffi: add comment to tracktitle
var payload = {
track_metadata : {
artist_name : _.first(tags.artist),
release_name : _.first(tags.album),
track_name : _.first(tags.title)+' ('+_.first(tags.comment)+')'
}
};
};  // fuffi
Don't replace any existing code, just add this code, which checks, if a comment-tag exists in the playing track, and if, generate the additional comment-tag after the tracktitle, separated with "(" and ")", which will look like "Artist - Tracktitle (Comment)" or "Tears For Fears - Mad World (World Mix)"
Title: Re: JScript Panel
Post by: Forfit on 2019-05-14 17:39:10
Do it is possibile a function to create custom tag instead only tag as PlayCount?

f.e.: fb.GetNowPlaying().SetJspTag("Playcount", 1);

f.e. i would add a tag (outside the file) "Lyrics" only if file "artist - title.lrc" exist.
Title: Re: JScript Panel
Post by: krznv on 2020-01-23 12:12:26
Does anyone have a script that mirrors a normal CUI menu panel? From 'File' to 'Help'
Title: Re: JScript Panel
Post by: davideleo on 2020-01-23 15:04:44
Does anyone have a script that mirrors a normal CUI menu panel? From 'File' to 'Help'

Since I moved to SMP, I'm not familiar with JS panel anymore, but have you checked the sample scripts?
The Spider Monkey panel comes with a bundled "MainMenuManager All-In-One" sample script, which I'm pretty sure has been ported from JScript panel and maybe even WSH panel.
Title: Re: JScript Panel
Post by: krznv on 2020-01-26 10:29:21
Does anyone have a script that mirrors a normal CUI menu panel? From 'File' to 'Help'

Since I moved to SMP, I'm not familiar with JS panel anymore, but have you checked the sample scripts?
The Spider Monkey panel comes with a bundled "MainMenuManager All-In-One" sample script, which I'm pretty sure has been ported from JScript panel and maybe even WSH panel.

I'm using JPanel for a few things precisely because of the sample files. I tried SMP too, didn't see any example files so I'll check again thanks for the update, so SMP would be the most up to date panel component.
Title: Re: JScript Panel
Post by: MordredKLB on 2020-02-14 20:23:05
Marc has stopped development on foo_jscript_panel. You can get his last release v2.3.5 (Dec. 2019) here (https://hydrogenaud.io/index.php?topic=118824.0).

I'll be putting up a final v2.3.6 release in the next few days which will hopefully contain the most updated version of his scripts, a dumb method only I'll use, and a few fixes that Marc had done in preparation for a v2.4.0 release.

After that point, I will probably stop maintaining foo_jscript_panel unless I managed to screw something up (in which case I'd probably fix those). Things should be in a fairly stable state, and I don't have time to take over another project.

Edit: Documentation is back online here (https://kbuffington.github.io/foo_jscript_panel/).
Title: Re: JScript Panel
Post by: MordredKLB on 2020-02-24 19:32:15
v2.3.6 available here (https://github.com/kbuffington/foo_jscript_panel/releases/tag/v2.3.6).

Some minor sample fixes and new InvertColours method.
Title: Re: JScript Panel
Post by: marc2k3 on 2020-07-01 20:00:46
It seems fb2k v1.6 has exposed some bad code which makes the component crash, I've uploaded a fixed version here...

https://hydrogenaud.io/index.php?topic=118824.msg984967#msg984967

@MordredKLB , I fixed this because I assumed you're spending your time on porting your own scripts to Spider Monkey Panel.
Title: Re: JScript Panel
Post by: dwmartin0906 on 2020-07-01 21:11:15
Hi.  I tried your new JScript panel with Foobar 1.6 beta 2 and Foobar starts now, but I have an issue with the Georgia library panel.  In artist view it expands to show the albums under that artist, but it doesn't expand any further to show the tracks under each album.  I've made some cosmetic changes to Georgia so maybe I broke something, but I wanted to let you know.
Title: Re: JScript Panel
Post by: Air KEN on 2020-07-01 21:59:19
Cause of the crash (can't start)

v1.6 beta
JS Smooth Browser/foo_jscript_panel

Revert to v1.5.5

Change
JS Smooth Browser/foo_spider_monkey_panel

Update v1.6 beta
Title: Re: JScript Panel
Post by: marc2k3 on 2020-07-01 22:24:43
Hi.  I tried your new JScript panel with Foobar 1.6 beta 2 and Foobar starts now, but I have an issue with the Georgia library panel.  In artist view it expands to show the albums under that artist, but it doesn't expand any further to show the tracks under each album.  I've made some cosmetic changes to Georgia so maybe I broke something, but I wanted to let you know.

It seems only the Georgia version is affected. The original Library Tree script by WilB expands down to track level as expected. Either way, it's not my problem.

I felt obliged to fix the component as the crash was my fault but I don't care about scripts I didn't write**

** well that's not strictly true. I don't mind fixing the odd bug because you get an error telling you which line of code is problematic. Changing the behaviour of super complex scripts is something else entirely....
Title: Re: JScript Panel
Post by: Air KEN on 2020-07-01 23:26:42
Hi :)
@snotlicker
Many Thanks for foo_jscript_panel-2.4.0.
Title: Re: JScript Panel
Post by: Forfit on 2020-07-02 07:57:49
How get foo_jscript_panel-2.4.0 ?
Title: Re: JScript Panel
Post by: marc2k3 on 2020-07-02 08:11:16
The link is just a few posts above but here it is again... https://hydrogenaud.io/index.php?topic=118824.msg984989#new
Title: Re: JScript Panel
Post by: 7tcQNdSLLx2Q on 2020-07-06 00:29:34
Using "foobar 1.5.5 + Columns +  JScript Panel".

Couldn't find a solition for volume bar . Otherwise my setup is not bad.

Help would be nice.


Title: Re: JScript Panel
Post by: MordredKLB on 2020-07-06 16:47:37
Hi.  I tried your new JScript panel with Foobar 1.6 beta 2 and Foobar starts now, but I have an issue with the Georgia library panel.  In artist view it expands to show the albums under that artist, but it doesn't expand any further to show the tracks under each album.  I've made some cosmetic changes to Georgia so maybe I broke something, but I wanted to let you know.

It seems only the Georgia version is affected. The original Library Tree script by WilB expands down to track level as expected. Either way, it's not my problem.
Yeah, it's definitely not your problem. I'll figure out what's going on. :)
Title: Re: JScript Panel
Post by: MordredKLB on 2020-07-07 04:32:50
Hi.  I tried your new JScript panel with Foobar 1.6 beta 2 and Foobar starts now, but I have an issue with the Georgia library panel.  In artist view it expands to show the albums under that artist, but it doesn't expand any further to show the tracks under each album.  I've made some cosmetic changes to Georgia so maybe I broke something, but I wanted to let you know.
The fix for this is to go into library_panel.js and on line 888 you should see something like:

this.show_tracks = window.GetProperty(.....

Replace that entire line with:

Code: [Select]
this.show_tracks = true;

I've got a fix up in github, but it also makes some changes to georgia-main.js and not sure if you've got custom changes in there.
Title: Re: JScript Panel
Post by: dwmartin0906 on 2020-07-07 16:08:55
Thank you very much.  I thought you might wait for your Spider Monkey version.  I applied your library panel fix and it works great.  But I noticed you had actually made several code changes to the library panel besides the one line fix.  Should I retrofit these as well?  I also applied your playlist row height fix and it works fine.  I saw your CD art file name changes, but don't have a need for this at this time.  I am curious about the time zone changes as I don't have a clue what this logic does.  Should I care? 

I hesitate to ask because I'm sure it's a lot of work.  But I would love the ability to spin the CD art as I saw referenced in an earlier post.  Just something to think about if you ever get bored.
Title: Re: JScript Panel
Post by: MordredKLB on 2020-07-08 06:02:46
Thank you very much.  I thought you might wait for your Spider Monkey version.  I applied your library panel fix and it works great.  But I noticed you had actually made several code changes to the library panel besides the one line fix.  Should I retrofit these as well?  I also applied your playlist row height fix and it works fine.  I saw your CD art file name changes, but don't have a need for this at this time.  I am curious about the time zone changes as I don't have a clue what this logic does.  Should I care? 

I hesitate to ask because I'm sure it's a lot of work.  But I would love the ability to spin the CD art as I saw referenced in an earlier post.  Just something to think about if you ever get bored.
The other library changes just allow disabling tracks. Not sure why anyone would want that, but they can now have it.
Timezone changes aren't important, it was just moving code around and general clean up.

I'll probably play with the spinning cdart at some point, but it's not very high priority for me right now because I'm pretty sure it'll be slow and won't look that great with large cds.
Much more important for me is downloading missing cdart (semi-)automatically.
Title: Re: JScript Panel
Post by: dwmartin0906 on 2020-07-08 07:44:12
Thank you for getting back to me.  The spinning art thing looked kind of cool, but it doesn't really add any useful functionality. 
Simplifying the downloading of CD art would be fantastic.  As always, your hard work is greatly appreciated.
Title: Re: JScript Panel
Post by: marc2k3 on 2020-07-30 11:51:35
Here's a beta version with WebP support (https://github.com/marc2k3/foo_jscript_panel/releases). You'll need to be running the latest fb2k v1.6 Beta 8.



Title: Re: JScript Panel
Post by: MojoBass on 2020-08-01 05:00:11
Fb v1.6 b9, JScript Panel  2.4.1-Beta.1:
Only for autoplaylists: JS Smooth Playlist crashes with right-click at jssp.js, line 2734:
Code: [Select]
_child01.AppendMenuItem(plman.IsAutoPlaylist(g_active_playlist) ? MF_DISABLED | MF_GRAYED : MF_STRING, 1020, "Remove");
Tried to put it as issue on Github (https://github.com/marc2k3/foo_jscript_panel), however couldn't locate the issue button.
Title: Re: JScript Panel
Post by: marc2k3 on 2020-08-01 05:35:07
I recently removed MF_DISABLED from all JS-Smooth scripts but I must have missed that one.

https://github.com/marc2k3/foo_jscript_panel/commit/89ece3e0680afc44735e45967a34bcb0a84c73ab

Thanks.
Title: Re: JScript Panel
Post by: MojoBass on 2020-08-01 05:44:28
Wow, this was immediate - thanks very much!!
And thanks for keeping the JScript Panel alive!
Title: Re: JScript Panel
Post by: marc2k3 on 2020-08-01 13:58:40
2.4.1-Beta.2 (https://github.com/marc2k3/foo_jscript_panel/releases)

WebP images are now supported on fb2k v1.5.x. Also contains various JS-Smooth sample fixes.
Title: Re: JScript Panel
Post by: Air KEN on 2020-08-01 14:30:05
Hi :) @snotlicker
JS-Smooth samples Modified

v2.4.1-Beta.2
Modified
JS Smooth Browser.txt 2020/07/01
-------
v2.4.1-Beta.1
Modified
JS Smooth Browser.txt 2020/07/30
Title: Re: JScript Panel
Post by: Air KEN on 2020-08-02 00:46:18
JS Smooth Browser.txt
v2.4.0
MD5: af59b654877382be61357ba577caf2c3

v2.4.1-Beta.1
MD5: af59b654877382be61357ba577caf2c3

v2.4.1-Beta.2
MD5: af59b654877382be61357ba577caf2c3

// ---------------

JS Smooth Playlist.txt
foo_jscript_panel-2.4.0
MD5: b35e3ffa94f55488122d00f01d19ffef

foo_jscript_panel-v2.4.1-Beta1
MD5: b35e3ffa94f55488122d00f01d19ffef

foo_jscript_panel-v2.4.1-Beta2
MD5: b35e3ffa94f55488122d00f01d19ffef

Why? Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2020-08-05 09:17:09
^There is no code inside those files. Check the contents. They use the @import feature to parse external files. And don't rely on modification times for changes.

v2.4.1 is now final: https://github.com/marc2k3/foo_jscript_panel/releases

The only change since last beta is that %fb2k_path% is no longer supported for imports. It should have been nuked years ago - %fb2k_profile_path% is always the correct solution.
Title: Re: JScript Panel
Post by: music-K on 2020-08-06 03:01:09
Hi, I use marc2003's "Menu Button", "Playback Order Button", and "Playback Buttons" to my setup and they all work perfectly. Just wondering if there is a way to add mouse over (hover) function to the above 3 scripts and make the buttons look more vivid? Thanks so much in advance!
Title: Re: JScript Panel
Post by: marc2k3 on 2020-08-06 10:40:36
Looking at the simplest example from the Menu button script.

Code: [Select]
buttons.buttons.menu = new _.button(0, 0, 36, 36, {normal : 'misc\\foobar2000.png'}, function (x, y, mask) { _.menu(0, 36); }, 'Menu');

You'll obviously need some new images saved somewhere. Do not use the component folder.

Code: [Select]
// define this at the start of the script
var hover_img = gdi.Image(fb.ProfilePath + "my images\\hover_image.png");

The button object already supports a hover "state" and you can pass an image directly to it like this...

Code: [Select]
buttons.buttons.menu = new _.button(0, 0, 36, 36, {normal : 'misc\\foobar2000.png', hover: hover_img }, function (x, y, mask) { _.menu(0, 36); }, 'Menu');

Title: Re: JScript Panel
Post by: music-K on 2020-08-06 13:32:04
Looking at the simplest example from the Menu button script.

Code: [Select]
buttons.buttons.menu = new _.button(0, 0, 36, 36, {normal : 'misc\\foobar2000.png'}, function (x, y, mask) { _.menu(0, 36); }, 'Menu');
...................

Thank you so much! This completes the last piece of my layout!
Title: Re: JScript Panel
Post by: marc2k3 on 2020-09-05 10:24:15
Last.fm updated their website which broke the downloading of artist art with the Thumbs script. This update fixes it...

https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: marc2k3 on 2020-11-17 20:46:59
Quote
v2.4.3
Add window.SetTooltipFont. Since it's not permissable to call window.CreateTooltip more than once in a panel, this method has been added for changing the tooltip font without reloading the panel.

https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: Takaji on 2020-12-21 14:26:17
I wanted to share this crash report I'm getting with trying to use v2.4.3. No matter what I do, I can't seem to avoid fb2k crashing immediately upon startup. For now, I'll revert to a previous jscript panel release.

https://pastebin.com/eT00mR7c

Any ideas for what's going on?
Title: Re: JScript Panel
Post by: marc2k3 on 2020-12-21 15:38:08
I'm able to reproduce the crash when foo_whatsnew is present. Since it works with older versions, I'll try and fix it so they both work together.
Title: Re: JScript Panel
Post by: marc2k3 on 2020-12-22 05:02:23
edit: attachment removed, I've posted a fixed version on github.

https://github.com/marc2k3/foo_jscript_panel/releases




Title: Re: JScript Panel
Post by: Takaji on 2020-12-22 16:32:17
Thank you! Can confirm it's not crashing anymore for me. :)
Title: Re: JScript Panel
Post by: marc2k3 on 2020-12-30 17:57:46
Here's a new BETA! Reading the changelog is IMPORTANT!!

https://github.com/marc2k3/foo_jscript_panel/releases

## v2.5.0-Beta.1
- The internal mechanism for saving per panel settings has changed. All scripts/settings from previous versions will be kept as you upgrade but the changes mean you can no longer downgrade to earlier versions without losing scripts embedded in each panel. Exporting your current layout before upgrading is highly recommended. Then if the worst happens, you can always re-import your theme with an earlier version.
- The `Album Art` sample now has a menu option to customise the double click action. It can either open the image in the default viewer as before or it can open the containing folder.
- Add `utils.ReplaceIllegalChars(str[, modern])`. If `modern` is set to `true`, characters are replaced with similar loooking unicode characters that are valid for use in file paths. If `false`, legacy character replacements are used. The behaviour should match the same advanced `Preferences` that are available for `File Operations` and the `Converter` built-in to `foobar2000` `v1.6` and later.
- Add `IMetadbHandleList` `RemoveDuplicates` method. The original order of the handle list is preserved.
- Remove `IMetadbHandleList` `MakeUnion` and `Sort` methods. `MakeDifference` and `MakeIntersection` now perform the required sorting internally so any calls to `Sort` before using them must be removed. More details can be found on the `Breaking Changes` wiki page.

https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-01 10:12:06
v2.5.0-Beta.3 fixes a handle list BSearch bug that was introduced in Beta.1

https://github.com/marc2k3/foo_jscript_panel/releases

Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-03 18:55:35
My attempted BSearch fix in Beta.3 was so bad so here's Beta.4

https://github.com/marc2k3/foo_jscript_panel/releases

Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-05 10:13:50
2.5.0 is now final. Everyone should read the release notes and avoid updating if they don't understand it.

https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: kutuzof on 2021-01-05 15:52:23
Shows as version 2.5.0-Beta in the component list
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-05 16:06:31
I've just uploaded a fixed version. Thanks.
Title: Re: JScript Panel
Post by: kutuzof on 2021-01-06 07:30:00
I have updated version 2.4.0 to 2.5.0. The images in the biography (Biography 0.9.0.5 by WilB) panel have stopped scrolling. Photos are uploaded to the folder, but only one is shown or not at all.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-06 10:31:39
Sorry about that, It was a bug in the utils.Glob function which I've just fixed.

v2.5.01 - https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: kutuzof on 2021-01-06 12:03:07
Yes, it also seems incompatible with the UI Hacks component. When editing scripts directly in the panels themselves, the player crashes.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-06 12:34:56
Can't reproduce - works for me.

FWIW, I have access to crash reports submitted via the foobar2000 troubleshooter so everyone should use it where possible.
Title: Re: JScript Panel
Post by: kutuzof on 2021-01-06 14:03:59
Yes, these are not UI Hacks. I started removing the components one at a time and checked each time. After removing the "foo_wave_seekbar" component, the crashes stopped.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-06 14:54:08
Found the bug, a fixed version will be released later.

edit: 2.5.0.2 is now live https://github.com/marc2k3/foo_jscript_panel/releases

Title: Re: JScript Panel
Post by: kutuzof on 2021-01-06 16:26:55
I have the "Punto Switcher" keyboard layout switch installed and always running. If I try to switch the layout in the JS panel with the keys, it hangs. This was not the case in version 2.4.0.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-06 19:49:59
I have no idea what you're on about. And there have been no changes to key handling since v2.4.0.
Title: Re: JScript Panel
Post by: kutuzof on 2021-01-07 05:41:24
I cannot change the input language in the script editing window using the "Shift + Alt" keys when the "Punto Switcher (https://yandex.ru/soft/punto/win/) is an automatic language switch of the input text" program is running.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-07 10:32:50
Well whatever the problem, it's far beyond my capabilities to "fix". Thanks for your help reporting those other bugs but I can't do anything about this.

My only suggestion is to have a preprocessor section that doesn't change and use an external editor to make changes to the imported .js files and reload whenever edits are made.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-08 19:11:34
v2.5.1 https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: regor on 2021-01-08 22:16:56
lol .... RemoveDuplicatesByFormat

On SMP that took me 400 lines of code, it would have been great to see it before! Thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-09 00:02:04
It only takes a few lines for SMP to give the same results. One iteration over the handle list modifying it in place...

Code: [Select]
var items = fb.GetLibraryItems();
var tfo = fb.TitleFormat("%artist% - %title%");
var i = 0;
var set = new Set(); // SMP only, can't do this with JSP
while (i < items.Count) {
    var str = tfo.EvalWithMetadb(items[i]);
    if (set.has(str)) {
        items.RemoveById(i);
    } else {
        set.add(str);
        i++;
    }
}
Title: Re: JScript Panel
Post by: regor on 2021-01-09 18:45:19
Wow, I totally missed that option. A pity I didn't mention it before, but thanks! Much faster too, I will update my scripts with that.
Title: Re: JScript Panel
Post by: SergPuh.68 on 2021-01-15 19:37:24
Hi, I use the JScript Panel 2.5.1 component and "YouTube Track Manager 3.9.5.4" When creating the tags album, it is not displayed correctly.If you manually change UTF-8 to UTF-8 with the specification, the playlist starts to display correctly.With earlier versions of JScript Panel, everything is displayed correctly
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-15 20:57:15
Everyone using WilB's scripts should be using the Spider Monkey Panel versions by now.

But FWIW, I always test text conversion on a whole bunch of multi-language files and the current version of JSP has no issue with Cyrillic characters that I can see.

If using foo_tags and that expects UTF8 with BOM then that would be a problem as that functionality was removed in v2.3.0 ages ago. The component now writes UTF8 without BOM only.

Title: Re: JScript Panel
Post by: SergPuh.68 on 2021-01-16 05:31:52
Thanks for the clarification
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-26 11:36:15
v2.5.2 https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: regor on 2021-01-26 12:12:00
Oh great! The fpl playlist saving comes handy hahaha. I was expecting not having to manually re-write m3u8 playlists on track changes, but will have to do so until SMP adds the fpl functionality.

I think the playlist manager script as is should work on jscript panels. I will check which scripts work so other people with this panel can use them too. The graph part seems out of question since I had to use extensive use of sets.

Btw, many scripts on your release file on github are .txt files now instead of .js. Not sure if it's intended (?)
Title: Re: JScript Panel
Post by: regor on 2021-01-26 16:46:44
Also for m3u8 playlist creations, your example at docs does not adhere to the standard.  You need to add at least #EXTM3U as first line. And it's recommended to add the encoding too.

Code: [Select]
...
// Get track paths
const tfo = fb.TitleFormat('%path%');
const items = plman.GetPlaylistItems(playlistIndex);
// Header text
let playlistText = [];
playlistText.push('#EXTM3U');
playlistText.push('#EXTENC: UTF-8');
// Tracks text
let trackText = [];
trackText = tfo.EvalWithMetadbs(items);
// Join and separte with new lines
playlistText = playlistText.concat(trackText).join('\r\n');
// Write to file
utils.WriteTextFile(playlistPath, playlistText);
...
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-26 17:28:46
I'm not entirely sure what programs need the #EXTM3U but I've added it anyway. The encoding should be obvious from the file extension.

fb2k itself doesn't care and neither does mp3tag or Media Player Classic Black Edition. I'm too lazy to download and test other software I don't already have installed.
Title: Re: JScript Panel
Post by: regor on 2021-01-27 09:50:44
It's usually used for streaming purposes, servers, etc. They don't care about extension, but the file content.
You may have track names on the file as UTF-8, but the files may have other encoding. Also some programs can read the UTF-8 m3u8 file but not manage tracks with names encoded like that... (even if that makes no sense).

There is an interminable list of #directives used on streaming programs. And even playlists pointing to playlists. You can also have a playlist name different than the filename. For example, to have duration, artist and title while streaming then the playlist must be formatted like this:
Code: [Select]
	...	
let playlistText = [];
playlistText.push('#EXTM3U');
playlistText.push('#EXTENC:UTF-8');
playlistText.push('#PLAYLIST:' + playlistName);
playlistText.push('#PLAYLISTSIZE:');
if (playlistIndex != -1) { // Tracks from playlist
let trackText = [];
// var tfo = fb.TitleFormat('%path%');
var tfo = fb.TitleFormat('#EXTINF:%_length_seconds%,%artist% - %title%$crlf()' + '%path%');
var items = plman.GetPlaylistItems(playlistIndex);
trackText = tfo.EvalWithMetadbs(items);
playlistText[3] += items.Count; // Add number of tracks to size
playlistText = playlistText.concat(trackText);
} else { //  Else empty playlist
playlistText[3] += 0; // Add number of tracks to size
}


Code: [Select]
#EXTM3U
#EXTENC:UTF-8
#PLAYLIST:Filter Results
#PLAYLISTSIZE:7
#EXTINF:154,Exuma - Don't let go
D:\foobar2000\_\510 Don't let go.mp3
#EXTINF:372,Faris Amine Bottazzi - Alwaq semman
D:\foobar2000\_\494 Alwaq semman.mp3
#EXTINF:249,Hamza El Din - Anesigu
D:\foobar2000\_\504 Anesigu.mp3
#EXTINF:276,Hamza El Din - Childhood
D:\foobar2000\_\503 Childhood.mp3
#EXTINF:262,Hamza El Din - The message bearer
D:\foobar2000\_\496 The message bearer.mp3
#EXTINF:181,Tamikrest - Nak akaline tinza (tinzaouatene)
D:\foobar2000\_\500 Nak akaline tinza (tinzaouatene).mp3
#EXTINF:214,Terakaft - Imad halan
D:\foobar2000\_\508 Imad halan.mp3

May seem useless for many programs as you noted but in my use-case for the playlist manager, for example, there is no way to know how many tracks a playlist have without loading it, since I'm just showing a list of files. To bypass that limitation I can either count the number of lines (not #) for every playlist at playlist library reload (and then cache it) or just read the size directive. Name and tracks infos are useful for streaming, although I can also use name to set that as playlist name within foobar instead of the filename.

Anyway, for sure, the program must support all those standard directives to make playlist work right. Otherwise those lines just get skipped. If you create a playlist with those lines an open it on VLC for example, you will see the length, artist and title get loaded from the playlist even if it points to non existent files. Foobar seems to skip that info... so that seems to be more a limitation of foobar rather than the directives being useless.
X
X
Title: Re: JScript Panel
Post by: marc2k3 on 2021-01-27 10:33:02
Who gives a **** about VLC. Terrible software. Anyway, since fb2k itself doesn't write any extra info when using File>Save playlist>save as m3u8, that'll do for me.
Title: Re: JScript Panel
Post by: regor on 2021-01-27 10:44:44
Well there are other programs, that's just an example hahaha
As I said, you may not use playlists for streaming, other people do. VLC may be terrible, foobar has its flaws too. This is one of them, considering foobar is used for streaming purposes too... (locations, radio stations, youtube, upnp plugins, etc.)

EDIT: I mean... we have m-tags and all those workarounds for streaming tagging but I'm surprised to see the standard method is missing (?)
Title: Re: JScript Panel
Post by: marc2k3 on 2021-02-01 15:06:25
v2.5.3 https://github.com/marc2k3/foo_jscript_panel/releases

- Add `IMetadbHandle` `ShowAlbumArtViewer` which uses the new internal viewer added in foobar2000 `v1.6.2`. You will see a popup text message if you try and use it on earlier versions. Check the docs for options.
- The included `Album art` sample now has 3 choices available for the `double click` action. Use the right click menu to choose.
  * Open using external viewer
  * Open using new internal viewer mentioned above
  * Open containing folder
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-19 12:16:34
JScript Panel v2.5.3

code metadb = fb.GetFocusItem(); returns nothing.

Spoiler (click to show/hide)
How to solve this. An example is desirable.
Thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2021-03-19 12:38:28
Radical idea: try a playlist that isn't empty.

Click the attachment for full size

Code is pretty much the same as above post...

https://github.com/marc2k3/foo_jscript_panel/blob/ae052b20dbb0f5148dfc05ddd119e646eff6cfa6/component/samples/complete/js/panel.js#L29-L47
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-19 16:26:16
Does not work.
Why.
I have some code.
Anyway a gift from me
Code: [Select]
// ==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 bgcolor = RGB(0, 128, 192);
var color_1 = RGB(255, 255, 0);
var color_2 = RGB(0,0,0);

var img = create_emoticon(color_1, color_2);

var emoticon_s = 60;
var emoticon = resize_img(create_emoticon(color_1, color_2), emoticon_s, emoticon_s);

function resize_img(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;
}

Title: Re: JScript Panel
Post by: marc2k3 on 2021-03-19 17:39:58
You might recognise this script considering it's YOURS.

(https://i.imgur.com/geTLm54.png)

Also, this other person in YOUR THREAD is running YOUR SCRIPT in JSP 2.5.3 just fine with a little fix for radio streams...

https://hydrogenaud.io/index.php?topic=114686.msg994823#msg994823



Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-19 17:54:51
Quote
Also, this other person in YOUR THREAD is running YOUR SCRIPT in JSP 2.5.3 just fine with a little fix for radio streams...
In fact of the matter.
This is my mistake somewhere.
Some kind of mysticism

From my
foo_vis_vumeter is required
Code: [Select]
// ==PREPROCESSOR==
// @name "Peak meter 6Е5С"
// @author "kgena_ua"
// @version "102020"
// ==/PREPROCESSOR==

function RGB(r,g,b) {
        return (0xff000000|(r<<16)|(g<<8)|(b));
}

var font = gdi.Font("Arial", 11, 0);

DT_LEFT = 0x00000000;
DT_CENTER = 0x00000001;
DT_VCENTER = 0x00000004;
DT_SINGLELINE = 0x00000020;
DT_NOPREFIX = 0x00000800;

var ww, wh;
var on_mouse = false;

var VUMOffset_t;
var wheel = false;
var tooltip_timer;

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
}

function get_color(){
    try {
        if (window.InstanceType == 0){
            bgcolor = window.GetColorCUI(ColorTypeCUI.background);
            c1 = window.GetColorCUI(ColorTypeCUI.inactive_selection_text);
            c2 = window.GetColorCUI(ColorTypeCUI.text);
            c3 = window.GetColorCUI(ColorTypeCUI.selection_text);
        } else if (window.InstanceType == 1) {
            bgcolor = window.GetColorDUI(ColorTypeDUI.background);
            c1 = window.GetColorDUI(ColorTypeDUI.highlight);
            c2 = window.GetColorDUI(ColorTypeDUI.text);
        }
    } catch(e){};
    try {
        if (window.InstanceType == 0){
            bgcolor = window.GetColourCUI(ColorTypeCUI.background);
            c1 = window.GetColourCUI(ColorTypeCUI.inactive_selection_text);
            c2 = window.GetColourCUI(ColorTypeCUI.text);
        } else if (window.InstanceType == 1) {
            bgcolor = window.GetColourDUI(ColorTypeDUI.background);
            c1 = window.GetColourDUI(ColorTypeDUI.highlight);
            c2 = window.GetColourDUI(ColorTypeDUI.text);
        }
    } catch(e){};
    window.Repaint();
}

get_color();

function on_colors_changed(){
    get_color();
}

var dll;
var is_dll = utils.CheckComponent("\\user-components\\foo_vis_vumeter\\foo_vis_vumeter");
if (is_dll) {dll = false} else {dll = true};

if (dll) {VUMeter = new ActiveXObject("VUMeter")};  
if (dll) {VUMeter.RegisterWindow(window.ID)};
  
function ToDB(Level){  
    return Math.round(2000*Math.log(Level)/Math.LN10)/100;  
}

var panel_on = true;

var x = window.Width / 2;
var y = window.Width / 2;
var steps = 360;
var r1 = window.GetProperty("radius", 50);
var r2 = r1 * 0.5;
var d1 = r1 * 2;
var d2 = r2 * 2;
var scale_on = window.GetProperty("scale on", true);

var c2 = RGB(0, 255, 127);
var c1 = combineColors(c2, RGB(255, 255, 255), 0.7)
var c3 = combineColors(c2, bgcolor, 0.5)

var color = [];

for(var j = 0; j < 10; j++) {
    color.push(combineColors(c1, bgcolor, j / 10)); /// bgcolor
}

var anglLP = 0;
var anglRP = 0;
var anglLP_p = 180;
var anglRP_p = 180;
var anglLP_stop = 180;
var anglRP_stop = 180;
var Lk = Rk = 0;

function on_paint(gr) {  
    gr.FillSolidRect(0, 0, ww, wh, bgcolor);
   
    // if (panel_on && fb.IsPlaying && dll) {
   
    if (dll && panel_on) {
        L = VUMeter.LeftLevel;  
        R = VUMeter.RightLevel;  
        LM = VUMeter.LeftPeak;  
        RM = VUMeter.RightPeak;  

        gr.SetSmoothingMode(4);

        for (var i = 180; i < 360; i++) {
            xP1 = (r1 * Math.cos(Math.PI * i / steps * 2 - Math.PI / 2));
            yP1 = (r1 * Math.sin(Math.PI * i / steps * 2 - Math.PI / 2));
            xP2 = (r2 * Math.cos(Math.PI * i / steps * 2 - Math.PI / 2));
            yP2 = (r2 * Math.sin(Math.PI * i / steps * 2 - Math.PI / 2));
           
            LP = ToDB(LM);
            //LP = -99;
            wwwLP = Math.pow(10, (LP + 100) / 50);
 
            //anglLP = Math.round(180 + (wwwLP * 130 / 100));
            anglLP = 180 + Math.round(wwwLP * 130 / 100);
           
            if (anglLP > 180 || anglLP_p > 190) {
           
                if (anglLP_stop > 180){  // stop or pause
                    anglLP_stop = anglLP_stop > 180 ? anglLP_stop - 0.02 : 180;
                    anglLP = Math.round(anglLP_stop);
                }

                if (anglLP > i){
                    c =  i < 310 ? c2 : c1;
                    gr.DrawLine(x + xP1, y + yP1, x + xP2, y + yP2, 2, c);
                }
                       
                if (wwwLP > 0 && anglLP_p >= anglLP){
                    Lk = Lk * 1.0005;
                    anglLP_p = anglLP_p - Lk;
                } else {
                    Lk = 0.005;
                    anglLP_p = anglLP;
                }
           
                //anglLP_p = wwwLP > 0 && anglLP_p >= anglLP ? anglLP_p - 0.005 : anglLP;

                if (Math.round(anglLP_p) == i){
                    c = i < 310 ? c2 : c1;
                    gr.DrawLine(x + xP1, y + yP1, x + xP2, y + yP2, 3, c);
                }
            }
           
            xL1 = ((r1 + 8) * Math.cos(Math.PI * i / steps * 2 - Math.PI / 2));
            yL1 = ((r1 + 8) * Math.sin(Math.PI * i / steps * 2 - Math.PI / 2));
            xL2 = ((r1 + 4) * Math.cos(Math.PI * i / steps * 2 - Math.PI / 2));
            yL2 = ((r1 + 4) * Math.sin(Math.PI * i / steps * 2 - Math.PI / 2));

            LL = Math.pow(10,((ToDB(L) + 100) / 50));
            anglLL = Math.round(180 + (LL * 180 / 100))

            if (anglLL > i){
                gr.DrawLine(x + xL1, y + yL1, x + xL2, y + yL2, 2, c3);
            }
        }

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

        for (var j = 0; j < 180; j++) {
            xP1 = (r1 * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
            yP1 = (r1 * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));
            xP2 = (r2 * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
            yP2 = (r2 * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));
              
            RP = Math.round(ToDB(RM));
            wwwRP = Math.pow(10, (RP + 100) / 50);
 
            anglRP = 180 - Math.round(wwwRP * 130 / 100);
           
            if (anglRP < 180 || anglRP_p < 160) {
           
                if (anglRP_stop < 180){  // stop or pause
                    anglRP_stop = anglRP_stop < 180 ? anglRP_stop + 0.02 : 180;
                    anglRP = Math.round(anglRP_stop);
                }

                if (anglRP < j){
                    c =  j > 50 ? c2 : c1;
                    gr.DrawLine(x + xP1, y + yP1, x + xP2, y + yP2, 2, c);
                }
               
                if (wwwRP > 0 && anglRP_p <= anglRP){
                    Rk = Rk * 1.0005;
                    anglRP_p = anglRP_p + Rk;
                } else {
                    Rk = 0.005;
                    anglRP_p = anglRP;
                }
           
                //anglRP_p = wwwRP > 0 && anglRP_p <= anglRP ? anglRP_p + 0.005 : anglRP;

                if (Math.round(anglRP_p) == j){
                    c = j > 50 ? c2 : c1;
                    gr.DrawLine(x + xP1, y + yP1, x + xP2, y + yP2, 3, c);
                }
            }
           
            xL1 = ((r1 + 8) * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
            yL1 = ((r1 + 8) * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));
            xL2 = ((r1 + 4) * Math.cos(Math.PI * j / steps * 2 - Math.PI / 2));
            yL2 = ((r1 + 4) * Math.sin(Math.PI * j / steps * 2 - Math.PI / 2));

            RL = Math.pow(10,((ToDB(R) + 100) / 50));
            anglRL = Math.round(180 - (RL * 180 / 100))

            if (anglRL < j){
                gr.DrawLine(x + xL1, y + yL1, x + xL2, y + yL2, 2, c3);
            }
        }

        th = gr.CalcTextHeight("0", font);

        for (var i = 0; i < 360; i++) {
            if (scale_on){
       
                xPt = ((r1 + 17) * Math.cos(Math.PI * i / steps * 2 - Math.PI / 2));
                yPt = ((r1 + 17) * Math.sin(Math.PI * i / steps * 2 - Math.PI / 2));

                if (i == 351 || i == 9){
                    tw = gr.CalcTextWidth(" 6", font);
                    gr.GdiDrawText(" 6", font, c2, x + xPt - tw / 2, y + yPt - th / 2, tw, th, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
                }

                if (i == 329 || i == 31){
                    tw = gr.CalcTextWidth(" 3", font);
                    gr.GdiDrawText(" 3", font, c2, x + xPt - tw / 2, y + yPt - th / 2, tw, th, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
                }
       
                if (i == 310 || i == 50){
                    tw = gr.CalcTextWidth(" 0", font);
                    gr.GdiDrawText(" 0", font, c2, x + xPt - tw / 2, y + yPt - th / 2, tw, th, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
                }
       
                if (i == 293 || i == 67){
                    tw = gr.CalcTextWidth(" -3", font);
                    gr.GdiDrawText(" -3", font, c2, x + xPt - tw / 2, y + yPt - th / 2, tw, th, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
                }
       
                if (i == 266 || i == 94){
                    tw = gr.CalcTextWidth(" -9", font);
                    gr.GdiDrawText(" -9", font, c2, x + xPt - tw / 2, y + yPt - th / 2, tw, th, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
                }
       
                if (i == 232 || i == 128){
                    tw = gr.CalcTextWidth("-20", font);
                    gr.GdiDrawText("-20", font, c2, x + xPt - tw / 2, y + yPt - th / 2, tw, th, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
                }
       
                if (i == 193 || i == 167){
                    tw = gr.CalcTextWidth("-50", font);
                    gr.GdiDrawText("-50", font, c2, x + xPt - tw / 2, y + yPt - th / 2, tw, th, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
                }
            }
        }

        gr.DrawLine(x, y - r1 - 8, x, y + r1 + 8, 2, bgcolor); /// bgcolor
       
        gr.DrawEllipse(x - r2 + 5, y - r2 + 5, d2 - 10, d2 - 10, 2, c3);
       
        if (wheel) {
            VUMOffset_t = Math.round(VUMeter.Offset) + " db";
            th = gr.CalcTextHeight(VUMOffset_t, font);
            tw = gr.CalcTextWidth(VUMOffset_t, font);
            gr.GdiDrawText(VUMOffset_t, font, c2, x - tw / 2, y - th / 2, tw, th, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
        }

    }
}

function on_playback_stop(reason) {
    anglLP_stop = anglLP;
    anglRP_stop = anglRP;
    window.Repaint();
}


function on_playback_pause(state) {
    anglLP_stop = anglLP;
    anglRP_stop = anglRP;
    //pause = state;
    window.Repaint();
}

function on_size() {  
    ww = window.Width;  
    wh = window.Height;
    x = ww / 2;
    y = wh / 2;
}  

function on_mouse_move(x,y) {
    on_mouse = true;
    window.SetCursor(32649);
}

function on_mouse_leave() {
    on_mouse = false;
    window.SetCursor(32512);
}

function on_mouse_wheel(step) {
    wheel = true;
    VUMeter.Offset = VUMeter.Offset + step;
    tooltip_timer && window.ClearTimeout(tooltip_timer);
    tooltip_timer = window.SetTimeout(function() {
        wheel = false;
        tooltip_timer && window.ClearTimeout(tooltip_timer);
    }, 2000);
}

function combineColors(c1, c2, f){ // When fraction is 0, result is 100% color1, when f is 1, result is 100% color2.
    var c1 = toRGB(c1);
    var c2 = toRGB(c2);

    var r = Math.round(c1[0] + f * (c2[0] - c1[0]));
    var g = Math.round(c1[1] + f * (c2[1] - c1[1]));
    var b = Math.round(c1[2] + f * (c2[2] - c1[2]));
   
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}

function toRGB(d){ // convert back to RGB values
    var d = d-0xff000000;
    var r = d >> 16;
    var g = d >> 8 & 0xFF;
    var b = d & 0xFF;

    return [r,g,b];
}

function print(msg) {
    try {   
        fb.trace(msg);  
    } catch(e){console.log(msg);};        
}

function on_playback_starting(cmd, is_paused){
    anglLP_stop = 180;
    anglRP_stop = 180;
    anglLP_p = 180;
    anglRP_p = 180;
    window.Repaint();
}

Title: Re: JScript Panel
Post by: marc2k3 on 2021-03-19 18:01:04
Well just in case you've not realised the change I made for radio streams, it's fb.TitleFormat Eval no long accepts a boolean "force" parameter. You can no longer write code like

Code: [Select]
fb.TitleFormat("%blah%").Eval(true);

it must be changed to

Code: [Select]
fb.TitleFormat("%blah%").Eval();

This was in the changelog/breaking changes when v2.3.0 was released a very long time ago.
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-20 14:59:46
Playback: STOP.
metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();   works in Playlist switcher
but if use Album List Panel...

X
Title: Re: JScript Panel
Post by: marc2k3 on 2021-03-20 15:36:12
So what you want is on_selection_changed and fb.GetSelection / fb.GetSelections. Read the docs.

on_item_focus_change / fb.GetFocusItem have always been playlist only regardless of component (JScript Panel/WSH panel mod/WSH panel mod plus/Spider Monkey Panel etc)

It wouldn't normally work from a playlist switcher except many people call on_item_focus_change from within on_playlist_switch.
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-20 15:52:27
Why in wsh panel mod  it works.
And it worked in older versions in jscript panel .
Title: Re: JScript Panel
Post by: marc2k3 on 2021-03-20 16:08:16
No, fb.GetFocusItem has never worked from album list in ANY component/older versions. I already said that above and I'm bored of repeating myself.

I give up. I won't be replying to any more of your drivel.
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-20 16:13:41
No, fb.GetFocusItem has never worked from album list in ANY component
What.
I use wsh panel mod to create scripts. Works fine.

foo_jscript_panel-2.1.8.  Works fine.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-03-20 16:20:47
1) make sure your active playlist is empty so there is no danger of any playlist item being picked up by fb.GetFocusItem()

2) add this code to WSH panel mod

Code: [Select]
function on_selection_changed() {
    var metadb = fb.GetFocusItem();
    if (metadb == null) fb.trace("it's always been null you dumb ass");
    else fb.trace("metadb ok ", metadb.Path);
}

3) watch the console as you select different items in album list

(https://i.imgur.com/mPpAOeZ.gif)
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-20 16:37:07
wsh_panel_mod
Code: [Select]
function on_selection_changed(metadb) {
    var metadb = fb.GetFocusItem();
    if (metadb == null) fb.trace("it's always been null you dumb ass");
    else fb.trace("metadb ok ", metadb.Path);
   
    on_item_focus_change();
}
X

and on foo_jscript_panel-2.1.8.  Works fine.
it was not always empty, ... I can't write to a stranger
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-20 16:55:01
foo_jscript_panel v 2.5.3
X
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-20 18:03:00
foo_jscript_panel v2.1.8
X
it was not always empty, ...
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-20 19:41:48
what answer to the stupid asshole
Title: Re: JScript Panel
Post by: MojoBass on 2021-03-20 19:52:26
Please try to maintain a decent conversation, thanks
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-20 19:59:02
Please try to maintain a decent conversation, thanks

sorry
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-27 18:06:04
so we will install the old working functions that did not seem to existfb.
Quote
fb.GetFocusItem has never worked from album list in ANY component
has never ...
EnableMenuItem never too
Title: Re: JScript Panel
Post by: kgena_ua on 2021-03-27 18:25:28
so we will install the old working functions that did not seem to exist.
Quote
fb.GetFocusItem has never worked from album list in ANY component
has never ...
EnableMenuItem never too
Title: Re: JScript Panel
Post by: marc2k3 on 2021-04-01 18:11:41
## v2.5.4
- Fix bug where the `cookie` returned by `gdi.LoadImageAsync` wasn't always unique.
- A recent website update broke the `Allmusic` sample. This is now fixed.

https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: marc2k3 on 2021-04-20 04:27:22
v2.5.5 https://github.com/marc2k3/foo_jscript_panel/releases

The included Album art sample can now display front covers in radio streams if using fb2k v1.6.6. Tested with RadioParadise as per this thread

https://hydrogenaud.io/index.php?topic=120855.0
https://radioparadise.com/listen/stream-links

Title: Re: JScript Panel
Post by: marc2k3 on 2021-04-21 02:36:19
v2.5.5.1 https://github.com/marc2k3/foo_jscript_panel/releases

- The `on_playback_dynamic_info_track` callback now receives a `type` as the first argument. It will have a value of `0` for stream title updates and a value of `1` for stream album art updates.
Title: Re: JScript Panel
Post by: Mrakobes on 2021-04-22 16:24:18
Hi Marс2003, please tell me the difference between this application and Spider Monkey Panel (foo_spider_monkey_panel), which is based on your scripts, which one is preferable to use and why?
Title: Re: JScript Panel
Post by: marc2k3 on 2021-05-06 20:04:20
v2.5.5.2 fixes double click bugs with Album Art sample. No real component changes.

https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: marc2k3 on 2021-05-08 10:32:48
v2.5.6 https://github.com/marc2k3/foo_jscript_panel/releases

- Fix crash with `utils.GetAlbumArtAsync` when it's asked to query art from radio streams. Update docs to clarify only `IMetadbHandle` `GetAlbumArt` and `utils.GetAlbumArtV2` can retrieve that type of art.
- Fix `track info + seekbar + buttons` sample to properly update on stream title/art changes. Note this requires replacing the text in any existing panel by using the `Samples` menu.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-05-15 15:56:42
v2.6.0-Beta.1 https://github.com/marc2k3/foo_jscript_panel/releases

- Add `fb.AddLocationsAsync`. Similar to `plman.AddLocations` except rather than specifiying a target playlist, you get the processed handles to a new `on_locations_added` callback.
- Add `plman.AddPlaylistLock` / `plman.RemovePlaylistLock`. Use in conjunction with the existing `plman.IsPlaylistLocked`, `plman.GetPlaylistLockFilterMask` and `plman.GetPlaylistLockName` methods. The `on_playlists_changed` callback will be triggered when locks are added/removed. See docs for full details.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-05-18 06:47:19
v2.6.0-Beta.2 https://github.com/marc2k3/foo_jscript_panel/releases

- Add `fb.AddLocationsAsync`. Similar to `plman.AddLocations` except rather than specifiying a target playlist, you get the processed handles to a new `on_locations_added` callback.
- Add `plman.AddPlaylistLock` / `plman.RemovePlaylistLock`. Use in conjunction with the existing `plman.IsPlaylistLocked`, `plman.GetPlaylistLockFilterMask` and `plman.GetPlaylistLockName` methods. The `on_playlists_changed` callback will be triggered when locks are added/removed. See docs for full details.
- (Beta.2) Add `plman.ShowPlaylistLockUI`. This only works if the playlist is unlocked or the lock is owned by `JScript Panel`. Provides a popup dialog with checkboxes for toggling the various options on/off.

Beta.2 adds a Playlist Lock dialog similar to the one provided by foo_playlist_attributes.

(https://i.imgur.com/8Cwmm7c.png)
Title: Re: JScript Panel
Post by: regor on 2021-05-18 18:02:10
Great! Make me want to revert back to js
Title: Re: JScript Panel
Post by: marc2k3 on 2021-05-19 16:56:36
v2.6.0-Beta.3 https://github.com/marc2k3/foo_jscript_panel/releases

- Add `fb.AddLocationsAsync`. Similar to `plman.AddLocations` except rather than specifiying a target playlist, you get the processed handles to a new `on_locations_added` callback.
- Add `plman.AddPlaylistLock` / `plman.RemovePlaylistLock`. Use in conjunction with the existing `plman.IsPlaylistLocked`, `plman.GetPlaylistLockFilterMask` and `plman.GetPlaylistLockName` methods. The `on_playlists_changed` callback will be triggered when locks are added/removed. See docs for full details.
- (Beta.2) Add `plman.ShowPlaylistLockUI`. This only works if the playlist is unlocked or the lock is owned by `JScript Panel`. Provides a popup dialog with checkboxes for toggling the various options on/off.
- (Beta.3) Minor bug fix for `plman.ShowPlaylistLockUI` removing/adding playlist locks which triggered the `on_playlists_changed` callback even when nothing had changed.
- (Beta.3) Update the playlist manager built in to `JSPlaylist` so it can manage playlist locks from the context menu. Additionally, full support for restoring/purging deleted playlists has been added using the `plman` `recycler` methods. Although this functionality has been in the component for a very long time, it's not been exposed in any included sample before.

Screenshot of JSPlaylist manager options:

(https://i.imgur.com/kAXWH2R.png)
Title: Re: JScript Panel
Post by: marc2k3 on 2021-05-27 13:18:20
v2.6.0 final https://github.com/marc2k3/foo_jscript_panel/releases

- Add `fb.AddLocationsAsync`. Similar to `plman.AddLocations` except rather than specifiying a target playlist, you get the processed handles to a new `on_locations_added` callback.
- Add `plman.AddPlaylistLock` / `plman.RemovePlaylistLock`. Use in conjunction with the existing `plman.IsPlaylistLocked`, `plman.GetPlaylistLockFilterMask` and `plman.GetPlaylistLockName` methods. The `on_playlists_changed` callback will be triggered when locks are added/removed. See docs for full details.
- Add `plman.ShowPlaylistLockUI`. This only works if the playlist is unlocked or the lock is owned by `JScript Panel`. Provides a popup dialog with checkboxes for toggling the various options on/off.
- Update the playlist manager built in to `JSPlaylist` so it can manage playlist locks from the context menu. Additionally, full support for restoring/purging deleted playlists has been added using the `plman` `recycler` methods. Although this functionality has been in the component for a very long time, it's not been exposed in any included sample before.
- The `JScript Panel` stats section on the `Properties` dialog, `Details` tab is now hidden unless there is actual data to display.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-05-27 19:44:34
I'm aware of a bug in the new version where the line numbers in the editor are not shown. I will try and fix this soon but I'm battling a new version of the Scintilla library which provides that functionality. I may have to revert to the old version if I lose.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-05-28 01:07:16
v2.6.0.1 https://github.com/marc2k3/foo_jscript_panel/releases

This fixes the bug mentioned above.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-06-24 08:03:34
v2.6.0.2 https://github.com/marc2k3/foo_jscript_panel/releases

- Fixes a regression in v2.6.0 where selected text in the Configuration Window may have become hard to read when the window lost focus.
- Because of the above change, colour/font changes have been reset. Also, the Editor Properties found under File>Preferences>Tools>JScript Panel have been simplified.
- Doc fixes.

Not sure if anyone is running their own totally custom themes but if you are, you should set a custom colour for style.selection.back here...

(https://i.imgur.com/hqyDOGg.png)

If left blank like the previous defaults/themes, you may have the same issue I just "fixed".
Title: Re: JScript Panel
Post by: bedul123 on 2021-06-25 00:50:58
Hi,
Is it possible to display the album art of playing track with blurred effect?
Like combining both "album art" and "StackBlur (image)" scripts in one panel. I saw this on Eole, but I don't know how to do it myself.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-06-25 05:33:23
Not entirely sure what you're after but you could try playing around with this??

Code: [Select]
// ==PREPROCESSOR==
// @name "Album Art"
// @author "marc2003"
// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"
// @import "%fb2k_component_path%samples\complete\js\helpers.js"
// @import "%fb2k_component_path%samples\complete\js\panel.js"
// @import "%fb2k_component_path%samples\complete\js\albumart.js"
// ==/PREPROCESSOR==

//////////////////////////////////////////////////
// edit these

var border = 100;
var blur_radius = 150;

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

var panel = new _.panel('custom_background');
var albumart = new _.albumart(0, 0, 0, 0);
albumart.blur_img = null;

panel.item_focus_change();

function on_size() {
panel.size();
albumart.x = albumart.y = border;
albumart.w = panel.w - (border * 2);
albumart.h = panel.h - (border * 2);
}

function on_paint(gr) {
panel.paint(gr);
if (albumart.blur_img) {
_.drawImage(gr, albumart.blur_img, 0, 0, panel.w, panel.h, image.crop);
}
albumart.paint(gr);
}

function on_playback_dynamic_info_track(type) {
if (type == 1) panel.item_focus_change();
}

function on_metadb_changed() {
_.dispose(albumart.blur_img);
albumart.blur_img = null;
albumart.metadb_changed();
if (albumart.img) {
albumart.blur_img = albumart.img.Clone(0, 0, albumart.img.Width, albumart.img.Height);
albumart.blur_img.StackBlur(blur_radius);
}
window.Repaint();
}

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

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

function on_mouse_lbtn_dblclk(x, y) {
albumart.lbtn_dblclk(x, y);
}

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

function on_key_down(k) {
albumart.key_down(k);
}
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-12 20:25:05
https://github.com/marc2k3/foo_jscript_panel/releases

## v2.6.1
- `window.GetFontCUI` and `window.GetFontDUI` have been updated so they never return null on failure. `Segoe UI` will be used instead.
- `gdi.Font` has also been updated so if it fails, the fallback font is `Segoe UI`. Previous fallbacks were not always predictable and there could be mismatches between the `.Name` property and what was actually used. In theory, that should not happen now.
- Add `utils.ListFonts`.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-14 06:17:50
Back by unpopular demand is my ye olde sox spectrogram seekbar from the WSH panel mod days.

You'll need sox and ffmpeg extracted to a folder named sox inside your profile folder (or edit the paths in the script)

Limitations:
since the script passes the filename to ffmpeg for decoding, your input components are irrelevant
it only works on local files with a known length
cue sheets/files with chapters are not supported
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-14 08:39:22
I forgot to mention that FontAwesome is required.

https://github.com/FortAwesome/Font-Awesome/blob/fa-4/fonts/fontawesome-webfont.ttf?raw=true

I also forgot to make it clear the image when playback stops. I've attached a fixed version.
Title: Re: JScript Panel
Post by: Majestyk on 2021-07-18 23:05:23
Why would the current version (including other versions from the last year or so) of foo_jscript_panel crash when I run any of the sample panels like JS Smooth? It shuts down Foobar2000 (latest version) and it won't load back up again unless I go into safe mode.

The earlier versions like 2.3.0.1 work fine.

Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-19 00:38:29
I'm not aware of any issues with the current version?? I assume you're using the link in my sig to get it??

The 2.3.x series was not good and known to crash on f2bk v1.6 Unfortunately some bad code got in that worked fine on fb2k v1.4/v1.5 but was brutally exposed by the release of fb2k v1.6!! But that bug was fixed within a few hours of me first noticing it and while they have been a few more bugs since, I generally try and fix them immediately and I've not had any crash reports submitted with any recent versions.
Title: Re: JScript Panel
Post by: Majestyk on 2021-07-19 02:40:57
Thanks for getting back. Actually, it turns out I didn't have the panel from your link installed. I had 2.3.6.1. Odd how that page makes it look like it's the latest.

Anyway, I have a new problem. :) 2.6.1 works but when I right click on JS Smooth and select any option (for example, Properties) I get an orange screen with JavaScript Error. 

The error message says... \profile\user-components\foo_jscript_panel\samples\js-smooth\js\jssp.js
Line: 2561, Col: 4

Any idea? Thanks.

EDIT... JS Playlist does not have that issue. Only JS Smooth.
Title: Re: JScript Panel
Post by: Majestyk on 2021-07-19 03:26:34
Forgot to include: 'ret' is undefined.
Title: Re: JScript Panel
Post by: Majestyk on 2021-07-19 04:21:04
I seemed to have fixed it. (Probably a band-aid solution).  I renamed the three traces of "ret" to "idx" and now it works.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-19 08:41:29
Heh, you did find bugz in the JS-Smooth playlist. Your fixes were correct.

https://github.com/marc2k3/foo_jscript_panel/commit/5362e350c0822bc9006c390899ea30c51dc42330

I guess you must be the first to use it in a long time. Sorry about that!



Title: Re: JScript Panel
Post by: Majestyk on 2021-07-19 20:57:44
No problem. I'm just glad it's been updated. For the longest time (since Nov 2015) it's had a bug where the cover art wouldn't refresh properly. 
Title: Re: JScript Panel
Post by: Majestyk on 2021-07-23 05:10:21
Any ideas why the artwork on the JS Smooth panel is cut off at all four corners of the sides? Like some albums might have a border on the edges of the artwork but on JS Smooth Panel the borders would be cut off. The artwork displays fine on JS Playlist.

Anyway, I'm not really expecting any outcome here since there's not much love for these panels anymore, but just thought I'd mention it.

Update... I think I found where to fix this. It's in the common file (I was spending all my time in the jssp file). This line to be exact...


Quote
gr.DrawImage(img, src_x, src_y, src_w, src_h, dst_x + 3, dst_y + 3, dst_w - 6, dst_h - 6, 0, alpha || 255);
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-23 18:23:03
You didn't need to edit the script. Just right click the album count in the top right corner>Display>uncheck auto-fill.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-24 06:04:55
Just realised the above comment applies to JS Smooth Browser only - not the playlist. I'll consider adding a similar option in the next version.

edit: changes have been made but I don't have plans for a new component any time soon. Here are the updated files if you want to save them in your own samples\js-smooth\js folder.

https://raw.githubusercontent.com/marc2k3/foo_jscript_panel/develop/component/samples/js-smooth/js/JScommon.js
https://raw.githubusercontent.com/marc2k3/foo_jscript_panel/develop/component/samples/js-smooth/js/jssp.js

After reloading the script, you should have a new option when clicking in the top right area-  Group Headers>Album Art: auto-fill (uncheck it)
Title: Re: JScript Panel
Post by: Majestyk on 2021-07-24 10:35:32
Cool, thanks!  Hey, I have another question and I promise I won't bother you anymore. :)

I notice with Jscript 2.61 and 2.56 you can't drag and drop files into both JS Smooth and JS Playlist UNLESS there is a playlist already made. If there is no playlist they won't let you drag.  JScript 2.3.0.1 (possibly others) will let you do this.

Is there an easy solution to this? Thanks, again.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-24 14:21:07
I'm not changing the behaviour of JSPlaylist. Before dragging, you can middle click the panel which opens the playlist manager. When that's open you can drag to the header section which offers to create a new playlist.

I've updated JS Smooth playlist so it behaves like older versions. Use the jssp.js link above.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-26 02:42:04
https://github.com/marc2k3/foo_jscript_panel/releases

## v2.6.2.1
- Fix drag/drop bug introduced when fixing callback bug in `v2.6.2`.

## v2.6.2
- Fix bug where callbacks that receive multiple args may not have received them in the correct order causing buggy behaviour in certain scripts.
- Fix various JS Smooth script issues.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-07-26 03:25:43
I'm such a doofus that I made a new bug while fixing another. That should be fixed above.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-08-14 06:47:13
https://github.com/marc2k3/foo_jscript_panel/releases

## v2.6.2.2
- Add `spectrogram seekbar` & `track info + spectrogram seekbar + buttons` samples.
- `JS Smooth Playlist` now displays dynamic artist/title info from radio streams.
- `JS Smooth Browser/Playlist` now correctly caches files as `jpg`. Previously they were saved as `png` with a `jpg` extension. Existing users may consider deleting their existing `js_smooth_cache` folder.

track info + spectrogram seekbar + buttons looks like this...

(https://i.imgur.com/HO7OvIB.png)
Title: Re: JScript Panel
Post by: Majestyk on 2021-08-14 21:25:54
I'm trying to update Tedgo's Darkone Mod from 2016 to the latest Jscript DLL. I already updated his original V4 but his 2016 Mod is a little more finicky. This line here (from Global Buttons)  comes up with a type mismatch error...
Quote
   this.draw = function(gr) {
      gr.FillSolidRect(this.left, this.top, this.w, this.h, this.col);
      gr.DrawRect(this.left, this.top, this.w, this.h, 1, 0xFF000000);
   }

I know it's because it doesn't like the FillSolidRectangle being lumped in with "draw".  Any chance you could steer me in the right direction? I have the whole code below.

Thanks!

(BTW, thanks for those above mentioned updates)


Quote
// DarkOne4Mod - Drawbutton Object
// Code by tedGo, based on a sample by T.P. Wang

var ButtonStates = {normal: 0, hover: 1, down: 2, hide: 3};
var Buttons = {};
var g_down = false;

// ----- CREATE DRAWBUTTON OBJECT --------------------------------------
var g_tooltip;

function Button(x, y, w, h, btn_col, func, tiptext) {
   this.left = x;
   this.top = y;
   this.w = w;
   this.h = h;
   this.right = x + w;
   this.bottom = y + h;
   this.func = func;
   this.tiptext = tiptext;
   this.state = ButtonStates.normal;
   this.col_normal = btn_col && btn_col.normal ? btn_col.normal : null;
   this.col_hover = btn_col && btn_col.hover ? btn_col.hover : this.col_normal;
   this.col_down = btn_col && btn_col.down ? btn_col.down : this.col_hover;
   this.col = this.col_normal;

   this.traceMouse = function(x, y) {
      if (this.state == ButtonStates.hide) return false;

      var b = (this.left < x) && (x < this.right) && (this.top < y) && (y < this.bottom);

      if (b)
         g_down ? this.changeState(ButtonStates.down) : this.changeState(ButtonStates.hover);
      else
         this.changeState(ButtonStates.normal);
      return b;
   }

   this.changeState = function(newstate) {
      newstate != this.state && window.RepaintRect(this.left, this.top, this.w, this.h);
      this.state = newstate;
      switch (this.state) {
         case ButtonStates.normal:
            this.col = this.col_normal;
            break;

         case ButtonStates.hover:
            this.col = this.col_hover;
            break;

         case ButtonStates.down:
            this.col = this.col_down;
            break;

         default:
            this.col = null;
      }
   }

   this.changePos = function(x, y, w, h) {
      this.left = x;
      this.top = y;
      this.w = w;
      this.h = h;
      this.right = x + w;
      this.bottom = y + h;
   }

   this.draw = function(gr) {
      gr.FillSolidRect(this.left, this.top, this.w, this.h, this.col);
      gr.DrawRect(this.left, this.top, this.w, this.h, 1, 0xFF000000);
   }

   this.repaint = function() {
      window.RepaintRect(this.left, this.top, this.w, this.h);
   }

   this.onClick = function() {
      this.func && this.func();
   }

   this.onMouseIn = function() {
      g_tooltip = window.CreateTooltip();
      g_tooltip.Text = this.tiptext;
      g_tooltip.Activate();
   }

   this.onMouseOut = function() {
      g_tooltip.Deactivate();
      g_tooltip.Dispose();
   }
}

function buttonsDraw(gr) {
   for (var i in Buttons) {
      Buttons.draw(gr);
   }
}

function buttonsTraceMouse(x, y) {
   var btn = null;
   for (var i in Buttons) {
      if (Buttons.traceMouse(x, y) && !btn)
         btn = Buttons;
   }
   return btn;
}

Title: Re: JScript Panel
Post by: marc2k3 on 2021-08-14 21:48:28
Code: [Select]
this.col_normal = btn_col && btn_col.normal ? btn_col.normal : null;

That looks suspect to me. A fallback for a colour should never be null. Any function expecting a colour argument would fail if you pass that to it.

There doesn't seem to be anything wrong with the rectangle code- it looks valid enough but that depends on the values of the args passed to it.

You can easily check all the values belonging to this like um.... this...

Code: [Select]
fb.ShowPopupMessage(JSON.stringify(this, null, 4));

If any of the top,left.width,height or colour args look suspect, now you know.

And of course g_tooltip should be created once outside the scope of any functions/objects and never disposed.
Title: Re: JScript Panel
Post by: Majestyk on 2021-08-14 23:12:11
Thanks! I seem to have it working now. You're correct (of course) about the Fill line. That was not the culprit.
Title: Re: JScript Panel
Post by: grimes on 2021-08-15 08:49:16
Spectrogram does not work in ColumnsUI.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-08-15 09:01:51
Works for me....

(https://i.imgur.com/WkJjJ9L.png)

but of course I probably wasn't explicit enough about the need for sox and ffmpeg. I kind of assumed anyone who was going to use it had used previous versions I'd posted as standalone scripts.

These paths in the script need to point at valid files which you need to download and extract yourself.

Code: [Select]
var sox_exe = fb.ProfilePath + "sox\\sox.exe";
var ffmpeg_exe = fb.ProfilePath + "sox\\ffmpeg.exe";

I'll add some notes for the next version.

edit: links added here... https://github.com/marc2k3/foo_jscript_panel/commit/744e01658e1a398723a8d574057ce4e30029fdd5
Title: Re: JScript Panel
Post by: grimes on 2021-08-15 09:32:33
Thanks, that works.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-08-17 04:37:23
https://github.com/marc2k3/foo_jscript_panel/releases

## v2.6.2.3
- The `JS Smooth Browser` filter box now supports proper `Media Library` queries.
- The filter box has been removed from `JS Smooth Playlist` as it was functionally useless. It's not possible to select/play from a filtered playlist without modifying playlist content which is beyond the scope of what any playlist viewer should do.
- `JS Smooth Playlist Manager` now has some new features added such as the ability to restore/purge deleted playlists, edit/remove playlist locks that belong to `JScript Panel` and playlists can be sorted by name. All options are available on the right click menu although may be hidden if the filter is active.
Title: Re: JScript Panel
Post by: MojoBass on 2021-08-18 06:12:24
@Marc: thanks very much for your continuos great work on the 'smooth' samples!
A feature wish from my side for the JS Smooth Browser (jssb) would be to add at the 'columns' selection additional to 'Album' and 'Artist' (+ 'Genre' at the SMP version) the choice 'Album Artist'.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-08-18 18:14:11
You might be better off using Library Tree for SMP in album art grid mode, That has more options than you can shake a stick at.

I just noticed that artist mode sorting in the latest version of JS Smooth Browser is utterly borked so I'll try and get a fix out sharpish. edit: nope, it's ok. I was testing something that was borked.
Title: Re: JScript Panel
Post by: MojoBass on 2021-08-22 07:36:48
Thanks for the hint! Tried LIbrary Tree (for Album Artist) with jsplaylist-mod (which I definitely want to use as it got great features+look), which corresponds not as good as jssb/jsplaylist-mod, but its ok.
Old jssb script allowed straightforward own modification to get Artist->Album Artist, however for the new script I did not manage so far...
Title: Re: JScript Panel
Post by: marc2k3 on 2021-08-22 10:04:36
I'm testing jssb album artist support at the moment. Most of the code is utterly baffling to me and it's really hard to pick apart.... but I have fixed a lot of bugs in the last few days. The next release should be much better.

As for JSplaylist, people might not like the changes. I've really taken a machete to it and stripped out huge chunks.  :))
Title: Re: JScript Panel
Post by: MojoBass on 2021-08-23 05:02:20
Great, thanks very much in advance, looking forward to both the album artist and the machete updates  :) .
I am currently mostly on SMP, so I would go back to JSP as I'd assume you are currently updating the JSP versions.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-08-23 08:57:09
The scripts aren't ready yet but I've detailed what's going on in the changelog.

https://github.com/marc2k3/foo_jscript_panel/blob/develop/CHANGELOG.md
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-03 05:31:05
I've have a new beta version for testing. For existing users, all included samples are broken until reloaded from the `Samples` menu in the config window. You have been warned.

https://github.com/marc2k3/foo_jscript_panel/releases

edit: while messing around with Br3tt's scripts I did find a gnarly bug which I should remind people not to do. Do not build menus/use TrackPopupMenu inside a timer. This blocks timer execution across all panels and the same would happen if you spawned modal dialogs such as the ColourPicker so don't do that either!!
Title: Re: JScript Panel
Post by: Forfit on 2021-09-03 06:30:59
Quote
The MeasureStringInfo interface and associated gr.MeasureString method have been removed.
How replace it?
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-03 06:42:49
For a single line of text, you have the .Height property of whatever font you're using and you can use gr.CalcTextWidth("some _text", my_font) to determine the width.

For multiple lines of text, I'd really recommend using GdiDrawText over DrawString and then you'll get accurate results using gr.EstimateLineWrap. I can help if you have some code that needs updating.
Title: Re: JScript Panel
Post by: Forfit on 2021-09-03 06:46:17
Code: [Select]
function calc_lines(ctab) {
var i, j;
var padx = 0;
g_tab_length = 0;
for (i = 0; i < ctab.length; i++) {
// calc sentence #lines to display / window.width
if (ctab[i].type !== null) {
var tmp_img = gdi.CreateImage(ww - (H_PADDING * 2) - padx, 100);
var gp = tmp_img.GetGraphics();
var lineh = gp.MeasureString(ctab[i].text, g_font, 0, 0, ww - (H_PADDING * 2) - padx, wh).Height;
ctab[i].total_lines = (lineh / LINE_HEIGHT) > Math.floor(lineh / LINE_HEIGHT) ? Math.floor(lineh / LINE_HEIGHT) + 1 : Math.floor(lineh / LINE_HEIGHT);
ctab[i].ante_lines = 0;
for (j = 0; j < i; j++) {
ctab[i].ante_lines += ctab[j].total_lines;
}
CollectGarbage();
}
g_tab_length += ctab[i].total_lines;
}
return ctab;
}

Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-03 07:18:13
I'm really confused as to what's going on there but maybe these lines...

Code: [Select]
			var lineh = gp.MeasureString(ctab[i].text, g_font, 0, 0, ww - (H_PADDING * 2) - padx, wh).Height;
ctab[i].total_lines = (lineh / LINE_HEIGHT) > Math.floor(lineh / LINE_HEIGHT) ? Math.floor(lineh / LINE_HEIGHT) + 1 : Math.floor(lineh / LINE_HEIGHT);

can be replaced with...

Code: [Select]
ctab[i].total_lines = gr.EstimateLineWrap(ctab[i].text, g_font, ww - (H_PADDING * 2) - padx).toArray().length / 2;
Title: Re: JScript Panel
Post by: Forfit on 2021-09-03 07:21:02
I can to mantain MovePlaylistSelection (word instruction) or simply replace it with MovePlaylistSelectionV2?
ty.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-03 07:35:52
Just leave the old one alone. It's staying put.
Title: Re: JScript Panel
Post by: Forfit on 2021-09-03 08:38:07
I'm really confused as to what's going on there but maybe these lines...

Code: [Select]
			var lineh = gp.MeasureString(ctab[i].text, g_font, 0, 0, ww - (H_PADDING * 2) - padx, wh).Height;
ctab[i].total_lines = (lineh / LINE_HEIGHT) > Math.floor(lineh / LINE_HEIGHT) ? Math.floor(lineh / LINE_HEIGHT) + 1 : Math.floor(lineh / LINE_HEIGHT);

can be replaced with...

Code: [Select]
ctab[i].total_lines = gr.EstimateLineWrap(ctab[i].text, g_font, ww - (H_PADDING * 2) - padx).toArray().length / 2;

I get error:
'gr' not is defined

not solve trying to add:
var _bmp = gdi.CreateImage(1, 1);
var _gr = _bmp.GetGraphics();

or

@import "%fb2k_component_path%samples\js\helpers.js"
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-03 08:39:18
Sorry that should have been gp
Title: Re: JScript Panel
Post by: Forfit on 2021-09-03 08:43:00
Sorry that should have been gp
in the examples is _gr.EstimateLineWrap.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-03 09:21:12
The script snippet you posted was using this

Code: [Select]
var tmp_img = gdi.CreateImage(ww - (H_PADDING * 2) - padx, 100);
var gp = tmp_img.GetGraphics();

which is why you must use gp.

Ignore what's in the helper files. Only use those in new scripts, never try and import them in to existing ones.

Title: Re: JScript Panel
Post by: Forfit on 2021-09-03 09:22:10
I now get error:
Object not support the property or method 'toArray'

In interfaces.txt I read that EstimateLineWrap return "width of text line 1" not height.
I would replace MeasureString and get .height.
With MeasureString I get values as 50,54296875.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-03 09:32:35
The function returns an array which is always even numbered in length. To get the number of rows of text, you must half that number like the example I posted (.length / 2)

Code: [Select]
ctab[i].total_lines = gp.EstimateLineWrap(ctab[i].text, g_font, ww - (H_PADDING * 2) - padx).toArray().length / 2

The name of the variable total_lines implied that was desired result.

If you want the total height in pixels then you must multiply that number by the height of the font (or predefined row height).

I'm done now. I need a lie down.
Title: Re: JScript Panel
Post by: Forfit on 2021-09-03 10:12:53
Code: [Select]
ctab[i].total_lines = gp.EstimateLineWrap(ctab[i].text, g_font, ww - (H_PADDING * 2) - padx).toArray().length / 2
It work removing "/2".
Scripts updated, ty.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-04 03:43:42
Dividing the length of the array by 2 is not optional. If it's determined a certain chunk of text needs 5 rows to be displayed, the array is always going to have a length of 10. Using the array length as-is is wildly inaccurate. This has been fixed behaviour since it was added to WSH panel mod many years before JScript Panel was even a thing.

I've updated the wiki to make it more readable.

https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes

(https://i.imgur.com/JIWlM1Q.png)

Title: Re: JScript Panel
Post by: MojoBass on 2021-09-04 06:47:55
I've have a new beta version for testing.
From first glimpse: works really good and stable, thanks for your passion + including Album Artist option in JS Smooth Browser!
Still quite some work on my side to get everything updated...
Title: Re: JScript Panel
Post by: MojoBass on 2021-09-05 07:27:20
Font size at JSP2.7.0b1 with CUI1.7.0b1: everything works well at JS Smooth, however for JSPlaylist a tiny font size is shown, which does not change when font size is adapted under Preferences/Display/Columns Ui/Colours and Fonts. Font type is changing at JSPlaylist as intended, only font size can not be adapted.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-05 08:33:25
Yep the size is fixed at the moment. I might work on it at some point in the future but for now, people will have to stick with the old component available on the releases page (while 2.7.0 is Beta) or on the old versions page (available now and always in the future - https://github.com/marc2k3/foo_jscript_panel/wiki/Old-Versions).

Beta.2 is out which fixes a few Smooth sample glitches and allows loving/unloving tracks on Last.fm directly from JS Playlist when you have foo_lastm_playcount_sync installed.

https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: MojoBass on 2021-09-05 09:42:15
Yep the size is fixed at the moment. I might work on it at some point in the future
Would be great if font size for JS Playlist would as well be adaptable... can't use it like that on my Surface Go...
For JS Playlist I stay with the SMP version until then.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-05 10:42:41
Surface Go...

You'll need to buy me one of those for testing!! :D
Title: Re: JScript Panel
Post by: MojoBass on 2021-09-05 10:59:31
Hmm, no idea where to ship... 8)
Title: Re: JScript Panel
Post by: Lucidae on 2021-09-05 14:30:57
Back by unpopular demand is my ye olde sox spectrogram seekbar from the WSH panel mod days.
I really do love this spectrogram, certainly an improvement over the DUI visualizer. Thanks for adding it back!
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-06 01:25:31
@MojoBass  - I've updated JS Playlist if you want to test it.

Go to the homepage

https://github.com/marc2k3/foo_jscript_panel

and click the green Code button and download the zip. Then browse inside the component folder and extract the contents in to your user-components\foo_jscript_panel folder. Keep your dll because this zip doesn't contain it.

edit: it only supports font size changes in the preferences. There is no mouse wheel zoom support.
Title: Re: JScript Panel
Post by: MojoBass on 2021-09-06 05:15:34
@Marc: wow, thanks very much, works exactly as I need it + that was really fast!! Great!
Can use it now even on on my Surface Go :-)
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-06 09:03:38
Beta.3 is more sample fixes. No component changes.

https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: Lucidae on 2021-09-06 11:54:11
Please forgive the OCD nature of this post...

I've been playing with the album art sample script and can't manage to get perfect scaling (ie. clean edges) with either the "center" or "stretch" modes. A custom background color makes it more noticeable, with a 1px border around the sides.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-06 12:15:40
You certainly won't get visible background in the crop or stretch modes. If you can see them in centre mode, the aspect of the panel does not match the image (or possibly rounding errors???)

If you don't like the current behaviour, copy this in to your panel and edit away.

Code: [Select]
function _drawImage(gr, img, src_x, src_y, src_w, src_h, aspect, border, alpha) {
if (!img) {
return [];
}
gr.SetInterpolationMode(7);
switch (aspect) {
case image.crop:
case image.crop_top:
if (img.Width / img.Height < src_w / src_h) {
var dst_w = img.Width;
var dst_h = Math.round(src_h * img.Width / src_w);
var dst_x = 0;
var dst_y = Math.round((img.Height - dst_h) / (aspect == image.crop_top ? 4 : 2));
} else {
var dst_w = Math.round(src_w * img.Height / src_h);
var dst_h = img.Height;
var dst_x = Math.round((img.Width - dst_w) / 2);
var dst_y = 0;
}
gr.DrawImage(img, src_x, src_y, src_w, src_h, dst_x + 3, dst_y + 3, dst_w - 6, dst_h - 6, 0, alpha || 255);
break;
case image.stretch:
gr.DrawImage(img, src_x, src_y, src_w, src_h, 0, 0, img.Width, img.Height, 0, alpha || 255);
break;
case image.centre:
default:
var s = Math.min(src_w / img.Width, src_h / img.Height);
var w = Math.floor(img.Width * s);
var h = Math.floor(img.Height * s);
src_x += Math.round((src_w - w) / 2);
src_y += Math.round((src_h - h) / 2);
src_w = w;
src_h = h;
var dst_x = 0;
var dst_y = 0;
var dst_w = img.Width;
var dst_h = img.Height;
gr.DrawImage(img, src_x, src_y, src_w, src_h, dst_x, dst_y, dst_w, dst_h, 0, alpha || 255);
break;
}
if (border) {
gr.DrawRect(src_x, src_y, src_w - 1, src_h - 1, 1, border);
}
return [src_x, src_y, src_w, src_h];
}

edit: this assumes you have the latest beta installed. Previous versions use a different implementation.
Title: Re: JScript Panel
Post by: Lucidae on 2021-09-06 13:36:25
You certainly won't get visible background in the crop or stretch modes. If you can see them in centre mode, the aspect of the panel does not match the image (or possibly rounding errors???)
Well I attempted to rule out rounding errors by using a panel and image size of evenly divisible proportions.
See the attached image showing centered mode, in which the panel is 300x300 and the album art is 600x600, the background color (green) is still visible around the edges.

edit: this assumes you have the latest beta installed. Previous versions use a different implementation.
I am on v2.7.0 beta 2
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-06 14:05:48
Try pasting this in your panel then...

Code: [Select]
function _drawImage(gr, img, src_x, src_y, src_w, src_h, mode, border, alpha) {
if (!img) {
return [];
}
var is_square = src_w == src_h && img.Width == img.Height;
gr.SetInterpolationMode(7);
switch (true) {
case is_square:
case mode == image.stretch:
gr.DrawImage(img, src_x, src_y, src_w, src_h, 0, 0, img.Width, img.Height, 0, alpha || 255);
break;
case mode == image.crop:
case mode == image.crop_top:
if (img.Width / img.Height < src_w / src_h) {
var dst_w = img.Width;
var dst_h = Math.round(src_h * img.Width / src_w);
var dst_x = 0;
var dst_y = Math.round((img.Height - dst_h) / (aspect == image.crop_top ? 4 : 2));
} else {
var dst_w = Math.round(src_w * img.Height / src_h);
var dst_h = img.Height;
var dst_x = Math.round((img.Width - dst_w) / 2);
var dst_y = 0;
}
gr.DrawImage(img, src_x, src_y, src_w, src_h, dst_x + 3, dst_y + 3, dst_w - 6, dst_h - 6, 0, alpha || 255);
break;
case mode == image.centre:
default:
var s = Math.min(src_w / img.Width, src_h / img.Height);
var w = Math.ceil(img.Width * s);
var h = Math.ceil(img.Height * s);
src_x += Math.floor((src_w - w) / 2);
src_y += Math.floor((src_h - h) / 2);
src_w = w;
src_h = h;
var dst_x = 0;
var dst_y = 0;
var dst_w = img.Width;
var dst_h = img.Height;
gr.DrawImage(img, src_x, src_y, src_w, src_h, dst_x, dst_y, dst_w, dst_h, 0, alpha || 255);
break;
}
if (border) {
gr.DrawRect(src_x, src_y, src_w - 1, src_h - 1, 1, border);
}
return [src_x, src_y, src_w, src_h];
}

This automatically skips calculations of any kind if the target area and image are both square and draws the image as-is like stretch mode does.
Title: Re: JScript Panel
Post by: Lucidae on 2021-09-06 14:49:45
This automatically skips calculations of any kind if the target area and image are both square and draws the image as-is like stretch mode does.
That does produce better results, thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-06 17:26:49
I'll probably make that the new default then. Thanks for confirming.
Title: Re: JScript Panel
Post by: MojoBass on 2021-09-07 05:02:21
Just for notification - not that it's a 'problem': second line in JS Playlist is - unlike to JS Smooth Playlist - not 'dimmed' any more.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-07 07:28:52
I noticed this the other day and I forgot to fix it. Thanks for the reminder!  8)

edit: fixed file is here if you want it now

https://raw.githubusercontent.com/marc2k3/foo_jscript_panel/89b3cd8481705fb827f25dfad1559ada66e85363/component/samples/jsplaylist/playlist.js
Title: Re: JScript Panel
Post by: MojoBass on 2021-09-08 04:54:48
The fix works, thanks very much!!
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 11:27:37
Beta.4 is just more sample fixes.

https://github.com/marc2k3/foo_jscript_panel/releases

Hopefully the last one.
Title: Re: JScript Panel
Post by: grimes on 2021-09-10 12:11:52
Got error:
Quote
JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003)
Laufzeitfehler in JavaScript:
"_" ist undefiniert
File: <main>
Line: 11, Col: 1
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 12:24:51
I know huge walls of text can be off putting but this is the first sentence.

Quote
The changelog for this release is bit of a monstrosity but if you use any of the included Samples, you really need to read that section. All of them will fail to load until you take the steps described below.

Specifically...

Quote
The internal file structure for all samples has changed meaning existing users will see blank panels or script errors on their first run. The scripts inside the panels must be updated from the Configuration Window Samples menu.
Title: Re: JScript Panel
Post by: grimes on 2021-09-10 12:29:52
I did an update of thumbs. restart foobar2000 -> error message
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 13:03:17
Cannot reproduce

(https://i.imgur.com/B2rrn6y.gif)

What is the code on line 11 of your script since that is where the error is pointing?



Title: Re: JScript Panel
Post by: grimes on 2021-09-10 14:09:55
You didn't install the panel and you didn't restart foobar2000. Your are working in the scratchbox.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 14:15:30
You never have to restart foobar when updating scripts. And the scratchbox thing is irrelevant.

If you upgraded from a previous version of the component, you had code saved in the panel that causes that exact error. Updating from the Samples menu like I clearly instructed overwrites the text in the panel and the problem is gone.

Now answer the question about the code on line 11.
Title: Re: JScript Panel
Post by: grimes on 2021-09-10 14:20:01
Did you never shutdown foobar2000 in your life? I shutdown my foobar2000 after a session and daily I shutdown Windows.

11: var thumbs = new _thumbs();
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 14:30:36
I can't believe you're struggling with such a basic concept. :/

(https://i.imgur.com/2Hbe3Xm.gif)
Title: Re: JScript Panel
Post by: nikolai4ik on 2021-09-10 14:31:08
Guys, hi, can you help me? I have a button with this function:

function(){fb.RunContextCommand('Tagging/Get tags from MusicBrainz (by artist & album)')});
however it doesn't work on selected items, only on now playing single item. How do I make it work with selection?
Title: Re: JScript Panel
Post by: grimes on 2021-09-10 14:36:42
I know that. I did that.  I imported the sample thumbs. I say it the last time: You didn't shutdown foobar2000 and restart some time after installation and importing. The error message is cosmetic, the panel is working.

Image: panel working, but error message after restart
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 14:51:19
And you think constantly building/testing components doesn't require me to restart foobar2000... a lot. OK then. :/

I'll happily concede to there being bugs and fixing them if you can point them out.

This error....

JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003)
Laufzeitfehler in JavaScript:
"_" ist undefiniert
File: <main>
Line: 11, Col: 1

can not exist when there is no instance of any _ variable in the updated thumbs script (like there is in the old version).

Please don't tell me you have multiple instances and have only updated one or something like that? I vaguely recall a situation like that happening with you before....

For the record, initialising scripts from clicking OK/Apply is identical to how they are handled on startup. Deep down you know that, right?
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 14:57:48
Guys, hi, can you help me? I have a button with this function:

function(){fb.RunContextCommand('Tagging/Get tags from MusicBrainz (by artist & album)')});
however it doesn't work on selected items, only on now playing single item. How do I make it work with selection?

You'll need to use fb.RunContextCommandWithMetadb. You can pass it a handle list like this for selected playlist items

Code: [Select]
var items = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
fb.RunContextCommandWithMetadb('Tagging/Get tags from MusicBrainz (by artist & album)', items);

Title: Re: JScript Panel
Post by: grimes on 2021-09-10 15:07:52
My console output:

Quote
[16:05:38] Components loaded in: 0:00.194916
[16:05:39] Configuration read in: 0:00.074945
[16:05:39] foobar2000 v1.6.7 [standard]
[16:05:40] Watching: G:\mp3
[16:05:40] JScript Panel v2.7.0-Beta.4 (codec icon v1 by grimes): initialised in 11 ms
[16:05:40] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): initialised in 128 ms
[16:05:40] JScript Panel v2.7.0-Beta.4 (JS Smooth Browser v2021-mod by Br3tt aka Falstaff): initialised in 24 ms
[16:05:40] JScript Panel v2.7.0-Beta.4 (Spectrogram Seekbar by marc2003): initialised in 34 ms
[16:05:41] Filter Panel - Genre: initialised in 0.133 s
[16:05:41] Filter Panel - Composer: initialised in 0.063 s
[16:05:41] Filter Panel - Album: initialised in 0.106 s
[16:05:41] Album list panel: initialised in 0.161 s
[16:05:41] Album list panel: initialised in 0.195 s
[16:05:41] Album list panel: initialised in 0.194 s
[16:05:42] Album list panel: initialised in 0.542 s
[16:05:42] Album list panel: initialised in 0.203 s
[16:05:42] Album list panel: initialised in 0.201 s
[16:05:43] Album list panel: initialised in 0.221 s
[16:05:43] Album list panel: initialised in 0.207 s
[16:05:43] Album list panel: initialised in 0.236 s
[16:05:43] Album list panel: initialised in 0.211 s
[16:05:43] Album list panel: initialised in 0.214 s
[16:05:44] Album list panel: initialised in 0.233 s
[16:05:44] Album list panel: initialised in 0.364 s
[16:05:44] Album list panel: initialised in 0.242 s
[16:05:45] Album list panel: initialised in 0.575 s
[16:05:45] Album list panel: initialised in 0.519 s
[16:05:47] Album list panel: initialised in 1.194 s
[16:05:47] Album list panel: initialised in 0.291 s
[16:05:49] Album list panel: initialised in 1.619 s
[16:05:49] Album list panel: initialised in 0.289 s
[16:05:49] Playlist view initialised in: 0.009 s
[16:05:50] User Interface initialized in: 0:10.665007
[16:05:50] Graphic Equalizer: initialized (SSE support: 3)
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): file not found C:\Users\Lange\AppData\Roaming\foobar2000\user-components\foo_jscript_panel\samples\complete\js\lodash.min.js
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): file not found C:\Users\Lange\AppData\Roaming\foobar2000\user-components\foo_jscript_panel\samples\complete\js\helpers.js
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): file not found C:\Users\Lange\AppData\Roaming\foobar2000\user-components\foo_jscript_panel\samples\complete\js\panel.js
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): file not found C:\Users\Lange\AppData\Roaming\foobar2000\user-components\foo_jscript_panel\samples\complete\js\thumbs.js
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003)
Laufzeitfehler in JavaScript:
"_" ist undefiniert
File: <main>
Line: 11, Col: 1
[16:05:51] FFmpeg version: 4.3.1
[16:05:54] Autoplaylists initialized in: 0:03.146417
[16:05:54] "5 Star" : 0:00.292334
[16:05:54] "Alexander Scriabin" : 0:00.062100
[16:05:54] "Alfred Schnittke" : 0:00.029562
[16:05:54] "All Music" : 0:00.025769
[16:05:54] "Allan Pettersson" : 0:00.036881
[16:05:54] "Anton Bruckner" : 0:00.048938
[16:05:54] "Antonin Dvorak" : 0:00.038408
[16:05:54] "Arnold Bax" : 0:00.038855
[16:05:54] "Arnold Schönberg" : 0:00.026662
[16:05:54] "BPM" : 0:00.195803
[16:05:54] "Bela Bartok" : 0:00.035823
[16:05:54] "Benjamin Britten" : 0:00.036386
[16:05:54] "Bohuslav Martinu" : 0:00.025367
[16:05:54] "Bootleg" : 0:00.028182
[16:05:54] "Carl Nielsen" : 0:00.031966
[16:05:54] "Charles Ives" : 0:00.023215
[16:05:54] "Classical" : 0:00.029137
[16:05:54] "Darius Milhaud" : 0:00.024464
[16:05:54] "Dmitri Shostakovich" : 0:00.048681
[16:05:54] "Eduard Tubin" : 0:00.023795
[16:05:54] "Egon Wellesz" : 0:00.045751
[16:05:54] "Einar Englund" : 0:00.027141
[16:05:54] "Einojuhani Rautavaara" : 0:00.025916
[16:05:54] "Ernst Krenek" : 0:00.025240
[16:05:54] "Ernst Toch" : 0:00.025351
[16:05:54] "Franz Schubert" : 0:00.026419
[16:05:54] "Frederic Chopin" : 0:00.031608
[16:05:54] "Gian Francesco Malipiero" : 0:00.024384
[16:05:54] "Gustav Holst" : 0:00.026724
[16:05:54] "Gustav Mahler" : 0:00.037495
[16:05:54] "Heitor Villa-Lobos" : 0:00.024274
[16:05:54] "Hilary Hahn" : 0:00.021155
[16:05:54] "Hugo Alfven" : 0:00.024184
[16:05:54] "Humphrey Searle" : 0:00.023324
[16:05:54] "Igor Stravinsky" : 0:00.035856
[16:05:54] "Isang Yun" : 0:00.022914
[16:05:54] "Jean Sibelius" : 0:00.024914
[16:05:54] "Jimi Hendrix" : 0:00.042790
[16:05:54] "Johann Sebastian Bach" : 0:00.036209
[16:05:54] "Johannes Brahms" : 0:00.017814
[16:05:54] "Josef Tal" : 0:00.023019
[16:05:54] "Jörg Widmann" : 0:00.024540
[16:05:54] "Kalevi Aho" : 0:00.016929
[16:05:54] "Karol Szymanowski" : 0:00.023430
[16:05:54] "King Crimson" : 0:00.027796
[16:05:54] "Last Added" : 0:00.148158
[16:05:54] "Last Played" : 0:00.183984
[16:05:54] "Led Zeppelin" : 0:00.046673
[16:05:54] "Lennox Berkeley" : 0:00.038608
[16:05:54] "Leonard Bernstein" : 0:00.027017
[16:05:54] "Ludwig van Beethoven" : 0:00.030849
[16:05:54] "Malcolm Arnold" : 0:00.023514
[16:05:54] "Martha Argerich" : 0:00.021664
[16:05:54] "Matthijs Vermeulen" : 0:00.026299
[16:05:54] "Michael Tippett" : 0:00.025322
[16:05:54] "Mieczyslaw Weinberg" : 0:00.023891
[16:05:54] "Mikis Theodorakis" : 0:00.024023
[16:05:54] "Morton Feldman" : 0:00.024136
[16:05:54] "Muse" : 0:00.021489
[16:05:54] "Neil Young" : 0:00.032149
[16:05:54] "Non Classical" : 0:00.049682
[16:05:54] "Official" : 0:00.035877
[16:05:54] "Olivier Messiaen" : 0:00.026092
[16:05:54] "Pink Floyd" : 0:00.069966
[16:05:54] "Playcount sorted" : 0:00.111139
[16:05:54] "Pyotr Ilyich Tchaikovsky" : 0:00.025005
[16:05:54] "Ralph Vaughan Williams" : 0:00.024367
[16:05:54] "Robert Simpson" : 0:00.024321
[16:05:54] "Rued Langgaard" : 0:00.026083
[16:05:54] "Sergei Prokofiev" : 0:00.036070
[16:05:54] "Supertramp" : 0:00.022208
[16:05:54] "Tangerine Dream" : 0:00.021924
[16:05:54] "Truls Mork" : 0:00.020350
[16:05:54] "Vanilla Fudge" : 0:00.022257
[16:05:54] "William Alwyn" : 0:00.023567
[16:05:54] "William Schuman" : 0:00.023786
[16:05:54] "Witold Lutoslawski" : 0:00.022491
[16:05:54] "Wolfgang Amadeus Mozart" : 0:00.023361
[16:05:54] "Yehudi Menuhin" : 0:00.021235
[16:05:54] "Yes" : 0:00.030822
[16:05:54] Startup time : 0:15.446396
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 15:12:59
The error message is cosmetic, the panel is working.

I missed this edit. No, that's impossible. That popup dialog would never present itself without the panel turning red/showing javascript error as my gif illustrates. Clearly you have multiple instances just as I guessed in my previous post.
Title: Re: JScript Panel
Post by: grimes on 2021-09-10 15:17:35
There is no folder "complete", or did I miss something.

Can't find multiple instances of thumbs.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 15:21:53
Correct, the internal folder structure has been updated as per my very first post.

Quote
    The internal file structure for all samples has changed meaning existing users will see blank panels or script errors on their first run. The scripts inside the panels must be updated from the Configuration Window Samples menu.

You've successfully updated one instance of a previous thumbs panel as can be seen from your console output.

Code: [Select]
[16:05:40] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): initialised in 128 ms

You have another instance which you have not updated.
Code: [Select]
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): file not found C:\Users\Lange\AppData\Roaming\foobar2000\user-components\foo_jscript_panel\samples\complete\js\lodash.min.js
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): file not found C:\Users\Lange\AppData\Roaming\foobar2000\user-components\foo_jscript_panel\samples\complete\js\helpers.js
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): file not found C:\Users\Lange\AppData\Roaming\foobar2000\user-components\foo_jscript_panel\samples\complete\js\panel.js
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003): file not found C:\Users\Lange\AppData\Roaming\foobar2000\user-components\foo_jscript_panel\samples\complete\js\thumbs.js
[16:05:50] JScript Panel v2.7.0-Beta.4 (Thumbs by marc2003)
Laufzeitfehler in JavaScript:
"_" ist undefiniert
File: <main>
Line: 11, Col: 1

Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 15:25:01
Can't find multiple instances of thumbs.

You have 2 artist images tabs in your previous screenshot. Could be a red herring but I don't see how you can expect anyone who isn't you to find it.
Title: Re: JScript Panel
Post by: nikolai4ik on 2021-09-10 15:28:00
Guys, hi, can you help me? I have a button with this function:

function(){fb.RunContextCommand('Tagging/Get tags from MusicBrainz (by artist & album)')});
however it doesn't work on selected items, only on now playing single item. How do I make it work with selection?

You'll need to use fb.RunContextCommandWithMetadb. You can pass it a handle list like this for selected playlist items

Code: [Select]
var items = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
fb.RunContextCommandWithMetadb('Tagging/Get tags from MusicBrainz (by artist & album)', items);
Thank you! But for me items variable only updates when I save the Jscript code, so properties window opens for items that were selected when I saved the script. Can you help me make it update "in real time"?
My button code is
Code: [Select]
if (bbtn3_b) Buttons.bottom3 = new Button(ww / 2 - 87, 90, 58, 14, b, function(){fb.RunContextCommandWithMetadb('Tagging/Get tags from MusicBrainz (by artist & album)', items);});
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-10 15:37:08
The var items... bit needs to go inside the function block

Code: [Select]
if (bbtn3_b)
    Buttons.bottom3 = new Button(ww / 2 - 87, 90, 58, 14, b, function () {
        var items = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
        fb.RunContextCommandWithMetadb('Tagging/Get tags from MusicBrainz (by artist & album)', items);
    });
Title: Re: JScript Panel
Post by: nikolai4ik on 2021-09-10 15:54:51
The var items... bit needs to go inside the function block

Code: [Select]
if (bbtn3_b)
    Buttons.bottom3 = new Button(ww / 2 - 87, 90, 58, 14, b, function () {
        var items = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
        fb.RunContextCommandWithMetadb('Tagging/Get tags from MusicBrainz (by artist & album)', items);
    });
Perfect, thank you very much!
Title: Re: JScript Panel
Post by: grimes on 2021-09-10 16:04:54
Deinstalled JScriptPanel completely with all panels in CUI Layout. Installed JScript Panel and the panels again. Now it works. It was a hidden stray JScript panel. Thanks for your patience.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-13 11:26:12
2.7.0 final has been released. Just a few minor sample fixes since the last beta.

https://github.com/marc2k3/foo_jscript_panel/releases

For anyone upgrading from 2.6.x or earlier, there are breaking changes and sample changes aplenty. Please check the big ol' wall of text or don't install it.

Old versions are available here: https://github.com/marc2k3/foo_jscript_panel/wiki/Old-Versions
Title: Re: JScript Panel
Post by: Forfit on 2021-09-13 11:32:59
Binary is missing.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-13 11:38:21
Thanks.

I didn't forget, I just didn't notice the upload had failed. Should be there now.
Title: Re: JScript Panel
Post by: Forfit on 2021-09-13 11:46:19
It is ok now, ty.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-16 16:37:31
v2.7.0.1 https://github.com/marc2k3/foo_jscript_panel/releases

Minor sample fixes, no component changes.

Anyone upgrading from v2.6.x or earlier still needs to check the horrible changelog for v2.7.0.
Title: Re: JScript Panel
Post by: DVS on 2021-09-18 18:14:20
What about "Last.fm Lover" button? Is it removed?
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-18 18:25:23
Oh crap, I removed it and forgot all about giving any advance warning. Since that's entirely my fault, I'll restore it.

I would prefer people use the last.fm playcount sync component in my signature. It has full track love/unlove support. That would mean importing your loved tracks again and using %lfm_loved% instead of %jsp_loved%. If that's not for you, the old script will be back soon.
Title: Re: JScript Panel
Post by: DVS on 2021-09-18 19:03:10
Thanks, They are both useful.
By the way, I noticed that the tagged track via Sync PlayCount Last.FM, is not displayed via Last.Fm Lover. In reverse order, it works fine.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-18 20:56:56
The script version is a bit gimped in the sense it never checks for updates if you've loved tracks via other means. The only way to update it is by importing all loved tracks again.

The component always checks every time a track is played so that's another benefit in addition to fetching/updating playcounts.

Anyway, script restored, you can download this zip...

https://github.com/marc2k3/foo_jscript_panel/archive/refs/heads/develop.zip

and extract the contents of the component folder in to your user-components\foo_jscript_panel folder. Keep your dll because this zip does not contain it.
Title: Re: JScript Panel
Post by: DVS on 2021-09-18 21:24:36
It works. Thanks again!
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-20 08:35:14
I've been messing around modding the DarkOne theme by Tedgo and updating it for the latest version of JSP. I've removed lots of components that appeared on the foobar2000 troubleshooter and replaced ELPlaylist with JS Playlist. The old visualisations have been removed and replaced with foo_musical spectrum. Many view options have been removed and replaced with more JSP. If anyone wants to try it out, grab it here...

https://github.com/marc2k3/foo_jscript_panel/wiki/files/DarkOne.zip
Title: Re: JScript Panel
Post by: grimes on 2021-09-20 16:45:55
Thank you very much marc2k3.

Small problem: Error: Image draw failed (h_iml)
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-20 17:16:18
Pretty much all included scripts with JSP require FontAwesome.

https://github.com/FortAwesome/Font-Awesome/blob/fa-4/fonts/fontawesome-webfont.ttf?raw=true

I'll update the readme in the zip.

edit: of course I assumed everyone was familiar with JS Playlist and that's why there is no playlist switcher - it's built in to the playlist itself. More instructions here...

https://github.com/marc2k3/foo_jscript_panel/blob/develop/component/samples/JS%20Playlist.txt

More bonus features include support for webp images in the album art panel AND playlist if you configure .webp in the main foobar2000 preferences. IIRC, wildcards won't pick it up.

Also, album art from radio streams can be displayed in the main panel when using fb2k v1.6.6 or later and of course a streaming site that provides it. I know of radioparadise which is mostly dad rock. There must be more out in the wild.
Title: Re: JScript Panel
Post by: grimes on 2021-09-20 18:18:36
The Quicksearch Icon is missing. Wrong path?
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-20 18:33:31
I think you have to browse for it manually as relative paths aren't supported. You might have to click where it should be, select Options and deselect Custom bitmap. Now select it again which will open a browse dialog. It's inside DarkOne2021\images (QS.bmp)
Title: Re: JScript Panel
Post by: grimes on 2021-09-20 19:02:07
Sorry for the many questions. How can I enable png covers in JS Playlist?
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-20 19:11:32
All scripts use the main foobar2000 preferences for album art (File>Preferences>Display>Album art>Front Cover>Search patterns). I try and mirror the behaviour you can expect in any normal DUI/CUI panel.

edit: there is one exception to that. I don't like the selection viewers option in the Preferences so my album art panel always tracks the playing item or selected item if playback is stopped. Using the right click menu, it can be configured to always follow the playlist selection regardless of what is playing. Showing library selections in my panels generally isn't supported but that's my choice on script writing only. The component has always had full support for those who want to create their own. (all inherited from WSH panel mod)
Title: Re: JScript Panel
Post by: grimes on 2021-09-20 19:16:26
Stupid, I forgot to restart. Thank you.
Title: Re: JScript Panel
Post by: grimes on 2021-09-21 08:25:37
Is your mod based on the last beta3 or the older version?
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-21 09:13:54
It was the newest version I could find on the german forum thread. Dated around 2019 though.
Title: Re: JScript Panel
Post by: grimes on 2021-09-22 14:11:17
Glitch in JS Playlist.
To reproduce:
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-22 16:58:11
I'll fix that and have a new component ready in a day or two. I'm working on something else before doing a full release.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-23 14:57:02
v2.7.1 https://github.com/marc2k3/foo_jscript_panel/releases

- `IMetadbHandle` `GetFileInfo` now takes an optional `full_info` argument which defaults to `false` if omitted to preserve original behaviour. If `true` the file is opened for reading and you can access tags that contain large chunks of text such as `LYRICS` which usually have their contents hidden behind the period character ever since `foobar2000` `v1.3` was released. When `full_info` is `true`, the return value must be checked before using. See docs for full details.
- Because of the above change, the `Text Reader` sample has been renamed to `Text Display` because it now can display the content of tags in full in addition to the previous text file read mode it had before. Use the right click menu to switch modes, customise the file path or tag etc.
- Restore `Last.fm lover` sample which was removed without notice in `v2.7.0`. Apologies for any inconvenience.
- Fix various `JS Playlist` bugs.

edit: I've also updated the DarkOne theme from a few posts ago with the new component. It also fixes a few other bugs.

https://github.com/marc2k3/foo_jscript_panel/wiki/files/DarkOne.zip

Anyone already using this should not extract the configuration folder as it would overwrite any customisations made to the playlist settings, custom buttons, other panel settings etc.
Title: Re: JScript Panel
Post by: Lucidae on 2021-09-24 10:39:18
Could the Spectrogram Seekbar be configured to display a spectrogram of the selected track if no track is playing?
Similar to the behavior of Waveform Minibar mod.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-24 14:16:41
I can do it but it will display cached images only. It will not generate new images as selection changes because it takes at least a few seconds each time.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-24 15:47:24
v2.7.2 https://github.com/marc2k3/foo_jscript_panel/releases

- Add `IThemeManager` `GetThemeColour`. See docs and the `basic\SimpleThemedButton` sample which now works properly with the `Windows` high contrast themes instead of having a fixed text colour which could clash with the background.
- The `spectrogram seekbar` and `track info + spectrogram seekbar + buttons` samples now display the cached spectrogram image for the selected track when playback is stopped. Existing users will need to update the scripts in their panels from the [Configuration Window](https://github.com/marc2k3/foo_jscript_panel/wiki/Configuration-Window) `Samples` menu.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-09-24 18:47:00
I made a small mistake updating the spectrogram seekbar scripts by not adding the callback that handles the playlist being switched when playback is stopped. The files bundled with the component have been updated but for anyone who already downloaded v2.7.2 and are using the updated script already, just add this inside your panel.

Code: [Select]
function on_playlist_switch() {
seekbar.item_focus_change();
}
Title: Re: JScript Panel
Post by: Lucidae on 2021-09-25 16:19:41
I can do it but it will display cached images only. It will not generate new images as selection changes because it takes at least a few seconds each time.
Glad to see this addition, thanks!
Title: Re: JScript Panel
Post by: sonvolt on 2021-10-03 15:45:22
Not bad mod Marc  , Nice what a refresh can do , not for me tho as I wish to keep the lists/albumlist/lyrics  panels as  per the original, had a little play trying to amend back to Tedgo/Gerhards panels but with little sucess.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-10-03 22:38:29
You can replace/reorder any of the 6 panels here.

(https://i.imgur.com/eLHTYv9.png)

After doing that, highlight the Panel Stack Splitter marked in green and click the Configure panel button.

(https://i.imgur.com/Ca8mWYS.png)

From here, you must ensure the Forced layout option is checked for any panels you've added and you can change the Caption used for the text labels which switch the panels.
Title: Re: JScript Panel
Post by: sonvolt on 2021-10-04 09:06:57
Great thanks for that , am away for a couple of days but will give this a go when i get back
Title: Re: JScript Panel
Post by: sonvolt on 2021-10-07 16:25:49

Thanks Marc , it was easier than i expected, i do have a horizontal scroll bar  along bottom of album list which i can't seem to get rid off.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-10-07 16:48:21
Dig in to the main Preferences>Media Library>Album list panel>Advanced tab.
Title: Re: JScript Panel
Post by: sonvolt on 2021-10-07 16:57:37
Dig in to the main Preferences>Media Library>Album list panel>Advanced tab.

Thank you   sorted  , your help is appreciated , can't wait for the w/e  so I can play about  some more .
Title: Re: JScript Panel
Post by: sonvolt on 2021-10-07 20:09:29

Hi Marc,

Sorry to be a pain , Probably another easy one for you,  ratings are displayed as boxes , a font issue I presume but font in CUI is set same as my original version of dark one , is there another setting im missing to display rating as *
Title: Re: JScript Panel
Post by: sonvolt on 2021-10-07 21:28:34

Ignore that one marc  solved rating by installing the fontawesome.webfont which I downloaded but never installed doh!
Title: Re: JScript Panel
Post by: sonvolt on 2021-10-09 14:27:21

Hi Marc, 

I've managed to re-add lyrics and my other mods but only  query I have is there a way to cycle the images ,   front/back etc.  when album is playing .

Title: Re: JScript Panel
Post by: marc2k3 on 2021-10-09 15:41:50
The album art script isn't really designed for that but you can right click>Configure and choose the Thumbs script from the Samples menu. It defaults to the same folder as the playing track and cycle mode is off but there are loads of options on the right click menu.
Title: Re: JScript Panel
Post by: sonvolt on 2021-10-09 16:16:05
The album art script isn't really designed for that but you can right click>Configure and choose the Thumbs script from the Samples menu. It defaults to the same folder as the playing track and cycle mode is off but there are loads of options on the right click menu.
Thanks for quick response , yes that option  works for me, more playing about on my secondary  system , but looking good.
Thanks again for your help/guidance..
Title: Re: JScript Panel
Post by: Majestyk on 2021-10-17 11:41:28
Thanks again for all your help, Marc. I finally got it done...

(The first 15 seconds is blurry)

https://www.youtube.com/watch?v=et-LNJdAQn4
Title: Re: JScript Panel
Post by: marc2k3 on 2021-11-11 10:35:19
https://github.com/marc2k3/foo_jscript_panel/releases

v2.7.2.1
- `gdi.Font` now throws an error if the supplied size is zero.
- Fix `JSPlaylist` drag/drop bugs caused by a change in `v2.7.1`.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-12-05 03:28:28
https://github.com/marc2k3/foo_jscript_panel/releases

v2.7.2.2
- The `thumbs` sample now supports multiple folders when in custom folder mode. Just separate each one with a `|`.
- Fix bug with `Text Display` sample where it used `utils.ReadUTF8` internally meaning `ANSI` and `UCS2-LE` files were not handled properly. It now uses `utils.ReadTextFile` which supports them.
- It's no longer possible to compile the component with `Visual Studio 2019`. `Visual Studio 2022` is now required.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-12-22 09:36:27
v2.7.3

https://github.com/marc2k3/foo_jscript_panel/releases

Some configuration window fixes.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-12-25 21:45:59
v2.7.3.1

edit: just pulled the release. I encountered an error from the lack of testing. Oops.
Title: Re: JScript Panel
Post by: marc2k3 on 2021-12-25 22:30:48
v2.7.3.2

https://github.com/marc2k3/foo_jscript_panel/releases

## v2.7.3.2
- Fix `JS Smooth Playlist` error when re-ordering playlists.

## v2.7.3.1
- Fix minor autocompete regressions in `v2.7.3`.
- `JS Smooth Playlist` and `JS Smooth Playlist Manager` now have support for custom background images in addition to the previous front cover support. `JS Smooth Browser` no longer supports background images of any kind.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-01 02:14:38
v2.7.4

https://github.com/marc2k3/foo_jscript_panel/releases

- The `Spectrogram Seekbar` samples no longer require `SoX` and use `ffmpeg` exclusively.

  For existing users using default settings, the difference should not be noticeable. However, if changes were made to the `SoX` options, these are no longer supported and you can use the `ffmpeg` options documented here instead:

  https://ffmpeg.org/ffmpeg-filters.html#showspectrumpic

  All previously cached images are now obsolete and can be removed using the relevant menu item when right clicking the panel.

- Fix `JS Smooth Playlist` bug where info bar didn't update when the active playlist was renamed.
- Remove `preprocessors` and `notes + hints` from the `Docs` folder. The content is now on the [wiki](https://github.com/marc2k3/foo_jscript_panel/wiki).
- Add `GitHub` menu to the [Configuration Window](https://github.com/marc2k3/foo_jscript_panel/wiki/Configuration-Window).
- More autocomplete fixes.

If anyone really wants to keep the old SoX version, remove this line from the preprocessor section at the start of the script.

Code: [Select]
// @import "%fb2k_component_path%samples\js\seekbar.js"

Now copy the contents of this file and insert it after the comments but before the code in your main panel script.

https://raw.githubusercontent.com/marc2k3/foo_jscript_panel/008a382716fad5f9bb9806eeacd70fb4a8d3128b/component/samples/js/seekbar.js

Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-01 02:52:30
The default looks the same as SoX

Code: [Select]
s=1024x128
(https://i.imgur.com/0aOvRRq.png)

Per channel
Code: [Select]
s=1024x128:mode=separate
(https://i.imgur.com/KSiTURw.png)

Different colour per channel
Code: [Select]
s=1024x128:mode=separate:color=channel
(https://i.imgur.com/hDSe3ij.png)

Rainbow
Code: [Select]
s=1024x128:color=rainbow
(https://i.imgur.com/1xftAlS.png)

Here's the link again for all colours/other options.

https://ffmpeg.org/ffmpeg-filters.html#showspectrumpic


Title: Re: JScript Panel
Post by: sveakul on 2022-01-01 03:30:24
Thanks for 2.7.4 marc2k3, nice New Year's gift!  Spectrogram image seems to be created a little faster now, am pointed at a 64-bit ffmpeg.exe (v4.4.1).  Nice to be able to change colors so easily.
Title: Re: JScript Panel
Post by: sveakul on 2022-01-01 19:00:51
Looks great added to my visualizer window!  Suggestion: an option for Cached images "Clear all on exit".

(https://i.imgur.com/EJKWsZg.png)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-02 05:17:32
I'm not adding it for everyone because scripts can't tell when they're being updated/removed from a layout and fb2k shutting down.

You can try this adding this in your main window so long as you know anything that causes the panel to reload will clear the images.

Code: [Select]
function on_script_unload() {
utils.ListFiles(spectrogram_cache).toArray().forEach(function (item) {
_deleteFile(item);
});
}
Title: Re: JScript Panel
Post by: sveakul on 2022-01-02 06:26:56
This script works beautifully, clearing image cache automatically when exiting Foobar.  Thank you, much appreciated!
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-08 08:21:36
v2.7.5

https://github.com/marc2k3/foo_jscript_panel/releases

- Add `plman.InvertSelection`. The included `JSPlaylist` and `JS Smooth Playlist` scripts have this option added to their context menus.
- The `Spectrogram Seekbar` samples now support files encoded with `exhale` if you use a special build of `ffmpeg` with `libfdk-aac` support. See here:

  https://hydrogenaud.io/index.php?topic=118888.msg1006624#msg1006624

  The script should auto-detect these files and update the command line it passes automatically. The only user action necessary is replacing the existing `ffmpeg` executable.
- `IMetadbHandle` `GetAlbumArt` may return the url of remote images when playing certain radio streams. Requires `foobar2000` `v1.6.6` or later. The included `Album Art` sample has been updated and tested with `radioparadise`.
Title: Re: JScript Panel
Post by: grimes on 2022-01-08 09:35:19
Want to remember:
Glitch in JS Playlist.
To reproduce:
  • mark an album in playlist. (click on header)
  • select track in album
  • selection of album remains (instead of track selection)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-08 09:48:32
I attempted to fix that before and even released a version with the "fix" before realising it had catastrophic side effects completely breaking drag/drop and selections not being released properly. Not sure I have the skills to fix it tbh. Although I've poked around the edges, the original code is not mine and large chunks of it are a mystery to me.
Title: Re: JScript Panel
Post by: stevehero on 2022-01-08 11:50:49
Thanks for this. 

I get this error after installing when I restarted FB2k.

My version of fb2k is 1.6.9.

Code: [Select]
JScript Panel v2.7.5 (id:202140)
JavaScript runtime error:
Object doesn't support property or method 'GetSysColor'
File: <main>
Line: 123, Col: 2
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-08 12:16:04
I changed the spelling of all internal methods to use the British English spelling of colour when v2.0.0 was released 4 years ago. Your previous version must have been ancient.  :o

All breaking changes are listed here:

https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes

Because I'm a terrible person, there have been numerous changes through the whole 2.x.x series - not just on the bump from v1 to v2.
Title: Re: JScript Panel
Post by: stevehero on 2022-01-08 12:37:59
Your previous version must have been ancient.  :o
Sorry, the previous version of what?

It was a fresh install of your component.

How can I fix this?
Title: Re: JScript Panel
Post by: grimes on 2022-01-08 12:42:07
Older scripts need to get updated, because there where a lot of changes in JScript Panel in the last years.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-08 12:46:00
If it was a fresh install, the only possible way of getting that error would be YOU importing or copy/pasting an old script in to the panel. If that's the case, then that script would need updating as per the breaking changes I linked to.

If you don't know or care about the existing contents inside that panel that couldn't possibly have got there other you putting it there, then hit the reset button or choose a new Sample from the samples menu.

Right click the panel>configure to open the configuration window...

https://github.com/marc2k3/foo_jscript_panel/wiki/Configuration-Window

Title: Re: JScript Panel
Post by: stevehero on 2022-01-08 14:00:35
:o Silly me I did have it installed and had a js for finding any whitespaces in all of my collection.

After rolling back to an older version of JSscript panel, I reset the panel and updated it to the new one. I still had the problem. Removing that panel and re-adding it worked.

The spectrogram script is amazing thanks.

I do have an issue with my older script but that's not related so I'll post elsewhere about this.

Here's that thread (https://hydrogenaud.io/index.php?topic=121983.msg1006684#msg1006684)
in case anyone can help.

Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-09 03:25:09
v2.7.5.1

https://github.com/marc2k3/foo_jscript_panel/releases

- Attempt to fix some weird `JS Playlist / JS Smooth Playlist` initialisation/refresh issues when contained within `Panel Stack Splitter`, specifically when `Forced layout` is enabled.
- `JS Smooth Browser` can now show `Media Library` contents only. The playlist option has been removed.
Title: Re: JScript Panel
Post by: Falstaff on 2022-01-09 09:27:15
After a long time away from this forum, it's nice to see JScript panel is still alive, big thanks to you Marc
Title: Re: JScript Panel
Post by: always.beta on 2022-01-09 15:46:56
Off topic, may I ask which plugin is at the top of your picture and can you share the configuration?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-09 17:34:11
After a long time away from this forum, it's nice to see JScript panel is still alive, big thanks to you Marc

:o  8)
Title: Re: JScript Panel
Post by: stevehero on 2022-01-09 17:41:07
Off topic, may I ask which plugin is at the top of your picture and can you share the configuration?
Yes, no problem. It's this https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Components/Musical_Spectrum_(foo_musical_spectrum)

Attached are the settings used.



Regarding this JScript panel and the Spectrogram Seekbar.

Is it possible to get the zoomed plots from it?

I've tried adding this to the Spectrogram Seekbar options but no joy.

Edit: Silly me this is the code for SoX. Perhaps ffmpeg can do similar?

Code: [Select]
s=128x128 -n remix 1 spectrogram -X 500 -y 1025 -z 120 -w Kaiser -S 1:00 -d 0:02

Here's the zoomed plot image that I was after.

(https://i.imgur.com/RlbaeK8.png)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-09 17:48:08
If those are SoX options then no.

https://github.com/marc2k3/foo_jscript_panel/blob/d33cef036f112474029b7b59c132de6047696cbb/component/samples/spectrogram%20seekbar.txt#L10L27

https://ffmpeg.org/ffmpeg-filters.html#showspectrumpic
Title: Re: JScript Panel
Post by: stevehero on 2022-01-09 17:58:39
If those are SoX options then no.
Thanks, I got excited and thought FFmpeg was capable of this like SoX.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-09 18:17:12
If you really want to use sox, edit this line inside the panel...

Code: [Select]
// @import "%fb2k_component_path%samples\js\seekbar.js"

Change it to something like

Code: [Select]
// @import "%fb2k_profile_path%my_scripts\seekbar.js"

Obviously the folder name can be anything you like. Do not put it inside the component folder but use the profile folder.

Now save this older copy of seekbar.js with sox support inside this new folder.

https://raw.githubusercontent.com/marc2k3/foo_jscript_panel/008a382716fad5f9bb9806eeacd70fb4a8d3128b/component/samples/js/seekbar.js

Finally, add this in your main panel next to the var ffmpeg_exe definition

Code: [Select]
var sox_exe = fb.ProfilePath + "sox\\sox.exe"; // just an example, must point at a folder containing sox and its bundled files

Just to be clear, this requires ffmpeg AND sox. ffmpeg is still used for decoding, the audio is then piped to sox which generates the image.
Title: Re: JScript Panel
Post by: stevehero on 2022-01-09 18:41:15
Thanks, I've had issues with SoX and files that have Unicode filenames. See https://sourceforge.net/p/sox/mailman/message/33072558/

If I had the knowledge I suppose FFmpeg could trim the playing file leaving the middle two seconds out to a temp copy and generate the spectrogram that way. This would be a better solution seeing as SoX fails for files with Unicode paths.

I've tested FFmpeg on this file `Låpsley - Operator (DJ Koze's Disco Edit)` and it works just fine.

I'll take a look at it and see if I can hack something together. 
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-09 18:43:14
If ffmpeg can decode the file, there is no issue. The audio data is piped to sox. And the script already hashes the image filename using fb2k's $crc32 title formatting function.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-12 08:43:30
Some advance warning of some upcoming breaking changes. I just can't help myself...

https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes#v280-unreleased
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-13 08:57:08
Nobody has asked for an alternative to using xmlttp ActiveXObjects but I've created one anyway. There are now methods utilising the foobar2000 SDK for online access...

https://github.com/marc2k3/foo_jscript_panel/releases

## v2.8.0-Beta.1
- Add `utils.GetRequestAsync` and `utils.PostRequestAsync`. These are for fetching plain text from a webserver and the result is sent to a new `on_http_request_done` callback.
- Add `utils.DownloadFileAsync` and `on_download_file_done` callback. Use this for downloading images or other binary files.
- The `last.fm lover` sample has been removed. The [breaking changes](https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes) page shows how you can retrieve an old copy from `GitHub` history and save it somewhere else if you really want to continue using it.
- The `IPlaybackQueueItem` interface has been removed. Also, the following methods have also been removed.

plman.AddItemToPlaybackQueue
plman.FindPlaybackQueueItemIndex
plman.GetPlaybackQueueContents

  Full management of the playback queue and display of queue indexes in scripted playlists is still possible. See the following page for full details.

  https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-14 06:38:38
https://github.com/marc2k3/foo_jscript_panel/releases

Changes in v2.8.0-Beta.2,

- (Beta.2) `JS Playlist` no longer shows a light coloured placeholder image as it could flash briefly on dark layouts waiting for the requested album art to load. Configure a stub image in the main `foobar2000` album art preferences if this leaves a blank space where an image used to be.
- (Beta.2) Add reminder to `Spectrogram` samples that files encoded with `Exhale` are supported if a special build of `ffmepg` with `libfdk-aac` support is used.
- (Beta.2) Refactor internal timer handling code.

See previous post for Beta.1 changes.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-15 10:22:37
v2.8.0-Beta.3

https://github.com/marc2k3/foo_jscript_panel/releases

- (Beta.3) `utils.GetRequestAsync` and `utils.PostRequestAsync` now have strict checks on the server response. Content type errors will be supplied in the `text` portion of the `on_http_request_done` callback. Please report any issues you encounter.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-15 13:51:16
v2.8.0-Beta.4

https://github.com/marc2k3/foo_jscript_panel/releases

- (Beta.4) Fix incomplete auto complete entry for `on_download_file_done`.
- (Beta.4) `utils.DownloadFileAsync` now checks the response and aborts if the size is unknown. Before this fix, supplying it with something it was not designed for like an audio stream url would have caused the background thread to run indefinitely without ever exiting.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-17 13:18:59
v2.8.0 (final)

https://github.com/marc2k3/foo_jscript_panel/releases

- Add `utils.GetRequestAsync` and `utils.PostRequestAsync`. These are for fetching plain text from a webserver and the result is sent to a new `on_http_request_done` callback.
- Add `utils.DownloadFileAsync` and `on_download_file_done` callback. Use this for downloading images or other binary files.
- The `last.fm lover` sample has been removed. The [breaking changes](https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes) page shows how you can retrieve an old copy from `GitHub` history and save it somewhere else if you really want to continue using it.
- The `IPlaybackQueueItem` interface has been removed. Also, the following methods have also been removed.

Code: [Select]
plman.AddItemToPlaybackQueue
plman.FindPlaybackQueueItemIndex
plman.GetPlaybackQueueContents

  Full management of the playback queue and display of queue indexes in scripted playlists is still possible. See the following page for full details.

  https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes

- `JS Playlist` no longer shows a light coloured placeholder image as it could flash briefly on dark layouts waiting for the requested album art to load. Configure a stub image in the main `foobar2000` album art preferences if this leaves a blank space where an image used to be.
- Fix bug with `JS Smooth Playlist Manager` where the selected playlist (as opposed to active playlist) was not highlighted.
- Refactor internal timer handling and management of multiple threads for async methods.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-19 13:06:21
v2.8.0.1

https://github.com/marc2k3/foo_jscript_panel/releases

- Fix `JS Playlist` item selection bug when the `Cover` column was enabled.
- Fix issue with `JS Playlist / JS Smooth` scrollbar sizes if DPI was increased.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-24 20:43:03
https://github.com/marc2k3/foo_jscript_panel/releases

## v2.8.1.1
- Add `IMetadbHandleList` `GetOtherInfo` method. This returns a `JSON` object which is in string form so you need to use `JSON.parse` on the result. This dumps all the information that is viewable on the `Details` tab of the `Properties` dialog. Content is divided in to sections such as `General`, `Location` etc. Other sections like `ReplayGain` and database fields from 3rd party components will be provided here if present.
- The `Track Info + Seekbar` samples have have been tweaked to allow more width for artist/title text. Also, the colour of the stop button automatically changes to reflect `Stop After Current` status. Existing users will need to reload the script from the [Configuration Window](https://github.com/marc2k3/foo_jscript_panel/wiki/Configuration-Window) samples menu.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-01-25 13:11:55
https://github.com/marc2k3/foo_jscript_panel/releases

## v2.8.1.2
- Add `properties + other info` sample which makes use of the `GetOtherInfo` method added in `v2.8.1.1`.
- The original `properties` sample no longer displays `ReplayGain` or `Playback Statistics` info. Use the new addition above if you want to display them.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-02-03 16:22:05
The most important feature in this component's history is about to be released soon...

(https://i.imgur.com/aXjPWfJ.png)

Support for coloured fonts and emoji. Just what nobody asked for.

I've also implemented support for styling ranges of text in a single string by passing a JSON array with a start position and length value. Then you can apply different fonts, sizes, bold, styles etc.

Here's a rather stupid example which splits a string by space so every word gets a random style.

(https://i.imgur.com/2kF7vJQ.gif)

It takes just a single line of code inside the on_paint function...

Code: [Select]
function on_paint(gr) {
gr.WriteTextStyled(text, JSON.stringify(styles), 10, 10, window.Width - 20, window.Height - 20);
}

Building the array only takes a dozen lines of code.

Also, scrolling text within the bounds of a given rectangle is now comparatively easy to what was required before.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-02-11 11:25:12
v2.8.3

https://github.com/marc2k3/foo_jscript_panel/releases

- Hopefully fix timer related crashes.
- Fix `JS Smooth` custom text colour not sticking.
Title: Re: JScript Panel
Post by: always.beta on 2022-02-14 12:32:28
spectrogram seekbar.txt:How should I modify the spectrogram that shows the selected track when playback is paused? Also, can this be modified to have scales on the left and right sides, similar to the Spek interface. for easy track comparison.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-02-14 17:22:26
Displaying the legend will utterly destroy it's usefulness as a seekbar but you can change this line of code (use 1 instead of 0)

https://github.com/marc2k3/foo_jscript_panel/blob/archive/component/samples/js/seekbar.js#L218
Title: Re: JScript Panel
Post by: always.beta on 2022-02-15 00:24:51
Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-02-17 18:42:25
https://github.com/marc2k3/foo_jscript_panel/releases

v2.8.4

Fix bug introduced in v2.8.2 which caused the IMetadbHandleList AttachImage / RemoveAttachedImage / RemoveAttachedImages methods to silently fail.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-02-19 02:07:36
https://github.com/marc2k3/foo_jscript_panel/releases

v2.8.4.1

Smooth sample fixes, no component changes.
Title: Re: JScript Panel
Post by: Forfit on 2022-02-22 07:04:48
Do it is possible to toggle any tab in fullscreen?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-02-22 12:13:37
Nope.
Title: Re: JScript Panel
Post by: Forfit on 2022-02-22 12:20:14
It have a on_focus
do it have a event for when panel gets/loses visibility?
To fire a change withtout click the mouse over the panel.
I would avoid that script work in background it is not need.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-02-22 14:52:03
You can try window.IsVisible (returns true/false) but there is nothing to notify you of changes.
Title: Re: JScript Panel
Post by: Hesperidina on 2022-03-17 15:35:48
Hi Marc, I've been working on a library filter and I've noticed that when I use EvalWithMetadbs the memory usage goes up on every refresh of the library or panel, but if I use EvalWithMetadb inside a for loop, it does not.

Ram usage goes up on every call of this line:
Code: [Select]
filterEvals = tfo.EvalWithMetadbs(source).toArray();

But not when using for loop:
Code: [Select]
filterEvals = [];
for (var i = 0; i < source.Count; i++) {
var item = source.Item(i);
filterEvals[i] = tfo.EvalWithMetadb(item);
}

Am I doing anything wrong on the first case? For now I'm using the for loop, but the other one runs a bit faster for my use case, I'd like to use it but I can't figure out whats wrong.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-03-17 16:24:57
Yeah, that's definitely a bug. Thanks for spotting it!

I'll see what I can do.
Title: Re: JScript Panel
Post by: Hesperidina on 2022-03-17 16:34:29
Glad to help!

I ran a few more tests now using my library filter in folder structure mode and the same issue occurs when using GetLibraryRelativePaths, so my guess would be it is related to methods that return a VBArray, maybe?

Thanks for your help.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-03-17 16:42:06
Yep, I'd expect these to be affected as well...

utils.ListFonts
utils.Glob
utils.ListFiles
utils.ListFolders
Title: Re: JScript Panel
Post by: marc2k3 on 2022-03-17 17:04:14
I hope I've fixed it...

https://github.com/marc2k3/foo_jscript_panel/releases
Title: Re: JScript Panel
Post by: Hesperidina on 2022-03-17 17:33:39
That was fast! Looking good so far, I've run the same tests as before and I see no memory issues, at least for the 2 methods I mentioned earlier. Thanks!
Title: Re: JScript Panel
Post by: grimes on 2022-03-19 11:38:33
Link to DarkOne4Mod 2021 is dead.  :'(  Please fix it.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-03-19 11:58:39
Same link as before...

https://github.com/marc2k3/foo_jscript_panel/wiki/files/DarkOne.zip
Title: Re: JScript Panel
Post by: grimes on 2022-03-19 12:04:08
Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-03-19 18:26:24
v2.8.5.1

https://github.com/marc2k3/foo_jscript_panel/releases

Quote
- Fix a `JS Smooth Playlist` script error when the `Delete` key was used to the remove the last item(s) in a playlist.
Title: Re: JScript Panel
Post by: always.beta on 2022-03-20 14:46:43
Quote
- Fix a `JS Smooth Playlist` script error when the `Delete` key was used to the remove the last item(s) in a playlist.
I  create an automatic playlist with level 1, and use it to mark songs to be deleted during the usual audition process, and often an error pops up after selecting all the songs in that list to delete. Use the right-click menu, file operations, to delete files.
I have modified the script inside the smp by referring to the place you modified, but I still encounter the error, can you please help me to look inside the smp?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-03-20 15:20:18
I was quite specific about the bug I fixed only affected using the Delete key to remove the playlist selection.

Using file operations is something else entirely. Having said that, I did try it just now and I can't make SMP or JSP throw script errors when using it. So I have no idea what you're doing.
Title: Re: JScript Panel
Post by: always.beta on 2022-03-20 15:37:01
I had feedback on smp's github before, here's a screenshot of the error.  https://github.com/TheQwertiest/foo_spider_monkey_panel/issues/161
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-16 22:11:21
v2.8.6

https://github.com/marc2k3/foo_jscript_panel/releases





Title: Re: JScript Panel
Post by: Air KEN on 2022-04-17 12:22:25
Hi :) marc2k3.

When did "Source > Library/Playlist" disappear?
Where do I choose "Source > Library/Playlist"?

JS Smooth Browser (SMP) | JS Smooth Browser (JSP)
https://i.imgur.com/KJwXg6G.png

Thanks your help.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-17 13:06:50
There is no playlist view option. It was removed in v2.7.5.1

https://github.com/marc2k3/foo_jscript_panel/blob/main/CHANGELOG.md#v2751
Title: Re: JScript Panel
Post by: Air KEN on 2022-04-17 13:15:13
Thank you for your reply

> JS Smooth Browser can now show Media Library contents only.

OK.Many thanks.
Title: Re: JScript Panel
Post by: always.beta on 2022-04-17 14:38:51
JS Smooth Playlist: I changed the following but the size of the Rating icon did not change. where should I change to change the size of the Rating icon?
g_font_awesome = gdi.Font("FontAwesome", scale(18));
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-17 14:58:05
v2.8.6.1

https://github.com/marc2k3/foo_jscript_panel/releases

This fixes a Smooth Browser bug where images were incorrectly loaded in the text-only column mode.

---

As for the Playlist font, I tested changing it here to something both bigger and smaller and it appears to work fine.

https://github.com/marc2k3/foo_jscript_panel/blob/eea558bf2b69711e9eed6da88e16d633dd44a372/component/samples/smooth/common.js#L335

Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-19 09:47:39
v2.8.6.2

https://github.com/marc2k3/foo_jscript_panel/releases

This fixes a bug where JS Smooth Playlist didn't initialise properly if it was hidden on startup.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-23 09:01:28
Here's an updated component which breaks so much stuff I had to rename it.

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

For anyone writing their own scripts, it's hard to recommend and probably should be avoided.  ;D

Title: Re: JScript Panel
Post by: grimes on 2022-04-23 11:13:08
Thank you. I have only one own script:
Code: [Select]
//codec icon by grimes
//fb2k 1.0+, WSH Panel Mod 1.3.0+ required
//DUI/CUI ready

// ==PREPROCESSOR==
// @name "codec icon"
// @version "1"
// @author "grimes"
// ==/PREPROCESSOR==

function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}

var icon = window.GetProperty("Icon Folder:", "icons");
var g_img;
var codec;
var dui = window.InstanceType;
if(fb.IsPlaying || fb.IsPaused) {
   codec = fb.TitleFormat("%codec%").Eval();
   g_img = utils.LoadImage(fb.FoobarPath + icon + "\\" + codec + ".ico");    
}
else {
    g_img = utils.LoadImage(fb.FoobarPath + icon + "\\generic.ico");
}


function on_paint(gr) {
    gr.FillSolidRect(0, 0, window.Width, window.Height, dui === 1 ? window.GetColourDUI(1) : window.GetColourCUI(3));  
    if (g_img) {
        var scale = 0;
        var x = 0,
            y = 0;
        var scale_w = window.Width / g_img.Width;
        var scale_h = window.Height / g_img.Height;

        if (scale_w <= scale_h) {
            scale = scale_w;
            y = (window.Height - g_img.Height * scale) / 2;
        } else {
            scale = scale_h;
            x = (window.Width - g_img.Width * scale) / 2;
        }
        gr.DrawImage(g_img, x, y, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height);
    }
}

function on_playback_new_track() {
    codec = fb.TitleFormat("%codec%").Eval();
    g_img = utils.LoadImage(fb.FoobarPath  + icon + "\\" + codec + ".ico");
    window.Repaint();
}

function on_playback_stop(reason) {
    g_img = utils.LoadImage(fb.FoobarPath + icon + "\\generic.ico");
    window.Repaint();
}

I need help. I get following error message:
Quote
JScript Panel v3.0.0-Beta.1 (codec icon v1 by grimes)
Laufzeitfehler in JavaScript
Das Objekt unterstützt die Eigenschaft oder Methode "FillSolidRect" nicht
File: <main>
Line: 29, Col: 5
This method is not mentioned in your changelog.

EDIT: The method is named gr.FillRectangle. But the codec icon is in low resolution (left). Right picture is old version.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-23 11:29:26
Yep, that's because the entire graphics section was rewritten from scratch...

https://marc2k3.github.io/jscript-panel/docs/changes/#removal-of-igdigraphics

Quote
The replacement is IJSGraphics which uses DirectWrite instead of Gdiplus. This means pretty much every method has changed.

https://marc2k3.github.io/jscript-panel/docs/interfaces/IJSGraphics

FillSolidRect is now FillRectangle
DrawRect is now DrawRectangle

Also, this...

Code: [Select]
var dui = window.InstanceType;

should be replaced with

Code: [Select]
var dui = window.IsDefaultUI;

Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-23 11:40:20
As for the ico image thing, I actually had no idea the old/new functions could even load them.

Previously, Gdiplus was used. Now I use the Windows Imaging component.

Since I have no idea what to do about it, perhaps you could consider using these pngs I extracted from the foobar2000 icons.



Title: Re: JScript Panel
Post by: grimes on 2022-04-23 11:58:01
Thank you, works now with the png's.
Title: Re: JScript Panel
Post by: Forfit on 2022-04-24 08:32:26
For anyone writing their own scripts, it's hard to recommend and probably should be avoided.  ;D
It is very hard to port script.
Why this revolution?
Do you still supports branch 2?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-24 11:54:07
The old version remains available but it won't be getting new features.

https://github.com/marc2k3/foo_jscript_panel

If people have bugs to report, I'll try and fix them.

As for why.... it was more of a case of why not. It was something to do, learn new things. If no other people use it, I'm fine with that.
Title: Re: JScript Panel
Post by: elia_is_me on 2022-04-24 13:06:26
really great improvement especially that directwrite be introduced;
scripts like js-smooth-playlist require only about 4ms to draw a frame.
Title: Re: JScript Panel
Post by: Forfit on 2022-04-24 14:04:14
How update this:
Code: [Select]
gr.DrawImage(g_img, x + move, y + move, g_img.Width * scale - move, g_img.Height * scale - move, 0, 0, g_img.Width, g_img.Height, move / 4);

var b = fb.GetQueryItems(fb.GetLibraryItems(), 'artist IS "'+nm.trim()+'" AND title IS "'+tt.trim()+'"');

img=metadb.GetAlbumArtV2(artList, false);

img_to_blur = utils.CreateImage(ww, wh);
var gb = img_to_blur.GetGraphics();
gb.FillSolidRect(0, 0, ww, wh, RGBA(0,0,0,155));

Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-24 14:53:53
First line can't be updated because there is no support for drawing images at different angles. I was lazy and didn't rewrite the new function to support it. The next beta/final version will have it restored. Images can be rotated at 90/180/270 but that probably isn't much use


Code: [Select]
var query = "...";
var items = fb.GetLibraryItems().GetQueryItems(query);

var img =metadb.GetAlbumArt(artList, false); // no V2

FillSolidRect is now FillRectangle

Title: Re: JScript Panel
Post by: Forfit on 2022-04-24 15:01:52
First line can't be updated because there is no support for drawing images at different angles. I was lazy and didn't rewrite the new function to support it. The next beta/final version will have it restored.
I updated this, but I undstand that it is better to wait first release before trying more deeply.
Title: Re: JScript Panel
Post by: grimes on 2022-04-24 15:03:50
3.0.0 beta 1: Where's the Edge style in Configuration?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-24 15:07:27
https://marc2k3.github.io/jscript-panel/docs/changes/#removed-features
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-24 20:17:46
Beta.2 restores the angle option to gr.DrawImage and the changes page has been updated:

https://marc2k3.github.io/jscript-panel/docs/changes/#removal-of-igdigraphics

https://github.com/marc2k3/jscript-panel/releases
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-25 18:03:24
Beta.3 adds SVG support.

https://marc2k3.github.io/jscript-panel/docs/namespaces/utils/#utilsloadsvgpath-max_width

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

Reminder of other new things added in v3 (which could mostly be done in JS before but native methods are nicer!)

https://marc2k3.github.io/jscript-panel/docs/changes/#new-additions
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-26 11:39:42
Beta.4 restores the Edge Style that was removed in Beta.1. (CUI only)

https://github.com/marc2k3/jscript-panel/releases
Title: Re: JScript Panel
Post by: Hesperidina on 2022-04-26 18:33:53
So many new and nice features! I better mentally prepare to rewrite my scripts after first release.
Title: Re: JScript Panel
Post by: TT on 2022-04-27 00:12:50
Beta.3 adds SVG support.

Nice, need SVG support for SMP too =)

-TT
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-27 04:29:58
Beta.5 updates utils.LoadSVG to accept a file path or XML text that you might have read/manipulated via script first. Previously, it supported file paths only.

https://github.com/marc2k3/jscript-panel/releases
Title: Re: JScript Panel
Post by: Forfit on 2022-04-27 09:41:39
Replacement for:
gb.SetTextRenderingHint(4);
window.GetColourDUI(1);
window.GetColorCUI(3);
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-27 13:02:53
SetTextRenderingHint is not needed because DrawString no longer exists. It's been replaced by WriteText.

https://marc2k3.github.io/jscript-panel/docs/interfaces/IJSGraphics/#writetexttext-font-colour-x-y-w-h-text_alignment-paragraph_alignment-word_wrapping

window.GetColourDUI / window.GetColorCUI have not changed. If you're getting errors from one or the other, it's probably because you haven't replaced window.InstanceType with window.IsDefaultUI.

https://marc2k3.github.io/jscript-panel/docs/changes/#renamedmoved-methods
Title: Re: JScript Panel
Post by: Hesperidina on 2022-04-27 15:21:24
Hey Mark, I've been rewriting some of my code to use jscript3 and I noticed that the behavior of window.SetCursor is a bit different, were there any changes to this?

For example:

Code: [Select]
if (y < 40) {
    window.SetCursor(32649);
} else {
    window.SetCursor(32512);
}

The hand cursor flickers when I move the mouse and when I click, it changes to the default cursor.

Another example (var "u" are the coordinates of the album art inside the panel):

Code: [Select]
 if (this.isHover != u) {
    if (u) {
        window.SetCursor(32649);
    } else {
        window.SetCursor(32512);
    }
}

This works perfectly fine on jscript 2.8.5, but on v3 the hand cursor appears for a split second and then it changes to the normal cursor.

Thanks for your help!
Title: Re: JScript Panel
Post by: grimes on 2022-04-27 15:36:14
That works in Default UI:
Code: [Select]
var dui = window.IsDefaultUI;
Code: [Select]
gr.FillRectangle(0, 0, window.Width, window.Height, dui == 1 ? window.GetColourDUI(1) : window.GetColourCUI(3));
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-27 16:11:39
@Hesperidina , Beta.6 should fix the cursor thingy.

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




Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-27 16:20:45
I see the perils of removing properties now...

InstanceType was a number in JSP v2 and even though it's been removed in JSP v3, it won't throw an error because it's a property. It will be undefined which means if(window.InstanceType) or if(window.InstanceType == 1) won't throw errors but they will never evaluate to true either.

The new window.IsDefaultUI is a boolean property but thanks to JS being what it is....

Code: [Select]
// using Default UI
console.log(window.IsDefaultUI == 1); // true
console.log(window.IsDefaultUI === 1); // false

Title: Re: JScript Panel
Post by: Forfit on 2022-04-28 14:36:34
Code: [Select]
function on_load_image_done(tid, image, image_path){
if(image){
g_img = image;
g_img2 = g_img.ApplyAlpha(170);
}
}
ApplyAlpha?

Code: [Select]
	var temp_bmp = utils.CreateImage(1, 1),
temp_gr = temp_bmp.GetGraphics();
textheight = temp_gr.CalcTextHeight(g_text, g_font)*g_text.count(/([\r\n]|\. )/g,1)*3;
CalcTextHeight?

Code: [Select]
		var gp = tmp_img.GetGraphics();
ctab[i].total_lines = gp.EstimateLineWrap(ctab[i].text, g_font, ww - (H_PADDING * 2) - padx).toArray().length;
EstimateLineWrap?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-28 15:16:39
Just give it up. This clearly is not for you.

I've written extensive documentation for all new methods with examples. Admittedly I've not lined up each and every replacement but you'd have a good idea what to do if you actually read it all.
Title: Re: JScript Panel
Post by: Forfit on 2022-04-28 15:24:06
Just give it up. This clearly is not for you.
thanks for the support...  ::)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-28 15:26:38
I've just added a section on callback changes which was my fault for not including before.

https://marc2k3.github.io/jscript-panel/docs/changes/#callback-changes

Looks at utils.CreateTextLayout / gr.WriteTextLayout for rendering large chunks of text with multiple lines/getting the height.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-04-28 16:58:26
Whilst not entirely complete, here's a side by side diff of the main API differences....

https://gist.github.com/marc2k3/4503b25ca3d551264fff95c3387f2d17/revisions?diff=split

Most of the fb removals have replacements detailed here...

https://marc2k3.github.io/jscript-panel/docs/changes/#renamedmoved-methods
Title: Re: JScript Panel
Post by: marc2k3 on 2022-05-02 05:20:50
edit: Beta.7 was released then pulled because I didn't test a feature properly. Before anyone says it, yes I'm a twonk.
edit2: Beta.6 has been restored to the releases page
Title: Re: JScript Panel
Post by: marc2k3 on 2022-05-03 00:44:39
Beta.8

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

I doubt anyone grabbed Beta.7 yesterday but please nuke it if you did.
Title: Re: JScript Panel
Post by: Sickid on 2022-05-03 07:35:01
Can you add a function to control the display of various components on the window, like wsh_panel_mod_plus.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-05-03 08:06:38
If you're thinking of  showing/hiding like Panel Stack Splitter then no.

---

Beta.9 has no component changes. I've just updated the thumbs sample with a circular option. This is for the strip only, the main image display is unchanged.

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

edit: also adding a reminder that thumbs supports these additional image types if you have the necessary extensions installed from the windows 10/11 store: webp, heic, avif
Title: Re: JScript Panel
Post by: Hesperidina on 2022-05-03 14:07:20
Thanks for the cursor fix! It works fine now.

Is there a way to make WriteText not add end ellipsis when using DWRITE_WORD_WRAPPING_NO_WRAP?

I'm rewriting my search bars and in jscript2 I could play around with no end ellipsis and text alignment to make the text align to the right when the string is longer than the search bar, but in jscript3 it adds ellipsis and it becomes confusing.

I'm not sure if I can explain it properly, but the text is not being pushed to the left when I set it to align right, it does align it but when it becomes bigger than the text box, it just adds ellipsis to the overflowing text.

Pictures and code to make it clear:

JScript2:
Code: [Select]
var inputWidth = gr.CalcTextWidth(this.input, FONT);

if (inputWidth > this.w - this.h - 10) {
    var inputAlign = 0x00000826;
} else {
    var inputAlign = 0x00000824;
}

gr.GdiDrawText(this.input, FONT, this.color, this.x + 10, this.y, this.w - this.h - 10, this.h, inputAlign);

X

Code: [Select]
this.InputWidth = utils.CalcTextWidth(this.Input, "Lato", panel.FontSize, 700);

if (this.InputWidth > this.W - this.H - 10) {
    this.InputAlign = 1;
} else {
    this.InputAlign = 0;
}

gr.WriteText(this.Input, this.Font, this.Color, this.X + 10, this.Y, this.W - this.H - 10, this.H, this.InputAlign, 2, 1);

X

Is CalcTextWidth trimming the input? Because when I write a space character in the search bar, it does not move the cursor to reflect the space character until I write any other character, which wasn't the case in jscript2.

Sorry to bring all this up, if not possible to change, I will implement workarounds to try to maintain previous behaviour.

Thanks!
Title: Re: JScript Panel
Post by: marc2k3 on 2022-05-03 17:18:11
These are definitely bugs that need fixing. Thanks for spotting.  8)

WriteText will need another argument to make end ellipsis optional instead of being implied by setting DWRITE_WORD_WRAPPING_NO_WRAP.

The CalcTextWidth not including trailing whitespace is just a straight up bug by me using width instead of widthIncludingTrailingWhitespace from this API...

https://docs.microsoft.com/en-us/windows/win32/api/dwrite/ns-dwrite-dwrite_text_metrics
Title: Re: JScript Panel
Post by: marc2k3 on 2022-05-03 18:50:55
Beta.10 should address these issues.

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

End ellipsis are no longer implied by using DWRITE_WORD_WRAPPING_NO_WRAP and the new DWRITE_TRIMMING_GRANULARITY must be used if you want it.
Title: Re: JScript Panel
Post by: Hesperidina on 2022-05-03 19:50:52
Beta.10 should address these issues.

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

End ellipsis are no longer implied by using DWRITE_WORD_WRAPPING_NO_WRAP and the new DWRITE_TRIMMING_GRANULARITY must be used if you want it.

Thanks!! Now it works just like in JScript2!  :)
Title: Re: JScript Panel
Post by: Sickid on 2022-05-11 22:05:17
gr.DrawImage(utils.LoadImage("o:\\1.jpg"),0,0,200,200,0,0,0,200);
A picture with zero size will invalidate all drawings.
Title: Re: JScript Panel
Post by: grimes on 2022-05-17 19:11:21
Quote
Beta.3 adds SVG support.

Is there a foobar2000 icon codec pack in svg format available?
Title: Re: JScript Panel
Post by: zeremy on 2022-05-18 10:18:44

@2tec pages has this list

https://audio-file.org/2020/01/29/foobar2000-icons-icon-sets/


Don't know if one as svg exists, maybe you could convert from other formats....

Title: Re: JScript Panel
Post by: marc2k3 on 2022-05-19 00:42:58
gr.DrawImage(utils.LoadImage("o:\\1.jpg"),0,0,200,200,0,0,0,200);
A picture with zero size will invalidate all drawings.

Not sure what you mean?? If the image is not valid, utils.LoadImage should return null which should cause a script error.

If you unsure about an image existing or being valid then you should check it something like this...

Code: [Select]
var image = utils.LoadImage("o:\\1.jpg");

function on_paint(gr) {
    if (image) {
        gr.DrawImage(image,0,0,200,200,0,0,0,200);
    }
}
Title: Re: JScript Panel
Post by: marc2k3 on 2022-05-19 01:03:48
v3.0.0 is final now.

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


Title: Re: JScript Panel
Post by: Sickid on 2022-05-27 11:53:39
gr.DrawImage(utils.LoadImage("o:\\1.jpg"),0,0,200,200,0,0,0,200);
A picture with zero size will invalidate all drawings.

Not sure what you mean?? If the image is not valid, utils.LoadImage should return null which should cause a script error.

If you unsure about an image existing or being valid then you should check it something like this...

Code: [Select]
var image = utils.LoadImage("o:\\1.jpg");

function on_paint(gr) {
    if (image) {
        gr.DrawImage(image,0,0,200,200,0,0,0,200);
    }
}

Image is valid.
gr.DrawImage(......, srcW, srcH);
When srcW or srcH equals 0, the script does not crash, but all drawings fail and the whole panel turn black.
By comparison, foo_jscript_panel3 and foo_jscript_panel perform differently. You can try it yourself.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-05-27 20:53:09
Well the previous behaviour of silently ignoring idiotic bad arguments is just as bad as displaying a black panel so the next version will correctly throw script errors so everyone knows not to be so stupid. Thanks for reporting.
Title: Re: JScript Panel
Post by: Sickid on 2022-05-28 02:36:29
Well the previous behaviour of silently ignoring idiotic bad arguments is just as bad as displaying a black panel so the next version will correctly throw script errors so everyone knows not to be so stupid. Thanks for reporting.

I think 0 is a perfectly normal value, which is inevitable in many cases.
I remember there was a similar problem in Spider Monkey Panel. When you draw a rectangle, it crashes if the width or height is equal to 0. It's ridiculous. (Now it must have been repaired.)
In a natural process of change, the emergence of a natural number is not allowed.
Title: Re: JScript Panel
Post by: kode54 on 2022-05-28 05:44:08
Width or height of 0 is not normal in drawing, though. If either dimension is 0, the object is effectively not being drawn.
Title: Re: JScript Panel
Post by: Sickid on 2022-05-28 10:36:59
Width or height of 0 is not normal in drawing, though. If either dimension is 0, the object is effectively not being drawn.

As you said, a size of 0 means nothing is painted. (JScript Panel 2).
This is exactly what I want.
Title: Re: JScript Panel
Post by: kode54 on 2022-05-28 11:01:53
Then don't call the function? You do know you can conditionally not call something.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-05-28 13:42:07
I've been setting a bad example in my own scripts by not checking the src width/height before drawing but the only way that could happen was if they were calculated from the panel width/height which would have to be zero and therefore not visible. Default UI won't even let you resize that low but I guess it's possible with Columns/Panel Stack Splitter.

Setting these args as zero when the panel has proper dimensions and is visible is just really stupid. If calling the function succeeded, what exactly do you expect to see??

I really hate doing it but I've updated the function to silently bail if the src w/h are bad,

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

edit: the difference in behaviour between v3 and previous versions is because I'm using Direct2D instead of Gdiplus. Gdiplus was generally very tolerant of bad args everywhere but it seems more care is needed now. I already have special conditions in place where drawing text isn't even attempted if the width/height are less than 12px. I discovered this quite early on in my testing!
Title: Re: JScript Panel
Post by: Sickid on 2022-06-18 12:34:17
gr.DrawRectangle(50, 50, 100, 100, 1, 0xffffffff);
Is my method wrong? I can't draw a line with a pixel width.
The minimum width is 2 pixels and the color is not correct.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-06-21 11:17:35
Well I'm passing the args untouched to the windows APIs so not really sure what is going on there. You could try adding or subtracting 0.5 from the x and y values and see if that makes any difference??

Title: Re: JScript Panel
Post by: marc2k3 on 2022-06-21 15:21:50
Possibly relevant is the strokeWidth documentation here...

https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-drawrectangle(constd2d1_rect_f__id2d1brush_float_id2d1strokestyle)

Quote
The width of the stroke, in device-independent pixels. The value must be greater than or equal to 0.0f. If this parameter isn't specified, it defaults to 1.0f. The stroke is centered on the line.
Title: Re: JScript Panel
Post by: Sickid on 2022-07-02 07:55:10
on_mouse_mbtn_down
This callback function doesn't seem to work. (foo_jscript_panel3)
Title: Re: JScript Panel
Post by: Sickid on 2022-07-02 08:15:36
function on_mouse_leave() {
    console.log("on_mouse_leave");
}
function on_mouse_mbtn_down(x, y, mask) {
    console.log("on_mouse_mbtn_down" + "(" + x + ',' + y + ',' + mask + ")");
}
When I click the middle button, the console displays "on_mouse_leave".
Title: Re: JScript Panel
Post by: marc2k3 on 2022-07-02 10:25:51
Cannot reproduce that here. Your snippet works as expected.

Also the code for mouse handling is identical to JSP2 and this is the bit of code for mapping windows messages (WM_SOMETHING) in to which callback to call.

https://github.com/marc2k3/foo_jscript_panel/blob/5180a353c4d84525a0204ef18e6f86817170d4bf/src/Panel/CallbackID.h#L153

Nothing has changed.
Title: Re: JScript Panel
Post by: Sickid on 2022-07-02 19:34:27
Cannot reproduce that here. Your snippet works as expected.

Also the code for mouse handling is identical to JSP2 and this is the bit of code for mapping windows messages (WM_SOMETHING) in to which callback to call.

https://github.com/marc2k3/foo_jscript_panel/blob/5180a353c4d84525a0204ef18e6f86817170d4bf/src/Panel/CallbackID.h#L153

Nothing has changed.

It's my problem here. Everything's fine again.
I'm a little confused about what happened, but it doesn't matter.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-07-11 11:20:38
v3.0.2 fixes a crash with the GoTo dialog in the Configuration Window.

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

A few samples have had had their rectangles tweaked as per a few posts up where you need to add 0.5 to the x/y co-ords if the line width is 1.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-07-28 15:13:34
https://github.com/marc2k3/jscript-panel/releases

v3.0.3 fixes a JSplaylist state/mood column alignment bug.

edit: not mentioned in the changelog but JS Smooth Playlist Manager referenced a non existing file. While completely harmless, it did spam the console on startup. Existing users can select the updated script from the samples menu or delete this line manually from the preprocessor section at the top of the script....

Code: [Select]
// @import "%fb2k_component_path%samples\smooth\filterbox.js"
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-05 06:47:16
This should be the final release in the v2 series of JScript Panel (v2.8.8 )

https://github.com/marc2k3/foo_jscript_panel/releases

I'll probably nuke the github repo soon but I'll make sure the download remains available.
Title: Re: JScript Panel
Post by: MojoBass on 2022-08-05 07:56:47
I am using JS Smooth Browser (artists) together with JS Playlist (albums). Within JSP2, Smooth Browser had the nice feature that single-click on an artist gave the artists album selection in JS Playlist. Seems to be gone with JSP3 Smooth Browser (on my side), double-click selects (as in JSP2) the artists albums but directly plays the album. Any chance to enable this single-click feature as well in JSP3 JSSB, or am I missing something?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-05 09:15:14
Yeah removing that was intentional and was mentioned in the changelog for v3...

https://marc2k3.github.io/jscript-panel/docs/changes/#sample-changes

Selfishly, I always hated that functionality and made it do what I use by default. I was too lazy to make options but I guess that's something to consider in future.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-05 10:03:56
I'm not doing a component release just now but I've updated one file which you can download and test. Single click still only highlights but double click can be configured not to play...

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

(https://i.imgur.com/4QUlzyf.png)
Title: Re: JScript Panel
Post by: MojoBass on 2022-08-06 07:17:50
Hello Marc, thanks very much, works perfect!! (as always)
Title: Re: JScript Panel
Post by: ahbh on 2022-08-08 22:29:46
Hi there, I've got an error when I customized my columns. - Unable to get property 'label' of undefined or null reference Line: 1131, Col: 5. Any ideas?

         
Quote
// Create TextBoxes
        var txtbox_value = p.list.groupby[listBoxCurrentId].label;
         this.elements.push(new oTextBox(1, txtbox_x, Math.ceil(cSettings.topBarHeight + rh * 4.5), ww - txtbox_x - 20 - this.scrollbarWidth, cHeaderBar.height, "Label", txtbox_value, "settings_textboxes_action", this.id));
         txtbox_value = p.list.groupby[listBoxCurrentId].tf;
         this.elements.push(new oTextBox(2, txtbox_x, Math.ceil(cSettings.topBarHeight + rh * 6.5), ww - txtbox_x - 20 - this.scrollbarWidth, cHeaderBar.height, "Title Format (enter 'null' for nothing)", txtbox_value, "settings_textboxes_action", this.id));
         txtbox_value = p.list.groupby[listBoxCurrentId].extraRows;
         this.elements.push(new oTextBox(3, txtbox_x, Math.ceil(cSettings.topBarHeight + rh * 8.75), 30, cHeaderBar.height, "Extra Rows To Add", txtbox_value, "settings_textboxes_action", this.id));
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-09 07:12:20
I can't reproduce the bug but from the error, it looks like adding/removing group presets was the issue rather than columns??

Anyway, I'll try and make it more robust for the next release.

If the error is preventing the script from even loading, right click the panel>Properties. Change the value of JSPLAYLIST.GROUPS.Pattern Index to 0.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-18 04:45:18
Advance warning: the next version JScript Panel will require fb2k v2 and later. 32/64 bit builds are ready to go.

The current version for fb2k v1.5+ will remain available to download but it won't be supported.

I've added some notes on what is coming...

https://marc2k3.github.io/jscript-panel/docs/changes/
Title: Re: JScript Panel
Post by: fooball on 2022-08-19 19:08:09
I've installed foo_jscript_panel-3.0.3 under FB2K 1.6.11.  I've installed FontAwesome in Win7.

Basic lack of understanding here.  I want to try out JS Smooth Playlist Manager in the Default UI.

I've added a tab to a tabbed panel, and loaded Jscript Panel in it.  I get "JavaScript error".  Right-click > Configure > Samples > JS Smooth Playlist Manager.  Edit window shows the (presumably) relevant JS.  Then what?  There's no "save" option under File.  Trying to close the window complains the changes haven't been saved.

What am I missing?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-19 21:09:53
There is no save because clicking OK saves any changes you've made in the editor. Making changes and then using the close or cancel buttons will prompt you and that means clicking OK (or Apply to test any script while the configuration window remains open).

---

As for the error... if you're getting it immediately after loading it on windows 7, it usually means you've not installed all windows updates.

If you check the foobar2000 console from the View menu, you might see one of these 2 errors

This component requires a system with IE9 or later. << I don't really need to explain what is missing. Windows 7 users really should have IE11 installed even though it's functionally useless and you must be using another browser to browse the web right now!

Critical graphics initialisation failure. << This means you've not installed the windows 7 platform update. There are special instructions with a link for windows 7 users here... (edit: thinking about it, you wouldn't see the javascript error text if this was missing!!)

https://marc2k3.github.io/jscript-panel/docs/#minimum-requirements

If you have these requirements installed then any errors would be due to a bug in the script you're using in which case that would also be detailed in the foobar2000 Console (and a popup window should show too).

I'd like to think any script included with the component wouldn't throw an error on first use but it does happen but I need reports of errors to fix them.

Here's an example of me using it on windows 8.1 (the oldest OS I have access to right now)...

(https://i.imgur.com/KhiOsf5.gif)


Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-19 23:45:36
I'm not bumping the version number because I can't recompile the component just now but I've reuploaded the current version 3.0.3 which fixes a few sample bugs (mostly Smooth / JS Playlist related).

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

Title: Re: JScript Panel
Post by: fooball on 2022-08-20 00:32:46
OK, thanks, I'm clearly being too naive about this.

There is no save because clicking OK saves any changes you've made in the editor.
That's as maybe, but I don't see an "OK" on my screen.  I'm not getting the "Reset" "OK" "Apply" "Cancel" panel rendered.  For one thing the screen is only 1024x600 so even the minimum size edit window doesn't fit, but then if I use Move to push it up there are no buttons along the bottom.

As for the error... if you're getting it immediately after loading it on windows 7, it usually means you've not installed all windows updates.
It's WIn7 Starter Edition.  I've checked for updates but all I get is an error.

If you check the foobar2000 console from the View menu, you might see one of these 2 errors

This component requires a system with IE9 or later. << I don't really need to explain what is missing. Windows 7 users really should have IE11 installed even though it's functionally useless and you must be using another browser to browse the web right now!
That's not the error I'm getting, but you're right I'm not running IE.  I have Chrome installed on the target system for when I really need a web browser (but this is basically a netbook dedicated to music), but mostly (and right now) I use other means to interact with the Internet.

Critical graphics initialisation failure. << This means you've not installed the windows 7 platform update. There are special instructions with a link for windows 7 users here... (edit: thinking about it, you wouldn't see the javascript error text if this was missing!!)
That's what I see in the console.  Nonetheless, the JScript Panel is orange with "JavaScript error" in white.

https://marc2k3.github.io/jscript-panel/docs/#minimum-requirements
So basically my netbook is never going to satisfy the requirements.  Shame you're relying on so much support from things which are basically nothing to do with the operating system.  Couldn't you just package up the necessary DLLs?

If you have these requirements installed then any errors would be due to a bug in the script you're using
That's a bit tough considering I haven't input *any* scripts!

Here's an example of me using it on windows 8.1 (the oldest OS I have access to right now)...
At least that helped me identify there is no "OK" button!



Title: Re: JScript Panel
Post by: fooball on 2022-08-20 00:39:32
I might have a play with whether I can install SP1, but not until I've taken a disk image!  Only then does it appear I could do the Platform Update (whatever that might be).  But then, what about IE11?  Really?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-20 06:00:24
Well it looks like I need to update the requirements to include a 1024x768 screen. If you meet the windows requirements, you could actually get around it by using the keyboard shortcut CTRL+S to Apply changes and then close the window without getting any prompts.

And sorry about my edit being incorrect. Text rendering doesn't need the platform update like I thought it did. But it is required for all image handling which most scripts are heavily dependent on.

As for IE, the requirements/potential error was clearly stating that IE9 is required. I only mentioned IE11 because having that installed is just a side effect of most windows 7 users being fully up to date. I know windows 7 shipped with IE8 in 2009 but I did a quick check and IE9 was shipped in 2011.

edited: I included the wrong keyboard modifier in my original post - it's CTRL, not ALT.
Title: Re: JScript Panel
Post by: fooball on 2022-08-20 07:14:52
Thanks for looking into this.

Ctrl+S does indeed get me past the save problem, but no further.  IE8 is installed.  I will (in the fullness of time) attempt to install Platform Update and IE9.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-20 09:08:35
I didn't really want to point new people towards my now abandoned old version of the component but this has no requirement for the platform update.

https://github.com/marc2k3/foo_jscript_panel/releases

It still requires IE9 though.

Title: Re: JScript Panel
Post by: fooball on 2022-08-20 16:32:07
That might be good for me.  Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-20 17:22:44
I'm pretty sure you can update IE without SP1 so that should be easier.
Title: Re: JScript Panel
Post by: fooball on 2022-08-21 17:30:44
Yowzer!

Easier said than done, but I managed to install IE9 and the (old version of) JScript Panel works fine (using the Ctrl+S hack).  I now have JS Smooth Playlist Manager running in a tab (replacing the default playlist manager).

What's more, that unlocks the possibility of other JS-based functionality in the future.

THANK YOU!
Title: Re: JScript Panel
Post by: fooball on 2022-08-24 10:46:52
I'm pretty sure you can update IE without SP1 so that should be easier.
Just in case anybody else follows this path:
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-25 06:46:45
Quote
Just in case anybody else follows this path:

Seems unlikely but who knows? At least your woes did let me know that text rendering works fine on ancient non-updated systems so that was useful.
Title: Re: JScript Panel
Post by: Hesperidina on 2022-08-25 13:20:10
Marc, I was wondering if it could be possible to have a callback for property change, it would make keeping track of the panel state easier, something like this:

Code: [Select]
window.SetProperty("SOME.PROP", VALUE);

And this would trigger a callback like:

Code: [Select]
on_property_change(prop_name, value) {
    // do something
    // or sync property with other panels
    window.NotifyOthers("propUpdate", {
        prop: prop_name,
        val: value
    });
}

Do you think something like this could be implemented?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-25 13:58:17
I won't be implementing a callback but you do something similar with plain old javascript.

Old code might look something like this...

Code: [Select]
var colour = window.GetProperty("COLOUR", RGB(0,0,0));

function update_colour() { // triggered by clicking a button/menu/whatever
   colour = ...
   window.SetProperty("COLOUR", colour);
   window.Repaint();
}

You can use Object.defineProperty with your own custom getter/setter like this...

Code: [Select]
function property(name, default_) {
Object.defineProperty(this, 'value', {
get : function () {
return this.val;
},
set : function (value) {
this.val = value;
window.SetProperty(this.name, this.val);
}
});

this.name = name;
this.default_ = default_;
this.val = window.GetProperty(name, default_);
}

Updated code would be like this...

Code: [Select]
var colour = new property("COLOUR", RGB(0, 0, 0));

To "get" the value you need to use colour.value like this...

Code: [Select]
gr.FillRectangle(0, 0, 200, 200, colour.value);

Now when you update the value you can write...

Code: [Select]
colour.value = some_new_colour();

And that is it. Because window.SetProperty is inside the custom "setter", it automagically updates and if you really must you can put your notify others code inside the custom set function too.
Title: Re: JScript Panel
Post by: Hesperidina on 2022-08-25 14:15:41
Thank you! I did not think about it this way, I can work with this and adjust it to my needs.
Title: Re: JScript Panel
Post by: always.beta on 2022-08-27 15:09:09
Thanks for your improvements to the jssx series of scripts, many of them are great and work well. Could you consider returning the jssp's ⭐  icon to the original version? Now the FontAwesome version of the stars is not as strong as the texture it was before.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-27 19:26:43
Oldest version I have kicking around is 2.3.7 using gui fx transports (on the left, 3.0,3 on the right) and I really don't know what you mean by "strong texture"??

(https://i.imgur.com/ggbzx2w.png)
Title: Re: JScript Panel
Post by: always.beta on 2022-08-28 03:09:10
"strong texture"??
Purely personal opinion, the FontAwesome version of the ⭐ icon doesn't look as good as the GuifxV2 Transports version. it would be great if you could switch back to the GuifxV2 Transports version. if not, I found that the last version was v2.6.2.3 and I'll try to see if I can modify it myself. thank you very much for your efforts.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-28 04:29:52
I'm not changing the default because I like having the single dependency for all scripts. I may consider letting people choose the font/symbol used via the properties dialog.
Title: Re: JScript Panel
Post by: always.beta on 2022-08-28 04:32:50
I may consider letting people choose the font/symbol used via the properties dialog.
It would be great if it could be selected via the properties dialog, looking forward to it.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-30 19:34:09
Here we go with a new Beta version that requires fb2k v2....

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

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

The old version will remain available.
Title: Re: JScript Panel
Post by: Forfit on 2022-08-30 19:47:32
No x64 for V2?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-30 19:50:16
Of course there is. It's clearly mentioned in the 2nd sentence.

edit: since github likes being awkward for pre-releases, you have to expand the "Assets" link to get the download to show.
Title: Re: JScript Panel
Post by: Forfit on 2022-08-31 00:02:41
I mean foo_jscript_panel2. I see it is stopped v2.8.8 without x64 Fb2k 2 versione mention.
Title: Re: JScript Panel
Post by: Air KEN on 2022-08-31 06:35:19
Hi :) @marc2k3

JScript Panel 3 3.1.0-Beta.1 / "JS Playlist"

contextmenu is missing "convert" and "file operation"

https://i.imgur.com/qPe7mBk.png
https://i.imgur.com/v3kPr2a.png

am i missing something?
Thanks for your help.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-31 07:13:22
And these are the same installs? It works fine for me...

(https://i.imgur.com/eAx9gVd.png)

Everything below the line outlined in red is provided by foobar2000 itself and is dependent on the components you have installed (and the preferences at File>Preferences>Display>Context menu)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-31 07:31:08
I mean foo_jscript_panel2. I see it is stopped v2.8.8 without x64 Fb2k 2 versione mention.

Yeah development is abandoned on that now.
Title: Re: JScript Panel
Post by: Air KEN on 2022-08-31 07:31:43
> And these are the same installs?
bingo! OH Sorry.
Option was unchecked during installation.
----------
Portable installation
https://i.imgur.com/9wsO5iw.png

Standard installation
https://i.imgur.com/9iLOB1h.png

Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-31 08:41:24
Not sure if anyone is messing around with exotic WIC codecs like jxl but the following features may crash...

album art sample configured to use fb2k image viewer on double click
track info + seekbar + buttons (with or without spectrogram) may crash if clicking the little cover thumbnail
IMetadbHandle ShowAlbumArtViewer for anyone writing their own scripts

Double clicking the default UI album art viewer has the same issue so it's something that needs to be worked around in fb2k: https://hydrogenaud.io/index.php/topic,122846.msg1014522/topicseen.html#new

Your bog standard image types and webp/codecs provided by microsoft should be OK.
Title: Re: JScript Panel
Post by: Majestyk on 2022-08-31 10:10:19
Ratings don't work in JS Playlist or JS Smooth with new V2.0 Beta. Ratings in JS Playlist in SMP doesn't work either, but JS Smooth it does.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-31 10:17:45
This is because playback statistics (previously foo_playcount) is built in to fb2k and using %rating% to display actual ratings from tags no longer works. This is something I have no control over.

Using rating tags is still possible but you have to follow the detailed instructions I wrote here....

https://marc2k3.github.io/jscript-panel/docs/changes/#sample-changes

Title: Re: JScript Panel
Post by: Majestyk on 2022-08-31 11:08:57
This is because playback statistics (previously foo_playcount) is built in to fb2k and using %rating% to display actual ratings from tags no longer works. This is something I have no control over.

Using rating tags is still possible but you have to follow the detailed instructions I wrote here....

https://marc2k3.github.io/jscript-panel/docs/changes/#sample-changes



That's weird because in version 1.6.11 I remove foo_playcount and the JS Playlist ratings still work. That's using Spider Monkey...I have not confirmed that on Jscript.

Ok, just tested Jscript with no foo_playcount and it indeed does not work with 16.11. Funny how it works with SMP.

WAIT, scratch that. It does work with JScript. I originally used a defunct playlist to test it so that's why it didn't work. So Jscript rating will work with 1.6.11 and foo_playcount removed.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-31 12:59:40
Rating cripts for JSP2 / v3.0.x simply do not play nice with fb2k v2. Stick to fb2k v1 if you want to continue using them.

The scripts included with JSP 3.1.0+ do play nice with fb2k v2 but some manual steps have to be taken as I mentioned in my previous post with the link to my change page.
Title: Re: JScript Panel
Post by: always.beta on 2022-08-31 14:25:05
JSP 3.1.0 +JSSP:
How do I increase the ⭐ spacing between icons? For example, 2 pixels.
The scroll bar and the list on the left overlap by 1 pixel, where should I modify it?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-08-31 16:08:23
No you can't change the spacing. Maybe the custom font we discussed will fix this but it's low priority right now.

As for the scrollbar, I don't know what you mean. I even tried increasing the font size to see if it makes anything clearer.... and nope.

(https://i.imgur.com/YTv3Gi2.png)
Title: Re: JScript Panel
Post by: always.beta on 2022-09-01 00:56:17
As for the scrollbar, I don't know what you mean.
(https://imgur.com/a/07aUUza)
https://imgur.com/a/07aUUza
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-01 01:41:07
If you can't wait for the next component release...

https://raw.githubusercontent.com/marc2k3/jscript-panel/main/component/samples/smooth/scrollbar.js
Title: Re: JScript Panel
Post by: Majestyk on 2022-09-01 05:14:35
IMO, I think the scrollbar looks better without zooming along with the fonts/cover-art.

On an older version of JSPlaylist I modified it so it appeared like a standard windows scrollbar no matter what zooming level you set.

(Yes, I know this post is totally pointless)
Title: Re: JScript Panel
Post by: Forfit on 2022-09-01 08:58:04
Do it is possible to add a parameter to new _button to set the font instead of use every FontAwesome?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-01 10:24:32
JSP 3.1.0 will have that in the next beta version. No it won't.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-01 10:26:14
JSP2 is abandoned for x64 and I have migrate.
I arrested a first attempt long ago.
Now I retry.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-01 10:37:45
edit; changes reverted,
Title: Re: JScript Panel
Post by: Forfit on 2022-09-01 11:01:59
I prefer:
   this.font_str = JSON.stringify({Name:this.font,Size:this.h - _scale(0)});

do it is possible parameter for _scale?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-01 11:05:27
The button size is already scaled with...

Code: [Select]
var bs = _scale(24);

Replace bs with your own.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-01 11:08:27
But I not will scale all button but only the font size:
   this.scaleFont = normal.scaleFont || 10;
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-01 11:16:36
Place a copy of function _button(..) {} inside your panel and make whatever changes you like.

This will always override what's inside the common.js file.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-01 11:18:24
I know... ty.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-01 14:40:44
Benchmarking old JSP vs new JSP on fb2k v2 with a simple title format call on every library item.

Code: [Select]
var tfo = fb.TitleFormat("%artist% - %title%");
var items = fb.GetLibraryItems();
var arr = tfo.EvalWithMetadbs(items).toArray();

Code: [Select]
JScript Panel v2.8.8 (id:8586070): initialised in 76 ms
JScript Panel v2.8.8 (id:8586070): initialised in 77 ms
JScript Panel v2.8.8 (id:8586070): initialised in 76 ms
JScript Panel v2.8.8 (id:8586070): initialised in 76 ms
JScript Panel v2.8.8 (id:8586070): initialised in 76 ms
JScript Panel 3.1.0-Beta.1 (id:3670846): initialised in 8 ms
JScript Panel 3.1.0-Beta.1 (id:3670846): initialised in 8 ms
JScript Panel 3.1.0-Beta.1 (id:3670846): initialised in 8 ms
JScript Panel 3.1.0-Beta.1 (id:3670846): initialised in 9 ms
JScript Panel 3.1.0-Beta.1 (id:3670846): initialised in 8 ms
JScript Panel 3.1.0-Beta.1 (id:3670846): initialised in 8 ms

And yes, my library is tiny. No laughing please.


Title: Re: JScript Panel
Post by: Forfit on 2022-09-01 20:40:04
In V2 I use:
Code: [Select]
var gp = tmp_img.GetGraphics();
ctab[i].total_lines = gp.EstimateLineWrap(ctab[i].text, g_font, ww - (H_PADDING * 2) - padx).toArray().length;
to use in lyrics script.
Do it have a equivalent for V3?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-01 21:19:30
Code: [Select]
var tmp = utils.CreateTextLayout("some long string", "font_name", font_size_px);
var height_px = tmp.CalcTextHeight(max_width);
tmp.Dispose()

If you wanted to use the full ITextLayout interface for scrolling* text, the docs with example are here....

https://marc2k3.github.io/jscript-panel/docs/namespaces/utils/#utilscreatetextlayouttext-font_name-font_size-font_size-font_style-font_stretch-text_aligment-paragraph_aligment-word_wrapping

* when I say scrolling, I mean with the mouse wheel. I've been far too lazy to write any scrollbar or even pinch the ones from the smooth/jsplaylist scripts.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-02 01:05:36
I confused myself.
I search a EstimateLineWrap replacement.
Code: [Select]
var gp = tmp_img.GetGraphics();
ctab[i].total_lines = gp.EstimateLineWrap(ctab[i].text, g_font, ww - (H_PADDING * 2) - padx).toArray().length;

Do it is possible to scroll to a specific line in TextLayout?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-02 01:33:39
No, you can't get the text split in to an array of lines. I thought you only wanted the height of the overall text which is what you came to me about when I nuked the old DrawString methods ages ago. You had to multiply the number of lines by the height of each line. The new method just gives the overall height in pixels.

As for scrolling, you can adjust the vertical offset. That's what the example included in link is all about. You might have to resize the panel so it's quite small so you can see the effect.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-02 03:09:08
I have modified all my script for V3.
Only Lyrics remained a small detail.
I' missing a EstimateLineWrap replacement.
I patch with a fixed heigth but not is but it's not so precise.
Your EstimateLineWrap V1 is exportable as function?
Or a via to get it?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-02 07:27:48
It's precise enough for me.

(https://i.imgur.com/pFMDhYp.gif)

Here's my C++ if you or anyone else wants to rip it apart/tell me what I'm doing wrong.

Code: [Select]
STDMETHODIMP Utils::CreateTextLayout(BSTR text, BSTR font_name, float font_size, UINT32 font_weight, UINT32 font_style, UINT32 font_stretch, UINT32 text_alignment, UINT32 paragraph_alignment, UINT32 word_wrapping, ITextLayout** out)
{
RETURN_HR_IF_NULL(E_POINTER, out);

const std::wstring name_checked = FontHelper::get().get_name_checked(font_name);
wil::com_ptr_t<IDWriteTextFormat> text_format;
wil::com_ptr_t<IDWriteTextLayout> text_layout;

RETURN_IF_FAILED(g_dwrite_factory->CreateTextFormat(name_checked.data(), nullptr, static_cast<DWRITE_FONT_WEIGHT>(font_weight), static_cast<DWRITE_FONT_STYLE>(font_style), static_cast<DWRITE_FONT_STRETCH>(font_stretch), font_size, L"", &text_format));
RETURN_IF_FAILED(g_dwrite_factory->CreateTextLayout(text, SysStringLen(text), text_format.get(), 512.f, FLT_MAX, &text_layout));
RETURN_IF_FAILED(JSGraphics::apply_alignment(text_layout.get(), text_alignment, paragraph_alignment, word_wrapping));

*out = new ComObjectImpl<TextLayout>(text_layout);
return S_OK;
}

Code: [Select]
STDMETHODIMP TextLayout::CalcTextHeight(float max_width, float* out)
{
RETURN_HR_IF_NULL(E_POINTER, out);
RETURN_HR_IF(E_POINTER, !m_text_layout);

DWRITE_TEXT_METRICS metrics{};
RETURN_IF_FAILED(m_text_layout->SetMaxWidth(max_width));
RETURN_IF_FAILED(m_text_layout->GetMetrics(&metrics));
*out = metrics.height;
return S_OK;
}

Title: Re: JScript Panel
Post by: Forfit on 2022-09-02 17:43:26
My script follows another approach:

Code: [Select]
var layout = utils.CreateTextLayout("", 'Segoe UI', 24);

function on_paint(gr) {
gr.WriteTextLayout(layout, g_backcolour, 0, 0, ww, wh, 0);
// LINE_HEIGHT ??
gr.FillRectangle(0, Math.floor(posy), ww, (tab[i].total_lines*LINE_HEIGHT), g_ovbg_highlightcolour);
gr.WriteText(tab[i].text, g_font, text_colour, H_PADDING, Math.floor(posy)-1, ww-H_PADDING*2, (tab[i].total_lines*LINE_HEIGHT), g_txt_align, 2, 0, 0);
}

do it is possible to calculate tab.total_lines before gr.WriteText ?
Title: Re: JScript Panel
Post by: Forfit on 2022-09-03 09:03:52
Do it have a equivalent for V3?
Now I understand how CalcTextHeight works and solved, ty.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-03 09:59:44
Documentation (https://marc2k3.github.io/jscript-panel/docs/namespaces/utils/#utilscreatetextlayouttext-font_name-font_size-font_size-font_style-font_stretch-text_aligment-paragraph_aligment-word_wrapping) have a mistake:
utils.CreateTextLayout(text, font_name, font_size[, font_size, font_style, font_stretch, text_aligment, paragraph_aligment, word_wrapping])
have to be:
utils.CreateTextLayout(text, font_name, font_size[, font_weight, font_style, font_stretch, text_aligment, paragraph_aligment, word_wrapping])
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-03 10:49:32
Thanks - https://github.com/marc2k3/jscript-panel/commit/5d5abc08e3321069511c467a8142ef6dd2645c93
Title: Re: JScript Panel
Post by: Forfit on 2022-09-03 12:21:43
do it have a replacement for fb.GetNowPlaying().SetPlaycount(0) ?
or it is replaced by internal "Play count" ?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-03 13:29:45
https://marc2k3.github.io/jscript-panel/docs/changes/#removed-features

No replacement.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-03 14:55:30
When use WriteTextLayout instead of WriteText?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-03 15:05:52
No more. You've made the ignore list.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-03 15:08:42
No more. You've made the ignore list.
I did not understand this answer.
Title: Re: JScript Panel
Post by: fooball on 2022-09-04 10:07:34
That means you've exceeded his patience.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-04 10:12:32
Thanks - https://github.com/marc2k3/jscript-panel/commit/5d5abc08e3321069511c467a8142ef6dd2645c93
Excuse if I have exceeded your patience.
Title: Re: JScript Panel
Post by: hexenszene on 2022-09-04 15:22:43
Hi Marc, Thanks for this addon and all the sample scripts.  Been using SMP on 1.6, so I'm very glad to see this is working beautifully with 2.0.  The only component I looked for but didn't find is one that will display an artist's top tracks from Last.fm.  On SMP, the YouTube track manager one used to do this.  Any chance something like this is coming for JSP 3?

Thanks again for all your efforts and the time you spend answering all our dumb questions. :)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-04 17:17:03
Pretty sure I had that back in ye olde WSH panel mod days but had to remove it because last.fm broke a whole load of APIs. If it's working again, I'll look in to it.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-04 23:09:22
@always.beta  - I've added support for Gui Fx Transport to Smooth Playlist. Save both these files inside samples\smooth

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

Now right click the panel on the header bar/empty space/scrollbar and select panel properties. Change the value of SMOOTH.RATING.FONT to 1.

@hexenszene - you can save this updated file inside the component folder\samples\js

https://raw.githubusercontent.com/marc2k3/jscript-panel/main/component/samples/js/list.js

Top tracks and top tags have been added. I was going to add top albums but the results are utter garbage.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-05 00:56:28
I managed to break* last.fm charts with that last list.js update so I've just fixed that. Link remains the same,

*the text showed but not the bar charts which I completely missed.
Title: Re: JScript Panel
Post by: always.beta on 2022-09-05 08:13:49
Change the value of SMOOTH.RATING.FONT to 1.
Thank you. It's very nice after changing the font size to 14.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-05 08:53:59
I'll probably change the option in the next component release to something more understandable like SMOOTH.RATING.FONT.GUIFX and make it true/false.

The current 0/1 option is a bit cryptic.

edit: changes made here

https://github.com/marc2k3/jscript-panel/commit/381945e0713a5f8811c5a7444d57741f4940e02c

I've compromised a bit with a font size of 16. 14 was too small for me.

Just the single file updated...

https://raw.githubusercontent.com/marc2k3/jscript-panel/main/component/samples/smooth/common.js
Title: Re: JScript Panel
Post by: always.beta on 2022-09-05 11:01:01
I've compromised a bit with a font size of 16. 14 was too small for me.
The hollow ⭐ icon of the FontAwesome font, paired with the 18th font, will make the list look like ⭐ is easier to capture people's eyeballs than the title, which is purely my personal opinion.
Thanks again.
Title: Re: JScript Panel
Post by: hexenszene on 2022-09-05 12:54:16
I managed to break* last.fm charts with that last list.js update so I've just fixed that. Link remains the same,

*the text showed but not the bar charts which I completely missed.

This works brilliantly!  Thanks very much Marc!  Really appreciate it. :)
Title: Re: JScript Panel
Post by: etip on 2022-09-05 19:40:35
Hi Marc,
I'm trying to use the following script to spin disc art :
https://gist.githubusercontent.com/marc2k3/1d449cc5bbb2fcfdb51157e49d679ad6/raw/4db85978e8b414d2aa3f4d3280457f8b5943f611/spinny%2520album%2520art%2520nonsense.txt

I'm using JScript Panel version 2.8.8 and it gives me the following error :
"JScript Panel v2.8.8 (Spinny Album Art Nonsense by marc2003)
Erreur d’exécution JavaScript:
The object doesnt manage the property or method « CreateImage » (please bear in mind i had to translate it so it may not be the exact translation)
File: <main>
Line: 26, Col: 1"

Do i need to upgrade JScript panel ?

ps : using CUI (if that matters)
Thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-05 20:12:01
Yes, you need JScript Panel 3 (link in sig).

Use 3.0.3 if running fb2k v1.5.x or v1.6.x.
Use 3.1.0-Beta.1 if running fb2k v2 Beta.

edit: since you're must be running 32bit fb2k for 2.8.8 to work, you can use both at the same time so your other panels aren't affected. Try the aptly named script you linked to for about 10 seconds until you get sick of it.
Title: Re: JScript Panel
Post by: etip on 2022-09-05 21:44:22
thanks Marc, works great !! Great you can have both panels at the same time.
And yes, dunno how long i will use this but it looks good :)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-06 00:55:01
I just added support for art from radio streams. My usual album art scripts have had this feature for sometime, I just forgot to add it to this...

https://gist.githubusercontent.com/marc2k3/1d449cc5bbb2fcfdb51157e49d679ad6/raw/514a4415078ffe4143ba7560ba60a37f5f8e6a17/spinny%2520album%2520art%2520nonsense.txt
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-07 03:14:27
3.1.0-Beta.2

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

The main changes are the addition of utils.TextBox which provides a multi-line text edit area. And Editor Properties have been reset as the component uses new brand new storage settings built in to fb2k v2. If you have custom fonts/colours, export to cfg file first before upgrading.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-07 07:54:52
The addition of utils.TextBox above means I can offer a cheap text display knock off.

(https://i.imgur.com/Ylw53xX.png)

Added bonus is that I'm using DIrectWrite for colour font symbol rendering. The dialog could support that if I used Scintilla but I was too lazy to do that. Maybe for final release.

Title formatting...

Code: [Select]
[🎙️ %artist% ][▶️ %title% ]$crlf()
[💿 %album% ][📅 %date%]$crlf()
[🎵 %genre% ][💬 %codec% %bitrate% kbps ][📊 %__bitspersample% bits ][∿ %samplerate% Hz ][🔊 %channels%]
Title: Re: JScript Panel
Post by: Forfit on 2022-09-07 08:48:10
Do it is possible to have a "wrap words" option in Scintilla editor?
Title: Re: JScript Panel
Post by: grimes on 2022-09-07 10:23:31
Thanks for text display
Title: Re: JScript Panel
Post by: ASopH on 2022-09-07 10:51:25
Thanks for text display ;D
A little suggestion: implement color output such as $rgb(...) or <>  :D
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-07 11:19:39
Well your post has made me realise the existing $rgb support in JSPlaylist is broken so I just fixed that. I did test it originally but then I made internal changes to the component without updating the script. Doh.

Re-using the code for text display is easy enough...

(https://i.imgur.com/Nyj6KAN.png)

edit: I forgot to add custom background support. If anyone wants that right now, open the configuration window and replace

Code: [Select]
var panel = new _panel();

with

Code: [Select]
var panel = new _panel({ custom_background : true });

Use the right click menu to customise.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-07 15:49:30
In example at page (https://marc2k3.github.io/jscript-panel/docs/interfaces/IJSGraphics/#fillgradientrectangleadvancedx-y-w-h-str) have:
[ 0.0, RGB(227, 9, 64, 1) ],
but RGB accept only 3 parameter, right:
[ 0.0, RGB(227, 9, 64) ],
Title: Re: JScript Panel
Post by: Forfit on 2022-09-07 17:15:14
utils.DetectCharset()
works in x64 but not in x86.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-07 18:07:03
I get identical results for every file in my test set...

(https://i.imgur.com/E0nwaCN.png)

The number after each path is the detected value.

It's never been claimed that it will work for every file...

https://marc2k3.github.io/jscript-panel/docs/namespaces/utils/#utilsdetectcharsetpath

Quote
This may not be accurate and returns 0 if an error occurred.

But x86 vs x64 is a not an issue to me.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-07 18:17:53
RGB fixed: https://github.com/marc2k3/jscript-panel/commit/3eee7a0b85767fd03caa34808cc6be83781b628a

It was copy/paste fail from C++ code which uses D2D1::ColorF and takes 4 arguments.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-07 18:53:59
But x86 vs x64 is a not an issue to me.
You are right, I forgot to update the component for V2 in x86.
Title: Re: JScript Panel
Post by: etip on 2022-09-07 22:35:34
Marc,
quick question for me regarding the Art nonsense script to display the album art :
https://gist.githubusercontent.com/marc2k3/1d449cc5bbb2fcfdb51157e49d679ad6/raw/514a4415078ffe4143ba7560ba60a37f5f8e6a17/spinny%2520album%2520art%2520nonsense.txt (https://gist.githubusercontent.com/marc2k3/1d449cc5bbb2fcfdb51157e49d679ad6/raw/514a4415078ffe4143ba7560ba60a37f5f8e6a17/spinny%2520album%2520art%2520nonsense.txt)

I was wondering what logic you were following for the album Art ID #2 here :
https://marc2k3.github.io/jscript-panel/docs/flags/#albumartid (https://marc2k3.github.io/jscript-panel/docs/flags/#albumartid)

I'm following the Taglib library to tag my mp3 which is using the following list :
https://taglib.org/api/classTagLib_1_1ASF_1_1Picture.html (https://taglib.org/api/classTagLib_1_1ASF_1_1Picture.html)
and also using Mp3Tag which is using the same list

I'm trying to find out which type i need to use in my Mp3s to follow your #2 : "Disc".

Any pointer is welcome
Thanks


Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-07 22:46:35
These ids correspond with fb2k preferences. I don't know have to know or care about the underlying specification for every different file type - the fb2k SDK handles it all for me.

Since I'm playing on fb2k terms, you'll need to embed an image using fb2k (right click>tagging>attach pictures>disc). Now inspect the file using whatever other software to see if it's recognisable/something you can work with.

edit: i always forget about the artwork tab in the Properties. You can attach images/drag drop there too.
Title: Re: JScript Panel
Post by: etip on 2022-09-07 23:38:40
Alright, thanks. i tested it a little bit further and it seems that the "Disc" type that Foobar is using corresponds to the "Media" type of taglib/Mp3tag.
This makes sense actually but i'm up with some library tagging fun !
Thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-08 02:27:03
3.1.0-Beta.3

This adds $rgb support for Text Display. Any current users need to update from the Samples button.
$rgb support has also been fixed in JSPlaylist

Script authors can re-use the DrawColuredText method found in helpers.txt

Just pass the return value of whichever fb.TitleFormat method you use as the text argument.

edit: FFS, just discovered a text alignment bug with the Text Display menu options. Fix incoming.

edit2: Fixed version uploaded. It's been 30 minutes since I posted, hopefully no one grabbed the borked version.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-08 03:15:30
Known issue: using $rgb() to reset default colour is not supported. I'll have to see if I can fix that. I can only apologise for my incompetence.  :))

edit: now fixed.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-08 07:33:31
Code: [Select]
buttons.buttons.menu = new _button(0, 0, 36, 36, { char : "\u009D", colour:colours.buttons, font:"Webdings"}, null, function (x, y, mask) {_menu(0, 36);}, 'Menu');
It doesn't work anymore, before it worked.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-08 10:49:31
We had a very long and tedious discussion about that before.

Place a copy of function _button(..) {} inside your panel and make whatever changes you like.

This will always override what's inside the common.js file.

I know... ty.

Evidently not.
Title: Re: JScript Panel
Post by: Forfit on 2022-09-08 11:08:27
I know very well.
But, when I reported the possibility of customizing the source, you changed the component and worked.
Now, who knows why?, you removed that change and it no longer works.
Evidently you have a negative bias with those who contribute to the thread, and I will have to keep in mind.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-08 11:27:50
I do have an extremely negative bias towards YOU. I'm happy to answer questions all day long but not when the people asking are so stupid it needs repeating 26 times before it finally "clicks".
Title: Re: JScript Panel
Post by: Forfit on 2022-09-08 11:30:19
I do have an extremely negative bias towards YOU. I'm happy to answer questions all day long but not when the people asking are so stupid it needs repeating 26 times before it finally "clicks".
I keep in mind your negative Bias and offensive approach, that once again confirm with your posts..
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-08 15:57:04
I've given the Gallery page an update.

https://marc2k3.github.io/jscript-panel/gallery/

The more advanced scripts now contain detailed setup/usage instructions.
Title: Re: JScript Panel
Post by: Air KEN on 2022-09-08 16:03:12
Thanks marc2k3 :)
foobar20000 v2.0 beta 4 64bit Windows 11
Sample Script: Last.fm Bio + Thumbs
https://i.imgur.com/wdRY2QV.png
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-08 23:08:22
3.1.0-Beta.4

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

This should fix a crash report that was recently submitted.
The Spectrogram Seekbar has been updated to save as WebP which takes much less space. If you have a cache of PNG files, the script will offer to delete them for you.
Title: Re: JScript Panel
Post by: fooball on 2022-09-09 08:43:17
I keep in mind your negative Bias and offensive approach, that once again confirm with your posts..
What you must keep in mind is that everything done here is entirely voluntary, and we benefit from the time and effort other people are willing to contribute.  I don't have the skills in software to make a contribution, so I'm a beneficiary of those who do, but I have other skills which I contribute on other forums.  That's known as "pay forward".

If you piss a contributor off so that he's no longer willing to take the hassle, we all lose out.  I was a major contributor to a club, but resigned from the committee and withdrew my contribution to the club because I was banging my head against a brick wall and it was bad for my health.

You need to be grateful for any answers you get to your queries, and accept that if they're not the answers you wanted that's just too bad.  You might think you are helping by pointing out bugs or whatever, but what anyone then does with your information is out of your hands.

We cannot control what other people do, we can only control what we ourselves do.
Title: Re: JScript Panel
Post by: grimes on 2022-09-09 09:14:12
Hi marc2k3.
Is it possible, to make a modded version of DarkOne4mod for 64 bit foobar2000. Columns UI will be soon 64bit, but I see a problem with PSS.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-09 09:43:24
With CUI dark mode, I can easily live without PSS. Not sure about others??

Of course the biggest sticking point for me would be updating the javascript for JSP3. It quite literally was hell doing it for JSPlaylist/Smooth Browser etc. I don't really fancy doing it again for more code I didn't write. I know the buttons/display are much less complex but it's not nothing.

edit: I suspect the desire for 64bit will be quite low anyway. People will have plenty of non-visual 32bit components they'll want to stick with.

Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-11 12:31:56
3.1.0-Beta.5

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

Fixes a bug with utils.TextBox where the prompt text wouldn't fill the whole width before wrapping.
Fixes a bug with the spectrogram seekbars not playing nice with new versions of foo_skip causing ffmpeg to get stuck and not exit.
Fixes a bug with last.fm bio and thumbs not being able to download and save files if the artist ended with period character(s).*

*I think this has been broken since v3.0.0 when I moved away from using ActiveX objects towards more native C++ code. Other online scripts were unaffected. Anyone else using utils.DownloadFileAsync must make sure they sanitise folder names in the path themselves so they don't end with a period either. See here for an example:

https://github.com/marc2k3/jscript-panel/commit/6c2d05cba70fb089a72223194454c5fc6f491045
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-11 17:50:07
3.0.4.... probably the final release for fb2k v1 - the minimum requirement is now 1.6.6 which I hope shouldn't be a problem.

https://github.com/marc2k3/jscript-panel/releases/tag/3.0.4

Try not to use this on fb2k v2. The Beta 3.1.x series has some optimisations and many sample fixes.

Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-13 01:45:43
3.1.0-Beta.6

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

Adds utils.Run and utils.RunCmdAsync /  on_run_cmd_async_done. Slowly getting rid of most ActiveX objects from my scripts. htmlfile will never get a replacement though.

Existing users of Spectrogram Seekbars must re-import from the Samples button. This is also the case for some other scripts. Full details on the changes page.

https://marc2k3.github.io/jscript-panel/docs/changes/#v310-beta6
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-17 04:58:49
3.1.0-Beta.7

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

No real component changes from Beta 6.

The main change is fixing bugs introduced with Beta5/6 where the spectrogram seekbars were not always refreshing when ffmpeg had finished processing the file. It was more likely to happen if using foo_skip. I hope this is fixed now. Scripts need re-importing (again).

Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-19 03:56:03
3.1.0 Final for foobar2000 v2 Beta

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

The changelog is a big old wall of text but it's actually more important for sample users to read it than people who write their own scripts. Sorry!  :D

https://marc2k3.github.io/jscript-panel/docs/changes/3-1-0/#sample-changes

New features for script authors

https://marc2k3.github.io/jscript-panel/docs/changes/3-1-0/#new-additions

The Gallery has been updated with more detailed setup/usage notes for most samples.

https://marc2k3.github.io/jscript-panel/gallery/

3.0.4 remains available for those sticking to fb2k v1.6.6 - 1.6.12.
Title: Re: JScript Panel
Post by: sveakul on 2022-09-19 05:34:11
Problem with Spectrogram Seekbar noted after updating from 3.1.0 Beta 4 to 3.1.0 Final (fbv2 beta 8 64-bit);  sample was re-imported as per instructions:

When opening Foobar with a cleared/empty spectrogram_cache folder, when beginning playback only the marker shows/moves against an empty background, although the webp spectrogram image for the song is created in the cache.  This behavior continues for each song played, until Foobar is closed and then re-opened, at which time the image is displayed for the last selected song, and then works normally for each song played after that.  If the cache is cleared while Foobar is still open, images continue to be created for new songs.  But if the cache is cleared, then Foobar closed immediately afterward, re-opening Foobar will again result in the songs played having no background image until the next restart, even though the webp's are being created in the cache.

Sorry about the awkward description.

Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-19 05:41:40
If anyone download this in the last 100 minutes and wanted to use the Text Display sample, it needs downloading again as it was buggy. Sample needs re-importing too. Apologies.

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

@sveakul , I'll come back and reply properly in a bit.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-19 06:02:26
RE: spectrograms, I have no idea what's going on there. Clearing the cache is the same as having never played the file before. There is no internal tracking - just a simple file existence check every time playback on a new track starts. If an image not matching the cached filename is found, a new one is generated and stored.

Just focusing on the first track here...

(https://i.imgur.com/x5C0sse.gif)

I play for the first time and get a little hourglass for a second. Now I listen for a few seconds and clear the cache. The image is in memory because the track is playing. But when I manually stop the image is gone. Play the track again and a new image is generated.

edit: i did add new code in Beta.6 to make it run in background threads but if the images are in the cache, that part must be working??

You definitely have this inside your panel? (near the bottom). This forward notifications when complete...

Code: [Select]
function on_run_cmd_async_done(task_id) {
seekbar.run_cmd_async_done(task_id);
}

You said you imported the updated file as instructed so it should be there but I can't think of anything else???
Title: Re: JScript Panel
Post by: ASopH on 2022-09-19 16:35:21
Hi,

after installing the new Text Display, I had a message after restarting fb2k.

"Die Eigenschaft "value" eines undefinierten oder Nullverweises kann nicht abgerufen werden."

The "Value" property of an undefined or zero reference cannot be called up.

File: <main>
Line: 37, Col: 3

Panel loading is successfully, only an info :-)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-19 16:47:34
If you used Text Display on an earlier Beta or 3.0.x did you re-import the script as mentioned on the release page?

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

What's the code on your line 37? Right click the panel>Configure.

It should be

Code: [Select]
return panel.rbtn_up(x, y, text);


Title: Re: JScript Panel
Post by: ASopH on 2022-09-19 17:04:44
Hi,

that's right: return panel.rbtn_up(x, y, text);

message comes up direct after starting foobar (x64)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-19 17:10:28
You posted this...

Code: [Select]
File: <main>
Line: 37, Col: 3

but it can't be right. It's quite literally impossible for that line to error on startup because it's only triggered by you right clicking the panel.
Title: Re: JScript Panel
Post by: ASopH on 2022-09-19 17:30:57
Hi,

ooops! - I'd a second panel .... without updating it  ;) - My mistake, please excuse. I no longer have that on the note.

all ok ! good job
Title: Re: JScript Panel
Post by: sveakul on 2022-09-19 17:53:03
I play for the first time and get a little hourglass for a second. Now I listen for a few seconds and clear the cache. The image is in memory because the track is playing. But when I manually stop the image is gone. Play the track again and a new image is generated.
Thanks for your reply.  Yes, if the cache is cleared while Foobar is still open, and Foobar then kept open, when more songs are played images are correctly shown as you described.

The problem only shows up if the image cache is cleared, and then Foobar is exited immediately afterwards.  Then, when Foobar is started again, no image is shown when a track is played although the webp is generated inside the cache folder.  If Foobar is exited again, when restarted the images are shown again as normal.

I do have the script section you referenced.

Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-19 17:54:42
second panel

And there was me thinking I'd made it easy to identify the errant panel.

(https://i.imgur.com/PGRPcri.png)

I guess I need to try harder. :/
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-20 09:28:12
The problem only shows up if the image cache is cleared, and then Foobar is exited immediately afterwards.

This doesn't make any sense to me. The script only cares about the existence of a single image when playback begins. The filename comes from a combination of the cache folder + fb2k title formatting of the audio file ($crc32(%path%)) + the ffmpeg options.

If this file exists, display it.
If it doesn't exist, a whole bunch of checks are performed to see if it's a file that can be fed to ffmpeg (length, not a cue, stream etc.), then a background task runs to create the image.

I don't feel there is anything I can do about it.

You'll just have to bin it.
Title: Re: JScript Panel
Post by: emaulana on 2022-09-20 16:38:11
Thank's for your hardwork with your JScript Panel. It makes my Foobar2000 x64 theme more complete. If you have time please add "Custom Folder" option in Allmusic Review & Last.FM Bio similar to Thumbs. Also if you add "Custom Image Background" option to Tex Display it would be beautiful. Keep it up bro. Greetings from Indonesia.
Title: Re: JScript Panel
Post by: sveakul on 2022-09-20 18:21:53
The problem only shows up if the image cache is cleared, and then Foobar is exited immediately afterwards.
I don't feel there is anything I can do about it.

You'll just have to bin it.
OK, well thanks for taking a look at it anyway!  The reason I ran into the issue I described right away is because I use the script addendum you created to auto-clear all the cached images upon Foobar's exit.  That works, but then after the next start of Foobar I get the blank image when starting to play.  There must be something else in my setup interfering.  I'm fine sticking with 3.1.0 Beta 4 where for whatever reason this doesn't happen.  I'll give it another go when v2 stabilizes.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-21 00:55:04
If you have time please add "Custom Folder" option in Allmusic Review & Last.FM Bio similar to Thumbs.

You can use Text Reader to display the content of any plain text files.

https://marc2k3.github.io/jscript-panel/gallery/text-reader/

Quote
Also if you add "Custom Image Background" option to Tex Display it would be beautiful.

This exists in the latest version. Only the first Beta didn't have it.
Title: Re: JScript Panel
Post by: emaulana on 2022-09-21 03:06:44
If you have time please add "Custom Folder" option in Allmusic Review & Last.FM Bio similar to Thumbs.

You can use Text Reader to display the content of any plain text files.

https://marc2k3.github.io/jscript-panel/gallery/text-reader/

Quote
Also if you add "Custom Image Background" option to Tex Display it would be beautiful.
If you have time please add "Custom Folder" option in Allmusic Review & Last.FM Bio similar to Thumbs.

You can use Text Reader to display the content of any plain text files.

https://marc2k3.github.io/jscript-panel/gallery/text-reader/

Quote
Also if you add "Custom Image Background" option to Tex Display it would be beautiful.

This exists in the latest version. Only the first Beta didn't have it.
This exists in the latest version. Only the first Beta didn't have it.
If you have time please add "Custom Folder" option in Allmusic Review & Last.FM Bio similar to Thumbs.

You can use Text Reader to display the content of any plain text files.

https://marc2k3.github.io/jscript-panel/gallery/text-reader/

Quote
Also if you add "Custom Image Background" option to Tex Display it would be beautiful.

This exists in the latest version. Only the first Beta didn't have it.

Thank's for your reply. I already use the final version. As you can see from the images  i attached there is no option as in Thumbs.
I ask this because it would be nice if i don't have to always redownload the info that i already have it in Artist folder at my hardisk Library. I also can not find "Custom Image Background" option in Text Display.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-21 04:49:14
I completely missed the word image when you said custom background. Sorry about that, I must be blind. So no, it doesn't have that.

The Text Reader script was supposed to be a replacement for last.fm bio. When installed, you can right click and change the path with custom title formatting...

(https://i.imgur.com/cUaKfnI.png)

Title: Re: JScript Panel
Post by: emaulana on 2022-09-21 06:34:58
I completely missed the word image when you said custom background. Sorry about that, I must be blind. So no, it doesn't have that.

The Text Reader script was supposed to be a replacement for last.fm bio. When installed, you can right click and change the path with custom title formatting...

(https://i.imgur.com/cUaKfnI.png)



Thank you for your info & suggestion regarding Text Reader!!. It is working as Biography replacement but not with Album Review since it only read text with Artist name title only not Artist - Album  :(  So please still consider to add the option if you have time. Thank you bro, your JScript Panel is very useful with Foobar2000 x64.
Title: Re: JScript Panel
Post by: etip on 2022-09-23 20:15:10
quick question from a noob in Jscript (but who is trying).
I need some pointers to a simple thing which is to create a scrolling text  in  a panel.
I thought i had to create a IJSGraphics object, write the text in that object and then draw it using horizontal offsets (WriteTextLayout can do that but only on vertical offsets). unfortunately, seems that it isnt the right way as i didnt find the way to do that offset.

Also, question about the DrawImage(image, dstX, dstY, dstW, dstH, srcX, srcY, srcW, srcH[, opacity, angle]) function. what 'src' stands for ?
Thank you
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-23 21:56:54
1) You can use gr.WriteText with a negative x value to start drawing it off the left hand side of the panel like this...

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%helpers.txt"
// ==/PREPROCESSOR==

var text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
var x = 5;

function on_paint(gr) {
x = Math.min(x, 5);
gr.FillRectangle(0, 0, window.Width, window.Height, RGB(255, 255, 255));
gr.WriteText(text, '', RGB(0, 0, 0), x, 5, window.Width + -x, 20, 0, 2, 1, 1);
}

function on_mouse_wheel(step) {
x += step * 24;
window.Repaint();
}

If you wanted it constrained within the bounds of a rectangle, you'd have to create a temporary IJSImage object and use WriteText on that and then use gr.DrawImage like this...

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%helpers.txt"
// ==/PREPROCESSOR==

var img = null;
var text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
var x = 5;
create_image();

function create_image() {
x = Math.min(x, 5);
img = utils.CreateImage(300, 20);
var g = img.GetGraphics();
g.WriteText(text, '', RGB(0, 0, 0), x, 0, 300 + -x, 20, 0, 2, 1, 1);
img.ReleaseGraphics();
}

function on_paint(gr) {
gr.FillRectangle(0, 0, window.Width, window.Height, RGB(255, 255, 255));
gr.DrawImage(img, 50, 50, img.Width, img.Height, 0, 0, img.Width, img.Height);
gr.DrawRectangle(50, 50, img.Width, img.Height, 1, RGB(255, 0, 0));
}

function on_mouse_wheel(step) {
x += step * 24;
create_image();
window.Repaint();
}

2) The src args in DrawImage is the portion of the image you'd like to display. For the whole image, it would be

Code: [Select]
0, 0, img.Width, img.Height

If it was square and you imagined it being cut in half both ways and you wanted the bottom right, you'd use

Code: [Select]
img.Width / 2, img.Height / 2, img.Width / 2, img.Height / 2
Title: Re: JScript Panel
Post by: etip on 2022-09-23 23:31:21
oh wow, thank you so much, it's perfect !
and thanks for the explanation of the src args, wasnt obvious to me :)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-24 01:17:39
3.1.1

https://github.com/marc2k3/jscript-panel/releases
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-24 04:33:41
3.1.2

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

This adds an album art background option to Text Display.

Like my main album art sample, it can display art from certain radio streams...

(https://i.imgur.com/lyyzvOH.png)
Title: Re: JScript Panel
Post by: emaulana on 2022-09-24 06:24:43
Thank you for the update! Keep it up.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-24 20:46:44
@sveakul  -regarding your spectrogram issues, what OS are you running? And was webp support built in or are you using the google installer?

I'm having a few issues myself since messing around with windows 11 22H2 this week and it does seem similar to what you described but I'm having a hard time figuring out why. Pretty sure it's not the script at fault because so far, I'm ensuring the file exists after the background test has successfully run and created the image but it's failing to recognise it 100% of the time with my image loading function and that is purely windows code. It's bugging me now.  ;D

edit: I seem to have confirmed webp support in windows 11 is sketchy as ****. Looks like I'll have to implement my own.
Title: Re: JScript Panel
Post by: sveakul on 2022-09-24 22:15:11
Hi marc2k3, I'm running Windows 10 x64 21H2.  I've always used Irfanview to actually view webp files (with Firefox for web pages support).  From what I read the situation on native support in 10 has been "cloudy" with some reports that while the Windows 10 "Photos" app needs some extension work-around to view them the "Windows Photo Viewer" handled them as-is.

Interesting that you're seeing a similar issue in 11.  The easiest steps to replicate what I described with the Spectrogram on JScript versions higher than 3.1.0-Beta 4 would be:

1.  Open Foobar and play some files as they generate webp images in the Spectrogram Seekbar.
2.  Stop playing, then right-click the Spectrogram image window and choose "Cached Images--Clear all," then immediately exit Foobar.
3.  Start Foobar again and play a file(s)--no image will appear in the Spectrogram panel, although they get created in the cache folder.  Behavior returns to normal if you exit Foobar again WITHOUT clearing the cache, and begin playing.

The only wild card with my setup is that I use the "-lossless 1" switch in the ffmpeg options to create a *slightly* better image;  the disc space doesn't bother me because I use that script addendum you provided to auto-clear the cache anyway upon exit.

I'd bet you are absolutely right that sketchy OS support is at the core of this whole thing.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-25 00:04:53
I've released 3.1.3 with built in webp support. If this doesn't fix the seekbars, I shall look a bit stupid.

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

edit: 3.1.4 fixes WebP album art not being handled internally.
Title: Re: JScript Panel
Post by: sveakul on 2022-09-25 17:17:08
Did a clean update to 3.1.4 and PROBLEM SOLVED, cached spectrogram images clear on exit (with the script addendum) and are re-created/shown in panel normally the next time Foobar plays a file.

Thanks for working this!!
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-25 18:08:23
Cool.  8)

I was using windows 10 previously but nuked the windows store (and built in webp support) with a powershell script so I used the google webp installer. I guess that's why I couldn't recreate the problem when you originally reported it.

Since using windows 11, I was relying on the store version of webp and that was the failure point. It worked most of the time but wasn't 100% reliable. I wasn't going to tell everyone on 10/11 they must use the google installer so I used their open source libwebp (https://github.com/webmproject/libwebp) library to do it myself.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-26 13:38:18
3.1.5

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

You can now change the editor fonts/colours directly from the configuration window.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-09-27 07:42:29
3.1.6

https://github.com/marc2k3/jscript-panel/releases
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-22 10:17:15
https://github.com/marc2k3/jscript-panel/releases

3.1.7 for fb2k 2.0 users. Columns UI users need to make sure they are using the latest v2 alpha.5

3.0.5 was released a few days ago for fb2k 1.6.6-1.6.13 users
Title: Re: JScript Panel
Post by: arabeh on 2022-10-23 00:24:44
Hi,
I want to update tags of selected tracks with a Discogger component,
but this context command only runs on currently playing item
Code: [Select]
fb.RunContextCommand("Tagging/Discogger/Write tags...");
I've searched through many topics and pages and didn't found a proper way to do this.
in the docs it says "This method is for the currently playing file only. See also: IMetadbHandleList RunContextCommand."

So I tried those "See also" options:
RunContextCommand (without fb. prefix) gives me "RunContextCommand is undefined" error
So I left with that "IMetadbHandleList" command, which I assume should help to do the task
If only I knew what to do with it  :'(
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-23 00:54:48
I've updated the docs with an example. You might need to refresh the page to see it.

https://marc2k3.github.io/jscript-panel/docs/interfaces/IMetadbHandleList/#runcontextcommandcommand
Title: Re: JScript Panel
Post by: hucifer on 2022-10-23 05:45:26
Hi, I just got back into modding FB2K and it's good to see JScript Panel is still alive and well!

I am having a slight issue, though. As you can see from the screenshot below, certain icons/glyphs are missing from the panels.

(https://i.postimg.cc/CxwtKK12/missing-buttons.jpg)

Any idea how I can fix this?

I'm running JSP v.3.0.5 on FB2K v.1.6.13 installed in default (non-portable mode).
Title: Re: JScript Panel
Post by: fooball on 2022-10-23 07:16:30
Have you installed FontAwesome?

From https://marc2k3.github.io/jscript-panel/docs/ (https://marc2k3.github.io/jscript-panel/docs/):
Quote
Most included samples require the installation of FontAwesome which you can grab here (https://github.com/FortAwesome/Font-Awesome/blob/4.x/fonts/fontawesome-webfont.ttf?raw=true).
Title: Re: JScript Panel
Post by: hucifer on 2022-10-23 07:30:22
Have you installed FontAwesome?

From https://marc2k3.github.io/jscript-panel/docs/ (https://marc2k3.github.io/jscript-panel/docs/):
Quote
Most included samples require the installation of FontAwesome which you can grab here (https://github.com/FortAwesome/Font-Awesome/blob/4.x/fonts/fontawesome-webfont.ttf?raw=true).

Yup, that'll do it!

I looked in the documentation but couldn't see any mention of required fonts. Knew I was missing something.

Much obliged.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-23 09:24:56
I've made the FontAwesome requirement prominent on the download page and moved it up so it's more visible on the docs landing page.
Title: Re: JScript Panel
Post by: hucifer on 2022-10-23 09:39:55
I've made the FontAwesome requirement prominent on the download page and moved it up so it's more visible on the docs landing page.

Good stuff - it's much more idiot-proof now  :D
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-25 18:07:30
3.1.8 for fb2k v2 https://github.com/marc2k3/jscript-panel/releases
Title: Re: JScript Panel
Post by: sonvolt on 2022-10-25 18:54:51
Have loaded a test of Foobar 2 with Marc@s Darkone mod  (modified)   only issue to date  is that i can only update rating via menu  Playback stats , ratings rather than clicking on * in  the  track display.  I've never used tags for rating prefering to keep my audio file  clean.  Any ideas on a resolution?
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-25 19:39:56
JSplaylist in the old version of JSP on fb2k v2 is going to suck but you should be able to hack the rating by browsing the component folder\samples\jsplaylist and opening main.js.

Find...

Code: [Select]
var foo_playcount = utils.CheckComponent("foo_playcount");

replace it with...

Code: [Select]
var foo_playcount = true;
Title: Re: JScript Panel
Post by: sonvolt on 2022-10-25 21:01:29
Thats perfect Marc , thank  you again  for your quick  and consise response, also your patience for us amateur dabblers  :D
Thanks Ken
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-29 01:42:33
3.1.9

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

Text Display now supports custom $font title formatting. It takes font name,size,weight,style,underline and strikethrough args. Only the first 2 are required,
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-29 12:48:45
3.1.10

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

This fixes a stupid bug where the Text Display $font parsing code was broken if $rgb code was not also present.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-30 01:15:33
3.0.6 for fb2k 1.6.6 - 1.6.13 users.

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

Title: Re: JScript Panel
Post by: fooball on 2022-10-30 08:08:29
Decent of you to be back-porting for those of us stuck on 1.6.13.  If you can be bothered, the Text Display stuff would be nice!
Title: Re: JScript Panel
Post by: Bollerkopp on 2022-10-30 09:52:53
Thank you very much for the enhanced Text Display. Really great!

Would it be possible to choose from smaller font sizes than 10? I would need 8 to better match my OS font size.

Thank you in advance. :)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-30 16:29:10
I'll relax restrictions on font size in the next release.

And nope, the text display won't be backported. The webp thing was easy because it was overwriting 2 complete files with no edits. Backporting the new dialogs and $font stuff would be a lot more work so I'm not doing it. And of course fb2k 1.x users can continue using foo_textdisplay- the main motivation for my own text display was creating something for 64bit fb2k v2 under default UI. Columns UI users have always had and still have Item details which supports $rgb and its own $set_font method.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-31 04:47:35
3.1.11

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

This adds simple scroll support for text display using your mouse wheel (no scrollbar).

edit: there was a bug with the default font size being reset on script init. A fixed version has been uploaded.
Title: Re: JScript Panel
Post by: Bollerkopp on 2022-10-31 06:19:03
Thank you very much for the new release. Smaller font size works using the $font title formatting now. Also the scroll support is very welcome.  :)
Title: Re: JScript Panel
Post by: grimes on 2022-10-31 07:22:53
Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-10-31 15:23:27
I was too lazy to add an example for utils.CreateTextLayout2 earlier. I've now added a new page

https://marc2k3.github.io/jscript-panel/docs/styling-ranges-text/

and I've updated the fonts page...

https://marc2k3.github.io/jscript-panel/docs/fonts/

At some point I will explain how to use $rgb/$font in your own scripts. If you can't wait, you can pick apart the code in samples\js\text_display.js and helpers.txt.
Title: Re: JScript Panel
Post by: grimes on 2022-11-01 08:13:01
My wish: Please list JScript Panel 3 on foobar2000.org/components.
Quote
Getting a component listed on foobar2000.org/components
... Contact Peter with info about your component.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-01 09:27:49
Auto-updates would not be a good fit for me. I often have to ask people to re-import samples to fix bugs or get new functionality. If they don't read the changes and blindly update, that's their problem. But if things break from using the component updater. people will be pointing their fingers at me.  :P

If anyone has a github account (I know you do), you can get notified of new releases by using the watch button. You certainly don't want notifications of all activity but if you select custom, you can get release notifications only.

(https://i.imgur.com/JMXt488.png)

edit: only just noticed you're already watching in some capacity!
Title: Re: JScript Panel
Post by: grimes on 2022-11-01 09:38:27
You can switch off download and auto-download. Example: https://www.foobar2000.org/components/view/foo_spider_monkey_panel
So every user has to visit your GitHub site to download.
I think, your component is worth a larger audience.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-01 15:11:23
I guess that's my only concern addressed so I might consider it in future. I'll probably wait for fb2k v2 to go final first. I'm not really that bothered about it tbh.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-04 07:51:53
I hadn't noticed before but you can use these additional title format functions inside Text Display because they all return the same code as $rgb

Code: [Select]
$hsl(h,s,l)
$hsl()
$blend(colour1,colour2,part,total)
$transition(string,colour1,colour2)

Full docs for those are here: https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#Historical_and_Columns_UI_color_functions
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-07 02:50:52
3.1.12

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

Some minor bug fixes.
Title: Re: JScript Panel
Post by: grimes on 2022-11-11 10:36:27
Docs Album Art: https://marc2k3.github.io/jscript-panel/gallery/album-art/ (https://marc2k3.github.io/jscript-panel/gallery/album-art/)
"This has full parity with with Default UI / Columns UI panels where"
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-13 02:12:25
3.0.7 for fb2k 1.6.6-16.13
3.1.13 for fb2k v2

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

Same thumbs sample bug fix for both releases.
Title: Re: JScript Panel
Post by: Air KEN on 2022-11-13 04:08:13
Hi :)

can't install.

foobar2000 v1.6.13 Windows 11 Home.
JScript Panel 3 3.0.7 (foo_jscript_panel3):
Failed to load DLL: foo_jscript_panel3.dll
Reason: Wrong version number; this component appears to have been built with a newer version of the foobar2000 SDK, please download latest version of foobar2000 in order to use it.

Deleting "\profile\user-components\foo_jscript_panel3 folder" and installing it again didn't work either.
JScript Panel 3 3.0.6 is fine.

Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-13 04:49:31
Thanks for noticing. I'll post a fixed version soon.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-13 05:01:24
Should be fixed now. Sorry for the inconvenience.
Title: Re: JScript Panel
Post by: Air KEN on 2022-11-13 05:57:12
Should be fixed now. Sorry for the inconvenience.

Many Thanks marc2k3 :)
Title: Re: JScript Panel
Post by: Hesperidina on 2022-11-15 02:59:21
Hi Marc,

I've found the time to get back to writing my scripts, and I think I came across a bug.

I'm using FillGradientRectangle and whenever I set an X or Y value other than 0, the gradient does not draw properly, it is cut by the amount of pixels I set X or Y (only the gradient effect, not the shape itself).

Take these 2 examples of vertical gradient and horizontal gradient respectively:

Code: [Select]
gr.FillGradientRectangle(0, 100, window.Width, 100, 0, 0xFF000000, 0xFFFFFFFF);
gr.FillGradientRectangle(100, 0, 100, window.Height, 1, 0xFF000000, 0xFFFFFFFF);

The result from this 2 lines is a box that is the correct size but the black part of the gradient is not visible, only if you set both X and Y to 0 you can actually see the black, as if it is being drawn from x:0 and y:0 no matter what.

I did the same test using FillGradientRectangleAdvanced with the sample in the docs, same behaviour.

Since I haven't yet updated to foobar v2.0 I'm using JScript Panel v3.0.7. I took a look at the changelog and couldn't find anything related to this in newer versions.

As always, thank you for this great component.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-15 03:27:08
Oh poop. That bug has only been there since the first version of v3 so about 6 months. :/

I ineptly used 0 instead of the x/y values  :-X

(https://i.imgur.com/gUk9CBV.png)
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-15 04:20:20
3.0.8 for fb2k 1.6.6-16.13 fixes the gradient rectangle bugs.

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

A fixed version for fb2k v2 will probably come at some point later on today.
Title: Re: JScript Panel
Post by: Hesperidina on 2022-11-15 19:58:59
Thank you! Now it works just fine.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-15 20:50:12
3.1.14 for fb2k v2 has the same gradient rectangle bug fix

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


Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-16 20:17:33
Anyone using smooth browser should make sure that update to fb2k v2 Beta 13 and component version 3.1.14 released yesterday. Previously I had to add a hacky workaround to prevent refreshing on playback statistics updates but that only worked for playcount updates. Now there is proper code which suppresses refresh on all playback statistics updates and updates from any other components that utilise DB functionality from the SDK.

This is documented here for anyone writing their own scripts...

https://marc2k3.github.io/jscript-panel/docs/callbacks/#on_library_items_changedhandle_list-fromhook
Title: Re: JScript Panel
Post by: josemescud on 2022-11-24 12:03:09
Message for Marc2K3:

Sorry if the translation is not well understood.I am Spanish and use Google Translator

I have installed the version V-2_64-bit + columns IU 2.0.0 ALPHA. 5. Most commements have not been able to install them as there is no 64 -bit version.

That is why I have installed JScript Panel 3 to replace the foo_uie_albumart component 0.2.7.1 by albumart.js

And I have the following problem:

Albumart.js paints the cover defined in preferences \ advanced \ display \ album art \ -> in my case "Prefer embedded" (image1)

I would like albumart.js to give the possibility of choosing to paint the external or embedded cover.

As seen in the image2 (Foobar 32 bit) the album art paints the external and the playlist view paints the embedded (image2).

Is this possible? If it was not possible, I would like the code linen to indicate where the cover load is produced to modify it in .js that corresponding.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-25 02:47:44
The sample you mention has always respected the main preferences and won't be changed. It's explained in great detail here...

https://marc2k3.github.io/jscript-panel/gallery/album-art/

If you want to ignore the Preferences, you need to write your own script that doesn't use the album art methods and uses the generic utils.LoadImage function based on whatever path/title formatting you like.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-25 22:59:53
https://github.com/marc2k3/jscript-panel/releases

3.0.9 for fb2k 1.6.6 - 1.6.14
3.1.15 for fb2k 2.0 Beta 13+

Both have been updated with a better SVG rendering library.
Title: Re: JScript Panel
Post by: Air KEN on 2022-11-26 04:13:10
Hi :)
JScript Panel 3 3.1.15 (2022-11-25)
Font, Color of Text Dispaly has become strange
https://i.imgur.com/fDWDETk.png

Preference > Columns UI > Colours and fonts > Item details > Font: Yu Gothic UI
Text Display > Custom text

[%title%$crlf()]
$font(Yu Gothic UI,16,600,2,0,0)$rgb(220,40,0)
[%artist%$crlf()]
$font()$rgb()
[%album%$crlf()]
[ '('%date%')'$crlf()]
[Track Number: %tracknumber%][ / %totaltracks%]$crlf()

JScript Panel 3 3.1.14
https://i.imgur.com/ypNnAIU.png

Thanks
Title: Re: JScript Panel
Post by: Air KEN on 2022-11-26 04:27:57
Sorry. I fixed it by replacing the component several times.
It's strange.  :o
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-26 05:57:03
Preference > Columns UI > Colours and fonts > Item details > Font: Yu Gothic UI

This has zero effect. The default font name when using CUI comes from Common (list items). The font weight / size from there are ignored. The weight will always be default (400) and the default size usually comes from the right click menu on text/list based panels.

If you want to override it for your whole text display panel, you need to use $font at the start and never use $font() - always revert to the original $font statement after styling a custom bit of text/new line.
Title: Re: JScript Panel
Post by: Air KEN on 2022-11-26 08:30:26
> Preference > Columns UI > Colours and fonts > Item details > Font: Yu Gothic UI
I wrote something irrelevant. orz

Thank you for your clear explanation.

Thanks again for your help.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-26 12:14:18
I've updated my github links.

docs are now here: https://jscript-panel.github.io/docs/
releases are now here: https://github.com/jscript-panel/release/releases

The old links will live on for a few hours before I nuke them!  :o
Title: Re: JScript Panel
Post by: josemescud on 2022-11-30 11:03:00
Message for marc2K3:

I need help.

I am modifying the script "Track Info + Seekbar + Buttons".

And I can't write in JavaScript the first line of the following code:

if (%genre% == 'Clásica') {
    var tfo = fb.TitleFormat('%album%   %date%   %artist%^^"$upper(%composer%)"  %tracknumber%. %title%^^[%playback_time%]^^$if2(%length%,LIVE)');
} else {
    var tfo = fb.TitleFormat('%artist%   %date%   %album%^^%tracknumber%. %title%^^[%playback_time%]^^$if2(%length%,LIVE)');
}
What I need is simply that in the case of a classical genre track it paints some metadata and otherwise others.

-------------------------------------------------------

I installed "fontawesome-webfont.ttf".
The buttons are painted correctly but when I move the mouse pointer to the buttons I get JavaScript error (image)

Thank you very much for your help
Title: Re: JScript Panel
Post by: marc2k3 on 2022-11-30 11:26:22
1) use $strcmp and incorporate in the TF string like this...

Code: [Select]
var tfo = fb.TitleFormat('%album%   %date%   %artist%^^$if($strcmp(%genre%,Clásica),$upper(%composer%),)  %tracknumber%. %title%^^[%playback_time%]^^$if2(%length%,LIVE)');

2) That is not my original code. You've made a terrible edit so you should undo it or just re-install the component to restore the untouched files.
Title: Re: JScript Panel
Post by: grimes on 2022-12-01 12:49:27
Just a small glitch (actually not worth to mention)
 Dark mode: On startup foobar2000 with open JScript panel a white rectangle flickers for a short time.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-01 15:38:10
I already set the background colour to white/dark grey depending on dark mode. This can be tested by adding a panel, removing all code and then switching DUI/CUI dark mode preferences. It will update in real time as you do it.

Any white showing through on startup will be most likely caused by a script blocking the main thread before it can be rendered. That's the nature of the beast with these javascript-y components. It could be other components blocking the main thread but that's less likely.

edit: if using the thumbs script and you have the thumbnail strip enabled, turn it off. That can be expensive depending on number/size of images. Displaying/cycling through images without the strip on display is cheap and should not affect startup.

late edit: while poking around a bit more, I did discover some dodgy code of mine that will display the javascript error text/red background even when there are no errors It only seemed to happen with a time consuming script running in CUI. I'll try and fix that.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-03 11:59:01
3.1.16 for fb2k 2.0 Beta13+

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

The last version compatible with fb2k 1.6.6-1.6.14 has been shunted off to my v1 component graveyard.

https://github.com/marc2k3/fb2k-archive/releases

I'm willing to fix bugs if people report them but it won't be getting new features.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-07 15:00:29
3.1.17 for fb2k 2.0 Beta13+

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

The SVG renderer now supports text.

Title: Re: JScript Panel
Post by: etip on 2022-12-07 17:15:45
Sounds great Marc !!! thank you.
I'll test it end of week when i'm back home and i successfully manage to upgrade to V2.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-07 18:24:13
My fb2k v1 compatible component has had the feature backported (yes I am contradicting what I said a few posts up  :P )

https://github.com/marc2k3/fb2k-archive/releases

Title: Re: JScript Panel
Post by: sveakul on 2022-12-07 21:25:18
Thanks, marc2k3!
Title: Re: JScript Panel
Post by: josemescud on 2022-12-09 12:21:12
1) use $strcmp and incorporate in the TF string like this...

Code: [Select]
var tfo = fb.TitleFormat('%album%   %date%   %artist%^^$if($strcmp(%genre%,Clásica),$upper(%composer%),)  %tracknumber%. %title%^^[%playback_time%]^^$if2(%length%,LIVE)');

2) That is not my original code. You've made a terrible edit so you should undo it or just re-install the component to restore the untouched files.


I want to thank you for your great help. You saved my life.

Thanks to your Indes my code was like this:

Code: [Select]
var tfo = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),%album%   %date%   %artist%^^"$upper(%composer%)"  ,%artist%   %date%   %album%^^)%tracknumber%. %title%^^[%playback_time%]^^$if2(%length%,LIVE)');

I also solved the matter of the buttons by installing version 3.1.17

Now I have the following problem:

   - How can I write above and below Seekbar? (Image1)

If it is not to abuse much I would like the Album Art, when I select an artist from the Album List Panel and deposit its albumes in the playlist "Library view" the Panel shows instead of an empty image the cover corresponding to the first album of the playlist. (This is what Artwork View does)

I would also like to know if you have thought of programming a script to replace the obsolete Graphical Browser component and thus be able to complete my foobar 64-bit.

Thank you for reading this message and for keeping jscript_panel3.
Thanks to your component I am gradually building my 64-bit foobar version.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-09 13:31:04
Regarding the text, you just need to modify the WriteText function in your script. You've already changed the y value to move text up/down so you just need to change the w value to make it expand wider.

The album art panel has always tracked playlist selection and not any library viewer. It's documented here under Limitations

https://jscript-panel.github.io/gallery/album-art/#limitations

Smooth Browser has a grid like album art view but is bound to the Library. There is no playlist option which I think graphical browser was tied to.

https://jscript-panel.github.io/gallery/smooth-browser/
Title: Re: JScript Panel
Post by: josemescud on 2022-12-09 18:28:19
Regarding the text, you just need to modify the WriteText function in your script. You've already changed the y value to move text up/down so you just need to change the w value to make it expand wider.

The album art panel has always tracked playlist selection and not any library viewer. It's documented here under Limitations

https://jscript-panel.github.io/gallery/album-art/#limitations

Smooth Browser has a grid like album art view but is bound to the Library. There is no playlist option which I think graphical browser was tied to.

https://jscript-panel.github.io/gallery/smooth-browser/


Thanks again for your help. I could already leave the texts as I wanted.

Indeed the Graphical Browser is linked to the playlist. I already installed Smooth Browser but it did not help me to be linked to the library.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-10 03:37:27
3.1.18 for fb2k 2.0 Beta 13+

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

3.0.11 for fb2k 1.6.6 - 1.6.14

https://github.com/marc2k3/fb2k-archive/releases
Title: Re: JScript Panel
Post by: josemescud on 2022-12-14 21:53:34
Message for marc2K3:

Foobar2000 v-2 64-bit
Jscript Panel3

I have the following problem in the "Track Info + Seekbar + Buttons.txt" script:

I need to paint the %samplerate% with one color if> 48000 and another color for the rest (image)

Something similar to this code that I had in the Graphical Browser 32-bit complement:
$ifgreater(%samplerate%,49000,$puts(colours.samplerate,0-240-0),$puts(colours.samplerate,170-170-170))

This my code:

Code: [Select]
var tfo = fb.TitleFormat('%samplerate% Hz');

//aquí se pinta la linea 1 dcha: samplerate
gr.WriteText(tfo.Eval(), normal3_font, colours.samplerate, panel.h + posi_vertical_linea1_dcha, posi_horiz_linea1, seekbar.x - panel.h, panel.h * 0.5, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
Thanks in advance
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-14 22:54:53
Any instance of gr.WriteText can be replaced with DrawColouredText. It fully supports $rgb in title formatting, Using $rgb() with no args resets to the default_colour.

Code: [Select]
$ifgreater(%samplerate%,44100,$rgb(255,0,0),)%samplerate%

Note that the first argument has to be gr. The rest of the arguments are the same as WriteText in the same order.

Code: [Select]
DrawColouredText(gr, text, font, default_colour, x, y, w, h, text_alignment, paragraph_alignment, word_wrapping, trimming_granularity)

edit: DrawColouredText is not part of the component so it won't be on the docs pages. It's just a bit of javascript included inside helpers.txt. All samples already import it by default. Anyone writing their own scripts from scratch would need to import it...

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%helpers.txt"
// ==/PREPROCESSOR==
Title: Re: JScript Panel
Post by: josemescud on 2022-12-15 10:54:00
Thank you very much mark2k3 for your quick response.

I have not been able to put it into practice.

It seemed to understand that tfo.eval () would interpret the color $rgb (0.240.0) and the metadato %samplerate% if %samplerate% > 49000 and otherwise would apply "colours.samplerate1"
But if %samplerate% > 49000 paints "00f00095000 Hz" (image)

I leave you an extract of my script in case you can help me indicating the convenient corrections.

// ==PREPROCESSOR==
// @name "Track Info + Seekbar + 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"
// @import "%fb2k_component_path%samples\js\seekbar.js"

// ==/PREPROCESSOR==

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

var colours = {
   buttons : RGB(220, 220, 220),
   background : RGB(50, 50, 50),
   artist : RGB(170, 170, 170),
   año : RGB(220, 220, 220),
   album : RGB(200, 200, 200),
   composer : RGB(200, 200, 200),
   track : RGB(200, 200, 200),
   title : RGB(220, 220, 220),
   time : RGB(220, 220, 220),
   time_total : RGB(230, 230, 230),
   relojes : RGB(170, 170, 170),
   codec : RGB(170, 170, 170),

   samplerate1 : RGB(170, 170, 170),

   rgain : RGB(190, 190, 190),
   seekbar_background : RGB(25, 25, 25),
   seekbar_progress : RGB(110, 110, 110),
   seekbar_knob : RGB(255, 0, 0),
   sac : RGB(196, 30, 35),
};

var tfo = fb.TitleFormat('$ifgreater(%samplerate%,49000,$rgb(0,240,0),)%samplerate% Hz');   

//aquí se pinta la linea 1 dcha: herzios
DrawColouredText(gr, tfo.Eval(), normal3_font, colours.samplerate1, panel.h + posi_vertical_linea1_dcha, posi_horiz_linea1, seekbar.x - panel.h, panel.h * 0.5, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-15 11:39:26
It only shows the colour codes if I pass the text with $rgb code in to WriteText like this....

(https://i.imgur.com/TizgLJ3.png)

edit: this is an appalling code example, never create fb.TitleFormat objects inside on_paint. I was lazy.
Title: Re: JScript Panel
Post by: josemescud on 2022-12-16 22:14:00
It only shows the colour codes if I pass the text with $rgb code in to WriteText like this....

edit: this is an appalling code example, never create fb.TitleFormat objects inside on_paint. I was lazy.

marc2k3 I want to thank you for your help.

Everything was fantastic as seen in the image.

Now I have another problem. Time data are paralyzed and do not advance per second.
However, if I take them on the Seekbar if they look correctly, but to move them away from the Seekbar they are paralyzed.

Keep in mind that the right side where the volume and the texts are painted above and below belong to another panel3 attached to the principal.  

I leave you the script in case you can take a look:
Code: [Select]
// ==PREPROCESSOR==
// @name "Track Info + Seekbar + 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"
// @import "%fb2k_component_path%samples\js\seekbar.js"
// ==/PREPROCESSOR==

//lleva 4 panel3:
//1 que lleva la minicover, los botones, la seekbar, los textos de la izquierda y los relojes
//2 un triple panel a derecha del pie: 1 para los textos arriba, el volumen y los textos abajo

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

//tamaño botones
var bs = _scale(25);
var sep_botones = 3;
//posicion vertical botones
var posi_horiz_botones = -1;
var LM = 318;
//posiciones para el botón speaker
var posi_horiz_botones2 = -2.5;
var LM2 = -64;
//posiciones seekbar
var posi_vert_seekbar_ini = 60;
var ancho_seekbar = _scale(550);
var alto_seekbar = _scale(5)

//el valor _scale(-xxx) marca el límite en que se corta el texto con ...
var limite1 = _scale(-497);
var posi_vert_linea_izq = 10;
var posi_horiz_linea1 = -5;
var posi_horiz_linea2 = 23;
var posi_horiz_porcen = -2;
var posi_vert_porcen = _scale(975);

//fuentes para los textos
var normal1_font = CreateFontString('Segoe UI', 11);
var normal2_font = CreateFontString('Segoe UI', 12);
var normal3_font = CreateFontString('Segoe UI', 13);
var normal4_font = CreateFontString('Eras Medium ITC', 13);
var bold_font = CreateFontString('Segoe UI', 12, true);

//aquí se definen los colores
var colours = {
buttons : RGB(220, 220, 220),
background : RGB(40, 40, 40),
artist : RGB(170, 170, 170),
año : RGB(220, 220, 220),
album : RGB(200, 200, 200),
composer : RGB(200, 200, 200),
track : RGB(200, 200, 200),
title : RGB(220, 220, 220),
time : RGB(220, 220, 220),
time_total : RGB(210, 210, 210),
relojes : RGB(170, 170, 170),
codec : RGB(170, 170, 170),
samplerate1 : RGB(170, 170, 170),
rgain : RGB(190, 190, 190),
seekbar_background : RGB(15, 15, 15),
seekbar_progress : RGB(70, 70, 70),
seekbar_progress_degra : RGB(20, 20, 20),
seekbar_borde : RGB(50, 50, 50),
seekbar_knob : RGB(230, 0, 0),
sac : RGB(196, 30, 35),
};

// textos izquierda
var tfo1 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),%album%    %date%    %artist%^^"$upper(%composer%)"   ,%artist%    %date%    %album%^^)%tracknumber%.  %title%^^[%playback_time% ]^^$if2(%length%,LIVE)');
// porcentaje, tiempos
var tfo3 = fb.TitleFormat('$div($mul(%_time_elapsed_seconds%,100),%_time_total_seconds%) ٪   |   %playback_time%   |   - %playback_time_remaining%');

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

var chars = {
vol : '\uF027',
activate : '\uF054',
prev : '\uF049',
next : '\uF050',
play : '\uF04B',
pause : '\uF04C',
stop : '\uF04D',
}

var panel = new _panel();
var seekbar = new _seekbar(0, 0, 0, 0);
var buttons = new _buttons();
var img = null;
window.MaxHeight = _scale(150);

on_playback_new_track();

buttons.update = function () {
var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_botones;
this.buttons.stop = new _button(panel.w - LM - (sep_botones * 4) - (bs * 8), y, bs, bs, { char : chars.stop, colour:fb.StopAfterCurrent ? colours.sac : colours.buttons}, null, function () { fb.Stop(); }, 'Stop');
this.buttons.previous = new _button(panel.w - LM - (sep_botones * 3) - (bs * 7), y, bs, bs, { char : chars.prev, colour:colours.buttons }, null, function () { fb.Prev(); }, 'Previous');
this.buttons.play = new _button(panel.w - LM - (sep_botones * 2) - (bs * 6), y, bs, bs, { char : !fb.IsPlaying || fb.IsPaused ? chars.play : chars.pause, colour:colours.buttons}, null, function () { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? 'Play' : 'Pause');
this.buttons.next = new _button(panel.w - LM-sep_botones - (bs * 5), y, bs, bs, { char : chars.next, colour:colours.buttons }, null, function () { fb.Next(); }, 'Next');
this.buttons.activate = new _button(panel.w - LM - (bs * 4), y, bs, bs, { char : chars.activate, colour:colours.buttons }, null, function () { fb.RunMainMenuCommand('View/Playlist view/Activate now playing'); }, 'Activate now playing');
var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_botones2;
this.buttons.vol = new _button(panel.w - LM2 - (bs * 3), y, bs, bs, { char : chars.vol, colour:colours.buttons }, null, function () { fb.RunMainMenuCommand('Playback/Volume/Mute'); }, 'Mute');
}

function update_album_art(metadb) {
_dispose(img);
img = null;
if (metadb) {
img = metadb.GetAlbumArt();
}
window.Repaint();
}

function on_mouse_lbtn_down(x, y) {
seekbar.lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
if (x < panel.h && fb.IsPlaying && img) {
fb.GetNowPlaying().ShowAlbumArtViewer();
return;
}
if (buttons.lbtn_up(x, y)) {
return;
}
if (seekbar.lbtn_up(x, y)) {
return;
}
fb.RunMainMenuCommand('View/Show now playing in playlist');
}

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

function on_mouse_move(x, y) {
window.SetCursor(x < panel.h && fb.IsPlaying && img ? IDC_HAND : IDC_ARROW);
if (buttons.move(x, y)) {
return;
}
seekbar.move(x, y);
}

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

//aquí cancelo que al mover la rueda del ratón se dispare el volumen
function on_mouse_wheel(s) {
if (seekbar.wheel(s)) {
return;
}
// if (s == 1) {
// fb.VolumeUp();
// } else {
// fb.VolumeDown();
// }
}

function on_paint(gr) {
//  aquí se pinta el background de todo el pie
    gr.FillRectangle(0, 0, panel.w, panel.h, colours.background);
// aquí se pinta la barra nula
// gr.FillRectangle(seekbar.x, seekbar.y, seekbar.w + _scale(6), seekbar.h, colours.seekbar_background);
gr.FillGradientRectangle(seekbar.x, seekbar.y, seekbar.w + _scale(6), seekbar.h, 0, RGB(50, 50, 50), RGB(0, 0, 0));

buttons.paint(gr);

// aquí se pinta la miniatura ---------------------------------------------
if (img) {
_drawImage(gr, img, 0, 0, panel.h - 2, panel.h - 2, image.centre);
}

if (fb.IsPlaying) {
var arr1 = tfo1.Eval().split('^^');

// aquí se pinta la linea 1 izq: artist, año, album
gr.WriteText(arr1[0], normal2_font, colours.artist, panel.h + posi_vert_linea_izq, posi_horiz_linea1, seekbar.x - panel.h - limite1, panel.h * 0.5, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

// aquí se pinta la linea 2 izq: composer, track, title
gr.WriteText(arr1[1], normal2_font, colours.title, panel.h + posi_vert_linea_izq, posi_horiz_linea2, seekbar.x - panel.h - limite1, panel.h * 0.9, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

// aquí se pinta el tiempo total del track
gr.WriteText(arr1[3], normal4_font, colours.time_total, seekbar.x + seekbar.w + _scale(12), -2, _scale(130), panel.h, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER);

//      aquí se pintan porcentaje, tiempo transcurrido y tiempo restante /////////////////////
var arr3 = tfo3.Eval().split('^^');
gr.WriteText(arr3[0], normal4_font, colours.relojes, seekbar.x - _scale(50), posi_horiz_porcen, posi_vert_porcen, panel.h, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

if (fb.PlaybackLength > 0) {
var pos = seekbar.pos();
// aquí se pinta la parte izquierda de la seekbar
// gr.FillRectangle(seekbar.x, seekbar.y, pos, seekbar.h, colours.seekbar_progress);
        gr.FillGradientRectangle(seekbar.x, seekbar.y, pos, seekbar.h, 0, RGB(70, 70, 70), RGB(20, 20, 20));
// aquí se pinta el knob avanzando
        gr.FillGradientRectangle(seekbar.x + pos, seekbar.y - 1, _scale(8), seekbar.h +2, 0, RGB(230, 0, 0), RGB(0, 0, 0));
}
}
}

function on_playback_dynamic_info_track(type) {
if (type == 0) window.Repaint();
else update_album_art(fb.GetNowPlaying());
}

function on_playback_edited() {
window.Repaint();
}

function on_playback_new_track(metadb) {
update_album_art(metadb);
}

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

function on_playback_seek() {
seekbar.playback_seek();
}

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

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

function on_playback_time() {
window.RepaintRect(panel.h, 0, seekbar.x - panel.h, panel.h);
}

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

//aquí se definen las coordenadas de la seekbar
function on_size() {
panel.size();
seekbar.x = _scale(posi_vert_seekbar_ini);
    seekbar.w = panel.w - seekbar.x - ancho_seekbar;
seekbar.h = alto_seekbar;
seekbar.y = (panel.h - seekbar.h) / 2;
buttons.update();
}
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-17 00:13:43
Replace this code...

Code: [Select]
function on_playback_time() {
window.RepaintRect(panel.h, 0, seekbar.x - panel.h, panel.h);
}
with
Code: [Select]
function on_playback_time() {
window.Repaint();
}
Title: Re: JScript Panel
Post by: josemescud on 2022-12-17 00:37:56
Replace this code...

Code: [Select]
function on_playback_time() {
window.RepaintRect(panel.h, 0, seekbar.x - panel.h, panel.h);
}
with
Code: [Select]
function on_playback_time() {
window.Repaint();
}

marc2K3 I just correct the script and everything has been perfect.

Thank you very much once again.
Title: Re: JScript Panel
Post by: josemescud on 2022-12-20 22:58:39
Message for marc2k3:

I don't know if it will be abusing you. But I ask you if you have a routine that does what I need.

It is a routine that I had in Foobar2000 32-bit in a WSH panel that eliminated when painting the metadata %album% and %title% all the text that was to the right of the "(" except that it was at the beginning of the text. When trying to write it in JScript Panel3 I give me continuous syntax errors.

Therefore the entire text will be eliminated from the first "(" until the end of the text except that "(" is at the beginning of the text.

In the following examples the red text indicates what should not be painted:

metadato                                                                                   Paint
----------------------------------------------------------------     ------------------------------------------
Three Seasons (Music From The Motion Picture)                     Three Seasons
Byrd Jazz (Live at London) aka "Yusef" (Delmark DL-407)        Byrd Jazz
Do Ai (Dhuong Vi..... The Red Blindfo)                                      Do Ai
(Down Home) Blues (together)                                                 (Down Home) Blues


This is my routine for wsh panel 32-bit:
Code: [Select]
// obtengo el titulo pintando la primera frase entre () si está al principio
// seguido de las palabras anteriores a la siguiente frase entre ()
$puts(cam,%title%)

//////////////////// Fase 1: proceso hasta la 1ª palabra entre parentesis /////////////////////
$puts(tx1,)$puts(tx2,)$puts(pri,)$puts(ult,)
$puts(var,)$puts(var2,)

$puts(pri,$strchr($get(cam),'('))
$puts(ult,$strchr($get(cam),')'))

// si no hay '('
$ifequal(pri,0,var1 = 1,)
// si no hay ')'
$ifequal(ult,0,var1 = 1,)
// si '(' está despues del ')'
$ifgreater(pri,ult,var var1 = 1,)
// si '(' está al principio
$ifequal(pri,1,var var2 = 1,)

$ifequal(var1,1
,
var trz1 = cam
var tx1 = cam
,
var trz1 = $left(cam,ult)
var tx1 = $left(trz1,$add(pri,-1))
var tx2 = $substr(trz1,pri,ult)
)

$ifequal(var2,1
,var titulo = tx2
,var titulo = tx1
)

//////////// Fase 2: proceso desde el final del 1er trozo hasta el final /////////////

//////////// Vuelvo a subdividir el resto

$ifgreater($len(cam),trz1
,
//$puts(resto,$replace($get(cam),$get(trz1),))
var resto = $right(cam,$sub($len(cam),$len(trz1)))

var tx1 =
var tx2 =
var pri =
var ult =

var pri = $strchr(resto,'(')
var ult = $strchr(resto,')')

// si no hay '('
$ifequal(pri,0,var var1 = 1,)
// si no hay ')'
$ifequal(ult,0,var var1 = 1,)
// si '(' está despues del ')'
$ifgreater(pri,ult,var var1 = 1,)

$ifequal(var,1
,
var trz2 = resto
var tx1 = resto
,
var trz2 = $left(resto, ult)
var tx1 = $left(trz2,$add(pri,-1))
var tx2 = $substr(trz2,pri,ult)
)
,
)

$ifequal(var2,1
,var titulo = titulotx1
,
)

This is my current script for JScript Panel3:
Code: [Select]
// ==PREPROCESSOR==
// @name "Track Info + Seekbar + 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"
// @import "%fb2k_component_path%samples\js\seekbar.js"
// ==/PREPROCESSOR==

//PIE que lleva 2 panel3:
//1 con la minicover, los botones, la seekbar, los textos de la izquierda y los tiempos
//2 un triple panel a derecha del pie: 1 para los textos arriba, 1 para el volumen y 1 para los textos abajo

//////////////////////////////////////////////////////////////
//tamaño botones
var bs = _scale(25);
var sep_bot = 3;
//posicion vertical botones
var posi_horiz_bot = -1;
var posi_horiz_bot2 = -0.1;
var LM = 324;
//posiciones para el botón speaker
var posi_horiz_bot3 = -1;
var LM2 = -64;
//posiciones seekbar
var posi_vert_seekbar_ini = 59;
var ancho_seekbar = _scale(550);
var alto_seekbar = _scale(5)

//el valor _scale(-xxx) marca el límite en que se corta el texto con ...
var limite1 = _scale(-496);

var posi_vert_lin_izq = 10;
var posi_horiz_lin1 = -5;
var posi_horiz_lin2 = 23;

//Recuadro de tiempos
//desplazamiento vertical
var time_x = 1365
//desplazamiento horizontal
var time_y = 21.5
//ancho de izq. a dcha.
var time_w = -240
//alto
var time_h = 26

var posi_horiz_time = 1;
var sep_time = 161;
var posi_vert_time_actual = _scale(1731);
var posi_vert_time_resto = posi_vert_time_actual + sep_time;
var posi_vert_time_total = posi_vert_time_resto + sep_time;

//fuentes para los textos
var normal1_font = CreateFontString('Segoe UI', 11);
var normal2_font = CreateFontString('Segoe UI', 12);
var normal3_font = CreateFontString('Segoe UI', 13);
var normal4_font = CreateFontString('Segoe UI', 14);
var normal5_font = CreateFontString('Eras ITC', 14);
var bold_font = CreateFontString('Segoe UI', 12, true);

//aquí se definen los colores
var colours = {
buttons : RGB(220, 220, 220),
background : RGB(40, 40, 40),
artist : RGB(170, 170, 170),
año : RGB(230, 230, 230),
album : RGB(200, 200, 200),
composer : RGB(170, 170, 170),
dato1 : RGB(150, 150, 150),
negro : RGB(0, 0, 0),
track : RGB(200, 200, 200),
title : RGB(215, 215, 215),
porcen : RGB(180, 180, 180),

time : RGB(180, 180, 180),
time_total : RGB(220, 220, 220),
time_reborde : RGB(32, 32, 32),
time_recuadro_sup : RGB(50, 50, 50),
time_recuadro_inf : RGB(25, 25, 25),

codec : RGB(170, 170, 170),
samplerate1 : RGB(170, 170, 170),
rgain : RGB(190, 190, 190),
seekbar_background : RGB(15, 15, 15),
seekbar_progress : RGB(70, 70, 70),
seekbar_progress_degra : RGB(20, 20, 20),
seekbar_borde : RGB(50, 50, 50),
seekbar_knob : RGB(230, 0, 0),
sac : RGB(196, 30, 35),
};

var tfo1 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),%album%    %date%    %artist%^^"$upper(%composer%)"   ,%artist%    %date%    %album%^^)%tracknumber%.  %title%^^[%playback_time% ]^^$ifgreater(%length%,0,$div($mul(%_time_elapsed_seconds%,100),%_time_total_seconds%) ٪,LIVE)');

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

var chars = {
vol : '\uF027',
activate3 : '\uF054',
prev : '\uF049',
next : '\uF050',
play : '\uF04B',
pause : '\uF04C',
stop : '\uF04D',
}

var panel = new _panel();
var seekbar = new _seekbar(0, 0, 0, 0);
var buttons = new _buttons();
var img = null;
window.MaxHeight = _scale(150);

on_playback_new_track();

buttons.update = function () {
var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_bot;

this.buttons.stop = new _button(panel.w - LM - (sep_bot * 4) - (bs * 8), y, bs, bs, { char : chars.stop, colour:fb.StopAfterCurrent ? colours.sac : colours.buttons}, null, function () { fb.Stop(); }, 'Stop');
this.buttons.previous = new _button(panel.w - LM - (sep_bot * 3) - (bs * 7), y, bs, bs, { char : chars.prev, colour:colours.buttons }, null, function () { fb.Prev(); }, 'Previous');
this.buttons.play = new _button(panel.w - LM - (sep_bot * 2) - (bs * 6), y, bs, bs, { char : !fb.IsPlaying || fb.IsPaused ? chars.play : chars.pause, colour:colours.buttons}, null, function () { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? 'Play' : 'Pause');
this.buttons.next = new _button(panel.w - LM-sep_bot - (bs * 5), y, bs, bs, { char : chars.next, colour:colours.buttons }, null, function () { fb.Next(); }, 'Next');

var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_bot2;
this.buttons.activate = new _button(panel.w - LM - (bs * 4), y, bs, bs, { char : chars.activate3, colour:colours.buttons }, null, function () { fb.RunMainMenuCommand('View/Playlist view/Activate now playing'); }, 'Activate now playing');

var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_bot3;
this.buttons.vol = new _button(panel.w - LM2 - (bs * 3), y, bs, bs, { char : chars.vol, colour:colours.buttons }, null, function () { fb.RunMainMenuCommand('Playback/Volume/Mute'); }, 'Mute');
}

function update_album_art(metadb) {
_dispose(img);
img = null;
if (metadb) {
img = metadb.GetAlbumArt();
}
window.Repaint();
}

function on_mouse_lbtn_down(x, y) {
seekbar.lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
if (x < panel.h && fb.IsPlaying && img) {
fb.GetNowPlaying().ShowAlbumArtViewer();
return;
}
if (buttons.lbtn_up(x, y)) {
return;
}
if (seekbar.lbtn_up(x, y)) {
return;
}
fb.RunMainMenuCommand('View/Show now playing in playlist');
}

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

function on_mouse_move(x, y) {
window.SetCursor(x < panel.h && fb.IsPlaying && img ? IDC_HAND : IDC_ARROW);
if (buttons.move(x, y)) {
return;
}
seekbar.move(x, y);
}

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

//aquí cancelo que al mover la rueda del ratón se dispare el volumen
function on_mouse_wheel(s) {
if (seekbar.wheel(s)) {
return;
}
// if (s == 1) {
// fb.VolumeUp();
// } else {
// fb.VolumeDown();
// }
}

function on_paint(gr) {
//  aquí se pinta el background de todo el pie
    gr.FillRectangle(0, 0, panel.w, panel.h, colours.background);
// aquí se pinta la barra nula
gr.FillGradientRectangle(seekbar.x, seekbar.y, seekbar.w + _scale(6), seekbar.h, 0, RGB(50, 50, 50), RGB(0, 0, 0));
buttons.paint(gr);

// aquí se pinta la miniatura fuera de If (fb.IsPlaying) para que no se borre al pulsar stop --------
if (img) {
_drawImage(gr, img, 0, 0, panel.h - 2, panel.h - 2, image.centre);
}

if (fb.IsPlaying) {
var arr1 = tfo1.Eval().split('^^');
// aquí se pinta la linea 1 izq: artist, año, album
gr.WriteText(arr1[0], normal2_font, colours.artist, panel.h + posi_vert_lin_izq, posi_horiz_lin1, seekbar.x - panel.h - limite1, panel.h * 0.5, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
// aquí se repinta en alta luminosidad la linea 1 izq: ALbum+Año o Artist+Año
var dato1_2 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),%album%    %date%,%artist%    %date%)').Eval();
gr.WriteText(dato1_2, normal2_font, colours.año, panel.h + posi_vert_lin_izq, posi_horiz_lin1, seekbar.x - panel.h - limite1, panel.h * 0.5, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
// aquí se repinta la linea 1 izq: ALbum o Artist (primero se pinta en negro y luego se vuelve a repintar en su color)
var dato1 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),%album%,%artist%)').Eval();
gr.WriteText(dato1, normal2_font, colours.negro, panel.h + posi_vert_lin_izq, posi_horiz_lin1, seekbar.x - panel.h - limite1, panel.h * 0.5, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
gr.WriteText(dato1, normal2_font, colours.artist, panel.h + posi_vert_lin_izq, posi_horiz_lin1, seekbar.x - panel.h - limite1, panel.h * 0.5, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

// aquí se pinta la linea 2 izq: composer, track, title
gr.WriteText(arr1[1], normal2_font, colours.title, panel.h + posi_vert_lin_izq, posi_horiz_lin2, seekbar.x - panel.h - limite1, panel.h * 0.9, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
// aquí se repinta en baja luminosidad la linea 2 izq: composer (solo para clásica)
var tfo_composer = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),"$upper(%composer%)",)').Eval();
gr.WriteText(tfo_composer, normal2_font, colours.composer, panel.h + posi_vert_lin_izq, posi_horiz_lin2, seekbar.x - panel.h - limite1, panel.h * 0.9, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

// aquí se pinta el porcen que lleva el track a la dcha. de la seekbar
gr.WriteText(arr1[3], normal3_font, colours.porcen, seekbar.x + seekbar.w + _scale(12), 0, _scale(130), panel.h, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

// aquí se pinta el recuadro con reborde que aloja los tiempos
gr.FillGradientRectangle(time_x, time_y, time_w, time_h, 0, colours.time_recuadro_sup, colours.time_recuadro_inf);
// aquí se pinta el reborde del recuadro
DrawRectangle(gr, time_x, time_y, time_w, time_h, colours.time_reborde);

// tiempo transcurrido
var time_actual = fb.TitleFormat('%playback_time%').Eval();
gr.WriteText(time_actual, normal5_font, colours.time, seekbar.x - _scale(50), posi_horiz_time, posi_vert_time_actual, panel.h, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
// tiempo restante
var time_resto = fb.TitleFormat('- %playback_time_remaining%').Eval();
gr.WriteText(time_resto, normal5_font, colours.time, seekbar.x - _scale(50), posi_horiz_time, posi_vert_time_resto, panel.h, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
// tiempo total
var time_total = fb.TitleFormat('%length%').Eval();
gr.WriteText(time_total, normal5_font, colours.time_total, seekbar.x - _scale(50), posi_horiz_time, posi_vert_time_total, panel.h, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

if (fb.PlaybackLength > 0) {
var pos = seekbar.pos();
// aquí se pinta la parte izquierda de la seekbar
        gr.FillGradientRectangle(seekbar.x, seekbar.y, pos, seekbar.h, 0, RGB(80, 80, 80), RGB(30, 30, 30));

// aquí se pinta el knob avanzando
        gr.FillGradientRectangle(seekbar.x + pos, seekbar.y - 1, _scale(8), seekbar.h +2, 0, RGB(230, 0, 0), RGB(0, 0, 0));
}
}
}

function on_playback_dynamic_info_track(type) {
if (type == 0) window.Repaint();
else update_album_art(fb.GetNowPlaying());
}

function on_playback_edited() {
window.Repaint();
}

function on_playback_new_track(metadb) {
update_album_art(metadb);
}

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

function on_playback_seek() {
seekbar.playback_seek();
}

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

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

function on_playback_time() {
//la linea siguiente la sustituí por la siguiente según me indicó marc2k3 en el foro para arreglar el que no se pintaban los tiempos per second
// window.RepaintRect(panel.h, 0, seekbar.x - panel.h, panel.h);
window.Repaint();
}

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

//aquí se definen las coordenadas de la seekbar
function on_size() {
panel.size();
seekbar.x = _scale(posi_vert_seekbar_ini);
    seekbar.w = panel.w - seekbar.x - ancho_seekbar;
seekbar.h = alto_seekbar;
seekbar.y = (panel.h - seekbar.h) / 2;
buttons.update();
}
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-21 08:28:20
Code: [Select]
var title = tfo.title.Eval();
var first = title.indexOf('(');
var last = title.lastIndexOf('(');
if (last > first) title = title.substr(0, last-1).trim();
else if (first > 0) title = title.substr(0, first-1).trim();
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-21 22:24:11
3.2.0 https://github.com/jscript-panel/release/releases

Actually quite a minor release but gets a bigger version bump because the `Playback Statistics` built in to foobar2000 have been dropped in the latest Beta 18. Using foo_playcount for playback stats is back once again so the JS Playlist and Smooth Playlist ratings have reverted to component detection like all versions prior to 3.1.0.
Title: Re: JScript Panel
Post by: Mrakobes on 2022-12-22 10:03:17
(https://i121.fastpic.org/thumb/2022/1222/18/_b0809f260c1d459b337861ba9b30b718.jpeg) (https://i121.fastpic.org/big/2022/1222/18/_b0809f260c1d459b337861ba9b30b718.png)

tell me how to change the background color on the thumbnail feed

(https://i121.fastpic.org/thumb/2022/1222/3a/99a2cd079ffabaff9e6acbe5c9b1383a.jpeg) (https://i121.fastpic.org/big/2022/1222/3a/99a2cd079ffabaff9e6acbe5c9b1383a.png)

how do I change the font, font size and underline on the text panel? and how do I remove the inscription and underline at all?

(https://i121.fastpic.org/thumb/2022/1222/78/69f780466c4e8734d377d3e1a9bc7978.jpeg) (https://i121.fastpic.org/big/2022/1222/78/69f780466c4e8734d377d3e1a9bc7978.png)

how to change the font, font size on the volume panel

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

and the most mega important question is how to install a biography on your dashboard from @WilB ???
Title: Re: JScript Panel
Post by: josemescud on 2022-12-22 10:51:17
Code: [Select]
var title = tfo.title.Eval();
var first = title.indexOf('(');
var last = title.lastIndexOf('(');
if (last > first) title = title.substr(0, last-1).trim();
else if (first > 0) title = title.substr(0, first-1).trim();

Marc2K3, once again thank you for your help.

Routine works perfectly.

The problem is now how to invoke the title variable (clean of parentheses) from the fb.titleformat() command

var tfo1 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),%album%    %date%    %artist%^^"$upper(%composer%)"   ,%artist%    %date%    %album%^^)%tracknumber%.  %title%^^[%playback_time% ]^^$ifgreater(%length%,0,$div($mul(%_time_elapsed_seconds%,100),%_time_total_seconds%) ٪,LIVE)');
Title: Re: JScript Panel
Post by: josemescud on 2022-12-30 17:05:03
Message for marc2k3:

I have installed JSPlaylist to try to replace the obsolete Graphical Browser.

In the notes listed at https: //jscript-panel.github.io/gallery/jsplaylist/#Clickable-ratings read: Change Colours and Fonts in Fobar2000 Preferences> Display> DefaultUI or ColumsUI.

However, I am not able to see in "Colours and fonts" the option to configure the source that is seen in the image is very large.

Thanks for your help.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-31 09:10:19
JSPplaylist uses window.GetFontCUI which only supports global fonts

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

If you want custom alternative fonts then you don't use it and write your own code...

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

Title: Re: JScript Panel
Post by: josemescud on 2022-12-31 14:21:37
Message for marc2k3:

I need, if possible, to solve 2 problems in JSPLAYLIST:

1. It is possible that all albums are collapsed?. I don't want when an album is playing the tracks. That is, I want the albums to always be collapsed.

2. I would like to be able to reduce the panel in width. It must now have a minimal width.
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-31 14:46:30
I've removed the min width/height for the next release. If you can't wait, you can make the changes yourself in samples\jsplaylist\main.js

https://github.com/jscript-panel/component/commit/7fb29822d2f8cce89ad7212f0659be0ac3cd5fc3

As for making all groups collapsed all the time, I can't help with it. I didn't write that code and most of it is alien to me.
Title: Re: JScript Panel
Post by: josemescud on 2022-12-31 16:58:42
I've removed the min width/height for the next release. If you can't wait, you can make the changes yourself in samples\jsplaylist\main.js

https://github.com/jscript-panel/component/commit/7fb29822d2f8cce89ad7212f0659be0ac3cd5fc3

As for making all groups collapsed all the time, I can't help with it. I didn't write that code and most of it is alien to me.


Thanks to your help I could reduce the panel.

With respect to the subject of Albums collapsed:

The image corresponds to a 32-bit version of towards 2017 in which I installed the jsplaylist script (in a WSH panel).

It looks like all discs are collapsed even if a track is playing.

The configuration differs from the current one in which the enable auto-collapse box is not marked and in the current one it is marked since if I uncheck it then it does not collapse.

I would like to try to modify the code to collapse totally.

To gain time it is possible that you can tell me that file. Js of those that are loaded in the jscript panel3 may contain said code.

I guess it's playlist.js
Title: Re: JScript Panel
Post by: marc2k3 on 2022-12-31 23:25:16
3.0.14 for fb2k v1 peasants - https://github.com/marc2k3/fb2k-archive/releases
3.2.1 for fb2k v2 -  https://github.com/jscript-panel/release/releases

The Thumbs sample has been limited to loading no more than 64MB of images from disk.

This can still take 1GB+ of memory so you may override it by using the Properties window (Hold Shift+Win before right clicking, 2K3.THUMBS.SIZE.LIMIT in bytes)

(https://i.imgur.com/gzdSjHx.png)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-05 15:22:02
3.2.2 for fb2k v2.0

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

A version compatible with fb2k v1 will get the same fixes but not today.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-06 05:22:30
3.0.15 for fb2k v1.6.6+

https://github.com/marc2k3/fb2k-archive/releases
https://jscript-panel.github.io/docs/changes/#for-foobar2000-166-1614
Title: Re: JScript Panel
Post by: santasanta on 2023-01-15 16:56:27
Message for Marc2K3:

I would like in the script "menu button" to be able to load instead of chars.Menu a PNG icon that I have on this route:
%fb2k_component_path%images\5. Pie\5-1.png

// ==PREPROCESSOR==
// @name "Menu Button"
// @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==

var colours = {
    buttons : RGB(200, 200, 200),
    background : RGB(50, 50, 50)
};

var panel = new _panel();
var buttons = new _buttons();
buttons.buttons.menu = new _button(1, -2, 30, 30, { char : chars.menu, colour : colours.buttons }, null, function () { _menu(0, 36); }, 'Menu');
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-15 22:03:22
%fb2k_component_path% is only valid in the preprocessor section. You cannot use it in script. But you can use fb.ComponentPath or fb.ProfilePath. But you should only ever use fb.ComponentPath to access files bundled with the component. Never put your own files inside the component folder as they will be wiped whenever you upgrade the component.

So to solve your problem, you can create an image object like this..

Code: [Select]
// make your own images folder inside your profile
var img = utils.LoadImage(fb.ProfilePath + "images\\5. Pie\\5-1.png");

Now the _button object doesn't support images by default but you can easily hack the paint function like this...

Code: [Select]
buttons.buttons.menu = new _button(1, -2, 30, 30, img, null, function () { _menu(0, 36); }, 'Menu');
buttons.buttons.menu.paint = function (gr) {
    _drawImage(gr, this.current, this.x, this.y, this.w, this.h, image.centre);
}
Title: Re: JScript Panel
Post by: josemescud on 2023-01-17 09:25:45
Message for Marc2K3:

I have  foobar2000 v2 64-bit beta23

I have installed the Qsearch 1.0.5 component

Using the context menu works perfectly

I have created with JScript panel3 a panel with 2 buttons that point to:

 1º - QSearch/title HAS
 2º - QSearch/album IS

I frame the track and click on any of the 2 buttons and do not respond.

I send you the script in case you can help me:

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

//////////////////////////////////////////////////////////////
//tamaño botones
var bs = _scale(21);
var sep_bot = -9;

//posicion botones
var posi_vert_bot = 7;
var posi_horiz_bot = -1;

//aquí se definen los colores
var colours = {
buttons : RGB(180, 180, 180),
background : RGB(0, 0, 0),
};

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

//aquí se definen los botones tomados de la fuente "fontawesome-webfont.ttf" que debe estar instalada
//algunos de ellos ya estaban definidos en "helpers.txt"
//por eso defino aquí los nuevos cambiando la variable chars por chars_cosi

var chars_cosi = {
//QSearch/title HAS
lupa1 : '\uF002',
//QSearch/album IS
lupa2 : '\uF00E',
}

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

buttons.update = function () {
var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_bot;
this.buttons.lupa1 = new _button(panel.w - posi_vert_bot - (sep_bot * 2) - (bs * 2), y, bs, bs, { char : chars_cosi.lupa1, colour:colours.buttons }, null, function () { fb.RunMainMenuCommand('QSearch/title HAS'); }, 'title HAS');
this.buttons.lupa2 = new _button(panel.w - posi_vert_bot - (sep_bot * 1) - (bs * 1), y, bs, bs, { char : chars_cosi.lupa2, colour:colours.buttons }, null, function () { fb.RunMainMenuCommand('QSearch/album IS'); }, 'album IS');
}

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

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

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

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

function on_paint(gr) {
//aquí se pinta el background de todo el pie
gr.FillRectangle(0, 0, panel.w, panel.h, colours.background);
buttons.paint(gr);
}

function on_size() {
panel.size();
buttons.update();
}
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-17 14:58:16
Quote
fb.RunMainMenuCommand

This is the main menu....

(https://i.imgur.com/giO6Q0R.png)

QSearch provides context menu commands. Not the same.

https://jscript-panel.github.io/docs/namespaces/fb/#fbruncontextcommandcommand
Title: Re: JScript Panel
Post by: josemescud on 2023-01-17 19:01:40
Quote
fb.RunMainMenuCommand

This is the main menu....

(https://i.imgur.com/giO6Q0R.png)

QSearch provides context menu commands. Not the same.

https://jscript-panel.github.io/docs/namespaces/fb/#fbruncontextcommandcommand

Thanks for your answer marc2k3.

I have used fb.RunContextCommand(command) and it works perfectly but only if the track is playing, which makes the option to create a button not so profitable.

Code: [Select]
buttons.update = function () {
var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_bot;
this.buttons.lupa1 = new _button(panel.w - posi_vert_bot - (sep_bot * 2) - (bs * 2), y, bs, bs, { char : chars_cosi.lupa1, colour:colours.buttons }, null, function () { fb.RunContextCommand('QSearch/title HAS'); }, 'title HAS');
this.buttons.lupa2 = new _button(panel.w - posi_vert_bot - (sep_bot * 1) - (bs * 1), y, bs, bs, { char : chars_cosi.lupa2, colour:colours.buttons }, null, function () { fb.RunContextCommand('QSearch/album IS'); }, 'album IS');

}

If there is another better solution I would appreciate if you could tell me about it.
Title: Re: JScript Panel
Post by: regor on 2023-01-17 23:26:22
If there is another better solution I would appreciate if you could tell me about it.
I would recommend you to read the docs first...
X
https://jscript-panel.github.io/docs/interfaces/IMetadbHandleList/#runcontextcommandcommand
Replace
Code: [Select]
fb.RunContextCommand('QSearch/title HAS');
With this or something similar
Code: [Select]
if (plman.ActivePlaylist !== -1) {
var handleList = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
if (handleList && handleList.Count !== 0) {
handleList.RunContextCommand("'QSearch/title HAS");
}
}
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-18 01:40:51
For QSearch to work, the handle list count must be 1. And since you have multiple buttons, it would be best to create a re-usable function like this...

Code: [Select]
function qsearch(what) {
// prefer playing file if playing or use selected playlist item if not
var handle = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
if (handle) {
fb.CreateHandleList(handle).RunContextCommand('QSearch/' + what);
}
}

Code: [Select]
	this.buttons.lupa1 = new _button(panel.w - posi_vert_bot - (sep_bot * 2) - (bs * 2), y, bs, bs, { char : chars_cosi.lupa1, colour:colours.buttons }, null, function () { qsearch('title HAS'); }, 'title HAS');
this.buttons.lupa2 = new _button(panel.w - posi_vert_bot - (sep_bot * 1) - (bs * 1), y, bs, bs, { char : chars_cosi.lupa2, colour:colours.buttons }, null, function () { qsearch('album IS'); }, 'album IS');

If you don't want that behaviour, you can prefer the selected playlist item at all times regardless of what is playing...

Code: [Select]
function qsearch(what) {
var handle = fb.GetFocusItem();
if (handle) {
fb.CreateHandleList(handle).RunContextCommand('QSearch/' + what);
}
}

Or if you want it to work on an item selected from a library viewer like album list you can use fb.GetSelection() like this

Code: [Select]
function qsearch(what) {
var handles = fb.GetSelection();
if (handles.Count == 1) {
handles.RunContextCommand('QSearch/' + what);
}
}

Note that the behaviour of fb.GetSelection is controlled by File>Preferences>Display>Selection viewers.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-18 03:19:28
3.0.17 for fb2k 1.6.6+
3.2.3 for fb2k 2.0 Beta 18+

The main landing page now contains version info/download links for both versions.

https://jscript-panel.github.io/docs/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-19 07:39:27
3.2.4 for fb2k 2.0 Beta 18+

Just internal changes using the latest fb2k SDK which was released yesterday.

https://github.com/jscript-panel/release/releases
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-20 02:28:37
3.2.5 for fb2k 2.0 Beta 18+

- Prevent component from loading on unsupported versions of foobar2000.
- Add plman.GetQueryItems.
- Add plman.GetGUID.
- Add plman.FindByGUID.

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

Beta 18 was stated as a minium requirement since 3.2.0 was released but wasn't enforced. Now it is.
Title: Re: JScript Panel
Post by: josemescud on 2023-01-20 08:23:13
I want to thank regor (#1051) and marc2k3 (#1052) for their great help in creating my panel3 buttons
Title: Re: JScript Panel
Post by: regor on 2023-01-20 08:23:30
3.2.5 for fb2k 2.0 Beta 18+

- Prevent component from loading on unsupported versions of foobar2000.
- Add plman.GetQueryItems.
- Add plman.GetGUID.
- Add plman.FindByGUID.

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

Beta 18 was stated as a minium requirement since 3.2.0 was released but wasn't enforced. Now it is.
Hoping to see an SMP update someday XD

The GUID thing would have made mi life much easier for the manager.
Now that I think of it, does it match the 'playlists-v1.4' index and names and also the 'playlists-v2.0' file names?

playlist-E1629559-B78C-45BE-A2C2-804141CC5E29
0B92BFBD7E2CEE9E2CCBDC69CBC910A7
...

I could try to hack it by reading files, instead of relying on SMP methods.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-20 10:26:12
Yes, the GUIDs match the content of the playlists-v2.0 folder. One minor difference is that my strings are wrapped in {}

Code: [Select]
console.log(plman.GetGUID(0)); // {88340458-489F-4B8C-AF30-040B6F82F424}

This is because the windows API for transforming strings back in to GUIDs expects them.

edit: I don't think hacks would work because playlist files are not generated in the playlists folder for empty playlists.

Title: Re: JScript Panel
Post by: nikolai4ik on 2023-01-22 18:41:37
Hi guys, I am trying to refresh my FB skin to newer versions (guess I'm a masochist) and my seekbar which I stole from DarkOne long time ago broke. So I switched to sample seekbar.

However it crashes when I switch tracks
Code: [Select]
JScript Panel v2.6.0-Beta.2 (Seekbar by marc2003)
JavaScript runtime error:
Invalid procedure call or argument
File: <main>
Line: 26, Col: 3
The code is

Code: [Select]
function on_paint(gr) {

gr.FillRoundRect(seekbar.x, seekbar.y, seekbar.w, seekbar.h, 6, 5, seekbar.c1);
if (fb.IsPlaying && fb.PlaybackLength > 0) {
gr.SetSmoothingMode(2);
gr.FillSolidRect(seekbar.x, seekbar.y, seekbar.pos(), seekbar.h, seekbar.c2);
gr.FillRoundRect(seekbar.x, seekbar.y, seekbar.pos(), seekbar.h, 6, 5, seekbar.c2);

FillRoundRect is what's crashing the seekbar, solidRect doesn't - why?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-01-23 01:53:17
You've set the arc_width to be 6px so the rectangle width needs to be at least double that. You're using seekbar.pos() for the width which can be less than 12px when a track starts.
Title: Re: JScript Panel
Post by: nikolai4ik on 2023-01-23 09:10:31
You've set the arc_width to be 6px so the rectangle width needs to be at least double that. You're using seekbar.pos() for the width which can be less than 12px when a track starts.
Thank you very much!
Title: Re: JScript Panel
Post by: marc2k3 on 2023-03-08 07:59:51
Advance warning for JSPlaylist users: The next version for fb2k 2.0 will have support for collapsable headers removed.

If you want to keep this functionality then you can can take these steps right now.

- Download this: https://jscript-panel.github.io/files/jsplaylist.zip
- Extract the jsplaylist folder to your foobar2000 profile folder
- Replace the contents of any JS Playlist instance with the contents of JS Playlist.txt

Any future component updates will not be able to touch these files!

Obviously this will be unsupported and will not receive any future updates.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-03-08 09:56:20
3.2.6 for fb2k 2.0 Beta 18+ https://github.com/jscript-panel/release/releases

- Minor IThemeManager bug fix.
- JS Playlist has had support for collapsable group headers removed. See the above post if you want to preserve this functionality by downloading a standalone copy.
- The playlist manager built in to JS Playlist and Smooth Playlist Manager now expose the foobar2000 context menu for playlist content.
- The Spectrogram Seekbar scripts can now generate images for tracks longer than 1 hour in length. This requires ffmpeg 6.0.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-03-08 18:47:52
3.0.18 for fb2k 1.6.6 - 1.6.16 https://github.com/marc2k3/fb2k-archive/releases/tag/latest

- Minor IThemeManager bug fix.
- The Spectrogram Seekbar scripts can now generate images for tracks longer than 1 hour in length. This requires ffmpeg 6.0.
Title: Re: JScript Panel
Post by: etip on 2023-03-08 22:01:54
 @marc2k3
For some reasons, after the update,  "plman.GetGUID(playlistIndex)" doesnt work anymore (maybe it's me).
I tried :
Code: [Select]
function getData() {  	
var data = [];
for (var i = 0; i < plman.PlaylistCount; i++) {
data.push({
name: plman.GetPlaylistName(i),
value: plman.GetPlaylistItemCount(i),
size: plman.GetPlaylistItems(i).CalcTotalSize(),
id: plman.GetGUID(i),
});
}
for (var i = 0; i < data.length; i++) {
console.log(data[i].name);
}
}

and i have a crash  :
Erreur d’exécution JavaScript
(translated from french) :
the object doesnt manage the method "GetGUID"


Title: Re: JScript Panel
Post by: marc2k3 on 2023-03-08 22:30:33
Looks like you've downloaded the wrong version meant for fb2k 1.6.x. It's not available there.

The docs are tagged with the minimum version required for certain methods/properties.

https://jscript-panel.github.io/docs/namespaces/plman/#plmangetguidplaylistindex
Title: Re: JScript Panel
Post by: etip on 2023-03-08 22:33:13
what an idiot i am. Sorry.
Title: Re: JScript Panel
Post by: bloxx on 2023-03-09 16:00:28
Hello,
can somebody please help me how I can configure my Jscript-component step by step if I want to see more than 4 images during a song played in Foobar? All the images are always in one folder called "covers".
An my folders look like this:
Music-A-Artist Name-Song Name (incl. the mp3-files)-covers
Music-B-Artist Name-Song Name (incl. the mp3-files)-covers
Music-C-Artist Name-Song Name (incl. the mp3-files)-covers.......
etc.
Sorry, tried it many times but it seems that I am really stupid.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-03-10 12:05:39
Using the Thumbs sample, (https://jscript-panel.github.io/gallery/thumbs/) you can right click and set a folder path to a folder. It will display all images contained within.

It's very hard to determine your intent from what you wrote but assuming covers is a subfolder where the playing/selected track is, this would work

Code: [Select]
$directory_path(%path%)\covers



Title: Re: JScript Panel
Post by: marc2k3 on 2023-03-13 04:56:38
3.0.19 for fb2k 1.6.6 - 1.6.16
3.2.7 for fb2k 2.0 Beta18+

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

- Fixes a bug with the 3rd party Lexilla library used for keyword highlighting in the Configuration Window.

If, like me, you didn't notice - it's because lower case words were fine. Only words with uppercase chars like Date, JSON, Array, etc were affected.

Title: Re: JScript Panel
Post by: mexx on 2023-03-14 15:25:34
I have a script here that renders a Seekbar in the WSH Panel Mod. This script should be configured to work in JScript3 as well.

Code: [Select]
DT_TOP = 0x00000000;
DT_LEFT = 0x00000000;
DT_CENTER = 0x00000001;
DT_RIGHT = 0x00000002;
DT_VCENTER = 0x00000004;
DT_BOTTOM = 0x00000008;
DT_SINGLELINE = 0x00000020;
DT_NOPREFIX = 0x00000800;

//--------

var g_font = gdi.Font("arial",18,1);
var g_font_rating = gdi.Font("Arial Unicode MS",25,0);
var g_fileinfo = null;

var g_drag = 0;
var g_drag_seek = 0;

var ww, wh, area;

//--------

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 Separator(x) {
this.left = x;

this.draw = function (gr) {
gr.FillGradRect(this.left-1,0, 1, wh-1, 90, RGB(133,133,133), RGB(0,0,0));
gr.FillGradRect(this.left,0, 1, wh-1, 90, RGB(163,163,163), RGB(163,163,163));
gr.FillGradRect(this.left+1,0, 1, wh-1, 90, RGB(60,59,59), RGB(0,0,0));
}
}

function separatorsDraw(gr) {
for (i in Separators) {
Separators[i].draw(gr);
}
}

//--------

function TimeFmt(t){
var zpad = function(n){
var str = n.toString();
return (str.length<2) ? "0"+str : str;
}

var h = Math.floor(t/3600); t-=h*3600;
var m = Math.floor(t/60); t-=m*60;
var s = Math.floor(t);
if(h>0) return h.toString()+":"+zpad(m)+":"+zpad(s);
return m.toString()+":"+zpad(s);
}

// --- APPLICATION START

function on_paint(gr){
var pos = 0;
var length = fb.PlaybackLength;
var txt;

if(length > 0){
if(g_drag){
pos = area * g_drag_seek;
txt = "Seek " + TimeFmt(g_drag_seek * length) + " / " + TimeFmt(length);
}
else{
pos = area * (fb.PlaybackTime / length);  
var g_titlefmt = fb.TitleFormat("[%album artist% - ][%album% ]['['%date%']' - ]%title% >> $div($mul(100,%playback_time_seconds%),%length_seconds%) '%'");
txt = g_titlefmt.Eval();
}
}

gr.FillGradRect(4, 0, area, wh/2, 270, RGB(90, 90, 90), RGB(0, 0, 0));
gr.FillGradRect(4, wh/2, area, wh/2, 90, RGB(90, 90, 90), RGB(0, 0, 0));
gr.FillGradRect(0, 0, pos, wh/2, 270, RGB(0, 200, 200), RGB(0, 0, 0));
gr.FillGradRect(0,wh/2, pos, wh/2, 90, RGB(0, 200, 200), RGB(0, 0, 0));

gr.FillGradRect(2, 0, 1, wh-1, 90, RGB(163, 163, 163), RGB(163, 163, 163));
gr.FillGradRect(3, 0, 1, wh-1, 90, RGB(60, 59, 59), RGB(0, 0, 0));

separatorsDraw(gr);

gr.FillGradRect(ww-4, 0, 1, wh-1, 90, RGB(133, 133, 133), RGB(0, 0, 0));
gr.FillGradRect(ww-3, 0, 1, wh-1, 90, RGB(163, 163, 163), RGB(163, 163, 163));

gr.DrawRect(0, 0, ww, wh, 4.0, RGB(0,0,0));

gr.GdiDrawText(txt, g_font, RGB(255, 255, 255), 0, 0, ww, wh, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);

var tfo_rating_a = fb.Titleformat("$if(%rating%,$repeat($char(9733),%rating%),)");
var tfo_rating_b = fb.Titleformat("$if(%rating%,$repeat($char(9734),$sub(5,%rating%)),)");
var txt_rating_a = tfo_rating_a.Eval();
var txt_rating_b = tfo_rating_b.Eval();

gr.GdiDrawText(txt_rating_a, g_font_rating, RGB(0,255,0), ww-120, 0, 110, wh, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
gr.GdiDrawText(txt_rating_b, g_font_rating, RGB(255,0,0), ww-120, 0, 105, wh, DT_RIGHT | DT_VCENTER | DT_SINGLELINE);
}

function on_size(){
ww = window.Width;
wh = window.Height;
area = ww - 4;

Separators = {
one: new Separator((ww-4)/10),
two: new Separator((ww-4)/5),
three: new Separator(3*(ww-4)/10),
four: new Separator(2*(ww-4)/5),
five: new Separator(ww/2),
six: new Separator(3*(ww-4)/5),
seven: new Separator(7*(ww-4)/10),
eight: new Separator(4*(ww-4)/5),
nine: new Separator(9*(ww-4)/10)
}
}

function on_mouse_lbtn_down(x,y){
g_drag = 1;
}

function on_mouse_lbtn_up(x,y){
if(g_drag){
g_drag = 0;
g_drag_seek = x / area;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
}
}

function on_mouse_move(x,y){
if(g_drag){
g_drag_seek = x / area;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
window.Repaint();
}
}

function on_playback_new_track(metadb){
window.Repaint();
}

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

function on_playback_seek(time){
window.Repaint();
}

function on_playback_time(time){
window.Repaint();
}

// --- APPLICATION END

I can't do it with my basic scripting skills.
Maybe someone can help me here.

Thanks in advance.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-03-15 10:05:10
There's no point. WSH panel mod didn't suddenly stop working. The whole point of JScript Panel is that it supports bucket loads of new features that don't exist in other components. If you're not going to use those features, why bother?
Title: Re: JScript Panel
Post by: mexx on 2023-03-15 13:15:25
Ok, Thanks for the answer.

Actually I wanted to ban the WSH panel mod from my configuration. Because I have already implemented 2 other ads via JScript Panel, my Seekbar should also run over it. But I didn't get it.
Then it shouldn't be.
Title: Re: JScript Panel
Post by: Majestyk on 2023-03-16 02:56:33
Advance warning for JSPlaylist users: The next version for fb2k 2.0 will have support for collapsable headers removed.

I can live with that. I never liked that concept.
Title: Re: JScript Panel
Post by: buckss on 2023-03-17 18:04:01
Hello!

Can you please tell how to remove "spaces" from sides of the Text Display panel?
And (maybe) make text scrollable?
(see screenshot comparison with old Text Display component).
Title: Re: JScript Panel
Post by: marc2k3 on 2023-03-17 18:50:23
You can get rid of the left/right margins by adding this at the start of the script

Code: [Select]
LM = 0;

or

Code: [Select]
LM = _scale(2); // or some other low value, 5 is the default

The text should already be scrollable with your mouse wheel. That arrow is also clickable but more cumbersome.
Title: Re: JScript Panel
Post by: buckss on 2023-03-19 14:01:09
You can get rid of the left/right margins by adding this at the start of the script

Code: [Select]
LM = 0;


Thanks, that worked, but only for left/right margin. What about top (it's more crucial)? =)

Scrolling doesn't work, but that maybe because of plugin Flowin, I guess (old one just shows scrollbar, though).
Title: Re: JScript Panel
Post by: eurekagliese on 2023-03-23 02:53:41
Hi there Marc, sorry for unrelated Jscript post. In some of your post, I see your foobar actually use a different shade of dark RGB(19, 19, 19) background as seen on
toolbar header background, window background and also the stacked tabs. May I ask how to do that? Thank you.

Spoiler (click to show/hide)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-03-23 16:19:02
Darker colours come from using Default UI (top) as opposed to Columns UI (bottom).

(https://i.imgur.com/7SxDP5c.png)
Title: Re: JScript Panel
Post by: buckss on 2023-04-01 11:07:04
You can get rid of the left/right margins by adding this at the start of the script

Code: [Select]
LM = 0;


Thanks, that worked, but only for left/right margin. What about top (it's more crucial)? =)

Scrolling doesn't work, but that maybe because of plugin Flowin, I guess (old one just shows scrollbar, though).

Figured it out myself (if someone need it):
X

<code>
LM = 2;
HM = 16;
...
var text = new _text_display(LM, -HM, 0, 0);
...
function on_size() {
   panel.size();
   text.w = panel.w - (LM * 2);
   text.h = panel.h + HM * 2;
   text.size();
}
</code>
Title: Re: JScript Panel
Post by: ASopH on 2023-04-02 08:08:43
Hi, I would like to create a button to delete a selected file in PL physically, but nothing happens. As a basis, I have the script "Menu Button". What am I doing wrong? Access to the context menu does not work.
Code: [Select]
// ==PREPROCESSOR==
// @name "Menu Button"
// @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==

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

var panel = new _panel();
var buttons = new _buttons();
buttons.buttons.menu = new _button(0, 0, 36, 36, { char : chars.menu, colour : colours.buttons }, null, function () { _menu(0, 36); }, 'Menu');
buttons.buttons.DeleteFile = new _button(36, 0, 36, 36, { char : 'X', colour : colours.buttons }, null, function () {
var handle_list = plman.GetPlaylistSelectedItems(plman.ActivePlaylist); handle_list.RunContextCommand('File Operation/Delete file'); }, 'Delete File');

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) {
if (buttons.buttons.menu.containsXY(x, y)) {
_help(0, 36);
return true;
} else {
return panel.rbtn_up(x, y);
}
}

function on_paint(gr) {
gr.FillRectangle(0, 0, panel.w, panel.h, colours.background);
buttons.paint(gr);
}

function on_size() {
panel.size();
}
many thanks for your help!
btw I'm a noob in programming  ;)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-02 09:42:04
Quote
'File Operation/Delete file'

Try a command that actually exists. :/

edit: chars.close will look better than 'X'
Title: Re: JScript Panel
Post by: ASopH on 2023-04-02 10:32:44
Hi, @marc2k3
damn typo  8)
thank you for "chars.close will look better than 'X'"
Title: Re: JScript Panel
Post by: ASopH on 2023-04-02 13:14:39
Hi,
me once again
with this button I can delete only one file per click
Code: [Select]
buttons.buttons.DeleteFile = new _button(bt, 0, bt, bt, { char : chars.close, colour : colours.buttons }, null, function () { 
var handle_list = plman.GetPlaylistSelectedItems(plman.ActivePlaylist); handle_list.RunContextCommand('File Operations/Delete file'); }, 'Delete File');

how to process multiselected files??
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-02 13:37:31
Look at the command name. It changes to Delete files when you select more than one. You can check the selection count and append an s if necessary.

Code: [Select]
var handles = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
var cmd = 'File Operations/Delete file';
if (handles.Count > 1) cmd += 's';
handles.RunContextCommand(cmd);
Title: Re: JScript Panel
Post by: ASopH on 2023-04-02 14:07:27
@mark2k3 thy a lot :-)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-05 00:52:23
3.0.20 for fb2k 1.6.6+
3.2.8 for fb2k 2.0 Beta 18+

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

- Restore on_playlist_item_ensure_visible which was removed in 3.0.0.
- Fix JSPlaylist and Smooth Playlist using the above callback so they should always scroll to the playing item when the status bar is double clicked. Previously, it would work only if the playing item wasn't selected.
Title: Re: JScript Panel
Post by: ASopH on 2023-04-08 13:32:43
Hi,

need a little help:
I have a vertical button display, but the buttons are not centered at the start of FB2K. According to configure and Apply, the button are centered - what do I do wrong?
See attached images.

Spoiler (click to show/hide)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-08 14:52:11
You need to update all the buttons from on_size so they get the proper window.Width which is zero on fb2k startup, I put them inside a buttons.update function and then call that.

Spoiler (click to show/hide)
Title: Re: JScript Panel
Post by: ASopH on 2023-04-08 14:59:39
Ahh, thank you
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-11 12:35:43
3.0.21 for fb2k 1.6.6 - 1.6.16

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

Fixes Smooth Browser which I accidentally broke ages ago by copying code from the fb2k 2.0 version and not testing.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-13 11:29:21
3.0.22 for fb2k 1.6.6. - 1.6.16
3.2.9 for fb2k 2.0 Beta 18+

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

- Fix bugs with `fb.GetClipboardContents()` and the `Paste` handling in `JSPlaylist` / `Smooth Playlist`.
- Various UI colour handling improvements in the `Smooth` samples.
- Minor drag/drop improvements. No script changes are required.

JSPlaylist for 3.2.9 also has some UI colour improvements that were not made for the old version.
Title: Re: JScript Panel
Post by: eurekagliese on 2023-04-13 12:56:53
3.0.22 for fb2k 1.6.6. - 1.6.16
3.2.9 for fb2k 2.0 Beta 18+

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

- Fix bugs with `fb.GetClipboardContents()` and the `Paste` handling in `JSPlaylist` / `Smooth Playlist`.
- Various UI colour handling improvements in the `Smooth` samples.
- Minor drag/drop improvements. No script changes are required.

JSPlaylist for 3.2.9 also has some UI colour improvements that were not made for the old version.

Thanks for the update.
Just wanted to let you know that selecting custom colours on the JSPlaylist doesn't seem to be applied.
Tested on beta 30 dui & cui and beta 32 dui.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-13 13:28:25
Oops, that was a copy/paste fail from smooth playlist. Thanks for spotting.

I'm not doing a new release right now but you can grab this fixed file...

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

and save it inside your component folder\samples\jsplaylist
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-13 17:13:01
So this previous comment for the last release was wildly inaccurate.

Code: [Select]
- Minor drag/drop improvements. No script changes are required.

I somehow managed to break it completely. /sigh

This should now be fixed in the latest releases. I can only apologise for being such a doofus.

3.0.23 for fb2k 1.6.6. - 1.6.16
3.2.10 for fb2k 2.0 Beta 18+

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

The JS Playlist custom colour bug reported a few posts up is also fixed.
Title: Re: JScript Panel
Post by: etip on 2023-04-13 19:16:42
Marc, thanks.
Another thing, on Smooth Playlist Manager, when you drag a playlist down till the end of the panel, instead of scrolling down, an error pops regarding the "length property".
foo_jscript_panel3\samples\smooth\jsspm.js
Line: 646, Col: 10

edit : dragging a playlist to the top of the panel makes it scroll up just fine.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-13 20:34:45
Thanks for spotting. I didn't even know auto-scroll was possible. I rarely use it and of course that functionality was written by the original author. It was probably me who broke it though. :))

Fix: https://github.com/jscript-panel/component/commit/617bc91a879f6f894beae8835aa1cc22bbac4125
Complete file if you want it now: https://raw.githubusercontent.com/jscript-panel/component/617bc91a879f6f894beae8835aa1cc22bbac4125/samples/smooth/jsspm.js
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-14 22:40:19
3.2.11 for fb2k 2.0 Beta 18+

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

- Add `window.IsThemed`.
- Update `JS Playlist` and `Smooth` samples to make use of the above feature.
- `JS Playlist` has a new `Dynamic` colour option which can be enabled via the right click menu. This extracts colours from the front cover of the playing track to use for the background and text.
- Update `Smooth Browser` with the ability to drag the selected group out on to playlist viewers/playlist managers.
- Fix script error when using `Smooth Playlist Manager` to drag and move a playlist towards the end of the list.

Using window.IsThemed in conjunction with window.CreateThemeManager. While the latter has been around for years, it wasn't easy to determine when to use it.

(https://i.imgur.com/9JkthK0.png)

Using dynamic colours...

(https://i.imgur.com/6khRIBn.png)

Just remember, you won't always get a nice contrast like that. Being computed automatically means the the results can be rather dull. YMMV.  :))
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-15 18:36:03
3.2.12 for fb2k 2.0 Beta 18+

This updates the Smooth samples with the same dynamic colour support that JS Playlist got in the previous release.

(https://i.imgur.com/pzWRckW.png)

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

I also shunted the function used by all of them in to helpers.txt so anyone can use it in any script...

Code: [Select]
var arr = GetNowPlayingColours();

It always returns an array and it will be empty if fb2k is not playing or there is no front cover. There will be 4 colours present if it succeeds. Check here or the actual file in your component folder...

https://github.com/jscript-panel/component/blob/2130f7e5b259f31a58393a22daa1638cf93f8c5e/helpers.txt#L281

Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-16 07:45:05
3.0.24 for fb2k 1.6.6 - 1.6.16

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

- Update `Smooth` samples with dynamic colour support. They are read from the front cover each time a new track starts. It can be enabled via the right click menu under `Colours`.
- Update `Smooth Browser` with the ability to drag the selected group out on to playlist viewers/playlist managers.
- Fix script error when using `Smooth Playlist Manager` to drag and move a playlist towards the end of the list.

Only the Smooth samples get all the latest features/fixes from the fb2k 2.0 release because they can be copied with no changes required. This is not the case for JS playlist/other samples.

edit: it took me 20 minutes to realise I didn't upload the updated component. I did the changelog/update the docs site but then forgot. It's now there.... :/
Title: Re: JScript Panel
Post by: etip on 2023-04-16 11:26:15
thanks Marc, the dynamic colour support is great !
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-16 16:02:24
Better late than never with the dynamic colours.  :))

The component has supported retrieving the colours for many years, long before Spider Monkey Panel was even a thing but of course lots of SMP themes have made use of it much sooner so it seems like it existed there first. But to use those themes, you have to surrender your whole UI to it which I'm not a fan of.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-18 17:22:02
3.0.25 for fb2k v1.6.6+
3.2.13 for fb2k 2.0 Beta 18+

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

Various sample fixes.

I also fixed a bug with right clicking on the scrollbar in the Properties dialog... the same bug as reported in main fb2k 2.0 bug thread for the playlist view if anyone has been reading that.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-23 21:30:33
3.2.14 for fb2k 2.0 Beta 18+

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

- Add fb.ShowPictureViewer. This uses the picture viewer that is built in to foobar2000 itself and accepts any valid image file path as input.
- The Thumbs sample has been updated with a custom double click action which you can set via the right click menu. The new picture viewer is one of the available options.


Title: Re: JScript Panel
Post by: grimes on 2023-04-23 21:41:16
Thank you so much. It works.  8)

EDIT: Glitch: JScript Panel 3 Properties, context menu in item free space removes selection.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-23 22:59:43
I cannot reproduce any bug with the properties dialog...

(https://i.imgur.com/FG5MPag.gif)

edit: I assumed you meant selected items being removed?? If you really meant the items not remaining highlighted then that is normal behaviour for any list control. Any single click deselects everything. Try the DUI playlist.
Title: Re: JScript Panel
Post by: grimes on 2023-04-23 23:08:25
Ok, no bug. Just thought, why a context menu in item free space at all. In DUI playlist viewer is Undo/Redo context menu in free space, for items "normal" context menu.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-23 23:13:44
Just thought, why a context menu in item free space at all.

If you had said that in the first place, it would have been understandable.  :P

edit: next version will suppress the context menu when nothing is selected.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-28 21:23:45
3.2.15 for fb2k 2.0 (Beta 18 is the enforced minimum requirement but using the final release is highly recommended)

https://jscript-panel.github.io/docs/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-04-30 09:16:28
3.2.16 for fb2k 2.0

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

The CUI toolbar is back after a well deserved break (it was really my incompetence  :))  )
Other bug fixes
Title: Re: JScript LAST.fm BioPanel
Post by: Jul2323 on 2023-05-02 17:59:42
newby questions :  how to change the color text in Last.fm Bio ? thks
Title: Re: JScript Panel
Post by: grimes on 2023-05-02 18:14:40
From Github https://github.com/marc2k3:

Quote
I'm continuing to maintain JScript Panel 3.

Docs: https://jscript-panel.github.io/

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

All other projects have been abandoned.

Title: Re: JScript Panel
Post by: regor on 2023-05-02 19:33:04
What a surprise...  This is totally immature.

WTF marc... you can't keep quitting every-time you get mad, deleting repositories again and again. Like we are grateful for your help and components, but your behaviors are totally toxic for any community (and yourself).

Please, just stop, take a break before acting by impulse... and please seek psychological help for these behaviors (I'm being serious, not an attack to you).
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-02 19:47:31
My repositories remained intact for several hours after my initial outburst in the SMP thread. The decision was well considered.
Title: Re: JScript Panel
Post by: regor on 2023-05-02 20:00:59
That doesn't fundamentally change what I said. Even if it's a "decision" marc, you keep doing the same everytime.

1. Over-expand with tenths of components.
2. Offering builds, fixes and alternatives for old components not found anymore.
3. Unknown trigger.
4. Delete everything or almost everything.
5. Profit.
6. Repeat.

All this is pretty toxic for a community. Since you keep making users dependent on things which you delete for no reason.

Like is fine if it happens once because... life. But this is not the first neither the second time. There is a pattern here.

The only way for the community to integrate with you in a non-toxic way is just either by ignoring your work since it's totally unreliable or making backups and mirrors of everything you do, in case it happens again.

And you could said you can do whatever you want with your code (yep); but my point is your code is open-source with permissive licenses (so nothing would stop other people to just keep backing up your components if you warned before); so you are doing all this in purpose. Either to get attention or "harm" other people. If it was a decision well considered, then I see no reason to not warn others to just clone your repositories. You didn't... because your intention is clear (specially if it happens again and again).
Title: Re: JScript Panel
Post by: TT on 2023-05-02 20:58:25
Ok, I had no idea it would escalate like this.
In a friendly manner, it was just "fun" talk to "provoke" you a little bit in hope to motivate you,
if you know what I mean, if not, I can't help you...
In the past it has worked and you did help with Wine and other stuff.
It was also a bit of euphoria that you've been working on SMP and delivered some fixes, since TheQwertiest is absent...
I feel sorry for the people who are depending on your components, don't do that shit man, they don't deserve it.

Maybe you should write a manual titled "The DO's and DON'TS - How to approach and speak to marc2k3?".
Anyways I don't really care but you should care, because it's your problem after all...

-TT
Title: Re: JScript Panel
Post by: grimes on 2023-05-03 12:47:31
Missing Dark Mode in popup message box:
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-03 13:11:09
Is this for real? You can easily style the background/colours of the text control which is a horrifying bright white but instead you choose to grumble about a single button dialog you'll see for a second or 2 when you perform a FAILED search. How often do you search for things that are not present?

Incidentally, this comes from using the MessageBoxW windows API which is blissfully unaware of any dark mode settings in fb2k. Am I really going to seek out a replacement... probably not.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-04 11:23:40
3.2.17 for fb2k 2.0

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

Just sample updates. Stop After Current can now be toggled by right clicking the Stop button in any Buttons script.

(https://i.imgur.com/B3P7ab3.png)
Title: Re: JScript Panel
Post by: grimes on 2023-05-04 11:36:58
Brilliant.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-04 12:59:52
Hopefully the last version for fb2k 1.6.6+

3.0.26

Changes: https://jscript-panel.github.io/docs/changes/#for-foobar2000-166-1616
Download: https://github.com/jscript-panel/release/releases/tag/legacy
Title: Re: JScript Panel
Post by: Jul2323 on 2023-05-06 12:08:37
function on_lbtn_up(x, y, mask) {
  var buttonWidth = 50; // Width of the button
  var buttonHeight = 20; // Height of the button
  var buttonX = panel.w - buttonWidth - 10; // X position of the button (10 pixels from the right edge of the panel)
  var buttonY = 10; // Y position of the button (10 pixels from the top of the panel)
 
  // Create the button
  var button = new_button(buttonX, buttonY, buttonWidth, buttonHeight, "Hide");
  button.on_click = function() {
    if (panel.Visible) {
      panel.Hide();
      button.text = "Show";
    } else {
      panel.Show();
      button.text = "Hide";
    }
  };
}
Is this code is working in jsp3 ? Just hide or show a panel with a button on click
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-06 12:28:14
3.2.18

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

- `utils.MessageBox` and other prompts have been updated to support `Dark Mode`.
- You can now edit the sort pattern for `Smooth Browser` via the right click menu. Previously, it was only possible via the `Properties` window.

Turns out the fb2k SDK has a message box helper which is dark mode compliant. But sacrifices were made. Anyone passing icon args to the utils method in scripts will get fugly icons from previous versions of windows. That's out of my control.
Title: Re: JScript Panel
Post by: grimes on 2023-05-06 12:37:08
Thanks. Happy. In all foobar2000 window box titles the icon is missing. A known limitation. I don't mind.
Title: Re: JScript Panel
Post by: josemescud on 2023-05-08 13:18:42
My repositories remained intact for several hours after my initial outburst in the SMP thread. The decision was well considered.

I just checked https://jscript-panel.github.io/gallery/ to see if there were any component updates and find that they have been removed.

I have been reading the forum posts and I see that this is a thoughtful decision.

I just want you to know that I abandoned the foobar 32-bit version because I was able to replace thanks to your Jscript Panel3 all the panels I had developed under WSH panel.
And I also replaced Quick Search by your Qsearch. And Keep Queue for your Queue Viewer. I also have Cover Info, Cover resizer and Musicbrainz64 installed.

I'm really sorry. I don't know your reasons for this decision. I would very much like you to go back and reinstate these components even if you don't update them regularly. Pity those of us who use your components.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-10 18:23:54
3.2.19

https://jscript-panel.github.io/docs/
Title: Re: JScript Panel
Post by: grimes on 2023-05-10 18:33:38
Thanks. Is there a documentation for the search dialog?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-10 18:39:18
The keyboard shortcuts for opening dialogs are here...

https://jscript-panel.github.io/docs/configuration-window/#keyboard-shortcuts

There's nothing much to say about using the dialog. :/

edit: I guess you can look at the searchFlags in the Scintilla docs...

https://www.scintilla.org/ScintillaDoc.html#searchFlags

The three checkboxes toggle these flags-

Code: [Select]
SCFIND_MATCHCASE
SCFIND_WHOLEWORD
SCFIND_REGEXP | SCFIND_CXX11REGEX

Title: Re: JScript Panel
Post by: grimes on 2023-05-10 18:53:12
Uhh, RegExp is for hardcore JScript programmers (not for me).
Title: Re: JScript Panel
Post by: grimes on 2023-05-11 13:43:51
Configuration window is cut on smaller devices. Please add resize of window. Thanks.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-11 13:54:43
Nope. Maybe I'll add 1024x768 as a minimum requirement to the docs page.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-11 19:51:08
The above needs correcting: 720px is also supported. People on 600px can do one.  :))

Actually, this subject has come up before. Anyone can copy/paste the script they want from any text editor in to the window. Even with the buttons out of view, Ctrl+S will apply and then they can close.
Title: Re: JScript Panel
Post by: fooball on 2023-05-12 00:28:05
Actually, this subject has come up before.
Yes – me!  8)
Title: Re: JScript Panel
Post by: grimes on 2023-05-12 01:32:11
Opens button menu in configuration window:


and


Title: Re: JScript Panel
Post by: fooball on 2023-05-12 08:27:27
Opens button menu in configuration window:

  • Alt+T: Tools menu
  • Alt+S: Samples menu

and

  • Alt+O: Ok
  • Alt+A: Apply
  • Alt+C: Cancel



It would be great if these could be added to the user info here (where I can find them): https://jscript-panel.github.io/docs/configuration-window/

Are there two key combinations for "apply"?  The above says Ctrl+S.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-12 08:48:58
It's not going to be documented on the docs page.

It's a generic windows thing that *some* dialogs will implement when pressing the Alt key.

Open dialog for the first time, look at the buttons.. nothing to see.

(https://i.imgur.com/PRorI2m.png)

Now press the Alt key, look again and spot the difference....

(https://i.imgur.com/3WrdZ3y.png)

See how some letters are underlined. That's the key combo with Alt you need to use.

Title: Re: JScript Panel
Post by: grimes on 2023-05-12 09:59:04
Are there two key combinations for "apply"?  The above says Ctrl+S.
Seems to be, that Ctrl+S is not working.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-12 10:08:55
The Ctrl+Something shortcuts documented on the website are handled by the edit control and it must have focus to work (click it!).
Title: Re: JScript Panel
Post by: fooball on 2023-05-12 11:08:04
It's not going to be documented on the docs page.

It's a generic windows thing that *some* dialogs will implement when pressing the Alt key.

Open dialog for the first time, look at the buttons.. nothing to see.

(https://i.imgur.com/PRorI2m.png)

Now press the Alt key, look again and spot the difference....

(https://i.imgur.com/3WrdZ3y.png)

See how some letters are underlined. That's the key combo with Alt you need to use.


Big problem: that is not visible on my 600px screen (which is why the hot keys are necessary), so there is no visual clue.  The keyboard shortcuts are useful, but less useful when the information is buried in a forum thread.  What's so wrong with including it in the documentation – surely something in the software (rather than the OS) allocates the hot letter in a button name?

I note the Style button has no hot key, but as I can't really use the editor anyway that hardly matters.
Title: Re: JScript Panel
Post by: Jul2323 on 2023-05-15 22:03:28
In the sample 'thumbs' . I would like to move the pictures coordinate x , y . They start at 0 on the top left .
Can I move them to something x = 50 and y = 50 ?
I change theirs size by : panel.width = 200 and panel height = 200. Thanks a lot
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-15 23:02:47
Pretty much every object in my scripts was designed to have custom x,y,w,h values. The one exception to that was thumbs. It's always been hardcoded to fill the whole panel. Changing values without breaking it will be difficult.
Title: Re: JScript Panel
Post by: ApacheReal on 2023-05-19 15:39:47
I hope I'm in the right section.

I have the following error:

Error: Spider Monkey Panel v1.6.1 (Lastfm Cover: Lastfm Cover by zeremy)
CheckMenuRadioItem failed:
Index is out of bounds

File: thumbs.js
Line: 345, Column: 25
Stack traces:
  _thumbs/this.rbtn_up@thumbs.js:345:25
  _panel/this.rbtn_up@panel.js:85:11
  on_mouse_rbtn_up@lastfm_cover.js:197:18

The error occurs when I right-click on the "Panel properties" menu and change the value from 3 to 4 in the "THUMBS.ASPECT" field

The problem also occurs in the original smoralis footuner-master skin.

(https://i.postimg.cc/3yNDJtQQ/1.png) (https://postimg.cc/3yNDJtQQ)

(https://i.postimg.cc/5QdHg1Yf/3.png) (https://postimg.cc/5QdHg1Yf)

(https://i.postimg.cc/rKtTcWPZ/4.png) (https://postimg.cc/rKtTcWPZ)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-19 17:48:18
I hope I'm in the right section.

No, you are not. Your error message tells you where you should be...

Code: [Select]
Error: Spider Monkey Panel
Title: Re: JScript Panel
Post by: ApacheReal on 2023-05-19 18:29:11
Sorry :-[
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-20 13:00:49
Hello, I wanted some help regarding scripting... In the Album Art section of the GitHub Documentation, it's mentioned that it supports displaying images from certain online sources.

Basically, I have a radio station where it doesn't send its album art through StreamUrl but instead hosts it somewhere else and even has an API to work with. Currently, I've implemented all the HTTP GET requests using JScript Panel and I am finally ended up with the URL of where the images are hosted but I am not sure if I can draw that image or if there's a way to just include an URL and the Panel draws the image... will be extremely helpful if you could provide some pointers...
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-20 14:27:02
Nope, you can't draw remote images as such. You'd have to download a copy, save it locally and then use utils.LoadImage to create an image object which you can then draw. To download, look at utils.DownloadFileAsync. To create folders to save in, look at utils.CreateFolder.

https://jscript-panel.github.io/docs/namespaces/utils/#utilscreatefolderpath
https://jscript-panel.github.io/docs/namespaces/utils/#utilsdownloadfileasyncwindow_id-url-path

To remove, look at...

https://jscript-panel.github.io/docs/namespaces/utils/#utilsremovepathpath
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-20 14:59:10
Nope, you can't draw remote images as such. You'd have to download a copy, save it locally and then use utils.LoadImage to create an image object which you can then draw. To download, look at utils.DownloadFileAsync. To create folders to save in, look at utils.CreateFolder.

https://jscript-panel.github.io/docs/namespaces/utils/#utilscreatefolderpath
https://jscript-panel.github.io/docs/namespaces/utils/#utilsdownloadfileasyncwindow_id-url-path

To remove, look at...

https://jscript-panel.github.io/docs/namespaces/utils/#utilsremovepathpath

Thanks! was about to resort to this since there wasn't any information out there regarding loading remote images.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-20 15:08:41
I might investigate and see if it's possible* to download an image and let you use it without the creation of an intermediate file.



*it's obviously possible.... but is it possible for me.  :P
Title: Re: JScript Panel
Post by: etip on 2023-05-20 16:14:11
Marc,
Is it possible to use font awesome for one specific menu using "AppendMenuItem(flags, item_id, text)" ?
I didnt find anything in the doc (i think).
Thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-20 16:30:30
Sorry but it's a straight forward no for that.  ;D
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-20 16:52:04
I might investigate and see if it's possible* to download an image and let you use it without the creation of an intermediate file.



*it's obviously possible.... but is it possible for me.  :P

Well, I've got it to work... since it's a radio station I can just overwrite the same file that foobar is using to read tags from. Also, a side note is that I am using m-TAGS and it pairs well with the album art and JS Playlist, only minor issue is I need to keep refreshing JS Playlist to load the new album image, maybe if I implement 'on_playback_dynamic_info_track' into JS Playlist that should work...? unless that refreshes the entire panel and breaks...
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-20 17:21:25
With the wallpaper option enabled in the JS Playlist settings, you can override the variable manually at any time.

Code: [Select]
images.wallpaper = get_my_image();
window.Repaint();

Playing a new track would always reset it but if you're listening to a stream, this won't be an issue.
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-20 19:14:57
With the wallpaper option enabled in the JS Playlist settings, you can override the variable manually at any time.

Code: [Select]
images.wallpaper = get_my_image();
window.Repaint();

Playing a new track would always reset it but if you're listening to a stream, this won't be an issue.

Is there an equivalent of panel.item_focus_change(); but for JS Playlist? I can't seem to refresh this unless I hit F5 to refresh the JS Playlist component... Can't seem to get it working with window.Repaint() as well... I've highlighted the part in red which needs to be refreshed after every track change...
Title: Re: JScript Panel
Post by: etip on 2023-05-20 20:37:30
Sorry but it's a straight forward no for that.  ;D

:)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-20 20:43:15
Is there an equivalent of panel.item_focus_change(); but for JS Playlist? I can't seem to refresh this unless I hit F5 to refresh the JS Playlist component... Can't seem to get it working with window.Repaint() as well... I've highlighted the part in red which needs to be refreshed after every track change...

The group header code is pretty horrible but I have updated it so F5 invalidates the image cache without reloading the whole panel...

https://github.com/jscript-panel/component/commit/357093f1acd0bd6032cc25797a1cba7cf1536bc0

Code: [Select]
p.list.groups.forEach(function (item) {
item.cover_img = null;
});
g_image_cache.reset();
full_repaint();

Title: Re: JScript Panel
Post by: Azuriye on 2023-05-21 07:03:06
Is there an equivalent of panel.item_focus_change(); but for JS Playlist? I can't seem to refresh this unless I hit F5 to refresh the JS Playlist component... Can't seem to get it working with window.Repaint() as well... I've highlighted the part in red which needs to be refreshed after every track change...

The group header code is pretty horrible but I have updated it so F5 invalidates the image cache without reloading the whole panel...

https://github.com/jscript-panel/component/commit/357093f1acd0bd6032cc25797a1cba7cf1536bc0

Code: [Select]
p.list.groups.forEach(function (item) {
item.cover_img = null;
});
g_image_cache.reset();
full_repaint();



Hey! Thanks for helping me out, just a small doubt that if I want to implement 'on_playback_dynamic_info_track' in JSPlaylist and only affect the image cache after every track change should I use 'g_image_cache.reset();' and 'full_repaint();' within the script panel? inside of on_playback... function?

Secondly, since my Album Art panel does the checking and downloading of album covers is it possible for JSPlaylist to access Album Art panel where I have set my custom variables? it might've been that my code was refreshing before the image has even been downloaded by my Album Art panel?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-21 10:22:02
If your artwork panel is handling the updating/fetching of artwork, you can send notifications to other panels with window.NotifyOthers and listen for it with the on_notify_data callback.

https://jscript-panel.github.io/docs/namespaces/window/#windownotifyothersname-info
https://jscript-panel.github.io/docs/callbacks/#on_notify_dataname-info

BTW, I'll have a new release later which allows the download/use of images without saving to file.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-21 11:50:49
3.2.20

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

- Add utils.DownloadImageAsync and on_download_image_done Using these in combination allows the download/display of images in memory without the need for saving to file. Use utils.DownloadFileAsync if you want a permanent copy.
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-21 13:33:10
3.2.20

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

- Add utils.DownloadImageAsync and on_download_image_done Using these in combination allows the download/display of images in memory without the need for saving to a file. Use utils.DownloadFileAsync if you want a permanent copy.


Thanks a lot! It works well with radio stations that don't utilize StreamUrl to serve cover art yet!
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-23 21:16:02
By the way marc2k3, I've got both my JSPlaylist and Album cover to properly display the custom radio station album covers...

Though I'm not sure if this could be fixed but basically when my album panel downloads the art, it displays first and then sends a notify to my JSPlaylist to update the cover art... Perhaps is there a way to sync the changes so that both the album art and JSPlaylist panels change at the same time instead of one by one?

I've thought of something where first I send the notification to JSPlaylist to refresh and then the playlist component sends a message back to album art panel in which it then changes... Sort of like a 2 way communication... Would this work? or would it produce the reverse effect of what I'm already facing?
Title: Re: JScript Panel
Post by: dpc666 on 2023-05-24 10:00:46
I'm having trouble getting this component to work in Wine under Linux. All I get is a black panel. The context menu only shows "reload", "properties" and "configure" regardless which script I have set it up with. The sample scripts don't work either. I saw that the newest version requires the latest f2k beta and I have 2.0 (which is all that is currently available from AUR), but v3.0.26 doesn't work either.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-24 17:22:55
Azuriye - I have no idea what you're trying to do. Sending confirmation from a panel back to another after a message has been received is possible but why? It's nonsensical.

dpc666 - you won't get this working in WINE. Forget it.
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-24 17:33:07
Azuriye - I have no idea what you're trying to do. Sending confirmation from a panel back to another after a message has been received is possible but why? It's nonsensical.

dpc666 - you won't get this working in WINE. Forget it.

I wanted to sync JSPlaylist and Album Art panels loading the album image at the same time instead of one by one... As of speaking the Album Art loads the image first and then JSPlaylist.
Title: Re: JScript Panel
Post by: Defender on 2023-05-25 21:52:24
Hi,

I finally found the way to this forum.

I'm trying to migrate the jscript2 2.88 menu button to jscript3 3.2.20 in my skin that is independent of windows scaling since the skin is used on a lot of different windows scalings and the menu button automatically scales under 2.88.

If I use code like this in 3.3.20 which works perfectly in all windows scalings when I set the value of var "scale" to the percentage of windows scaling:

var colours = {
   buttons    : RGB(255, 255, 255),
   normal     : RGB(63,  100, 126),   // JSCRIPT3 Modified
   hover      : RGB(192, 224, 255),   // JSCRIPT3 Modified
   background : RGB(196,  30,  35)
};

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

// Modified code
var scale   = 250;            // Windows Scaling percentage

var bx   = -5 * scale / 100;
var by   = -7 * scale / 100;
var bw   = 34 * scale / 100;
var bh   = 34 * scale / 100;

var mx   = -4 * scale / 100;
var my   = 25 * scale / 100;

buttons.buttons.menu = new _button(bx, by, bw, bh, { char : chars.menu, colour : colours.normal }, { char : chars.menu, colour : colours.hover }, function () { _menu(mx, my); }, '');

Problem is I just do not know how to set the correct value of "scale" automatically.
In 2.88 I used something like scale = windows.Width / 25 since the width of the calling window was 25px times the windows scaling, but for one reason or another the windows.Width is not set anymore.

How can I set the value of "scale" automatically in 3.2.20?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-26 01:35:09
window.Width / window.Height is always zero when fb2k starts so it's why most buttons are created from the on_size function. This is called when window.Width/window.Height get valid values.

A common pattern I use in many of my scripts is having a buttons.update function like this....

https://github.com/jscript-panel/component/blob/66c096863ee57acfc4d24312627cd2e292c5692f/samples/Playback%20Buttons.txt#L41-L52

And then calling buttons.update from on_size...

https://github.com/jscript-panel/component/blob/66c096863ee57acfc4d24312627cd2e292c5692f/samples/Playback%20Buttons.txt#L126
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-26 22:55:53
Hello marc2k3, is it possible to maybe have some sort of clickable icons where if I click on the heart icon, etc. it writes a value to that file's tag? sort of like the Format Value option.

Or maybe have it interconnected in a way where if I click on an icon it executes a custom script located in Tagging > Scripts > (The script to be executed)?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-26 23:06:57
https://jscript-panel.github.io/docs/interfaces/IMetadbHandleList/#updatefileinfofromjsonstr
Title: Re: JScript Panel
Post by: hexenszene on 2023-05-29 11:32:30
Hi all, hope all is well.
I've just updated to the latest JS Panel release, however I'm getting an error with the Last FM Bio Sample:

JScript Panel 3.2.20 (Last.fm Bio by marc2003)
JavaScript runtime error
Invalid procedure call or argument
File: C:\Program Files (x86)\Foobar2000 2.0 (64 bit)\profile\user-components-x64\foo_jscript_panel3\samples\js\text.js
Line: 119, Col: 5

If I reload it, it works, but every time I re-save my UI, the panel crashes with the above message.

Thanks for any advice you can offer.
Title: Re: JScript Panel
Post by: Air KEN on 2023-05-29 12:09:19
@hexenszene

foobar2000 v2.0 64bit Standard installation destination.
-C:\Program Files\foobar2000

Configuration folder
-C:\Users\<USERNAME>\AppData\Roaming\foobar2000-v2
Title: Re: JScript Panel
Post by: hexenszene on 2023-05-29 12:23:30
@hexenszene

foobar2000 v2.0 64bit Standard installation destination.
-C:\Program Files\foobar2000

Configuration folder
-C:\Users\<USERNAME>\AppData\Roaming\foobar2000-v2

Are you asking about my installation?  I actually use a portable installation.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-29 12:24:08
@hexenszene , thanks for the report. It's now fixed...

3.0.27 for fb2k 1.6.6 - 1.6.16
3.2.21 for fb2k 2.0 (technically Beta18+ but you should be using final or 2.1 preview by now  :P )

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

Fix issue with `ITextLayout` `CalcTextHeight` where passing an invalid `max_width` would throw a script error.
Title: Re: JScript Panel
Post by: hexenszene on 2023-05-29 12:35:32
@hexenszene , thanks for the report. It's now fixed...

3.0.27 for fb2k 1.6.6 - 1.6.16
3.2.21 for fb2k 2.0 (technically Beta18+ but you should be using final or 2.1 preview by now  :P )

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

Fix issue with `ITextLayout` `CalcTextHeight` where passing an invalid `max_width` would throw a script error.
You're the absolute best Marc!  🙏
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-30 01:08:00
I really should have done this when fb2k 2.0 went final but better late than never... I've added some notes on upgrading to the docs site.

https://jscript-panel.github.io/docs/upgrading/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-31 02:40:07
3.2.22 for fb2k 2.0

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: etip on 2023-05-31 07:11:56
Thanks Marc for the bold option in the menu.
quick question : what fb.CheckComponent is supposed to do ?
Thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-31 07:43:51
You use it to check for other components by name. I've added an example...

https://jscript-panel.github.io/docs/namespaces/fb/#fbcheckcomponentname

You might need to hard refresh the page if you've been there recently.
Title: Re: JScript Panel
Post by: Bogozo on 2023-05-31 18:05:25
Currently, script "Spectrogram Seekbar" cannot display spectrogram for separate tracks from image+cue.
Here is example of how to use title formatting to generate spectrogram for separate tracks from image+cue (also for images with embedded cue)  when running ffmpeg from foo_run:
Code: [Select]
$if($stricmp($ext(%path%),cue),cmd.exe /d /c ffmpeg.exe -v 0 -drc_scale 0 -ss $add($mul($ifequal($strchr(%__referenced_offset%,:),3,$cut(%__referenced_offset%,2),$cut(%__referenced_offset%,3)),60),$cut($right(%__referenced_offset%,5),2)).$pad_right($muldiv($muldiv($right(%__referenced_offset%,2),%samplerate%,75),1000000,%samplerate%),6,0) -i "$directory_path(%path%)\%__referenced_file%" -t %length_ex% -f sox -|ffmpeg.exe -y -i - -lavfi showspectrumpic=s=1600x1200:mode=separate:legend=enabled "%path%.png",$if($stricmp(%__cue_embedded%,yes),cmd.exe /d /c ffmpeg.exe -v 0 -drc_scale 0 -ss $add($mul($ifequal($strchr(%__referenced_offset%,:),3,$cut(%__referenced_offset%,2),$cut(%__referenced_offset%,3)),60),$cut($right(%__referenced_offset%,5),2)).$pad_right($muldiv($muldiv($right(%__referenced_offset%,2),%samplerate%,75),1000000,%samplerate%),6,0) -i "%path%" -t %length_ex% -f sox -|ffmpeg.exe -y -i - -lavfi showspectrumpic=s=1600x1200:mode=separate:legend=enabled "%path%.png",ffmpeg.exe -y -v 0 -drc_scale 0 -i "%path%" -map_metadata -1 -lavfi showspectrumpic=s=1600x1200:mode=separate:legend=enabled "%path%.png"))
"sox" here is just format to transfer audio data between ffmpeg instances, not sox command line tool.

Can someone integrate this into script "Spectrogram Seekbar" for it to be able to generate spectrograms for separate tracks from image+cue?
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-31 20:34:16
Hello marc2k3, is it possible for JSPlaylist to follow the now-playing track? hard to navigate through my playlist when it's enormous and I need to find that one song out of many...
Title: Re: JScript Panel
Post by: marc2k3 on 2023-05-31 21:01:40
Azuriye  - standard fb2k behaviour is:

-Enable Cursor follows playback from the Playback menu if you want it on every track change
-Double clicking the status bar always take you to the playing track. If you don't have one visible, bind a button/shortcut to "View/Show now playing in playlist".

I'm totally ignoring the cue sheet/spectrogram for now. I'll a need a few weeks to digest that.  ;D
Title: Re: JScript Panel
Post by: Azuriye on 2023-05-31 21:56:41
Azuriye  - standard fb2k behaviour is:

-Enable Cursor follows playback from the Playback menu if you want it on every track change
-Double clicking the status bar always take you to the playing track. If you don't have one visible, bind a button/shortcut to "View/Show now playing in playlist".

I'm totally ignoring the cue sheet/spectrogram for now. I'll a need a few weeks to digest that.  ;D

My bad, I got so used to SimPlaylist scrolling downwards to the current playing track I haven't even bothered searching that such a thing existed even... Thanks a lot!
Title: Re: JScript Panel
Post by: etip on 2023-05-31 22:28:31
You use it to check for other components by name. I've added an example...

https://jscript-panel.github.io/docs/namespaces/fb/#fbcheckcomponentname

You might need to hard refresh the page if you've been there recently.

Thank you. Clear !
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-01 02:50:42
3.2.23 for fb2k 2.0

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

This updates the spectrogram seekbar samples to support cue sheets. Embedded and external should work the same.
Title: Re: JScript Panel
Post by: Defender on 2023-06-01 14:15:02
window.Width / window.Height is always zero when fb2k starts so it's why most buttons are created from the on_size function.

@Marc2k3

Hi, as a result of your tip I was able to create scale independent buttons. Thx!


I do have a question about Mute within jscript3 ...

I created a rightclick Mute function on your Volumeslider.

Apparently fooBar knows when it is muted and also the previous volume.
How can I read the status whether fooBar is muted/not-muted and the non-muted volume within Jscript3 (something like fb.IsPaused / fb.IsPlaying for instance)?
I solved it by some ugly code, but would prefer to make use of a proper status variable.

I also noticed that if you exit fooBar while muted and then restart fooBar it is still muted but does not know the previous volume anymore. Is that correct behavior or a bug?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-01 14:52:05
The various fb.VolumeXXX commands are just shortcuts to main menu commands. You have to hold Shift when clicking the main playback menu to see them...

(https://i.imgur.com/0NqRYiL.png)

There is a C++ function in the SDK (https://github.com/jscript-panel/foobar2000-sdk/blob/6a37425fd39df2a93f4defc8ebc2ab7617fef2a1/foobar2000/SDK/playback_control.h#L139-L141) called is_muted but it's no different to this...

Code: [Select]
function is_muted() {
    return fb.Volume == -100;
}

And if your previous volume before muting is not remembered after restarting, I suppose you could save it with window.SetProperty before muting and then restoring it with window.GetProperty.

https://jscript-panel.github.io/docs/namespaces/window/#windowgetpropertyname-default_value
Title: Re: JScript Panel
Post by: Bogozo on 2023-06-01 16:19:18
This updates the spectrogram seekbar samples to support cue sheets. Embedded and external should work the same.
Thanks!
Title: Re: JScript Panel
Post by: Defender on 2023-06-01 17:07:58
Mute

Thanks. Fixed it with using SetProperty / GetProperty and some code modification. Pretty neat :-)
Title: Re: JScript Panel
Post by: Defender on 2023-06-01 22:54:38
(Not sure this is the right forum topic)

@Falstaff

I migrated my skin to use Smooth Playlist Manager and Smooth Browser on my main system (scale 100%). Looks great.

When I ported the skin to one of my other systems with scale 250% I noticed some anomalies after adjusting SMOOTH.EXTRA.FONT.SIZE to make SPM and SB look good.

1) In SPM if you need to input some stuff the inputfield is not (down)scaled according to the settings of SMOOTH.EXTRA.FONT.
2) In SB the Filterbox and the displays ALL ITEMS and NO COVER which are displayed in the cover area are not (down)scaled.

Is there a setting I'm overseeing?

One other question:
Would it be possible to add the option to both SPM and SB to use pseudo-transparancy (could be an extra option in the wallpaper section, I guess) ?
If not, can you add the same option for wallpaper to SB as you currently have in SPM?

Thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-02 01:04:06
I've been maintaining Falstaff's scripts for years now. He's no longer around.

I've fixed some Smooth font size bugs for the next release.

Once upon a time, Smooth Browser did have a background wallpaper option but I nuked it because it was cluttered and looked crap. I have no intention of restoring it.

And if you really want transparency, you'll have to use the same trick I gave you for other scripts - comment out the line that fills the panel with a solid colour. Smooth Browser can be found here...

https://github.com/jscript-panel/component/blob/372b0e6bc701dd99b8547635fb5d4e90708dc9e2/samples/smooth/jssb.js#L130
Title: Re: JScript Panel
Post by: Defender on 2023-06-02 13:34:07
I've fixed some Smooth font size bugs for the next release.

Thanks for fixing the font bugs in the upcoming version.

Background trick for Smooth  Browser worked and I also applied it for Smooth Playlist Manager, so I don't use the album cover background option anymore. Works a lot better for me in case of streaming Radio.
Title: Re: JScript Panel
Post by: Azuriye on 2023-06-02 21:02:08
Hello again... I've been talking with the dev responsible for foo_discord_rich in hopes to see if he could implement some sort of compatibility with his plugins or at least listen for notifications sent by the JScript panel,

He mentioned that if I want to use a custom radio station which hosts its album art separately I could use the UpdateFileInfoFromJSON function which will write tags to an mTAG file and trigger the upload script for foo_discord_rich, while at first, it seems something plausible but soon enough I noticed an issue where when I update tags while a file is playing it'll stop and start entering into a cycle where it checks for all my conditions again from start... a whole refresh.
https://github.com/s0hv/foo_discord_rich/discussions/12#discussioncomment-6070967

I assume this cannot be the correct way of using the UpdateFileInfoFromJSON function to trick another component into that a metadata change has occurred.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-03 01:56:17
UpdateFileInfoFromJSON  is obviously not for updating radio streams. It's always going to fail on playlist entries that are streams as per the very first line in the docs...

Quote
This method is for writing tags to files.

I know less than nothing about components like mtags but I'd assume they handle tagging updates transparently from fb2k/3rd party taggers without playback being affected?? Any issues with them not behaving as you expect need to be reported to the relevant dev.
Title: Re: JScript Panel
Post by: Azuriye on 2023-06-03 08:45:29
UpdateFileInfoFromJSON  is obviously not for updating radio streams. It's always going to fail on playlist entries that are streams as per the very first line in the docs...

Quote
This method is for writing tags to files.

I know less than nothing about components like mtags but I'd assume they handle tagging updates transparently from fb2k/3rd party taggers without playback being affected?? Any issues with them not behaving as you expect need to be reported to the relevant dev.


Thanks, will follow up with the respective dev.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-03 16:22:40
3.0.28 for fb2k 1.6.6 - 1.6.16
3.2.24 for fb2k 2.0

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

- Fix various `Smooth` sample bugs when using the `Ctrl` key and mouse wheel to increase the font size.
Title: Re: JScript Panel
Post by: Defender on 2023-06-03 20:21:41
3.2.24 for fb2k 2.0

- Fix various `Smooth` sample bugs when using the `Ctrl` key and mouse wheel to increase the font size.

Thx. I'll test it
Title: Re: JScript Panel
Post by: Defender on 2023-06-03 21:34:32
3.0.28 for fb2k 1.6.6 - 1.6.16
3.2.24 for fb2k 2.0

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

- Fix various `Smooth` sample bugs when using the `Ctrl` key and mouse wheel to increase the font size.

Findings on a system with 250% windows scaling:

1) ALL ITEM and NO COVER text align just fine inside the image squares. Thx :-)

2) Scaling of font with CTRL works fine, but there is a minimum fontsize. This is still a bit too big (especially in SB).

3) With the scaling of the font with CTRL, the font in the inputboxes also scale. Problem is that the base size font of the inputbox in regard to the normal font used in SPM is way too big.

For reference I attached two screenshots with an ELP, ButtonBar and Current Track which has the appropiate font sizes for display on 250%.

Is there a setting in the panel properties I'm overseeing?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-03 22:08:43
225% seems to be the max I can set in windows 10. Zero problems using default settings. I've not touched a thing.

https://i.imgur.com/sdegfcD.png
Title: Re: JScript Panel
Post by: Defender on 2023-06-03 22:37:15
225% seems to be the max I can set in windows 10. Zero problems using default settings. I've not touched a thing.

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

Are these SB and SPM?
Also, I cannot see the inputbox in your screenshot (Rename Playlist Box in SPM and Top Filterbox in SB. Are they  looking OK?

In the meanwhile I'll port my current version to 225 as well (have to do that anyway) and check that scaling.
Title: Re: JScript Panel
Post by: Defender on 2023-06-03 23:15:31
225% seems to be the max I can set in windows 10. Zero problems using default settings. I've not touched a thing.

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

It's a bit better in 225. However the skin must scale to 300, so it's going to be worse.

With 225 the minimum font size for standard text in SPM is ok. The inputbox (when renaming playlist) in very large font  is not ok.
In SB the standard font is too big and also the inputbox ("Filter" in very large font) is not ok.

In the attached screenshot I circled the problem areas in RED. In my opinion it just does not look good.

Where do SB and SPM get their initial fontsizes from and where does the inputbox get its font from?
I tried everything in Smooth Panel Properties and checked all settings in CUI fonts but nothing weird from my side. All either Segoe 10pt or 12pt.

If it can't be fixed, I'd appreciate a tip for an alternative for SB (as a graphical artistbrowser).
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-03 23:43:10
So the edit font is too big but it's not as broken for me as it for you. I will improve it.

But your artist labels looking so borked doesn't seem to be something I have any control over.

You (and all 32bit users) should use this: https://github.com/Wil-B/Library-Tree

Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-04 00:57:41
I've made some inputbox improvements but I'm not doing a brand new release. I've simply updated the component archives on github with the updated script files. The component remains untouched with the same version number.

Title: Re: JScript Panel
Post by: Defender on 2023-06-04 18:47:39
I've made some inputbox improvements but I'm not doing a brand new release. I've simply updated the component archives on github with the updated script files. The component remains untouched with the same version number.

Sorry, didn't see this message (new page).

I can confirm the changes are perfect in all scaling. Thanks.

I also had a look at Wil-B/Library-Tree and that looks great! Not really an issue it only runs on x86 since pretty much all I use is not supported on x64 anyway.

I really hope someday there will be a wrapper under x64 that at least runs x86 visuals in a kinda sandbox.
Title: Re: JScript Panel
Post by: zeremy on 2023-06-05 15:03:03
Is it possible for GetAlbumArt() to return if the image returned as the IJSImage is a file or embedded?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-05 15:15:48
Check the path of the image against the handle path.

Code: [Select]
var is_embedded = false;
var handle = fb.GetFocusItem();

if (handle) {
var img = handle.GetAlbumArt();
if (img) {
is_embedded = img.Path == handle.Path;
}
}

Path being a property of most images is new in JSP3.

https://jscript-panel.github.io/docs/interfaces/IJSImage/
Title: Re: JScript Panel
Post by: zeremy on 2023-06-05 15:22:29
Check the path of the image against the handle path.

Code: [Select]
var is_embedded = false;
var handle = fb.GetFocusItem();

if (handle) {
var img = handle.GetAlbumArt();
if (img) {
is_embedded = img.Path == handle.Path;
}
}

Path being a property of most images is new in JSP3.

https://jscript-panel.github.io/docs/interfaces/IJSImage/
Perfect!
Thanks
Title: Re: JScript Panel
Post by: Defender on 2023-06-05 19:13:47
How do I get  the current state of PlaybackOrder in jscript3?

In WSHpanel fb.PlaybackOrder is available and contains the state. This is not available in jscript2/jscript3 to my knowledge.

However if you change the playbackorder from a jscript button the value of fb.PlaybackOrder within WSH has been changed accordingly (including the graphical display based on this value).

I need this value to be "known" in jscript to show a jscript button with an image displaying the current state of PBO.

Is there a global state variable available in jscript I'm overlooking?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-05 19:24:07
IIRC, WSH panel mod had fb.PlaybackOrder and plman.PlaybackOrder which did the same thing.

One of the first things I ever did was remove the fb variant. It's plman only.

https://jscript-panel.github.io/docs/namespaces/plman/

Title: Re: JScript Panel
Post by: Defender on 2023-06-05 21:44:21
IIRC, WSH panel mod had fb.PlaybackOrder and plman.PlaybackOrder which did the same thing.

Based on plman.PlabackOrder I can select the correct image now.

However if I change the PBO status with the (jscript2) button it doesn't repaint the button (WSH Display panel does BTW).
Tried multiple things in the code but I just cannot get it to update after a change of playbackorder. Only way I get the current and correct image is when I resize the window (and force an on_size I guess).

So where and how do I force a repaint of the PBO button to reflect the current state of playbackorder (even when it is changed via the Menu button)? I included the current test jscript2 PBO button script.

Would be much obliged.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-06 00:24:37
The WSH panel mod script will use this exact same callback.

https://jscript-panel.github.io/docs/callbacks/#on_playback_order_changednew_order_index

Nothing has changed in this regard.

Everything function prefixed on_XXX like this...

Code: [Select]
function on_playback_order_changed(new_index) {
   // do something
}

is triggered by the component forwarding messages from fb2k itself.
Title: Re: JScript Panel
Post by: Defender on 2023-06-06 01:50:35
I added to my code:

function on_playback_order_changed(new_index) {
//   window.RepaintRect(0, 0, 26, 22);
//   panel.size();
   buttons.update();
}

Small improvement. If you go to the button (hover) it changes the image to the corrrect one. If you unhover the correct image is shown as well. Unfortunately you have to hover to get the correct PBO representation in the first place.

I really feel kind of stupid. I created some 475K of PSS code and 180K of ELP code and everything works exactly as I planned/programmed. Unfortunately PSS does not support dropdown menu's and rightclick on either textbuttons or imagebuttons.
I just don't have a clue how jscript works. All I did so far is based on reverse engineering (which drives me nuts).

What do I have to add to the jscript code to force an update upon changing the playbackorder (not only on hover)?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-06 03:02:55
Code: [Select]
function on_playback_order_changed(new_index) {
   buttons.update();
   window.Repaint();
}

Just like most of my other scripts that react to various player events...

https://github.com/jscript-panel/component/blob/418edec427d371c3b700c51f8e4f26a3a0106245/samples/Playback%20Buttons.txt#L104-L122
Title: Re: JScript Panel
Post by: Defender on 2023-06-06 03:44:08
Code: [Select]
function on_playback_order_changed(new_index) {
   buttons.update();
   window.Repaint();
}

Phew. Thank you. This one does the job. I thought I tried the window.Repaint() one, but obviously not.

Anyway, next step will be cleaning up this button and migration to JS3. This is my last JS2 one except for the Artwork panel. Tried JS3 but that one does not show which image it is showing on mousewheel (Front cover, Back Cover, Disc, Icon, Artist, Picture 1/5)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-14 18:47:19
3.2.25 for fb2k 2.0

https://jscript-panel.github.io/docs/
Title: Re: JScript Panel
Post by: Defender on 2023-06-20 19:30:49
Hi Marc2k3,

Small issue with foobar2000 2.1 preview 2023-06-20 with jscript3  3.2.25.

When I use File - Add Location and add a new stream list.js crashes. If I reload it still crashes. When I play the newly added stream and hit reload it is fine.

See attaches screenshots

Thx
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-21 13:40:31
When reporting bugs, just copy/paste the popup dialog/console text. It's so much easier.

Anyway, hopefully fixed in this version...

3.2.26

https://jscript-panel.github.io/docs/
Title: Re: JScript Panel
Post by: Defender on 2023-06-21 19:24:15
When reporting bugs, just copy/paste the popup dialog/console text. It's so much easier.

As you like.

Anyway, hopefully fixed in this version...
3.2.26

Yes it is fixed. Much obliged.
Title: Re: JScript Panel
Post by: etip on 2023-06-21 20:26:12
Hi Marc,
Quick question for you. I'm struggling to set up a recursive function in the playlist organizer script.
It seems that when the function is called within the same function, it works but doesnt come back to finish the initial function (not sure i'm clear).
Would you happen to know if there is an issue in JScript ?
thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-22 12:59:51
Not really sure what you mean?? The simplest recursive function would be something like this...

Code: [Select]
function sqaure(n, max) {
    console.log(n * n);
    n++;
    if (n <= max) {
        square(n, max);
    }
}

square(1, 10);

You need to tell it when to stop otherwise you'll have an infinite loop of doom. :P
Title: Re: JScript Panel
Post by: etip on 2023-06-23 06:42:41
Here is a simple test :
Code: [Select]
var data2 = [1,2,3,4,5];
function recurs(numb) {
for (i=0; i<data2.length;i++)
if (data2[i] == numb)
recurs(11);
else
console.log(data2[i]);
}
recurs(2);

The result is :
Code: [Select]
1
1
2
3
4
5
So when it reaches 2, it goes to a new loop (the recurs(11);), go through all the data2 and then, i wish when the
Code: [Select]
the recurs(11);
is done, it goes back to the first loop to finish it.
The result should be (in my opinion) :
Code: [Select]
1
1
2
3
4
5
3
4
5
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-23 11:24:28
(in my opinion) :


Computer says no. Just tested this in a browser....

(https://i.imgur.com/l7pcBmd.png)

Title: Re: JScript Panel
Post by: regor on 2023-06-23 12:22:05
Computers may be stupid. The code logic is flawless, and the problem is a JS bug-feature from old days without a proper standard.
The problem is variable scope. No idea if 'use strict' is supported by JScript panel, but if it does, please USE IT. It's the default in SMP for a good reason.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode

Code: [Select]
var data2 = [1,2,3,4,5];
function recurs(numb) {
for (var i=0; i<data2.length;i++) { // Must set scope to i here!!
if (data2[i] == numb) {
recurs(11);
} else {
    console.log(data2[i]);
        }
    }
    return;
}
recurs(2);

Note the "var i ="  part. Without it, i is added as a global variable, so your second call at recurs(11) sets the variable to 5 after finishing and the first loop is ended at that point. You should always set the scope of a variable.

These errors are impossible with 'use strict' usage, since panel would crash immediately, giving you a warning about many bad coding practices.
Title: Re: JScript Panel
Post by: sveakul on 2023-06-23 22:42:55
marc2k3:  I have added your Thumbs sample set to show an artist bio picture downloaded from Last.fm and underneath it the Last.fm Bio to a DUI panel in my fb2k v2.1, and it's amazing how fast and accurately they both work with radio stream metadata, they've transformed the GUI and I appreciate it!!

I would like to know if there is some extra script I can add to the end of one or both samples that, upon script unloading, would delete the contents of the js_data/artists folder of the subfolders with the artists' names and their contents of both the downloaded image and the Bio .js file.  You generously supplied a script to me earlier that did this with the contents of the spectrogram_cache folder.

I am using jscript panel 3 version 3.2.26.  Thanks for any help you can provide!
Title: Re: JScript Panel
Post by: etip on 2023-06-23 23:01:30
Computers may be stupid. The code logic is flawless, and the problem is a JS bug-feature from old days without a proper standard.
The problem is variable scope. No idea if 'use strict' is supported by JScript panel, but if it does, please USE IT. It's the default in SMP for a good reason.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode

Code: [Select]
var data2 = [1,2,3,4,5];
function recurs(numb) {
for (var i=0; i<data2.length;i++) { // Must set scope to i here!!
if (data2[i] == numb) {
recurs(11);
} else {
    console.log(data2[i]);
        }
    }
    return;
}
recurs(2);

Note the "var i ="  part. Without it, i is added as a global variable, so your second call at recurs(11) sets the variable to 5 after finishing and the first loop is ended at that point. You should always set the scope of a variable.

These errors are impossible with 'use strict' usage, since panel would crash immediately, giving you a warning about many bad coding practices.

Thanks. 3 letters that made it. I cant possibly say how long i've been staring at my code wondering what was going on.
Title: Re: JScript Panel
Post by: MonolithNZ on 2023-06-24 07:58:06
Hi there, apologies if this is the wrong thread for me to post this.

I'm new to Foobar2k and I've recently installed JSPlaylist. It's working very well, my only issue is the default sorting of albums. I'd like the albums to sort by year , descending. How would I go about enforcing that?

Kind regards
Monolith

EDIT: I've figured it out, Thanks for developing such a great component!
Title: Re: JScript Panel
Post by: sveakul on 2023-06-26 19:38:27
Jscript Panel 3.2.26, Foobar v2.1 x64 Preview 06-24-1023.

I am running the Thumbs sample (set to "Last.fm artist art" and "Automatic downloads") and Last.fm Bio concurrently in different panels.  I notice that when listening to radio streams that send artist/track metadata, when the song on the same stream changes, the Last.fm Bio panel will auto-update every time to the new artist.  However, the Last.fm artist art panel will change to empty and not update automatically, but only grab the new artist art when "Download now" is clicked--the autodownload option is only invoked when actually changing radio streams.  Is there a way to modify the Last.fm artist art Thumbs code so that it auto-updates when the same stream's metadata changes, like what already happens with Last.fm Bio?
Title: Re: JScript Panel
Post by: TakuSkan on 2023-06-27 06:36:43
There seems to be an issue with Smooth Playlist in the last FB v1.1.6 compatible v3.0.28 when using the keyboard up and down keys to navigate to previous or next tracks. Here's the error code:

Code: [Select]
JScript Panel 3.0.28 (Smooth Playlist by Br3tt aka Falstaff)
JavaScript runtime error
'timers' is undefined
File: C:\Users\xxx\work\Foobar2000\profile\user-components\foo_jscript_panel3\samples\smooth\common.js
Line: 129, Col: 2

Uninstalling it and installing v3.0.19 got it working properly, though I had to replace the code for 'Track Info + Seekbar + Buttons.txt' with the one from v3.0.19. So far it looks like the rest of the v3.0.28 panel codes are playing nice with  v3.0.19.

Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-27 12:53:05
3.0.29 for fb2k 1.6.6+
3.2.27 for fb2k 2.0 Beta18+

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

- Various sample fixes
Title: Re: JScript Panel
Post by: TakuSkan on 2023-06-27 13:48:42
Lots of work there. I'll take a few out for a spin around the block a bit later. Thanks marc.
Title: Re: JScript Panel
Post by: etip on 2023-06-27 22:53:18
@marc2k3 quick question for you,
Is there any way to retrieve the query string of an autoplaylist ? i didnt find any function in plman for that.
Thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-28 09:19:25
Is there a way to modify the Last.fm artist art Thumbs code so that it auto-updates when the same stream's metadata changes, like what already happens with Last.fm Bio?

You can try opening the configuration window and looking for this...

Code: [Select]
function on_playback_dynamic_info_track() {
panel.item_focus_change();
}

Replace it with...

Code: [Select]
function on_playback_dynamic_info_track(type) {
if (type == 0) thumbs.playback_new_track();
}

Is there any way to retrieve the query string of an autoplaylist ? i didnt find any function in plman for that.

Nope. It's been asked for before but I'm pretty sure the fb2k SDK does not provide any means for doing it.
Title: Re: JScript Panel
Post by: sveakul on 2023-06-28 20:30:26
Is there a way to modify the Last.fm artist art Thumbs code so that it auto-updates when the same stream's metadata changes, like what already happens with Last.fm Bio?

You can try opening the configuration window and looking for this...

Code: [Select]
function on_playback_dynamic_info_track() {
panel.item_focus_change();
}

Replace it with...

Code: [Select]
function on_playback_dynamic_info_track(type) {
if (type == 0) thumbs.playback_new_track();
}
marc2k3, THANKS for this, it works great with both v2.1 and 1.6.16!  Much appreciated.
Title: Re: JScript Panel
Post by: sveakul on 2023-06-30 00:25:08
As a P.S. I was wondering if you've had a chance to take a look at the cache-clearing-on-exit functionality that I brought up in my post here: https://hydrogenaud.io/index.php/topic,110499.msg1029204.html#msg1029204 (https://hydrogenaud.io/index.php/topic,110499.msg1029204.html#msg1029204) .
Title: Re: JScript Panel
Post by: marc2k3 on 2023-06-30 12:35:54
3.2.28 for fb2k 2.0

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-07-05 09:33:47
3.3.0 is now unified for any fb2k version above 1,6.6. A few features remain exclusive to fb2k 2.0 users

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

I'll try and get the docs site updated ASAP but it seems to be borked right now.. The docs site is now updated...

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

Title: Re: JScript Panel
Post by: Air KEN on 2023-07-05 17:09:33
I am always grateful for your script.

v3.3.0
Samples - Track Info + Seekbar + Buttons

Do you have any plans to add "Colours > Enable Dynamic" Option to "Track Info + Seekbar + Buttons"?

(https://i.imgur.com/cX1hkEq.png)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-07-06 11:02:58
I may consider it over the weekend.

If you're the one updating the japanese wiki, it should be made clear 3.3.0 is for fb2k 2.0 as well. Currently it says 1.6.6 - 1.6.16.

It's 64bit compatible and all internal functions that were optimised for 2.0 still are. It will fall back to old code if 1.6.x is used.
Title: Re: JScript Panel
Post by: Air KEN on 2023-07-06 11:05:16
> If you're the one updating the japanese wiki, it should be made clear 3.3.0 is for fb2k 2.0 as well. Currently it says 1.6.6 - 1.6.16.
thank you. Check and correct.
---
Special thanks to Text Display.
Title: Re: JScript Panel
Post by: TakuSkan on 2023-07-07 05:15:52
Hey marc. Would it be possible to bring back the "Panel Properties" option for the Smooth Playlist that was available back in v3.2.25. With that it was possible to edit the code to switch the positions of Artist and Album names.

Also the placeholder for missing album art set in 'Preferences > Display >Album Art > Stub image path' used to show up in Smooth Playlist. It doesn't seem to work anymore. Am I missing an option somewhere, or is this something that needs new jscript code?

I've only recently remade a build I 1st put together back in 2016 that was having issues with foo_playcount I never resolved. Happily that's history now with x86 FB 2.0 and updated versions of components for all my old panels. The only thing I really miss is your 'Now playing (basic).txt' from js_marc2003-v4.0 2019.

(https://i.imgur.com/wdfb2n3.jpg)

I don't guess there's any chance you'd be interested in resurrecting that elegant old dinosaur, is there?

Thanks so very much for all the phenomenal work you put into all these scripts marc!
Title: Re: JScript Panel
Post by: marc2k3 on 2023-07-07 09:23:04
You can still access panel properties by holding Shift+Win key before right clicking.

The stub image from the Preferences has never been supported in any smooth samples because they resize and cache album art to disk for performance reasons. This is not anything new.

If you really want it, you can change the false to true on this line of code...

https://github.com/jscript-panel/component/blob/1a3b1f8eb49bb1b7090b82f6442687e0e0bc9ec0/samples/smooth/common.js#L138

I might consider the combined image/bio in a single panel at some point.
Title: Re: JScript Panel
Post by: TakuSkan on 2023-07-08 05:15:05
You can still access panel properties by holding Shift+Win key before right clicking.
Got it! Thanks.

Quote
The stub image from the Preferences has never been supported in any smooth samples because they resize and cache album art to disk for performance reasons. This is not anything new.
Oh! I've been using one of Br3tt's versions that was doing that from way back to Kameleon days when we'd copy whole jscript folders to the root of FB. I guess those were loading the original larger album art files. I see your script makes smaller thumbnails and saves them to \js_smooth_cache, which must be what you're saying about performances reasons. Faster loading times.

Quote
If you really want it, you can change the false to true on this line of code...

https://github.com/jscript-panel/component/blob/1a3b1f8eb49bb1b7090b82f6442687e0e0bc9ec0/samples/smooth/common.js#L138
Ran into a bit of an issue with the script making thumbs from my png stub image that has a transparent background where the resulting jpgs all ended up with black backgrounds against my overall white panel backgrounds. I can just make a white background copy. I don't have many tracks/albums without album art.

Quote
I might consider the combined image/bio in a single panel at some point.
That'd be sweet!
Title: Re: JScript Panel
Post by: marc2k3 on 2023-07-08 10:13:56
Oh! I've been using one of Br3tt's versions that was doing that from way back to Kameleon days

That's what JSplaylist is baed on. It handles stub images with transparency because there is no caching. The component method for saving images to disk only writes jpg. It could be expanded to other formats but I really don't want to. It was never meant for quality, only speed.
Title: Re: JScript Panel
Post by: DClaville on 2023-07-08 11:54:53
Hey i am new to trying out using JScripts for changing my Foobar experience and i see loads of cool tings to do with it thanks for making it possible.

One thing that i would really love is if the Sample playback buttons one could be made into a vertical row I think it would be useful for many people who use foobar on a vertical screen and has a tall narrow layout but problem is i know just minus 14 about coding ive been fiddling around with trial and error but no luck yet.

So just shooting it out here if anyone would consider making that an option that's a toggle in a future update

thanks and kind Regards.
Title: Re: JScript Panel
Post by: TakuSkan on 2023-07-08 12:44:33
That's what JSplaylist is baed on. It handles stub images with transparency because there is no caching. The component method for saving images to disk only writes jpg. It could be expanded to other formats but I really don't want to. It was never meant for quality, only speed.
Br3tt\Falstaff was quite the innovator. Wish he was still active. I'd love to see him rework his feature-rich Kameleon, still my all time favorite FB build.  

Yeah, I can't see any reason to be considering png support. I notice the bio.www.last.fm.json files in \js_data\artists match the ones in \wsh_data\artists from my old build. I've accumulated well over a gig of photos through the years that I've copied into the new build that seems to play nice with both the old .json & .jpgs. Haven't yet looked into which panels are using all these new getSimilar, getInfo, echonest, almusic.(album) .json file types.

Oh... I'd been synchronizing those js_smooth_cache album thumbs between builds on my PC and notebook. But while testing changing 'false' to  'true', I noticed 3 what look like indexing files with 10 digit file names. If I sync just the album jpgs between the 2 systems, is that going to screw anything up? 
Title: Re: JScript Panel
Post by: marc2k3 on 2023-07-10 09:26:27
3.3.1 for any version of fb2k above 1.6.6

https://jscript-panel.github.io/docs/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-07-10 09:30:42
Oh... I'd been synchronizing those js_smooth_cache album thumbs between builds on my PC and notebook. But while testing changing 'false' to  'true', I noticed 3 what look like indexing files with 10 digit file names. If I sync just the album jpgs between the 2 systems, is that going to screw anything up? 

Cached album art filenames are based on the path of the track its associated with. The paths would need to be identical on both systems for a "shared" cache to work. If the paths are different, it will ne no different to the script never seeing the track before and new cached files will be generated.
Title: Re: JScript Panel
Post by: TakuSkan on 2023-07-11 03:57:37
Cached album art filenames are based on the path of the track its associated with. The paths would need to be identical on both systems for a "shared" cache to work. If the paths are different, it will ne no different to the script never seeing the track before and new cached files will be generated.
Okay. I'll delete the folders on both systems, set identical paths and let them regenerate. Not really a big deal with such small files, as intended. Thanks for the feedback marc.
Title: Re: JScript Panel
Post by: Azuriye on 2023-07-13 19:58:16
Hello marc2k3... sorry for keep on bugging you but I decided to move my fb2k setup from Desktop to Laptop and I seem to face some issue with utils.DownloadFileAsync, basically I am using it along with on_download_file_done as well.

On my Desktop, it works flawlessly but on my Laptop, I'm not able to pinpoint what exactly is causing the issue... I used the function like this... (window.ID, the full url which contains the image hosted elsewhere, the absolute path with extension for where the file gets saved)

but I keep getting error_text hinting out Object not found... what exactly could be causing the issue here?

Edit: Fixed it... was a combination of missing slashes and the full URL for the file save location and URL respectively...
Title: Re: JScript Panel
Post by: mexx on 2023-07-18 17:20:47
Hello,

how can I set the font and color in JScrip3/Samples:Properties. I already got the color of the heading (see picture below)
Title: Re: JScript Panel
Post by: Jul2323 on 2023-07-24 09:21:37
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 .
Title: Re: JScript Panel
Post by: marc2k3 on 2023-07-26 13:02:56
3.3.2

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: ApacheReal on 2023-07-26 16:16:29
Thank you.

I'm starting to understand how it works.

First I changed my INFO panel to the samples Text Display with my own ad hoc configuration.

For the JSplaylist I would like to have the correct image ratio by setting Panel Setting Apparance wallpaper status album enable.

By the way I have noticed that in another samples in Thumbs it is possible to do it.

(https://i.postimg.cc/dDRsGbCX/Screenshot-2023-07-26-170606.png) (https://postimg.cc/dDRsGbCX)
Title: Re: JScript Panel
Post by: marc2k3 on 2023-07-27 09:19:14
The wallpaper option in JSPlaylist will always be cropped to fill the rectangle without stretching. This is the best look when you have text drawn over the top. If it were centered, it would look crap.

Thumbs has various options because it's image only and no text.

As always javascript can be edited by anyone but I'm not doing it...

https://github.com/jscript-panel/component/blob/b518b8bc8de00750ce6ea2d6d77c96764e40eabb/samples/jsplaylist/main.js#L967
Title: Re: JScript Panel
Post by: ApacheReal on 2023-07-27 15:59:15
in JS version Playlist mod I see:

Spoiler (click to show/hide)

wpp_img_info.orient = 0
Changing 0 to 2/1 does nothing.
[/pre]
[/pre]

Title: Re: JScript Panel
Post by: marc2k3 on 2023-07-28 12:06:45
This thread is for JScript Panel 3 only. Clearly you're using some ancient version or Spider Monkey Panel???
Title: Re: JScript Panel
Post by: ApacheReal on 2023-07-28 12:45:26
This thread is for JScript Panel 3 only. Clearly you're using some ancient version or Spider Monkey Panel???

Yes I know, I changed from the JS3 version to the Spider Monkey Panel version, which has other options, with the hope of being able to correctly set the image in wallpaper / portrait mode / adjust.

Without success unfortunately.
Title: Re: JScript Panel
Post by: hikaze on 2023-08-10 12:11:12
Hello,The helpers.txt(#310 line) can not decode the emoji icons correctly . ALL are . (I only changed the 2 ratings icon.)I cannot find the correct new Unicode numbers. Can you please change the code to normal font type? (It is not convenient to use FontAwesome)
var chars = {
   // FontAwesome
   up : '\uF077',
   down : '\uF078',
   left : '\uF060',
   right : '\uF061',
   close : '\uF00D',
   rating_on : '\u2605',
   rating_off : '\u2606',
   heart_on : '\uF004',
   heart_off : '\uF08A',
   prev : '\uF049',
   next : '\uF050',
   play : '\uF04B',
   pause : '\uF04C',
   stop : '\uF04D',
   preferences : '\uF013',
   search : '\uF002',
   console : '\uF120',
   info : '\uF05A',
   audioscrobbler : '\uF202',
   minus : '\uF068',
   music : '\uF001',
   menu : '\uF0C9',
   hourglass : '\uF254',
   lock : '\uF023',
   list : '\uF0C9',
   volume : '\uF028',
   // Ignore these, they are special chars for $rgb and $font parsing
   etx : String.fromCharCode(3),
   bel : String.fromCharCode(7),
   tab : '\t',
};
Title: Re: JScript Panel
Post by: marc2k3 on 2023-08-11 10:49:24
Nothing is stopping you use any font you want. I choose to use fontawesome for my own scripts. It's not meant to be "convenient" for others. :/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-08-14 15:04:06
3.3.3

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-08-25 15:45:55
3.3.4

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: ApacheReal on 2023-08-27 09:47:07
update_album_art();

function update_album_art() {
   angle = 0;
        angle_circle = 0;
        angle_arm = 0;
   if (g_img) g_img.Dispose();
   g_img = null;
   g_info = '';
   g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();
   if (g_metadb) {
      var tmp = g_metadb.GetAlbumArt(3) // type 3 = icon art
      if (!tmp) tmp = g_metadb.GetAlbumArt(0); // if disc art not found, use front cover
      if (!tmp) tmp = g_metadb.GetAlbumArt(4); // if disc art not found, use artist cover
      if (tmp) {
         var path = tmp.Path;
         var size = Math.min(tmp.Width, tmp.Height);
         
         g_img = utils.CreateImage(size, size);
         temp_gr = g_img.GetGraphics();
         temp_gr.DrawImageWithMask(make_square(tmp, size), circular_mask, 0, 0, g_img.Width, g_img.Height);
         g_img.ReleaseGraphics();
         temp_gr = null;
         tmp.Dispose();
         g_info = 'Original dimensions: ' + g_img.Width + 'x' + g_img.Height;
         if (path.length) g_info += '\nPath: ' + path;
      }
   }
   window.Repaint();
}

I need some help
the bold line has no effect.

What is the correct mod.

Thank you

auto disc cover art from front

(https://i.postimg.cc/5X7SsCPQ/disc-front-art.png) (https://postimg.cc/5X7SsCPQ)

auto disc cover art from artist

(https://i.postimg.cc/sGYJmH83/disc-artist-art.png) (https://postimg.cc/sGYJmH83)

I need it to add the cover in a radio stream where I use the .tags which doesn't support the artwork icon which instead works with local files.



Title: Re: JScript Panel
Post by: ApacheReal on 2023-08-28 06:35:04
That's how it works:

      var tmp = g_metadb.GetAlbumArt(4);if (!tmp) tmp = g_metadb.GetAlbumArt(3)
      if (!tmp) tmp = g_metadb.GetAlbumArt(0);
Title: Re: JScript Panel
Post by: ApacheReal on 2023-09-05 03:48:22
If it is possible in the next updates I would need to have:

Smooth Playlist Manager (with the ability to change the correct dimension image in the Background Wallpaper (crop/strech etc..)).

Thumbs (which supports embedded images)

Album Art (which supports non-embedded / osd info images if you change from front to back etc..
info dimension / path with the possibility to change font or not make it appear).

Text Reader with the ability to edit text and save it.

Thank you.

Title: Re: JScript Panel
Post by: marc2k3 on 2023-09-06 09:36:45
I have precisely zero interest in changing the behaviour of any included samples. Edit them yourself or don't use them.

edit: I'm sometimes open to sensible requests but those don't make any sense at all. If you really want to block tooltips in a panel, add this empty function in the panel.

Code: [Select]
function _tt() {}
Title: Re: JScript Panel
Post by: Montchenot on 2023-09-06 12:48:04
😊
Title: Re: JScript Panel
Post by: Gabriel Schwartz on 2023-09-06 21:29:39
That's how it works:

      var tmp = g_metadb.GetAlbumArt(4);if (!tmp) tmp = g_metadb.GetAlbumArt(3)
      if (!tmp) tmp = g_metadb.GetAlbumArt(0);

I have a folder with a double album and disc1.jpg and disc2.jpg (all in the same folder)
Is there a way to get the correct disc cover according to the current playing one?
Currently is always returns disc1.jpg
Title: Re: JScript Panel
Post by: ApacheReal on 2023-09-07 05:58:27
That's how it works:

      var tmp = g_metadb.GetAlbumArt(4);if (!tmp) tmp = g_metadb.GetAlbumArt(3)
      if (!tmp) tmp = g_metadb.GetAlbumArt(0);

I have a folder with a double album and disc1.jpg and disc2.jpg (all in the same folder)
Is there a way to get the correct disc cover according to the current playing one?
Currently is always returns disc1.jpg

This instruction works with my skin:

https://www.youtube.com/@solomusica277

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

Read the information, on the main page of my youtube channel
Title: Re: JScript Panel
Post by: TakuSkan on 2023-09-08 01:53:57
Hey marc.  Smooth Playlist seems not to be recognizing the <COMPILATION DATE> tag that groups tracks together for albums where tracks are labeled with different years as Columns UI's Playlist View does. I'm still on JSP3 3.2.28. Am I missing a setting somewhere that addresses this?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-09-08 10:07:31
Well it won't recognise it by default. That's not a standard tag that's in common use and I'm sure it's the same for CUI as well. You would need to configure the group setting somewhere. I can't remember if it's available in the panel properties window or whether the script would need editing.

Component wise, title format methods uses the same C++ from the SDK as any other component. It would be nonsensical to suggest that certain tags are not recognised properly.

Title: Re: JScript Panel
Post by: TakuSkan on 2023-09-09 03:22:11
It's been so long since I researched how to get this working in Columns UI, I can't remember where I got the code. But taking your lead in looking into group settings, I found I had this set up in all my old FB2K builds at: Preferences > Columns UI > Playlist View > Grouping

Code: [Select]
%album artist% - $if2(%compilation album%,%album%) - $if2(%compilation date%,%date%) - $if(%totaldiscs%,$if(%discnumber%,Disk %discnumber%,1) of %totaldiscs%,$if(%discnumber%,Disk %discnumber%,Disk 1 of 1))

I had previously switched the positions of Artist and Album names in Smooth Playlist panel code in SMOOTH.GROUPKEY. So I just copied and pasted the code I've had in Playlist View Grouping into SMOOTH.GROUPKEY, and all the tracks in my albums with that <COMPILATION DATE> tag instantly collapsed into one single album group again.

Thanks for the pointer my friend!
Title: Re: JScript Panel
Post by: Gabriel Schwartz on 2023-09-09 23:13:06
That's how it works:

      var tmp = g_metadb.GetAlbumArt(4);if (!tmp) tmp = g_metadb.GetAlbumArt(3)
      if (!tmp) tmp = g_metadb.GetAlbumArt(0);

I have a folder with a double album and disc1.jpg and disc2.jpg (all in the same folder)
Is there a way to get the correct disc cover according to the current playing one?
Currently is always returns disc1.jpg

This instruction works with my skin:

https://www.youtube.com/@solomusica277

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

Read the information, on the main page of my youtube channel

If only get the first disc1.jpg
Title: Re: JScript Panel
Post by: Ahnen on 2023-09-10 00:06:13
I got it like this.
(https://i.postimg.cc/rdDhxC85/foo2k.jpg) (https://postimg.cc/rdDhxC85)
Title: Re: JScript Panel
Post by: ApacheReal on 2023-09-19 06:30:53
In sample thumbs, if you use a long name in the file, the cover is not displayed.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-09-19 13:29:54
It's hard to say what the problem is. It could be my code for getting all files from a folder which you can test first in a blank panel...

Code: [Select]
// make sure backslashes are escaped like this...
var files = utils.ListFiles("D:\\path\\to\\folder\\").toArray();
console.log(JSON.stringify(files, null, 4));

If the above lists all the files correctly, then the folder iteration code must be OK and it's image reading function at fault.

To test that, supply utils.LoadImage with a long path...

Code: [Select]
// again ensure escaped backslashes....
var image = utils.LoadImage("d:\\some\\long\\path\\image.jpg")
if  (image) {
   console.log("image ok:", image.Width, "x", image.Height);
} else {
   console.log("oh noes, it went wrong");
}
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-03 12:45:43
3.3.5

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

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

Various fixes plus an option to blur album art has been added to the Text Display sample.
Title: Re: JScript Panel
Post by: ApacheReal on 2023-10-03 13:19:39
3.3.5

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

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

Various fixes plus an option to blur album art has been added to the Text Display sample.

Text Display
If it is possible to make it so that I have to make this change every time:

//         _drawImage(gr, albumart.img, 0, 0, panel.w, panel.h, image.crop);
         _drawImage(gr, albumart.img, 0, 0, panel.w, panel.h, image.centre);


I would add, that by deselecting Album Art in background, nothing should appear in the background, instead the blur/crop image appears
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-03 13:43:24
I would add, that by deselecting Album Art in background, nothing should appear in the background, instead the blur/crop image appears

Nope. :/

Title: Re: JScript Panel
Post by: ApacheReal on 2023-10-03 13:51:42
I would add, that by deselecting Album Art in background, nothing should appear in the background, instead the blur/crop image appears

Nope. :/

Ok I reloaded the sample and it seems to work.

I confirm, the module must be reloaded, configure / samples / Text Display.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-04 13:26:46
There may be a bug when using Text Display and toggling album art while listening to streams which supply album art. I'm not doing a new component release just for this but people can download this file and save it inside their component folder\samples\js overwriting the existing file...

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

Title: Re: JScript Panel
Post by: Gabohar on 2023-10-08 08:50:16
I installed the last version 3.3.5 and I have a problem in JS Playlist. If I watch the properties of the audio tracks, Foobar2000 mark as "loved", but in the playlist the songs in the mood column shows the heart empty. Another thing I noticed is that the heart is only "clickable" and shows full when the album tracks are independent audio files and are not in the Image+Cue format in FLAC for example, if I click nothing happens. This did not happen previously and in the console nothing appears.

I also tried to clear the authorization on both components Last.fm Playcount Sync / Last.fm Scrobbling and authorize again them, but nothing changes. If I click the "Last.fm Playcount Sync" and then on "import loved tracks" or "show loved tracks" on Library menu, It shows all the tracks correctly.

In any case, the songs played by Foobar2000 are displayed on my Last.fm profile page, it does scrobbling well.

This shows when I click "import loved tracks" on the console.

Last.fm Playcount Sync: On page 1 of 9, 200 matches were found from a possible 200
Last.fm Playcount Sync: On page 2 of 9, 194 matches were found from a possible 200
Last.fm Playcount Sync: On page 3 of 9, 198 matches were found from a possible 200
Last.fm Playcount Sync: On page 5 of 9, 159 matches were found from a possible 200
Last.fm Playcount Sync: On page 6 of 9, 182 matches were found from a possible 200
Last.fm Playcount Sync: On page 4 of 9, 184 matches were found from a possible 200
Last.fm Playcount Sync: On page 8 of 9, 186 matches were found from a possible 200
Last.fm Playcount Sync: On page 7 of 9, 194 matches were found from a possible 200
Last.fm Playcount Sync: On page 9 of 9, 152 matches were found from a possible 154
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-09 09:15:55
By default, JSPlaylist writes a tag named MOOD but you can make it play nice with foo_lastfm_playcount_sync by doing the following:

1) hold shift + win key and then right click the panel>Edit Properties. Enable the last option, "Love tracks with foo_lastfm_playcount_sync"
2) Then right click the panel>Panel Settings>Columns tab. Find Mood in the columns list and edit the title formatting to become...

Code: [Select]
[%lfm_loved%]

Now the column should show loved tracks and clicking the heart should toggle the current value as it's bound to the context menu item which triggers loving/unloving tracks with the playcount sync component.
Title: Re: JScript Panel
Post by: ApacheReal on 2023-10-12 11:41:00
Because this is no longer found in the samples?:

https://gist.githubusercontent.com/marc2k3/1d449cc5bbb2fcfdb51157e49d679ad6/raw/514a4415078ffe4143ba7560ba60a37f5f8e6a17/spinny%2520album%2520art%2520nonsense.txt

For me it's a worthy sample.

One thing I noticed is a freeze when updating the last plays / play count I entered in the text display:

[$crlf()$rgb(31,143,104)📃Last played on $date(%last_played%)$crlf()]

$if(%play_count%,
Track played
$ifequal(%play_count%,1, only once,
$ifequal(%play_count%,2, twice , %play_count% times)),)



Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-12 15:26:12
Quote
Because this is no longer found in the samples?:

It never was.

Quote
For me it's a worthy sample.

Nope. The clue is in the name... "Spinny Album Art Nonsense"

There's nothing I can with regards to its senstivity to other CPU intensive things that might happen in the background. But I really wouldn't expect playback stats updates to trouble it unless you've enabled the option to sync with file tags??
Title: Re: JScript Panel
Post by: ApacheReal on 2023-10-13 17:38:05
If you are referring to the option you see in the image it is disability:

(https://i.postimg.cc/18WtsLKx/Screenshot-2023-10-13-183518.png) (https://postimg.cc/18WtsLKx)

The problem remains.
Title: Re: JScript Panel
Post by: Gabohar on 2023-10-14 01:53:06
By default, JSPlaylist writes a tag named MOOD but you can make it play nice with foo_lastfm_playcount_sync by doing the following:

1) hold shift + win key and then right click the panel>Edit Properties. Enable the last option, "Love tracks with foo_lastfm_playcount_sync"
2) Then right click the panel>Panel Settings>Columns tab. Find Mood in the columns list and edit the title formatting to become...

Code: [Select]
[%lfm_loved%]

Now the column should show loved tracks and clicking the heart should toggle the current value as it's bound to the context menu item which triggers loving/unloving tracks with the playcount sync component.

Thanks @marc2k3 it works! 😉
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-14 11:58:35
I'll try and update the next release so that if anyone enables the playcount sync option in the properties, they won't have to edit the title formatting. It should be handled automatically but I was lazy.
Title: Re: JScript Panel
Post by: Defender on 2023-10-19 13:16:15
Hi Marc2k3,

I have an issue with the Properties + Other Info (POI) sample, which in my case is set to Follow selected track (playlist). I'm running fooBar 2.1 2023-10-13 x86 with jscript 3.3.5. I made no modifications to the sample or the js sources.

If you select on a (youtube short) track with a "weird" character like a smiley and the file has no length (yet), fooBar immediately crashes to the desktop without writing a crashdump.
If the track has either length or no weird character in the name fooBar does not crash.
I isolated the problem by removing all other panel besides POI and standard Playlist view and fooBar still crashes. My full skin without POI but including a lot of other JS3 stuff does not crash.

If you set POI to Prefer now playing and play some normal audiotrack, fooBar does not crash when you select the video. If you play the video (while another normal track is already playing!) everything is fine. As a result additional info like length is retrieved I think. So the next time you select the video even when POI is set to Follow selected track and you are not playing audio, fooBar does not crash.

Sample:
https://www.youtube.com/shorts/dteLwLlaOvg

www.youtube.com/shorts/dteLwLlaOvg

I checked a lot of youtube videos and as far as I can see the problem only occurs if the video has no length AND weird characters.

Can you look into this?
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-19 14:39:51
I can't test online clips because I don't have internet on my dev machine.

I guess you could see if this crashes (test in a blank panel, select playlist items to trigger)...

Code: [Select]
function on_item_focus_change() {
var handle = fb.GetFocusItem();
if (!handle) return console.log("nothing selected");

var handles = fb.CreateHandleList(handle);
console.log(JSON.stringify(handles.GetOtherInfo(), null, 4));
}

function on_playlist_switch() {
on_item_focus_change();
}

on_item_focus_change();

If this doesn't crash, try the plain Properties sample. In theory, one of these should crash??
Title: Re: JScript Panel
Post by: Defender on 2023-10-19 15:42:43
I can't test online clips because I don't have internet on my dev machine.

I guess you could see if this crashes (test in a blank panel, select playlist items to trigger)...

Code: [Select]
function on_item_focus_change() {
var handle = fb.GetFocusItem();
if (!handle) return console.log("nothing selected");

var handles = fb.CreateHandleList(handle);
console.log(JSON.stringify(handles.GetOtherInfo(), null, 4));
}

function on_playlist_switch() {
on_item_focus_change();
}

on_item_focus_change();

If this doesn't crash, try the plain Properties sample. In theory, one of these should crash??

DEBUG CODE
I changed the original POI code to your debug code.
If I select a working video it writes the console.log. Log attached to this post.
The moment I select a video with no length and weird character in %title% fooBar crashes immediately. I cannot access the console.log (in what location is it stored?)

PROPERTIES
When I change the POI code to the Properties code, fooBar does not crash if I select a video with no length and weird character in %title%. When I play it, fooBar adds length to the video and it runs fine.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-20 09:13:21
I've not tested but I hope 3.3.6 fixes it...

https://github.com/jscript-panel/release/releases
Title: Re: JScript Panel
Post by: Defender on 2023-10-20 10:06:26
I've not tested but I hope 3.3.6 fixes it...

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

I installed 3.3.6. Reimported the Properties+Info sample. Same instant crash unfortunately.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-20 10:46:31
Well I'm stumped then. :/

Can you test the Item Properties panel that is part of Columns UI? After adding, you must right click>Options and in the Information sections bit, enable All other sections. Obviously make sure the problematic JSP panel is removed first.

The reason I ask is because both my component this CUI panel are using the same internal fb2k method (track_property_callback_v2) and I really can't understand why it's crashing? If the CUI panel were to crash then I'd figure the bug would be fb2k at fault but it's hard to point fingers when I'm unable to test/reproduce. :O
Title: Re: JScript Panel
Post by: Case on 2023-10-20 13:44:01
@Defender - I see you have a lot of other components too besides JScript. Including very nasty ones like foo_ui_hacks. Can you check if Windows Event Viewer and its Application log has anything helpful logged about the crash to desktop. It should tell a component name causing the issue.
I was trying to reproduce your crash too. I don't know how you click the video link without it having a length. When foo_youtube is installed just adding the url to playlist gives it length. Nuking foobar's metadata store nukes the length but also the characters you blame for the issue. I created artificial test file with the same tags and no length and can't trigger any crashing.
Title: Re: JScript Panel
Post by: ApacheReal on 2023-10-20 13:54:57
With this update I solved a lot of problems.

Proof that the problem wasn't my skin mod.

Fixed the switch problems I had on the graphics modules, fixed the spin disc rotation much, much smoother.

There remains a very slight problem with the playback statistics with a very slight freeze on the spin discs.

video test:

https://www.youtube.com/watch?v=g9EBLrIe3D8
Title: Re: JScript Panel
Post by: Defender on 2023-10-20 14:41:04
Well I'm stumped then. :/

Can you test the Item Properties panel that is part of Columns UI? After adding, you must right click>Options and in the Information sections bit, enable All other sections. Obviously make sure the problematic JSP panel is removed first.

The reason I ask is because both my component this CUI panel are using the same internal fb2k method (track_property_callback_v2) and I really can't understand why it's crashing? If the CUI panel were to crash then I'd figure the bug would be fb2k at fault but it's hard to point fingers when I'm unable to test/reproduce. :O

CUI-IP. I already did that yesterday with all sections enabled.
CUI-IP does not crash. Probably because it only gives info on the current (already) playing file. No file playing? No info.

As far as I can see your JS-POI already gives info upon the selection of a track but fails on not earlier played files with no length and weird characters in %title% (to be named "culprit" from now on).

Interestingly enough ... if I set JS-POI to Prefer now playing, then play some audiotrack and queue the culprit as the next track. JS-POI does NOT crash when this culprit starts to play and shows the correct information. Also because of playing (with resulting added metadata?) it is no longer a culprit.
Title: Re: JScript Panel
Post by: Defender on 2023-10-20 15:06:44
@Defender - I see you have a lot of other components too besides JScript. Including very nasty ones like foo_ui_hacks. Can you check if Windows Event Viewer and its Application log has anything helpful logged about the crash to desktop. It should tell a component name causing the issue.
I was trying to reproduce your crash too. I don't know how you click the video link without it having a length. When foo_youtube is installed just adding the url to playlist gives it length. Nuking foobar's metadata store nukes the length but also the characters you blame for the issue. I created artificial test file with the same tags and no length and can't trigger any crashing.

@Case and Marc2k3

Yesterday I removed everything in my skin before I started testing except for a panel with JS3-POI and the standard Playlist View. With this minimal skin JS3-POI crashes on a culprit.

fooBar does not write an event in the windows log upon "crashing". Maybe it is just a very fast exit. I do get the "crash" screen upon starting fooBar afterwards though.
If I remove the "running" file after a "crash" I do not get the screen from the screenshot upon restarting fooBar.

I retested my (full) skin now without fui_ui_hacks. Still "crashes".
I don't use foo_ui_hacks in my skin, but need it to reset stuff switching back from Georgia or Georgia-ReBorn with an assigned keyboard shortcut.
Title: Re: JScript Panel
Post by: Defender on 2023-10-20 16:20:11
@Case and Marc2k3

I also deleted my full skin after removing foo_ui_hacks (and Georgia and Georgia-ReBorn from the FCL) and created a new vanilla skin which only contains:
Playlist switcher
JS3-POI
Playlist View

So no code anywhere by me. Exited and restarted fooBar. Still "crashes" when I select a culprit.

Remember ... Crash only occurs:
1) If you are not playing audio and you click on a culprit (JS3-POI selection mode does not matter)
2) Playing an audiofile and you click on a culprit while JS3-POI is in Follow selected track selection mode
Title: Re: JScript Panel
Post by: Case on 2023-10-20 16:30:41
I don't know about marc2k3, but I'd like to try to replicate the crash if you share a config that does it. If I can replicate it I might be able to help him debug it.
Title: Re: JScript Panel
Post by: Defender on 2023-10-20 20:20:05
I don't know about marc2k3, but I'd like to try to replicate the crash if you share a config that does it. If I can replicate it I might be able to help him debug it.

I'm using Youtube Search component from foo_youtube 3.9 beta 3 (also checked 3.8.1) to search YouTube videos and add them to my playlist.

If you use the default search provider youtube.web in this component it only returns videos with length as far as I can see. It does also return a lot of garbage that plays fine but has no sound and no video. It does not return any Youtube shorts videos. Since all the returned videos and garbage have length JS3-POI does not cause a crash.

If you use youtube-dl as a search provider in this component you don't get the garbage, you get Youtube Shorts videos, but some of those have no length and have weird characters in the title. Upon selecting one of those in a foobar install with JS3-POI in it fooBar crashes.

If I write down the name of one of the culprits, then delete my playlist in foobar, go to youtube in my webbrowser, search for the culprit in my webbrowser on the youtube website, I can play the file just fine inside my webbrowser.
If you select the url and drop it in fooBar it will get no length also. And selecting the file subsequently crashes fooBar if it contains JS3-POI.

If you load the cui-vanilla.fcl or the cui-vanilla+yt-search.fcl and then drop for instance the following url in your playlist fooBar with JS3-POI in it will crash.

www.youtube.com/shorts/RCmvO_9DyyE

I hope you are able to reproduce it now.

Also included a screenshot of my normal skin with a culprit. First track under Youtube Shorts group. No length and weird characters. Instant crash guaranteed.
Second track under shorts also has weird character, but length. So no crash there.
Title: Re: JScript Panel
Post by: Case on 2023-10-20 21:21:20
I can't trigger a crash. I don't know what I'm supposed to search for with the search element in the layout. Everything I try has length. And dragging the url you linked comes up with an entry that has a length.

If you make a fresh portable foobar2000 install without involving any skins and just install JScript panel and youtube-dl, can you make things crash?

If you have a way to reproduce the crash easily I really don't understand why you don't provide a simple config that shows it. Should be super simple to make a minimal foobar with the required components and configs that crashes just by clicking the playlist entry. Then just zip/7zip/rar that dir up and share.
Title: Re: JScript Panel
Post by: musicmusic on 2023-10-20 21:37:20
I managed to trigger the crash (it wasn't easy since there are quite a few prerequisities...) It was logged in the Windows Event Viewer:

Code: [Select]
Faulting application name: foobar2000.exe, version: 2.1.0.0, time stamp: 0x65292aa0
Faulting module name: jscript9.dll, version: 11.0.19041.3570, time stamp: 0x8ebdb297
Exception code: 0xc0000602
Fault offset: 0x0019803c
Faulting process ID: 0x5fa8
Faulting application start time: 0x01da03939e0484ac
Faulting application path: F:\foobar2000\foobar2000-2.1-x86\foobar2000.exe
Faulting module path: C:\Windows\System32\jscript9.dll
Report ID: 569abd91-ea0c-436e-af4d-4668eac781f2
Faulting package full name:
Faulting package-relative application ID:

The exception code is STATUS_FAIL_FAST_EXCEPTION ('A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.')

I've attached an FPL file that may trigger it for other people (with the right set-up).
Title: Re: JScript Panel
Post by: Defender on 2023-10-20 21:41:28
I can't trigger a crash. I don't know what I'm supposed to search for with the search element in the layout. Everything I try has length. And dragging the url you linked comes up with an entry that has a length.

If you make a fresh portable foobar2000 install without involving any skins and just install JScript panel and youtube-dl, can you make things crash?

If you have a way to reproduce the crash easily I really don't understand why you don't provide a simple config that shows it. Should be super simple to make a minimal foobar with the required components and configs that crashes just by clicking the playlist entry. Then just zip/7zip/rar that dir up and share.
I managed to trigger the crash (it wasn't easy since there are quite a few prerequisities...) It was logged in the Windows Event Viewer:

Code: [Select]
Faulting application name: foobar2000.exe, version: 2.1.0.0, time stamp: 0x65292aa0
Faulting module name: jscript9.dll, version: 11.0.19041.3570, time stamp: 0x8ebdb297
Exception code: 0xc0000602
Fault offset: 0x0019803c
Faulting process ID: 0x5fa8
Faulting application start time: 0x01da03939e0484ac
Faulting application path: F:\foobar2000\foobar2000-2.1-x86\foobar2000.exe
Faulting module path: C:\Windows\System32\jscript9.dll
Report ID: 569abd91-ea0c-436e-af4d-4668eac781f2
Faulting package full name:
Faulting package-relative application ID:

The exception code is STATUS_FAIL_FAST_EXCEPTION ('A fail fast exception occurred. Exception handlers will not be invoked and the process will be terminated immediately.')

I've attached an FPL file that may trigger it for other people (with the right set-up).

Thank you! I really don't know what else to do after making a complete vanilla FCL. Make a portable foobar? Why? My included FCL's are completely vanilla plus JS3_POI and do crash with a culprit/bad file.

I can confirm that your attached playlist triggers the crash.

All of a sudden I get an entry in windows eventviewer as well.

Faulting application name: foobar2000.exe, version: 2.1.0.0, time stamp: 0x65292aa0
Faulting module name: jscript9.dll, version: 11.0.22621.2070, time stamp: 0x30f96d8e
Exception code: 0xc0000602
Fault offset: 0x0020fef7
Faulting process id: 0x0x70B8
Faulting application start time: 0x0x1DA036E24AE46C9
Faulting application path: C:\Program Files (x86)\_MEDIA\foobar2000\foobar2000.exe
Faulting module path: C:\Windows\System32\jscript9.dll
Report Id: cf96887e-2f71-4be6-9c86-3ae2635e38fa
Faulting package full name:
Faulting package-relative application ID:

Same dll, but other version.
Title: Re: JScript Panel
Post by: Case on 2023-10-20 22:00:28
I've attached an FPL file that may trigger it for other people (with the right set-up).
Thanks musicmusic, that works nicely for triggering the crash.

Thank you! I really don't know what else to do after making a complete vanilla FCL. Make a portable foobar? Why? My included FCL's are completely vanilla plus JS3_POI and do crash with a culprit/bad file.
To make finding the claimed bug as easy as possible. I don't know if marc2k3 tried triggering the crash but I have spent a lot of time trying various component configurations and following your instructions. Feels almost like that's all I have managed to do today, try to make foobar2000 crash.
It's quite easy to ignore a crash report if one can't trigger a problems. As a rule of thumb if you want to report a bug you should provide all the information you can and make it as easy as possible for the developer to confirm the problem.
Title: Re: JScript Panel
Post by: Defender on 2023-10-20 23:12:32
Thank you! I really don't know what else to do after making a complete vanilla FCL. Make a portable foobar? Why? My included FCL's are completely vanilla plus JS3_POI and do crash with a culprit/bad file.
To make finding the claimed bug as easy as possible. I don't know if marc2k3 tried triggering the crash but I have spent a lot of time trying various component configurations and following your instructions. Feels almost like that's all I have managed to do today, try to make foobar2000 crash.
It's quite easy to ignore a crash report if one can't trigger a problems. As a rule of thumb if you want to report a bug you should provide all the information you can and make it as easy as possible for the developer to confirm the problem.

That's why I spend almost two days on this bug (a full day before I sent my first post about it).
Still don't understand why a vanilla fcl which crashes is not enough and it has to be a portable one.

Thankfully Musicmusic had the right idea by just sending an fpl with a culprit.
Title: Re: JScript Panel
Post by: Case on 2023-10-21 08:29:24
Still don't understand why a vanilla fcl which crashes is not enough and it has to be a portable one.
Because the crash has nothing to do with the FCL. And like I was trying to say, even after going through the trouble of obtaining all the components your layout file needed and trying to follow your instructions as well as possible, foobar was not crashable. The files you provided didn't cause the crash and I could not create a scenario that you described that would crash.
If you had provided a zip with needed components and crashing playlist, it would have been reproducible in 1 minute. Now we spent a day hunting it down.

Now with musicmusic's FPL file the crash is triggerable with instructions anyone can follow:
1. install clean portable foobar2000.
2. install foo_youtube
3. install foo_jscript_panel3
4. add JScript panel to UI
5. load Properties + Other Info sample script to the panel
6. configure panel selection mode to Follow selected track
7. drag bad-playlist.fpl to the UI
8. observe how things crash after a short moment
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-21 09:17:22
So the bug was me being oblivious to this dump method default args in the JSON library I'm using documented here...

https://json.nlohmann.me/api/basic_json/dump/

I didn't realise the default behaviour was to throw exceptions with invalid UTF8 sequences. I've since updated this and hope it works now.

Thanks to musicmusic for the .fpl file.  8)

---

3.3.7

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

Title: Re: JScript Panel
Post by: ms1602 on 2023-10-21 10:44:47
Hi,

Please look at the screenshot:

https://imgbox.com/3GWaBkLo

How to make songs with disc number and track number appear first? I use Smooth Playlist.

Thanks for any help.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-21 11:00:40
It's not really a playlist's job to sort items. Proper playlists obviously provide clickable column headers for convenience but generally it's the responsibility of whatever library viewer you're using (or Preferences>shell integration > sort incoming files by if using the file menu to add files/folders or drag/dropping from Explorer).

The only way to sort files after being added is using the Edit menu>Sort. Use Sort By for custom title formatting or use one the built in presets.
Title: Re: JScript Panel
Post by: ms1602 on 2023-10-21 11:31:30
Thanks for the answer.

The problem is that regardless of the sorting scheme I would choose, files without a disk number are displayed first.

And I would like it to be the other way around, because I have a disc where the additional songs are not a separate disc, but are placed on the disc as a bonus files. On the mobile foobar everything is as it should be.

edit. Okay, in foobar for Windows installed without any additions it's the same, i.e. foobar simply treats songs without a discnumber as "disc zero" and places them before the first, second, etc. The only way is probably to add 2 of these songs or something else to the "discnumber" tags.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-10-21 11:56:08
If you want tracks without discnumber tags to be treated as disc 1 without tags then you can try this somewhere in your sort pattern....

Code: [Select]
$if2(%discnumber%,1)

Use some silly high value like 9999 if you want them shunted right to the end. Repeat for %tracknumber% if needed.
Title: Re: JScript Panel
Post by: Defender on 2023-10-22 01:13:08
So the bug was me being oblivious to this dump method default args in the JSON library I'm using documented here...

https://json.nlohmann.me/api/basic_json/dump/

I didn't realise the default behaviour was to throw exceptions with invalid UTF8 sequences. I've since updated this and hope it works now.

Thanks to musicmusic for the .fpl file.  8)

---

3.3.7

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


Thx for fixing this.

Plenty of questions about the search component of foo_youtube and/or the external yt-dlp.exe though which I will address in the correct forum topic.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-11-01 09:22:01
3.3.8

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

The allmusic sample has been nuked because of changes on the website that prevent new lookups. If you have a cache of previously saved reviews and want to continue displaying them, you'll need this script....

https://jscript-panel.github.io/files/allmusic.txt

I've also added an "Album Art + Text Display" sample. If peeps have been following the discussion thread, you might have seen it there already. It displays album art above the text in addition to the optional background. Just select it from the samples button.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-11-03 09:11:27
Apologies for the inconvenience but I already broke the "Album Art + Text Display" sample added in 3.3.8 2 days ago.

If you install 3.3.9+, you need to replace it with the original "Text Display". This now has 3 layout options available on the right click menu:

- Text only
- Album Art top, Text bottom ( text alignment is not available in this mode but are in the other 2)
- Album Art left, Text right

---

3.3.9

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

edit: it's quite likely this breaks mods posted in the discussion thread. They should be replaced with the original if possible.


Title: Re: JScript Panel
Post by: marc2k3 on 2023-11-13 09:23:57
3.3.10

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: seongbin on 2023-11-15 13:35:39
Hi, marc!
My script is not working somehow, specifically DrawThemeBackground function.

Code: [Select]
...
this.theme = window.CreateThemeManager("scrollbar");

this.upImage_normal = utils.CreateImage(this.w, this.w);
gb = this.upImage_normal.GetGraphics();
this.theme.SetPartAndStateID(1, 1);
this.theme.DrawThemeBackground(gb, 0, 0, this.w, this.w);
this.upImage_normal.ReleaseGraphics();
...

And, is it possible to revert the 'topbar filterbox' feature in smooth playlist?

Thanks!
Title: Re: JScript Panel
Post by: marc2k3 on 2023-11-15 16:03:41
My script is not working somehow, specifically DrawThemeBackground function.

I can't test now but I'll look at it later. I know it works when used conventionally without creating your own graphics objects. See the basic\SimpleThemedButton + Tooltip sample or the Smooth samples/JS Playlist when not using dark mode and you use "system default" colour in DUI or have theming enabled in CUI.

Quote
And, is it possible to revert the 'topbar filterbox' feature in smooth playlist?

Absolutely not. That was so broken, it was never usable. The filtering never considered the original positions in the playlist so you could never select or play the results. It was functionally useless.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-11-16 09:09:58
3.3.11

This fixes the GetGraphics / DrawThemeBackground bug reported above.

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-11-20 12:57:12
3.3.12

Playback statistics are back. The title format pattern for binding database records to tracks is no longer hard coded. It can edited to anything you like.

Pay attention to the docs. :P

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

https://jscript-panel.github.io/docs/playback-statistics/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-11-22 09:24:28
3.3.13

Various playback statistic improvements

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-11-25 14:18:19
3.3.14

- Update Playback Statistics with %jsp3_skipcount%.
- Add IMetadbHandleList Drop and IMetadbHandleList Take.
- Remove up/down indicators from Text Display sample.

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

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

Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-01 09:13:30
3.3.15

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

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

The Allmusic Review sample has been restored after figuring out how to scrape the website again.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-04 09:36:53
3.3.16

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-05 11:22:05
3.3.17 adds Dark mode support to utils.ColourPicker

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-08 09:11:54
3.3.18

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

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

No component changes, just a new combined last.fm bio/images sample. Screenshot can be found in the DUI gallery thread.

https://hydrogenaud.io/index.php/topic,58574.msg1036118.html#msg1036118
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-11 11:02:17
3.3.19

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

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

Add utils.GetCountryFlag and a $country_flag title format function. Details on how to use and the required font is here...

https://jscript-panel.github.io/docs/country-flags/

Some docs have been added on how to use $font and $rgb in your own scripts.

https://jscript-panel.github.io/docs/font-rgb/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-13 09:21:08
3.3.20

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

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

Existing users of Last.fm Bio + Image must re-import from the Samples button.
Fixes various bugs with Last.fm Bio + Image.
Add new Allmusic Review + Album Art sample
Both of the above have toggles for displaying the text to the right or to the bottom of the main image.
You can alter the ratio for image/text display by holding down Ctrl while you scroll.
Title: Re: JScript Panel
Post by: Air KEN on 2023-12-13 11:34:00
Both of the above have toggles for displaying the text to the right or to the bottom of the main image.
You can alter the ratio for image/text display by holding down Ctrl while you scroll.

Great, Bravo, Wonderful.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-20 14:01:23
3.3.21

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

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

last.fm bio / last.bio + images / allmusic /allmusic + album art users will need to update scripts in their panels from the samples button.

For country flag display to work, there has been a change to the required font that was used in various test versions in the script discussion thread. You should now install Twemoji Mozilla.

https://github.com/mozilla/twemoji-colr/releases/tag/v0.7.0

If you previously used Twitter Color Emoji in Text Display title formatting, it's recommended that you update and use $font(Twemoji Mozilla,16) or whatever.

edit: just to be clear, flags in bio scripts can come from file tags or pulled from last.fm. If you don't have file tags, you have to rely on the country being present in the Born In / Founded In section of the display. These sections are not always present.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-23 04:22:10
3.3.22

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

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

Just sample fixes really. And sorry once again but last.fm bio / last.fm + images / thumbs users will need to update again from the Samples button after installing.

I've also updated the docs site with a page on making web requests.

https://jscript-panel.github.io/docs/web-requests/
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-24 05:27:22
3.3.23

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

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

This improves the behaviour of web requests.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-25 15:42:29
3.3.24

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

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

No changes for samples users.

Just because it's Christmas, there is a breaking change in a minor release. But I figured the number of people making their own POST requests with utils.HTTPRequestAsync is somewhere around zero. Updated docs links are on the changes page.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-26 08:57:25
3.3.25

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

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

edited: I originally stated I'd fixed a bad last.fm bio bug which triggered more web requests than it should. But now I don't think it was as bad as I thought. I think my file age checks would have prevented spurious lookups. Updating is still recommended.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-29 10:48:10
3.3.26

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

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

Sample updates only.
Title: Re: JScript Panel
Post by: IP974 on 2023-12-29 12:30:03
hi everyone, in js-playlist, how to put back "Auto Collapse", thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-29 12:39:47
You can't.

I suppose 32bit users can install JScript Panel 2.8.8 and use that. It installs side by side with JSP3 so it could be kept for other panels if you need it.
Title: Re: JScript Panel
Post by: IP974 on 2023-12-29 13:47:57
Thx marc2k3.
Title: Re: JScript Panel
Post by: marc2k3 on 2023-12-30 23:50:53
3.3.27

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: Jul2323 on 2024-01-03 12:29:48
NEED HELP ON MY SCRIPT in Panel script 3 :
it is a biography and thumb panel together . but i need to right click " reload " to make it work . the text overwhise is not showing .
if someone can help me ? thanks a lot
the script :

// ==PREPROCESSOR==
// @name "jul"
// @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\thumbs.js"
// @import "%fb2k_component_path%samples\js\rating.js"
// @import "%fb2k_component_path%samples\js\lastfm.js"
// @import "%fb2k_component_path%samples\js\albumart.js"
// @import "%fb2k_component_path%samples\js\text.js"


// ==/PREPROCESSOR==

// https://jscript-panel.github.io/gallery/thumbs/
// https://jscript-panel.github.io/gallery/lastfm-bio/
// https://jscript-panel.github.io/gallery/album-art/

var panel = new _panel({ custom_background : true });
var thumbs = new _thumbs();
//var rating = new _rating(40, 580, 16, RGB(255, 128, 0)); // x, y, height, colour
var albumart = new _albumart(40, 60, 230, 230);
var lastfm = new _lastfm();
var text = new _text('lastfm_bio', LM * 68, TM * 5 , 0, 0);
var lastfm_textlogo = utils.LoadImage(fb.ComponentPath + 'samples\\images\\Lastfm2.png');
var button_left = utils.LoadImage(fb.ComponentPath + 'samples\\images\\left.png');
var button_left_hover = utils.LoadImage(fb.ComponentPath + 'samples\\images\\left_hover.png');
var button_right = utils.LoadImage(fb.ComponentPath + 'samples\\images\\right.png');
var button_right_hover = utils.LoadImage(fb.ComponentPath + 'samples\\images\\right_hover.png');
var cover_img = null;
var cover_array = [];
var g_img = null;
var bs = _scale(22);
var ww = window.Width;
var wh = window.Height;
var init_ww = window.Width;

var tfo = {
   artist : fb.TitleFormat('%artist%'),
   lfm_loved : fb.TitleFormat('$if2(%lfm_loved%,0)'),
   title : fb.TitleFormat('%title%'),
   date : fb.TitleFormat(('%date%')),
   genre : fb.TitleFormat(('%genre%')),
   album : fb.TitleFormat(('%album%')),
   albumartist : fb.TitleFormat(('%album artist%')),
   codec : fb.TitleFormat(('%codec%')),
   copyright : fb.TitleFormat(('%encoding%')),
        label : fb.TitleFormat(('%label%')),
   play_count : fb.TitleFormat(('%play_count%')),
   totalplay : fb.TitleFormat(('%totalplayed%')),
   country : fb.TitleFormat(('%countryperformer%')),
   bitrate : fb.TitleFormat(('%bitrate%')),
   tool : fb.TitleFormat(('%tool%')),
   playback_time : fb.TitleFormat('[%playback_time%]'),
   length : fb.TitleFormat('$if2(%length%,LIVE)'),
   samplerate : fb.TitleFormat(('%samplerate%')),
};

//flags
var cfg_foobarpath = window.GetProperty("foobar path:", fb.Profilepath);
var cfg_flag = window.GetProperty("flag folder:", "flags");
var flag_file = cfg_foobarpath + cfg_flag + "\\noflag.svg";
var svg_content = utils.ReadUTF8(flag_file);
var country = fb.TitleFormat("%country%").Eval();
var flags = utils.LoadSVG(cfg_foobarpath + cfg_flag + "\\" + country + ".svg");  //utils.LoadSVG(flag_file);

panel.item_focus_change();

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

function on_http_request_done(task_id, success, response_text) {
   thumbs.http_request_done(task_id, success, response_text);
}

function on_item_focus_change() {
   if (panel.selection.value == 0 && fb.IsPlaying) return;
   panel.item_focus_change();
}

function on_download_file_done(path, success, error_text) {
   text.download_file_done(path, success, error_text);
}

function on_font_changed() {
   panel.font_changed();
   window.Repaint();
}

function on_key_down(k) {
   thumbs.key_down(k);
   text.key_down(k);
}

function on_metadb_changed(handles, fromhook) {
   if (fromhook) return;
    text.metadb_changed();
}

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

function on_mouse_leave() {
   //rating.leave();
}

function on_mouse_lbtn_dblclk(x, y) {
   thumbs.lbtn_dblclk(x, y);
}

function on_mouse_lbtn_up(x, y) {
   thumbs.lbtn_up(x, y);
//   rating.lbtn_up(x, y);
   text.lbtn_up(x, y);
        if(x < ww - 30 && x > ww - 55 && y > 5 && y < 30) {
           if(ww >= init_ww - 60) {
              window.MaxWidth = ww - 50;
              window.MinWidth = ww - 50;
              ww -= 50;
              window.Repaint();
           }
        }
        if( x > ww - 26 && x < ww && y > 5 && y < 30) {
            if(ww <= init_ww + 60) {
               window.MaxWidth = ww + 50;
               window.MinWidth = ww + 50;
               ww += 50;
               window.Repaint();
            }
        }
              
}

function on_mouse_move(x, y) {
   thumbs.move(x, y);
//   rating.move(x, y);
   if ( x > 350 && x < ww && y > 50 && y < wh ) {
           text.move(x, y);
        }
         // Left Over
    window.SetCursor(x > ww - 50 && x < ww - 5 && y > 5 && y < 30 ? IDC_HAND : IDC_ARROW);
         if( x > ww - 50 && x < ww - 30 && y > 5 && y < 30){
                  button_left = utils.LoadImage(fb.ComponentPath + 'samples\\images\\left_hover.png');
                  window.Repaint();
         } else {
                  button_left = utils.LoadImage(fb.ComponentPath + 'samples\\images\\left.png');
                  window.Repaint();
         }
         // Right Over
   
         if( x > ww - 27 && x < ww - 5 && y > 5 && y < 30){
                  button_right = utils.LoadImage(fb.ComponentPath + 'samples\\images\\right_hover.png');
                  window.Repaint();
         } else {
                  button_right = utils.LoadImage(fb.ComponentPath + 'samples\\images\\right.png');
                  window.Repaint();
         }
}

function on_mouse_rbtn_up(x, y) {
        if ( x > 40 && x < 320 && y > 60 && y < 340 ) {
      return panel.rbtn_up(x, y, thumbs);
        }
   if ( x > 40 && x < 250 && y > 580 && y < 620 ) {
           return panel.rbtn_up(x, y, rating); 
   }
   if ( x > 350 && x < ww && y > 50 && y < wh ) {
      return panel.rbtn_up(x, y, text);
        }
      
}

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

function on_paint(gr) {
   
   panel.paint(gr);
   gr.FillRectangle( 0, 0, panel.w, panel.h, RGB(60, 60, 60));
        country = fb.TitleFormat("%country%").Eval();
        flags = utils.LoadSVG(cfg_foobarpath + cfg_flag + "\\" + country + ".svg");  //utils.LoadSVG(flag_file);
   var metadb = fb.GetFocusItem();
        // getColor(gr);
   for (var i = 0; i < cover_array.length; i++) {
      var cover_colour = cover_array[5];
   }
        if (metadb) {
      g_img = metadb.GetAlbumArt();
      g_art = metadb.GetAlbumArt();
   }

   if (fb.IsPlaying) {
      panel.colours.text = RGB(255, 255, 255);
       panel.paint(gr);
      gr.FillRectangle( 0, 0, panel.w, panel.h, RGB(30, 30, 30));
      if (g_img) {
            g_img.StackBlur(250);
         _drawImage(gr, g_img, 0, 0, panel.w , panel.h , image.crop_top, 0.5);
      }
           var small_font = CreateFontString('Segoe UI', 10);
      var normal_font = CreateFontString('Segoe UI', 12);
      var big_font = CreateFontString('Segoe UI', 20);
      var big = CreateFontString('fontawesome ', 13, true);
      var bigtitle = CreateFontString('fontawesome ', 18, true);
      var bige = CreateFontString('fontawesome ', 11, true);
      var sma = CreateFontString('fontawesome ', 8 );
      var smal = CreateFontString('fontawesome ', 10 );
      gr.DrawRectangle(40, 60, 280, 280, 1, RGB(255, 255, 255));
       gr.WriteText(tfo.title.Eval(), big, RGB( 255, 255, 255), 40, 300, 260, 125, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      gr.WriteText(tfo.album.Eval(), bige, RGB( 41, 140, 245), 40, 325, 240, 125, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      gr.WriteText('Conductor : ' + tfo.albumartist.Eval(), bige, RGB( 255, 255, 255), 40, 380, 240, 125, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      gr.WriteText('Played ' + tfo.play_count.Eval() + ' times', smal, RGB( 255,255, 255), 40, 400, 240, 125, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      gr.WriteText('Released : ' + tfo.date.Eval(), sma, RGB( 255,255, 255), 40, 420, 240, 125, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      gr.WriteText(tfo.codec.Eval() + ' | ' + tfo.samplerate.Eval() + ' Hz', sma, RGB( 255,255, 255), 40, 440, 240, 125, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      gr.WriteText('BITRATE : ' + tfo.bitrate.Eval() + ' Kpbs', sma, RGB( 255,255, 255), 40, 460, 240, 125, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      gr.WriteText(tfo.artist.Eval(), bigtitle, RGB( 41, 140, 245), 478, 7, 800, 125, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      gr.WriteText('Last.fm',small_font, RGB(255, 255, 255), 478, 2, 290, 200, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      //gr.WriteText('Audioscrobbler',small_font, RGB(255, 255, 255),window.Width - 106, -84, 290, 200, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
      gr.WriteText(tfo.genre.Eval(), small_font, RGB( 255,255, 255), 478, 2, 290, 235, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
   //   rating.paint(gr);
                text.paint(gr);
           thumbs.paint(gr);
                // Button left right
                gr.DrawImage(button_left, ww - 55, 5, 27, 25, 0, 0, 27, 25);
                gr.DrawImage(button_right, ww - 30, 5, 27, 25, 0, 0, 27, 25);
                //flags
                if (flags) {
                 flags = utils.LoadSVG(cfg_foobarpath + cfg_flag + "\\" + country + ".svg");
                 gr.DrawImage(flags, svg_flag_x, svg_flag_y, 50, 26, 0, 0, 640, 480);
                }
     }
   
    
}

function on_playback_dynamic_info_track() {
   panel.item_focus_change();
        //flags
        country = fb.TitleFormat("%countryperformer%").Eval();
   flags = utils.LoadSVG(cfg_foobarpath + cfg_flag + "\\" + country + ".svg");
       
}

function on_playback_new_track() {
   panel.item_focus_change();
   thumbs.playback_new_track();
   //flags
        country = fb.TitleFormat("%countryperformer%").Eval();
   flags = utils.LoadSVG(cfg_foobarpath + cfg_flag + "\\" + country + ".svg");
       
}

function on_playback_stop(reason) {
   if (reason != 2) {
      panel.item_focus_change();
   }
}

function on_playback_time(time) {
   thumbs.playback_time();
}

function on_playlist_switch() {
   on_item_focus_change();
}

function update_album_art(metadb) {
   _dispose(g_img);
   g_img = null;
   if (metadb) {
      g_img = metadb.GetAlbumArt();
   }
   window.Repaint();
}

function on_item_focus_change() {
   //focus
   handle = fb.GetFocusItem();
   //cover colour
   if (cover_img) {
      cover_img.Dispose();
      cover_img = null;
   }
   cover_array = [];
   var metadb = fb.GetFocusItem();
   if (metadb) {
      cover_img = metadb.GetAlbumArt(); // omitting the type defaults to front

      if (cover_img) {
         cover_array = cover_img.GetColourScheme(10).toArray();
      }
   }
   window.Repaint();
}

function on_size() {
   panel.size();
   thumbs.size();
   text.w = panel.w - (LM * 70);
   text.h = panel.h - (TM * 6);
   text.size();
   //flag
   svg_flag_x = 40
   svg_flag_y = 540
}
Title: Re: JScript Panel
Post by: emaulana on 2024-01-03 15:30:06
Could you add Custom Path option for Allmusic Review Sample? I have store my cache files for album review in eksternal HDD. Thanks in advance for your hardwork, this Jscript component makes Foobar2000 theme more friendly.
Title: Re: JScript Panel
Post by: grimes on 2024-01-06 13:00:53
Hi Marc, happy new year.
Problem:
Quote
JScript Panel 3.3.27 (Rating by marc2003)
Laufzeitfehler in JavaScript
Die Eigenschaft "mode" eines undefinierten oder Nullverweises kann nicht abgerufen werden.
File: C:\Users\juerg\AppData\Roaming\foobar2000-v2\user-components-x64\foo_jscript_panel3\samples\js\rating.js
Line: 7, Col: 3
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-06 20:39:44
Oops, extract these files into component folder,
Title: Re: JScript Panel
Post by: grimes on 2024-01-08 14:24:34
I don't understand, what [Shift] File |  JScript Panel 3 |  1-10 does. The description is "Invoke on_main_menu (1)".
Title: Re: JScript Panel
Post by: zeremy on 2024-01-08 14:40:20
I don't understand, what [Shift] File |  JScript Panel 3 |  1-10 does. The description is "Invoke on_main_menu (1)".

https://jscript-panel.github.io/docs/callbacks/#on_main_menuindex
Title: Re: JScript Panel
Post by: grimes on 2024-01-08 15:06:30
Not quite sure how it works. Is there a build-in sample in JScript panel 3 for that function?
Title: Re: JScript Panel
Post by: zeremy on 2024-01-08 16:13:10
Not quite sure how it works. Is there a build-in sample in JScript panel 3 for that function?
There is a sample in the link to try
Replace
 do_something();
with a valid function
e. g
utils.ShowPopupMessage("test") ;


Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-10 09:22:48
3.3.28

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

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

Sample fixes only.

Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-12 09:54:19
3.3.29

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

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

Thumbs now has a multi-line edit box in Custom folder mode making it easier to set multiple folders.
Component changes are listed on the main changelog.
Title: Re: JScript Panel
Post by: lewyturn on 2024-01-12 15:00:05
How to display the slider at the beginning of the progress bar?
Like this:
X

X

Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-13 09:49:15
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);
}
Title: Re: JScript Panel
Post by: grimes on 2024-01-13 15:42:11
Flag enhancement: My %county%-tag is Sovietunion for Dmitry Shostakovich, but the flag isn't displayed in your scripts.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-13 16:19:19
You can write something like $country_flag($replace(%country%,Sovietunion,ru))
Title: Re: JScript Panel
Post by: Jul2323 on 2024-01-13 16:34:58
Hi marc , can i create a radio button in jscript panel 3 and how ? thanks
Title: Re: JScript Panel
Post by: lewyturn on 2024-01-14 11:44:40
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?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-15 10:08:53
You've already modified it to display 0:00 for the playback time/length. The code goes there.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-15 10:15:06
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
Title: Re: JScript Panel
Post by: Jul2323 on 2024-01-15 11:54:56
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 ?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-15 14:21:11
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';

Title: Re: JScript Panel
Post by: Jul2323 on 2024-01-15 22:05:47
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 👍😊👍😊
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-16 09:28:24
This is a temporary link to a new beta. Under the hood changes only, no new features or changes to samples.

edit: link removed - it's borked on non standard DPI settings.  :))
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-16 09:47:36
@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();
}
Title: Re: JScript Panel
Post by: grimes on 2024-01-16 10:13:35
foo_jscript_panel3-3.3.30-Beta.1: I have a problem with font sizes and cut pictures. Windows scaling: 125%
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-16 10:17:13
Confirmed it's borked on non standard DPI settings. Link removed and thanks for reporting.

I have more work to do.  :D
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-16 13:19:58
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.
Title: Blur effect
Post by: Jacob91 on 2024-01-16 16:10:19
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
Title: Re: JScript Panel
Post by: Gabriel Schwartz on 2024-01-16 21:16:58
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.
Title: Re: JScript Panel
Post by: Jul2323 on 2024-01-16 22:15:36
Real thank you Marc2k3 for your investment and your time ...  :D  :D  :D  :D  :D  :D 
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-17 13:46:00
@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.

Title: Re: JScript Panel
Post by: Gabriel Schwartz on 2024-01-17 15:15:48
@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.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-18 09:14:12
The site for EsPlaylist is still up...

http://foo2k.chottu.net/
Title: Re: JScript Panel
Post by: Defender on 2024-01-18 20:57:06
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?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-19 10:10:40
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.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-19 10:23:43
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.




Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-20 09:09:34
3.3.30 final, beta links above are now dead

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

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

Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-20 11:06:33
3.3.31 fixes some silly Repaint/RepaintRect bugs introduced in 3.3.30.

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: MaFred on 2024-01-22 17:07:36
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
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-22 17:51:09
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?
Title: Re: JScript Panel
Post by: MaFred on 2024-01-22 21:50:52
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
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-22 22:23:15
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.

Title: Re: JScript Panel
Post by: ApacheReal on 2024-01-23 05:27:59
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
(https://i.postimg.cc/7CT65RVH/Screenshot-2024-01-23-062218.png) (https://postimg.cc/7CT65RVH)

3-3.3.31
(https://i.postimg.cc/MnLHKw13/Screenshot-2024-01-23-062255.png) (https://postimg.cc/MnLHKw13)


Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-23 07:17:41
I have no idea what you mean. :/
Title: Re: JScript Panel
Post by: MaFred on 2024-01-23 14:20:46
Quote from: marc2k3 link=msg=1038238 date=1705962195 https://raw.githubusercontent.com/jscript-panel/component/main/samples/smooth/jssp.js [/quote
/>

Danke/Thank you
Title: Re: JScript Panel
Post by: ApacheReal on 2024-01-23 15:50:05
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
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-23 17:04:39
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.


Title: Re: JScript Panel
Post by: Defender on 2024-01-23 21:54:53
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
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-23 22:45:59
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
Title: Re: JScript Panel
Post by: Defender on 2024-01-23 22:52:23
This is wrong...

Thx. I'll give it another go.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-24 07:32:16
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/
Title: Re: JScript Panel
Post by: ApacheReal on 2024-01-24 11:06:06
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.

Title: Re: JScript Panel
Post by: Defender on 2024-01-24 12:43:18
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();
}
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-24 12:50:41
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.
Title: Re: JScript Panel
Post by: Sickid on 2024-01-24 15:14:14
Since version 3.3.30, all my button animations have failed. Is there any change? The document did not mention it.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-24 15:22:30
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.
Title: Re: JScript Panel
Post by: Defender on 2024-01-24 15:31:37
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!
Title: Re: JScript Panel
Post by: Sickid on 2024-01-24 15:46:04
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());}
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-24 16:23:28
Font link please. I can find Material Icons and Material Design Icons Desktop but not the one you mention. :/
Title: Re: JScript Panel
Post by: Sickid on 2024-01-25 18:26:36
https://pictogrammers.com/library/mdi/
I downloaded it a few years ago. Now I can only find its official website, but I can't find the download link.



Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-25 19:39:51
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.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-25 20:19:36
3.3.33 fixes the RepaintRect bug detailed above.

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: Defender on 2024-01-26 05:37:42
3.3.33 fixes the RepaintRect bug detailed above.

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

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

It also fixes buttons that stay in hover mode if you go over them quickly.
Nice!
Title: Re: JScript Panel
Post by: ApacheReal on 2024-01-27 06:19:36
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

Title: Re: JScript Panel
Post by: michi777 on 2024-01-27 13:38:11
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
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-27 13:51:13
There is a global limit on images loaded from disk which may prevent the script from displaying all images in a folder (or combination of multple folders). But it works on disk space taken, not image count. Without this limit, the component can gobble up all the memory it can and cause fb2k to crash. I have no idea how to limit memory usage taken in C++ so I get my script to stop loading images when a certain limit is reached.

But the thumbnail mode should have zero affect on that?? It's currently limited to 64MB worth of files which may equate to something like 1GB when loaded in memory. If you use the 64bit version and want to increase this, you can hold Shift+Winkey, right click the panel and select Edit properties. The value of 2K3.THUMBS.SIZE.LIMIT can be increased. It's in bytes. If you wanted to try 128MB, you could enter 134217728.

edit: changelog entry: https://jscript-panel.github.io/docs/changes/#321
Title: Re: JScript Panel
Post by: michi777 on 2024-01-27 16:12:26
Thank you.

I increased the value of THUMBS.SIZE.LIMIT and now more images are displayed.
However, in Grid, all of them are displayed, but in Left,Right,Top,Bottom, if there are too many, they are not displayed at all.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-27 16:26:50
Oh right, I assume it's the windows API for creating images that is crapping out. There's nothing I can do about it.

If this C++ fails, you get null returned.

Code: [Select]
IJSImage* ImageHelpers::create(uint32_t width, uint32_t height)
{
wil::com_ptr_t<IWICBitmap> bitmap;
if FAILED(g_imaging_factory->CreateBitmap(width, height, GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &bitmap)) return nullptr;
return new ComObject<JSImage>(bitmap);
}

edit: this is the failure message...

Code: [Select]
Arithmetic result exceeded 32 bits.   (0x80070216)

I can probably improve behaviour by making it reduce the number of images used automatically but again this means all content will not be displayed. But it's better to have a valid thumbnail strip than nothing.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-27 19:24:00
3.3.34

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

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

Thumbs now defaults to resizing the main image to 1024px. It will be left untouched if already smaller. Options exist on the right click menu if you want to restore the previous behaviour of leaving all images untouched.

utils.LoadImage now takes an optional max_size argument which does the above for other people in their scripts. This is opt in. Original images are returned as-is by default. While resizing has always been an option on returned images, this is just more convenient.

Also, plman.GetPlaybackOrders has been added.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-30 07:33:49
3.3.35

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

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

This adds utils.RemoveFolderRecursive and $jsp3_since - a title formatting function for showing the difference between a given date string and now. Can be used playback statistics, last.fm last played dates etc.

edit: attached is an example using $jsp3_since(%lfm_last_played%) from Last.fm Playcount Sync



Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-30 13:15:41
3.3.36 is just a minor improvement to the way strings are formatted in $jsp3_since added in 3.3.35.

It now shows years/months and excludes weeks/days for anything over a year.

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-30 14:29:45
edit: pulled both recent releases. I'm utterly stupid. New fix coming soon. /sigh

edit2: here we go again...

3.3.37

https://github.com/jscript-panel/release/releases
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-31 04:02:44
3.3.38

No component changes except the version bump. This adds date to smooth browser in album mode. There's no room in the "overlayed text" style but is available in all others.

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

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

Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-31 14:26:38
3.3.39 temporarily reverts recent rendering changes.

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

But this is the last version with:
Edge styles for CUI panels
window.CreateThemeManager / IThemeManager interface
CUI toolbars
Title: Re: JScript Panel
Post by: ApacheReal on 2024-01-31 14:36:14
3.3.39 temporarily reverts recent rendering changes.

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

But this is the last version with:
Edge styles for CUI panels
window.CreateThemeManager / IThemeManager interface
CUI toolbars

I don't have any problems with this one.

Should be OK
Title: Re: JScript Panel
Post by: marc2k3 on 2024-01-31 23:51:04
But this is the last version with:
CUI toolbars

Just going to correct myself here. CUI toolbars are staying.

Edge Style/Theme Manager are gone. :P
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-01 01:17:35
If @eurekagliese or @ApacheReal are feeling brave, here's another attempt at fixing the tab stack switching issue from versions 3.3.30 to 3.3.38 without reverting to my old code.

Note that it will cause errors on any script using window.CreateThemeManager, that is now gone.

Included Smooth samples / JS Playlist that previously made use of it have been updated and should just work.

https://github.com/jscript-panel/jscript-panel.github.io/raw/test/docs/files/foo_jscript_panel3.4.0.fb2k-component

edit: this link is not guaranteed to live for very long

Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-01 03:52:19
The issue appears again on the latest version.
Title: Re: JScript Panel
Post by: ApacheReal on 2024-02-01 05:00:32
The issue appears again on the latest version.

The custom track clearly crashes for me, and therefore I cannot test the 3.4.0 pack
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-01 08:44:39
Well I did say any script using window.CreateThemeManager would throw an error.

This build has no attempted fixes. It just spams the console so cannot be used with any script using a timer as results will go by too quickly. That certainly rules out the customt track bar or any other seekbar/spinning album art.

Ideally, it should be clean layout with a tab stack and 2 JSP panels. Say artwork in one and properties in the other.

https://github.com/jscript-panel/jscript-panel.github.io/raw/test2/docs/files/foo_jscript_panel3.fb2k-component

I'd like to see the console results.

I understand if people don't have the time to set something like that up. Thanks for your time so far.
Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-01 12:54:34
@marc2k3 no issue so far.
https://pastebin.com/ut5dZALN
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-01 13:07:48
"no issue" means it's now working? I did push a tiny change after my original post but didn't mention it because I was too late to edit.

As for the logs. I've never seen this in my own testing...

Code: [Select]
RepaintRect() 0.0000000 0.0000000 0.0000000 0.0000000

RepaintRect is only ever triggered by scripts, never by the component itself and since you appear to be using mine, I have no idea how that is happening. That's something else for to me look at.
Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-01 13:19:01
Yes, everything is working properly now.
Regarding the logs, it could be because there was a jsp script tab under tabs.
Here is a preview. (Fortunately, we can utilise scroll to switch tabs).
Spoiler (click to show/hide)
-------
EDIT:
Apparently the problem persists when a song is playing.
Spoiler (click to show/hide)
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-01 13:37:08
Using the same link, I've added suppression for attempting to paint with invalid width/height values. That's in the component. No one has to update scripts.

https://github.com/jscript-panel/jscript-panel.github.io/raw/test2/docs/files/foo_jscript_panel3.fb2k-component

Meanwhile, it looks like I might need to check out tabs in tabs??

Thanks again for testing.

edit: tabs in tabs is giving me empty RepaintRect even with my suppression in place. That's definitely a bug in my code somewhere.
Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-01 14:07:06
The problem remains when on playback.
Spoiler (click to show/hide)

There's also probably another side quest on that JS Playlist error message.
>Unable to get property 'GetGraphics' of undefined or null reference

Btw, the script is default, only made few minor changes on the title formatting using its panel settings.
Title: Re: JScript Panel
Post by: ApacheReal on 2024-02-01 14:10:22
@eurekagliese

in custom tracks

I have made these changes are they sufficient or do I need to do something else:

Spoiler (click to show/hide)

Title: Re: JScript Panel
Post by: ApacheReal on 2024-02-01 14:15:14
@marc2k3

in JS 3.4.0-dev

I did some tests, the problem returns.
Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-01 14:16:13
@eurekagliese

in custom tracks
I have made these changes are they sufficient or do I need to do something else:
yeah, that's ok.
However during this testing period, it would better to not use it and just use the default one so we can help isolate the issue.
Title: Re: JScript Panel
Post by: ApacheReal on 2024-02-01 14:21:54
@eurekagliese

in custom tracks
I have made these changes are they sufficient or do I need to do something else:
yeah, that's ok.
However during this testing period, it would better to not use it and just use the default one so we can help isolate the issue.

I see continuous activity in the console:

(https://i.postimg.cc/S2w5xspn/Screenshot-2024-02-01-151911.png) (https://postimg.cc/S2w5xspn)
Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-01 14:29:31
I think that on purpose verbose log from marc.
Anyway, my script is super noob, so perhaps it'd be better not use with these dev builds.
Let's just give Marc all the time he needs to figure out the problem. We, or rather I, are not in a rush.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-01 14:34:49
To help with this specific tab issue, I did say not to have any seekbar of any kind. With a timer running around 6 times a second, it spams the console too much to catch any messages of interest.

Anyway, I still can't reproduce panels ending up blank in tabs but I've encountered a different kind of bug which probably has the same root cause.

Here's another attempted fix.

https://github.com/jscript-panel/jscript-panel.github.io/raw/test2/docs/files/foo_jscript_panel3.fb2k-component

edit: if this still happens...

Code: [Select]
RepaintRect() 0.0000000 0.0000000 0.0000000 0.0000000

...it is not fixed... :P

Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-01 14:58:28
The issue persist on my default fb2k install.
https://pastebin.com/UHdjdi3v

However, I couldn't reproduce it on portable install (with the script and layout)
https://pastebin.com/4C6GfEFn
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-01 16:28:29
I consider this version to be "fixed". It has all console spamming removed and should work like 3.3.39. If it doesn't I might just cry.

https://github.com/jscript-panel/jscript-panel.github.io/raw/test2/docs/files/foo_jscript_panel3.fb2k-component

With this snippet I could find and fix a bug slightly different to what was reported...

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%helpers.txt"
// ==/PREPROCESSOR==

var colour = RGBA(0, 0, 0, 0);

function on_paint(gr) {
gr.FillRectangle(0, 0, window.Width, window.Height, colour);
}

window.SetInterval(function () {
colour = RGB(Math.random() * 255, Math.random() * 255, Math.random() * 255);
window.RepaintRect(Math.random() * (window.Width - 50), Math.random() * (window.Height - 50), 50, 50);
}, 250);

Left alone, the timer repaints little 50x50 squares but if resized or tabs are switched, it should repaint in full. My bug prevented that as can been in bug.gif

Basically, my RepaintRect was interfering with Windows who was shouting at me to repaint the whole thing. :P

fixed.gif shows the whole panel being painted in the new colour on tab switching.
Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-02 10:07:09
https://github.com/jscript-panel/jscript-panel.github.io/raw/test2/docs/files/foo_jscript_panel3.fb2k-component

404.
Sorry, I was unable to test the latest version.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-02 10:33:05
Yeah, I pulled it. I mentioned on the previous page that the link was temporary.

I'm not looking for validation now. I was finally able to confirm by myself full repaints were not happening on tab switches. Now they are.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-03 00:22:11
I'm on a roll with borked releases recently. In 3.3.35, I accidentally broke windows 7 support. The component would fail to load but no one has reported it. Therefore I am dropping support in future but I have released 3.3.40 as the last working version.

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

utils.RemoveFolderRecursive is taking a break for this release and does not exist It was the cause of the breakage but will be back.

edit: I would strongly recommend anyone using 3.3.30-3.3.38 to update as those had various repaint glitches. Anyone using 3.3.39 can stick if they like. They must be running something newer than win7 already. :P
Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-03 02:16:13
Thanks for the update!
The latest version is working fine.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-03 10:00:54
With the removal of IThemeManager in the next release, people will need to remove the following from their scripts..

window.CreateThemeManager and anything that uses the return value
window.IsThemed (as this is a property, using it won't cause an error but will be undefined as opposed to boolean)

An example of how the included samples were updated is here...

https://github.com/jscript-panel/component/commit/3a44c34529645a46184e6cac60d15d0017be6a77
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-04 00:27:03
Have a beta version which is quite likely to set your goldfish on fire. You have been warned.

Or maybe I'm being a little melodramatic. Windows 8.1 is the new minimum requirement. :P

Other breaking changes are listed here...

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

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

The stable version for windows 7 will remain available even when this goes final. It will just be unsupported like JSP 2.8.8 which I still provide.

Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-04 22:09:44
3.4.0-Beta.2

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

No real component changes since Beta.1 but I've added a FillGradientRectangle helper in.... helpers.txt

This makes it easier to create 2 colour gradients that go vertical or horizontal like the component method that was removed.

Code: [Select]
// removed component method
gr.FillGradientRectangle(x, y, w, h, direction, colour1, colour2);

// new JS method
FillGradientRectangle(gr, x, y, w, h, direction, colour1, colour2);

I've also attached a fixed version of Custom Track 3.1 by eurekagliese

etip's playlist organiser doesn't require changes and should work in these new betas.
Title: Re: JScript Panel
Post by: ApacheReal on 2024-02-05 06:37:41
I stopped at 3.3.40, with subsequent betas the problem discussed in previous posts returns.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-05 13:57:36
Since you never answered last time I asked, is the problem only happening in tabs when switching or in panels that are in view all the time?
Title: Re: JScript Panel
Post by: ApacheReal on 2024-02-05 14:08:48
When switching between tabs in the panels that loaded the sample album art.
Title: Re: JScript Panel
Post by: MusicHound on 2024-02-05 16:07:06
JScript Panel 3.4.0-Beta.1 (Custom Track 3.1 by eurekagliese)
JavaScript runtime error
Unable to get property 'colour' of undefined or null reference
File: <main>
Line: 1916, Col: 4


Get this whenever an album with a single color comes up ... hopefully there is a workaround
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-05 20:51:39
I wrote for a function for extracting album art colours and I use them across the included JS Playlist and Smooth scripts and they can all handle an album art image being a single colour. I don't have any genuine single colour album art but knocked up a jpg just for the screenshot I've attached.

I'm not responsible for others who take it, modify it and break it in the process. :P
Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-08 06:26:20
Please pardon my delay in responding. I'd been feeling a little under the weather for the past several days.
Anyway, here is an update to the custom track script. It took some time for a beginner like me to find out the answer to the solid image album art issue; apparently, it was simply altering the code placement.
The recent update also includes the most recent gradient on FillRectangle new method, as well as a new looks on seekbar, volume, album art borders, and play circle gradients similar to those seen in Windows' default media player; this one requires JSP version 3.4.0 or higher.
The rest of it does not require the most recent version, although it is recommended to update to the most recent JScript Panel version.
Spoiler (click to show/hide)
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-08 07:12:09
You could have taken FillGradientRectangle from helpers.txt and modified it for earlier versions. I added this for 3.4.0...

Code: [Select]
// Simplified 2 colour helper
function FillGradientRectangle(gr, x, y, w, h, direction, colour1, colour2) {
var stops = [[0, colour1], [1, colour2]];
var brush = {Start : [0, 0], Stops: stops};
if (direction == 0) brush.End = [0, h];
else brush.End = [w, 0];
gr.FillRectangle(x, y, w, h, JSON.stringify(brush));
}

To make it work with earlier versions, put this in your script...

Code: [Select]
function FillGradientRectangle(gr, x, y, w, h, direction, colour1, colour2) {
if (utils.Version < 30400) {
gr.FillGradientRectangle(x, y, w, h, direction, colour1, colour2);
return;
}

var stops = [[0, colour1], [1, colour2]];
var brush = {Start : [0, 0], Stops: stops};
if (direction == 0) brush.End = [0, h];
else brush.End = [w, 0];
gr.FillRectangle(x, y, w, h, JSON.stringify(brush));
}

It's OK to declare the same function name more than once - the one in helpers.txt will be ignored. The last one to get parsed is used.

Then you can use FillGradientRectangle anywhere without making your own "brush".

At some point before 3.4.0 final, I will add some more gradient documentation.
Title: Re: JScript Panel
Post by: eurekagliese on 2024-02-08 08:11:19
Ah I see, thanks for the tips!
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-08 15:29:27
I've stuck up a page for gradients. I do waffle on, I can't help it. :/

https://jscript-panel.github.io/docs/guides/gradients/

Also, callbacks have been separated in to categories: windows, foobar2000, component

https://jscript-panel.github.io/docs/callbacks/
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-08 21:14:52
3.4.0 final. No changes since Beta.2

Requires windows 8.1+ for those encountering this version for the first time. Has some breaking changes as well....

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

The last version (3.3.40) for Windows 7/8 will remain available here but will be unsupported unless anyone reports a critical bug.

https://github.com/jscript-panel/release/releases/tag/legacy
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-10 04:42:28
3.4.1

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

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

Nothing new. I marked the want_stub arg for GetAlbumArtAsync as deprecated in 3.3.10 but forgot to remove it in 3.4.0. It's now gone. :P

fb.GetAlbumArtStub can be used instead.
Title: Re: JScript Panel
Post by: MusicHound on 2024-02-10 05:44:18
Thanks to both mark2k3 and eurekagliese single color covers work great now.
Title: Re: JScript Panel
Post by: Major_Tom on 2024-02-10 11:55:17
Thanks Marc for all the previous updates and your support.

I got a little strange behaviour of the configuration/editor window with 3.4.1. Whenever I try to search with ctrl+f "ASC" is inserted into the code. This also happens with ctrl+g ("BEL" is inserted) and others. Going back to 3.4.0 resolves this issue.

Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-10 12:09:13
Oh flip... thanks for spotting that.  :o

3.4.2 fixes that: https://github.com/jscript-panel/release/releases/tag/latest
Title: Re: JScript Panel
Post by: Major_Tom on 2024-02-10 12:22:48
Thanks for the quick fix  :)
Title: Re: JScript Panel
Post by: michi777 on 2024-02-12 14:14:27
JS Playlist, when single clicked in the standard Filter,
The standard Artwork view is not displayed. If you double-click, it will be displayed.

If you single click in the JS Playlist panel, the Artwork view selected in the standard Filter is displayed.
-----------------------------
  ↓
Single click on 'A' in the standard Filter → The standard Artwork view is not displayed.
(Double-click 'A' in the standard Filter → the standard Artwork view shows 'A'.)

Single click on 'A' in the standard Filter → standard Artwork view shows nothing.
Single click on 'B' in the JS Playlist panel → standard Artwork view shows 'A'.

foobar2000 v2.12
JScript Panel 3 v3.4.2
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-12 15:10:40
Any interaction between what you're calling a "standard filter (??)" and any artwork panel is nothing to do with ANY playlist.

A playlist viewer only updates other panels like artwork or selection properties when it's clicked.

I've attached a gif showing how it does exactly the same thing as the DUI playlist view. If you want to point out its shortcomings, please do so in relation to other playlist viewers.
Title: Re: JScript Panel
Post by: michi777 on 2024-02-14 15:44:54
Any interaction between what you're calling a "standard filter (??)" and any artwork panel is nothing to do with ANY playlist.

A playlist viewer only updates other panels like artwork or selection properties when it's clicked.

I've attached a gif showing how it does exactly the same thing as the DUI playlist view. If you want to point out its shortcomings, please do so in relation to other playlist viewers.

Without the JS Playlist, both the standard Filter and Artwork View work fine.
Introducing the JS Playlist will affect the standard Filter and single clicks will work incorrectly.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-14 18:42:29
Again with the "standard filter" of which I have no clue. That's why I added ?? in my post. If that's CUI filters then say so. That's very much not "standard".

edit: some testing has revealed some naughty behaviour in this component. It will probably need breaking changes for those who write their own playlist views/library viewers. I'll try and keep the changes as minimal as I can.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-14 20:33:11
More breaking changes in a minor release ahoy.  ;D

3.4.3 fixes some selection holder bugs where once set, it wasn't released for other selection viewers to take over. This has no affect on sample users. Just update the component and everything should be fine.

Script writers maintaining playlist/library viewer scripts will need to make changes like these that were made to JSPlaylist/smooth samples etc.

https://github.com/jscript-panel/component/commit/f4d4175d39f33da15450db8080bfd77118fa86a6

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

https://jscript-panel.github.io/docs/changes/
Title: Re: JScript Panel
Post by: michi777 on 2024-02-17 13:33:37
Regarding the single click in JS Playlist, it worked correctly in V3.4.3.
Thank you very much.

And, as a minor detail, the JS Playlist
group header line, the total time is followed by a '.' (dot) in the group header line.
The total time of the playlist is not followed by a '.' (dot) is not displayed after the total time in the playlist.

This is not a particular problem, but I noticed it and am reporting it.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-17 14:07:22
That would probably bother me if I had it enabled. I always have it turned off so hadn't noticed. Fix will be in the next release.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-21 06:29:58
3.4.4 is a pretty minor release.

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

A few sample fixes and $jsp3_since has been updated with proper today/yesterday handling. It never returns 0d any more so any previous title formatting gymnastics are no longer necessary.
Title: Re: JScript Panel
Post by: michi777 on 2024-02-21 14:42:28
Oh right, I assume it's the windows API for creating images that is crapping out. There's nothing I can do about it.

If this C++ fails, you get null returned.

Code: [Select]
IJSImage* ImageHelpers::create(uint32_t width, uint32_t height)
{
wil::com_ptr_t<IWICBitmap> bitmap;
if FAILED(g_imaging_factory->CreateBitmap(width, height, GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, &bitmap)) return nullptr;
return new ComObject<JSImage>(bitmap);
}

edit: this is the failure message...

Code: [Select]
Arithmetic result exceeded 32 bits.   (0x80070216)

I can probably improve behaviour by making it reduce the number of images used automatically but again this means all content will not be displayed. But it's better to have a valid thumbnail strip than nothing.

Thumbs,before,when 'thumbs.size.limit' was 67108864 (64MB), it showed up to 219 images, and when I set it to 134217728 (128MB), it showed more.

Now, even with 75px,134217728(128MB), it is down to 110 images.

Number of pictures does not change even if the folder to be displayed is changed, so it may be that the number of pictures is limited by the number of pictures rather than the size ?

JScript Panel 3 Version 3.4.4
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-21 14:49:25
Yeah, I put more restrictions in. While it's nice to have a dozen or 2 images on rotation, I think getting in to the hundreds is silly and way beyond what this was ever meant for. Edit the script yourself if you want to change it.

https://github.com/jscript-panel/component/blob/8fb1bdde45a742de574db6fc132b8686f3334559/samples/js/thumbs.js#L140-L150

Just be warned that this can exhaust all memory and cause fb2k to crash. I mean proper crashes, not script errors.
Title: Re: JScript Panel
Post by: anamorphic on 2024-02-21 16:26:20
Hey marc2k3, sorry to bug you with this one, :)

Can you please have a look over the "Menu Button" sample / code? I've been using it since around v3.3.14 and getting some strange glitches with wrong menus appearing, just updated to current v3.4.4 and same deal. For example "glitch-1" screenshot of 'File > Load playlist...' showing the 'Playback' menu.

At first I thought it was because I modified the script incorrectly - just minor stuff like changing the bright red background :D , but now reset to default sample (as the bright red indicates), and then tried on fresh install of foobar v2.1.2 and same deal.

At second I thought it was another component interfering - perhaps something like foo_flowin (https://github.com/ttsping/foo_flowin), because on the fresh install, the only component installed was JSP3, and yet one time I got a foo_flowin sub-menu appear - how can that be? At that time I had a second foobar instance running my main install with foo_flowin loaded there. Then I closed everything and nuked the DLL from orbit, yet still the same deal on the fresh install - see "glitch-2" screen showing a menu that does not even exist in foobar. (?!)

It only happens occasionally though, I probably had to click the button 15 times to get that (and then clicking outside the menu to close it). It usually is just a sub-menu appearing on what should be a single-click command.

Hopefully you have some ideas what the heck is going on here?  :-[ (I'm on Win10 v22H2 b19045.4046, by the way, and fb2k 32-bit)
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-21 17:00:22
That is very curious. I've never seen anything like it.  :o

Can I ask about the potential number of dynamic menu items you might have? I'm thinking DSP chains/playlists/etc. Is there anything slightly unusual about your setup?
Title: Re: JScript Panel
Post by: Xin-Hong on 2024-02-21 17:16:09
Hello marc,

I'm trying to add a "glass" overlay to album covers but .png with alpha channel and shadows seems not supported very well.
foobar2000 on the left, paint.net on the right:

(https://i.postimg.cc/HLgbJj3N/PNG-JScript.png)

I'm using utils.LoadImage to load the file and gr.DrawImage to draw it. Is it normal ?

JScript v3.3.37 & Windows 10
Title: Re: JScript Panel
Post by: Major_Tom on 2024-02-21 17:17:20
Can confirm this menu problem. In fact I have it for quite some time now, not only since the last updates (Win11 fbk2 32 bit).

The wrong submenus seem to come from my German Windows version.

Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-21 17:23:31
I'm trying to add a "glass" overlay to album covers but .png with alpha channel and shadows seems not supported very well.
foobar2000 on the left, paint.net on the right:

Attach the image inside a zip please.
Title: Re: JScript Panel
Post by: anamorphic on 2024-02-21 17:30:23
About 3 DSPs and 55 playlists. I suppose a bit experimental though, I moved all library navigation into 10 foo_flowin pop-ups along the top (there are actually 16 in the 'View > Flowin' menu, some not used leftover from previous fb2k v1 install - though this was a fresh install of v2, not upgraded, but I did copy over foo_flowin.dll.cfg file)

Occasionally the menu also glitches with a missing top level, like File, or View.

But like I said, I can reproduce on a fresh install and just now did so with no other foobars / programs running. I think it does glitch more often on my main install with more components and sub-menus to choose from.

Component list (foo_flowin has wrong version info, pretty sure is actually current v0.2.1) -

Spoiler (click to show/hide)

EDIT: ^ Major_Tom with the German menus. Thanks for confirming. At least now I know it was nothing I've done.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-21 17:54:57
I've knocked up a special debug build where the menu is no longer functional. The menu items will appear in the same way but clicking them will never execute any commands because I want it to be safe regardless of what the menu item says. Instead, they will log some info to the Console. I'd like that output please. Particularly if the top level name given did not match what you actually clicked.

This is 32bit only since both of you are using 32bit.
Title: Re: JScript Panel
Post by: Major_Tom on 2024-02-21 18:09:35
One example where i had the complete View-Menu behind Playback - Stop shown and I selected DSP - Equalizer:
MainMenuManager::ExecuteByID: view 37

Another one for the same constellation where I selected console:
MainMenuManager::ExecuteByID: view 44

No console logs available for German language submenus

some more:

MainMenuManager::ExecuteByID: view 11 (Oscilloscope selected from Menu behind View - Internetradio)

MainMenuManager::ExecuteByID: view 10 (View - Visualizations - Spectrum Analyzer - Equalizer)

Next try, the View menu was gone completely

MainMenuManager::ExecuteByID: playback 44 (View - Visualizations - Spectrum Analyzer - Playback - Stop)
Title: Re: JScript Panel
Post by: Xin-Hong on 2024-02-21 18:13:37
I'm trying to add a "glass" overlay to album covers but .png with alpha channel and shadows seems not supported very well.
foobar2000 on the left, paint.net on the right:

Attach the image inside a zip please.

This is the files, one background and one overlay
Title: Re: JScript Panel
Post by: anamorphic on 2024-02-21 18:23:51
foobar2000 v2.1.2 x86 [portable]
Playlist #0 loaded in 0:00.000374
JScript Panel 3.4.4 (Menu Button by marc2003): initialised in 88 ms
User Interface initialized in: 0:00.294131
FFmpeg version: 6.0
Startup time : 0:00.404086
Library initialized after 0:00.404179
MainMenuManager::ExecuteByID: file 16
MainMenuManager::ExecuteByID: edit 22
MainMenuManager::ExecuteByID: view 1

^ This was Edit > Remove duplicates > (top level sub menu) View > Always on top.

MainMenuManager::ExecuteByID: playback 16

^ View > Always on top > (Devices menu) Null output - (I think)

MainMenuManager::ExecuteByID: view 6

^ View > Activate or hide > (Vis menu) Oscilloscope

MainMenuManager::ExecuteByID: playback 7

^ File > Add folder > (Order menu) Random

MainMenuManager::ExecuteByID: playback 37

^ View > Always on top > (Order menu) Random

MainMenuManager::ExecuteByID: playback 28

^ Edit > Select all > (top level) Playback > Pause

They all seem to match the last menu clicked rather than first menu selected.

(I can try more thoroughly tomorrow, past my bedtime now...)
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-21 19:55:04
This is the files, one background and one overlay

I'm on windows 10 myself and it seems OK??

(https://i.imgur.com/sNSmxKw.png)
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-21 20:10:49
I have another build for debugging this menu issue.

This restores the menu function to what is was before. For some more Console output I need to see, paste this in any panel and click OK.

Code: [Select]
fb.RunMainMenuCommand("plop"); //plop can be anything that doesn't exist

This gives a total count. As an example, mine goes up to 150. I'd like to see if peeps with problems have a lot more.
Title: Re: JScript Panel
Post by: Major_Tom on 2024-02-21 20:43:12
Here you are:

Spoiler (click to show/hide)

Whatever you changed, I can't reproduce the strange behaviour with this debug version - switching back to the regular version, the wrong menus are back again
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-21 21:13:36
I didn't realise that upload had my attempted fix in it. If it works, great.  :))
Title: Re: JScript Panel
Post by: Major_Tom on 2024-02-21 21:19:08
Thanks a lot  :)
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-21 21:21:30
Quick favour, could you try this one.

Title: Re: JScript Panel
Post by: Major_Tom on 2024-02-22 06:58:04
Good Morning,

the problem is back with this version but only for the Edit Menu, all other menus including submenus are working without problems. The wrong submenus in the Edit menu all come from WinRAR as you can see from the second screen shot. Ocasionally there's also Equalizer shown behind Remove dead items.

Title: Re: JScript Panel
Post by: anamorphic on 2024-02-22 07:07:08
Hi there,

Reply #1471 JSP3 gave me some 147 "plop" items on the fresh install, and ... 534 on my main install (those 16 foo_flowin sub-menus I have). The console could not even keep them all...

Spoiler (click to show/hide)

Reply #1475 JSP3 is still giving me glitched menus like 'File > Add folder > Equalizer'. Nothing on fresh install for first 10 clicks then I got 'Edit > Clear > (View > Layout sub menu) > Quick Setup' (etc). So no luck there.

(I should point out fresh is DUI, main is CUI)

Edit: Going back to #1471 JSP3 on main install... no glitches so far. :)  And 15 minutes of clicking later everything is fine. I'm curious what was causing the glitches?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-22 07:24:50
If that works it's just bonkers. My original code allows 999 items for File, 999 for Edit etc. That mod allows 9999. But you guys are showing a few hundred at most combined.

I can post a fixed version with the 9999 limit but I'm so confused by it all, I started a thread in dev section about it...

https://hydrogenaud.io/index.php/topic,125527.msg1039870/topicseen.html#new

edit: corrected numbers
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-22 07:56:18
3.4.5 contains the workaround. I'm not calling it a fix because that would imply I know what I'm doing.  :))

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

@anamorphic and @Major_Tom , thanks for testing.
Title: Re: JScript Panel
Post by: anamorphic on 2024-02-22 12:30:57
The workaround is working, thank you. :)

Hope you get some rest, looks like you've been posting around the clock...
Title: Re: JScript Panel
Post by: esa372 on 2024-02-22 20:46:58
3.4.5 contains the workaround.
Thank you for addressing this - I was having the same issue.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-22 21:18:22
Competition time. Who has had this bug the longest and chose not to report it?  ;D

This menu is part of my main layout. Maybe I don't use it everyday but it does get used and if I encountered this bug myself, I'd obviously be all over it.

For bugs I don't encounter, I do rely on others to report them. If I'm being a douche bag to people reporting bugs, it's always because of the appalling quality of the reporting. I guess I should try harder to be tolerant but it's really hard work at times....
Title: Re: JScript Panel
Post by: Defender on 2024-02-23 21:34:27
I have a small refresh question/issue about JS3.

In my CUI/PSS (Bottom) panel I have a lot of different plugins active (foo_wave_minibar_mod, foo_quicksearch, foo_vis_vumeter, foo_uie_vis_peakmeter_spectrum and a couple of different representations of foo_uie_vis_peakmeter_spectrum).
Most of my audiocontrolbar is made of separate JS3 toolbars/panels (Menu, Stop, Play/Pause, Prev, Next, PBO, OutputDevice and VolumeBar).

I spent a lot of time optimizing refreshes in my skin to achieve minimal screen flicker. Therefore I only sent relevant PANELSHOW:0 commands from textbuttons/imagebuttons to force a screen update to panels that I know will be changed on that particular mouseclick. Works fine, but all JS3 panels in this Bottom panel are updating always while none of the other plugins do.
Same thing happens upon track change.

The JS3's seem to hide themselves (like they received a PANELSHOW:0 command) and then show themselves directly after that which results in a flicker.

Is there a way/setting to change this behavior of JS3 panels?

BTW. Only JS3 panels in their parent panel are affected. JS3 panels which have a different parent panel don't flicker.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-23 23:48:18
I'm not investigating any Panel Stack Splitter issues. It's dead to me and I have zero interest in it.

But I will give some advice from my time using it. This is from way before I started any component development and just used it like everyone else....

I never used PANELSHOW / $showpanel. I'd make sure forced layout was checked for every child panel. Never set positions from that tab, always from script.

Then I used global variables
Code: [Select]
$init_ps_global(panel_index,0)
//my button would $set_ps_global(panel_index,WHATEVER) //may be it's different from buttons, I can't remember, this is from memory, not tested, you get the idea

Then I'd hide all panels with $movepanel. If had 3....
Code: [Select]
$movepanel(0,0,0,0,0)
$movepanel(1,0,0,0,0)
$movepanel(2,0,0,0,0)

Then call $movepanel again on the one panel I wanted to show
Code: [Select]
$movepanel(%panel_index%,0,0,%_width%,%_height%)

If that doesn't work, I don't care. Replace JSP with SMP, whatever.
Title: Re: JScript Panel
Post by: Defender on 2024-02-24 01:35:01
If that doesn't work, I don't care. Replace JSP with SMP, whatever.

Thank you for taking the time to respond.

Of course I'm using the method you describe with panels.

I'm not asking to investigate PSS issues.
I'm just pointing out that JSP handles refreshes differently compared to all other plugins (in the same parent panel).
And I just asked if there was a way to change that behavior, because I don't like flickering stuff.

I guess your last remark would have sufficed.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-24 01:46:10
Of course I'm using the method you describe with panels.

You specifically said you were using PANELSHOW. I never used it because of the glitches. Meh. :/

Maybe the fact I rewrote the entire graphics subsysytem in JSP3 to use Direct2D instead of ye olde GDI from the WSH panel mod/JSP1/JSP2 days is the issue. Who knows? Who cares?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-24 02:32:59
So I took the time to check this out with this bit of PSS code.

Code: [Select]
$init_ps_global(panel_index,0);

$movepanel(0,0,0,0,0)
$movepanel(1,0,0,0,0)
$movepanel(2,0,0,0,0)

$movepanel(%panel_index%,0,0,%_width%,$sub(%_height%,30))

$textbutton(0,$sub(%_height%,30),100,30,PANEL 1,PANEL 1,SETGLOBAL:panel_index:0;REFRESH,fontcolor:0-0-0,)
$textbutton(100,$sub(%_height%,30),100,30,PANEL 2,PANEL 2,SETGLOBAL:panel_index:1;REFRESH,fontcolor:0-0-0,)
$textbutton(200,$sub(%_height%,30),100,30,PANEL 3,PANEL 3,SETGLOBAL:panel_index:2;REFRESH,fontcolor:0-0-0,)

It does flicker with panels added as CUI toolbars for the transparency hack. It's perfectly fine for "normal" panels. So yeah, nothing I'm doing about that.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-24 08:58:24
3.4.6

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

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

The docs site is no longer pink. After nearly 2 years, I've had enough. :P
Title: Re: JScript Panel
Post by: Defender on 2024-02-24 14:08:52
So I took the time to check this out with this bit of PSS code.
It does flicker with panels added as CUI toolbars for the transparency hack.

Thanks for testing and confirming.

It's perfectly fine for "normal" panels. So yeah, nothing I'm doing about that.

Fair enough.
Title: Re: JScript Panel
Post by: Defender on 2024-02-24 14:20:08
3.4.6

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

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

The docs site is no longer pink. After nearly 2 years, I've had enough. :P

Unfortunately all 16 JS3 buttons and panels (Smooth Playlist Manager, Properties + Other Info, Thumbs) I use lost transparency with this upgrade. And frankly speaking it does not look great at all.

I read the release notes, but I don't understand:
Transparency is now reserved exclusively for genuine Columns UI toolbars. Adding as a toolbar via the Columns UI Layout settings will have no effect and it will be a normal panel with a solid color background.

Please explain how I can restore transparency for the JS3 stuff or propagate 3.4.5 like 3.3.40 2.8.8 as a legacy release.
Title: Re: JScript Panel
Post by: francesco on 2024-02-24 16:13:14
hi
i don't know if it's the right place ,but i have asked about how to customize a theme based on JScript Panel
the theme is pretty famous and is Tedgo 's DarkOne4Mod v2.0 2019
the last version let a user to add some buttons and use JScript panel. , to assign to the buttons some functions , they should be 20 buttons
for example i would like to have a button to enable/disable replaygain and switch between album/track , or  dps , radio ,dsp presets
is here the right place?
if not  ,my apologies
thanks
Title: Re: JScript Panel
Post by: Defender on 2024-02-25 16:33:12
I kind of like the idea to add a button to control replaygain which I almost implemented.
All done but not finalized, because of a two small issues:

1) Is there a plman.ReplayGain (like plman.PlaybackOrder) variable available to reflect current state of replaygain?
2) Is a function on_replaygain_changed(new_index) available (like on_playback_order_changed(new_index))?

If not available, can those please be added?
Title: Re: JScript Panel
Post by: francesco on 2024-02-25 16:46:33
I kind of like the idea to add a button to control replaygain which I almost implemented.
All done but not finalized, because of a two small issues:

1) Is there a plman.ReplayGain (like plman.PlaybackOrder) variable available to reflect current state of replaygain?
2) Is a function on_replaygain_changed(new_index) available (like on_playback_order_changed(new_index))?

If not available, can those please be added?
hi
have you tried  DarkOne4Mod v2.0 2019 , it's pretty easy to custmoze
what about a button to enable  dps presets or even to last.fm love /unlove a song ?
by the way beautiful screenshots , have you used the old v1 or v2 darkone4mod?
thanks
Title: Re: JScript Panel
Post by: Defender on 2024-02-25 16:55:59
I kind of like the idea to add a button to control replaygain which I almost implemented.
All done but not finalized, because of a two small issues:

1) Is there a plman.ReplayGain (like plman.PlaybackOrder) variable available to reflect current state of replaygain?
2) Is a function on_replaygain_changed(new_index) available (like on_playback_order_changed(new_index))?

If not available, can those please be added?
hi
have you tried  DarkOne4Mod v2.0 2019 , it's pretty easy to custmoze
what about a button to enable  dps presets or even to last.fm love /unlove a song ?
by the way beautiful screenshots , have you used the old v1 or v2 darkone4mod?
thanks

Yes, I'm using DarkOne as well. The original one, which I heavily modified, since I did not like the flat view of Mod2.
My ReplayGain button works fine, but I cannot see current state therefore the mocked up images and the request for change.
Title: Re: JScript Panel
Post by: Henry66 on 2024-02-25 21:24:12
Yes, I'm using DarkOne as well. The original one, which I heavily modified, since I did not like the flat view of Mod2.
Have you publicly shared your modifications somewhere? I am very interested in them.

Many, many years ago, Tedgo himself helped me add display of Dynamic Range info to DarkOne original.
(https://i.imgur.com/YUyGKU1.png)
Title: Re: JScript Panel
Post by: Defender on 2024-02-25 21:39:13
Yes, I'm using DarkOne as well. The original one, which I heavily modified, since I did not like the flat view of Mod2.
Have you publicly shared your modifications somewhere? I am very interested in them.

Many, many years ago, Tedgo himself helped me add display of Dynamic Range info to DarkOne original.
(https://i.imgur.com/YUyGKU1.png)

:-)

Let's not hijack this topic. I'll post a separate topic.
I did not rip anything from the original skin and with some mouseclicks you can have have the same view except for the square buttons.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-26 06:16:49
1) Is there a plman.ReplayGain (like plman.PlaybackOrder) variable available to reflect current state of replaygain?
2) Is a function on_replaygain_changed(new_index) available (like on_playback_order_changed(new_index))?

RTFM.

plman is Playlist Manager so it won't be there. A good place to look would be fb since it's related to fb2k core settings.

https://jscript-panel.github.io/docs/namespaces/fb/

fb.ReplaygainMode is a readable and writable property https://jscript-panel.github.io/docs/flags/#replaygainmode

Callback: https://jscript-panel.github.io/docs/callbacks/foobar2000/#on_replaygain_mode_changednew_mode

Why do I even bother writing documentation? :/

Even starting a search with on_repl would have found it...

(https://i.imgur.com/PcyPurO.png)
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-26 08:01:13
3.4.7 no component changes. Changes to samples only - I've taken FontAwesome out back and shot it.

Segoe Fluent Icons is now used across all samples. Windows 11 users do nothing -you already have it. Everyone else can grab it here...

https://download.microsoft.com/download/8/f/c/8fc7cbc3-177e-4a22-af48-2a85e1c5bffb/Segoe-Fluent-Icons.zip

It's something I have to install myself. I despise 11 and won't be going near it any time soon.  :P

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

Existing users of included button samples need to re-import. Even if you used the previously optional support for Fluent Icons, scripts in panels still need updating.
Title: Re: JScript Panel
Post by: Gabriel Schwartz on 2024-02-26 10:09:41
Trying to use JSPlaylist with version 3.4.7 on fb2k 2.1.2

Components loaded in: 0:00.029234
Configuration read in: 0:00.004870
foobar2000 v2.1.2 x86 [portable]
Watching: M:\music
Playlist #0 loaded in 0:00.016248
JScript Panel 3.4.7 (JS Playlist by Br3tt aka Falstaff)
JavaScript runtime error
Invalid procedure call or argument
File: N:\foobar2000\profile\user-components\foo_jscript_panel3\samples\jsplaylist\main.js
Line: 1378, Col: 2
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-26 10:56:22
That's weird. Even if you didn't install the font as mentioned in the previous post, the display is just borked on certain icons that make up the layout. No errors should be thrown.

Hold Shift+Winkey together and right click the panel>Configure. Add this code.

Code: [Select]
String.prototype.calc_width = function (font_str) {
console.log("DEBUG", font_str);
var font = JSON.parse(font_str);
return utils.CalcTextWidth(this, font.Name, font.Size, font.Weight || 400);
}

You should get the same error but with a console DEBUG message before it. I'd like to see that please.

edit: the shift+winkey bit isn't necessary when the script has errored. It's only required when JSPlaylist is "working". :P
Title: Re: JScript Panel
Post by: Gabriel Schwartz on 2024-02-26 11:30:25
That's weird. Even if you didn't install the font as mentioned in the previous post, the display is just borked on certain icons that make up the layout. No errors should be thrown.

Hold Shift+Winkey together and right click the panel>Configure. Add this code.

Code: [Select]
String.prototype.calc_width = function (font_str) {
console.log("DEBUG", font_str);
var font = JSON.parse(font_str);
return utils.CalcTextWidth(this, font.Name, font.Size, font.Weight || 400);
}

You should get the same error but with a console DEBUG message before it. I'd like to see that please.

edit: the shift+winkey bit isn't necessary when the script has errored. It's only required when JSPlaylist is "working". :P

DEBUG {"Name":"FontAwesome","Size":0,"Weight":400}
JScript Panel 3.4.4 (JS Playlist by Br3tt aka Falstaff)
JavaScript runtime error
Invalid procedure call or argument
File: N:\foobar2000\profile\user-components\foo_jscript_panel3\samples\jsplaylist\main.js
Line: 1379, Col: 2
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-26 12:42:22
edit: nope, not dealing with that. I need an offline holiday.  ;D
Title: Re: JScript Panel
Post by: Defender on 2024-02-26 13:02:26
1) Is there a plman.ReplayGain (like plman.PlaybackOrder) variable available to reflect current state of replaygain?
2) Is a function on_replaygain_changed(new_index) available (like on_playback_order_changed(new_index))?

RTFM.

plman is Playlist Manager so it won't be there. A good place to look would be fb since it's related to fb2k core settings.

https://jscript-panel.github.io/docs/namespaces/fb/

fb.ReplaygainMode is a readable and writable property https://jscript-panel.github.io/docs/flags/#replaygainmode

Callback: https://jscript-panel.github.io/docs/callbacks/foobar2000/#on_replaygain_mode_changednew_mode

Why do I even bother writing documentation? :/

Even starting a search with on_repl would have found it...

(https://i.imgur.com/PcyPurO.png)

I have been trying to do searches in this forum many many times, but searches always come up empty.
I bookmarked the three links you included.

Thank you. With your help I was able to implement the intended button.
Title: Re: JScript Panel
Post by: Defender on 2024-02-26 13:11:57
-----
3.4.6

I read the release notes, but I don't understand:
Transparency is now reserved exclusively for genuine Columns UI toolbars. Adding as a toolbar via the Columns UI Layout settings will have no effect and it will be a normal panel with a solid color background.

Please explain how I can restore transparency for the JS3 stuff or propagate 3.4.5 like 3.3.40 2.8.8 as a legacy release.
----

Does this mean that effectively JS3 from version 3.4.6 onwards does not support transparency anymore?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-26 13:20:53
You reported the flickering with transparency so I solved it by removing the transparency. Without your report, I would have been oblivious to it.  Thanks.

The legacy versions will continue to support the transparency hack. You're using PSS from 2009. JSP 2.8.8 is from August 2022, JSP 3.3.40 is just over 3 weeks old. If you have a problem with that, contact your bank for a refund.
Title: Re: JScript Panel
Post by: Defender on 2024-02-26 14:18:30
You reported the flickering with transparency so I solved it by removing the transparency. Without your report, I would have been oblivious to it.  Thanks.

The legacy versions will continue to support the transparency hack. You're using PSS from 2009. JSP 2.8.8 is from August 2022, JSP 3.3.40 is just over 3 weeks old. If you have a problem with that, contact your bank for a refund.

I guess that's your way of saying yes.

What I said was "I have a small refresh question/issue about JS3" and told you only JS panels had this thingy. I did not  even call it a bug or anything. It was just a small glitch I noticed.

First you respond by saying movepanel/showpanel/panelshow is bugged.
I've got around 100 panels running all operated by movepanel/showpanel/panelshow and I have zero issues. Except for the small JS glitch.

Later you confirm the small issue and respond by removing transparency support completely.

Bit like going to the doctor with a ingrown toenail and the doctor solves the problem by amputating the whole leg.
Title: Re: JScript Panel
Post by: michi777 on 2024-02-26 14:39:18
Yeah, I put more restrictions in. While it's nice to have a dozen or 2 images on rotation, I think getting in to the hundreds is silly and way beyond what this was ever meant for. Edit the script yourself if you want to change it.

https://github.com/jscript-panel/component/blob/8fb1bdde45a742de574db6fc132b8686f3334559/samples/js/thumbs.js#L140-L150

Just be warned that this can exhaust all memory and cause fb2k to crash. I mean proper crashes, not script errors.
The number of sheets displayed does not change when Thumbs is Off, though,
Is it necessary to limit the number of pictures displayed even when Thumbs is Off?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-26 15:43:23
I'm started to think this is a co-ordinated attack where I'm having idiots thrown at me from every direction. The numbers are impressive.
Title: Re: JScript Panel
Post by: pqyt on 2024-02-26 15:58:19
I'm started to think this is a co-ordinated attack where I'm having idiots thrown at me from every direction. The numbers are impressive.
:))
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-26 16:30:18
3.4.8 internal font related changes. It does nothing to address the JSPlaylist script error reported above but I hope any future errors point somewhere else in the code. If it does, it will give me a better idea of what is wrong.

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

edit: hardly worth mentioning but the JSPlaylist state column can now display 3 digit queue indexes. I think when it was written, the queue limit was 64 which was OK but since it was updated to 256, it got truncated.
Title: Re: JScript Panel
Post by: Gabriel Schwartz on 2024-02-26 18:21:01
3.4.8 internal font related changes. It does nothing to address the JSPlaylist script error reported above but I hope any future errors point somewhere else in the code. If it does, it will give me a better idea of what is wrong.

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

edit: hardly worth mentioning but the JSPlaylist state column can now display 3 digit queue indexes. I think when it was written, the queue limit was 64 which was OK but since it was updated to 256, it got truncated.

I'll try this fix altough I found that this is actually a CUI problem.
I opened the settings and all the Font size were 0.
I change them to 12 and it's working.
No idea how it worked with 0 font size as it was set to all types.
Strange but now it works.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-26 20:50:47
Everyone else handles that gracefully so I guess I should as well...

3.4.9
Quote
Update window.GetFontCUI to gracefully handle a font with zero size being defined in the Preferences.

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

BTW, the most likely cause of it being borked was using foo_ui_hacks.

edit: most components didn't have to do anything because GDI fonts default to something sane if source properties are nonsense.

I'm storing the font name as a string and using numbers for other properties like weight, size etc. Passing a size of zero to this method caused the error.

https://learn.microsoft.com/en-us/windows/win32/api/dwrite/nf-dwrite-idwritefactory-createtextformat


Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-28 02:36:53
3.4.10

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

Not worthy of a changelog entry but the crappy transparency effect for CUI toolbars is once again available when added as panels. Even with my supposed removal of it, flickering can still happen so it might as well stay. All flickering can be avoided by using standard panels in proper splitters - not PSS.

edit: I didn't mean to say transparency in CUI toolbars is crappy - it's essential. Adding toolbars as panels to use with PSS sucks. :P
Title: Re: JScript Panel
Post by: Defender on 2024-02-28 02:39:20
3.4.10

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

Not worthy of a changelog entry but the crappy transparency effect for CUI toolbars is once again available when added as panels. Even with my supposed removal of it, flickering can still happen so it might as well stay. All flickering can be avoided by using standard panels in proper splitters - not PSS.

Great. Thx
Title: Re: JScript Panel
Post by: josemescud on 2024-02-28 13:07:29
Message to marc2k3:

I have Columns UI and JScriptPanel3 3.4.10 installed and have configured "Track Info + Seekbar + Buttons + Volume.txt" with my own code.

I need, if possible, the following:

In the image you can see in the playlist view, the title column in which I have made a script with title formating that makes the texts in parentheses (up to a maximum of 4) except if it is at the beginning to be painted in low brightness.

The caption shows the title with the text in parentheses on the right removed.

What I need is a routine that allows to paint in the footer the title with the texts in brackets that are not at the beginning in low luminosity.

Current: 

(I Love You) Caravan

Desired:

(I Love You) Caravan (Bande Originale Du Film) aka "Paris, Paris" (Spain) "Paris 36" (Europe)

Code: [Select]
// ==PREPROCESSOR==
// @name "Track Info + Seekbar + Buttons + Volume"

// con 1 fuente (Segoe Fluent Icons.ttf)
// Pie en un solo panel

// @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\seekbar.js"
// @import "%fb2k_component_path%samples\js\volume.js"

// ==/PREPROCESSOR==

/*
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.
*/

//////////////////////////////////////////////////////////////
//tamaño botones
var bs = _scale(26);
var sep_bot = 3;

//tamaño botón volume
var bsv = _scale(25);

//posicion botones
var posi_horiz_bot = -1;
var posi_vert_bot = 757;

//posiciones para el botón activate
var posi_horiz_bot2 = -1;
var posi_vert_bot2 = 275;

//posiciones seekbar
var posi_vert_seekbar_ini = 59;
var ancho_seekbar = _scale(896);
var alto_seekbar = _scale(5);
var posi_horiz_seekbar = 2;

//posiciones knob
var ancho_knob = _scale(6)
var alto_knob = ancho_knob

//posiciones barra volumen
var alto_volume = alto_seekbar;
var posi_horiz_barra_volume = _scale(24);
var ancho_volume = _scale(524);
var separacion_pared_derecha_volume = _scale(13);

//posición icono volumen
var posi_horiz_volume = _scale(14);

//el valor _scale(-xxx) marca el límite en que se corta el texto con ...
var limite1 = _scale(-485);

var posi_vert_lin_izq = 10;
var posi_horiz_lin1 = -5;
var posi_horiz_lin2 = 24;

//Recuadro de tiempos
//desplazamiento vertical
var time_x = 1420
//desplazamiento horizontal
var time_y = 23
//ancho de izq. a dcha.
var time_w = -240
//alto
var time_h = 26

var posi_horiz_time = 0;
var sep_time = 161;
var posi_vert_time_actual = _scale(1815);
var posi_vert_time_resto = posi_vert_time_actual + sep_time;
var posi_vert_time_total = posi_vert_time_resto + sep_time;

var posi_horiz_porcen = -2

//texto encima volumen
var posi_horiz_linea1 = -25;
var posi_vert_herz = 1650;
var posi_vert_codec = 1827;

//texto debajo volumen
var posi_horiz_gain = 22;
var posi_vert_gain = 1827;

//fuentes para los textos
var normal2_font = CreateFontString('Segoe UI', 12);
var normal3_font = CreateFontString('Segoe UI', 13);
var normal4_font = CreateFontString('Segoe UI', 11);
var normal5_font = CreateFontString('Eras ITC', 14);
var normal6_font = CreateFontString('Segoe UI', 8);
var bold_font = CreateFontString('Segoe UI', 12, true);

//aquí se definen los colores
var colours = {
buttons : RGB(220, 220, 220),
background : RGB(34, 34, 34),
artist : RGB(170, 170, 170),
año : RGB(230, 230, 230),
album : RGB(200, 200, 200),
composer : RGB(160, 160, 160),
track : RGB(200, 200, 200),
title : RGB(225, 225, 225),
porcen : RGB(180, 180, 180),

time : RGB(180, 180, 180),
time_total : RGB(220, 220, 220),
time_reborde : RGB(32, 32, 32),
time_recuadro_degra1 : RGB(25, 25, 25),
time_recuadro_degra2 : RGB(50, 50, 50),

gain : RGB(180, 180, 180),
codec : RGB(170, 170, 170),
seekbar_background : RGB(15, 15, 15),
seekbar_progress : RGB(80, 80, 80),
knob : RGB(220, 0, 0),
sac : RGB(196, 30, 35),
};

//aquí se guardan los metadatos que se van a pintar
//metadatos que se depurarán de paréntesis
var tfo_album = fb.TitleFormat('[%album%]');
var tfo_title = fb.TitleFormat('[%title%]');
var tfo_artist = fb.TitleFormat('[%artist%]');
var tfo_genero = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),$cut(%genre%,7),)');

var panel = new _panel();
var seekbar = new _seekbar(0, 0, 0, 0);
var volume = new _volume(0, 0, 0, 0);
var buttons = new _buttons();

var img = null;
window.MaxHeight = _scale(150);

on_playback_new_track(fb.GetNowPlaying());

buttons.update = function () {
var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_bot;

//  aquí se pintan los botones tomándolos de helpers.txt
this.buttons.stop = new _button(panel.w - posi_vert_bot - (sep_bot * 4) - (bs * 8), y, bs, bs, { char : chars.stop, colour:fb.StopAfterCurrent ? colours.sac : colours.buttons}, null, function () { fb.Stop(); }, 'Stop');

this.buttons.previous = new _button(panel.w - posi_vert_bot - (sep_bot * 3) - (bs * 7), y, bs, bs, { char : chars.prev, colour:colours.buttons }, null, function () { fb.Prev(); }, 'Previous');

this.buttons.play = new _button(panel.w - posi_vert_bot - (sep_bot * 2) - (bs * 6), y, bs, bs, { char : !fb.IsPlaying || fb.IsPaused ? chars.play : chars.pause, colour:colours.buttons}, null, function () { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? 'Play' : 'Pause');

this.buttons.next = new _button(panel.w - posi_vert_bot-sep_bot - (bs * 5), y, bs, bs, { char : chars.next, colour:colours.buttons }, null, function () { fb.Next(); }, 'Next');

//  aquí se pinta el boton activate que está definido en helpers.txt como right
var y = (Math.round((panel.h - bs) / 2)) + posi_horiz_bot2;
this.buttons.activate = new _button(panel.w - posi_vert_bot - (bs * 4), y, bs, bs, { char : chars.right, colour:colours.buttons }, null, function () { fb.RunMainMenuCommand('View/Playlist view/Activate now playing'); }, 'Activate now playing');

//  Aquí se pinta el boton volumen
this.buttons.volume = new _button(volume.x - bs, posi_horiz_volume, bsv, bsv, { char : chars.volume, colour:colours.buttons }, null, function () { fb.VolumeMute(); }, 'Mute Volume');
}

function update_album_art(metadb) {
if (img) img.Dispose();
img = null;
if (metadb) {
img = metadb.GetAlbumArt();
}
window.Repaint();
}

function on_mouse_lbtn_down(x, y) {
seekbar.lbtn_down(x, y);
volume.lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
if (x < panel.h && fb.IsPlaying && img) {
fb.GetNowPlaying().ShowAlbumArtViewer();
return;
}
if (buttons.lbtn_up(x, y)) {
return;
}
if (seekbar.lbtn_up(x, y)) {
return;
}
if (volume.lbtn_up(x, y)) {
return;
}
fb.RunMainMenuCommand('View/Show now playing in playlist');
}

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

function on_mouse_move(x, y) {
window.SetCursor(x < panel.h && fb.IsPlaying && img ? IDC_HAND : IDC_ARROW);
if (buttons.move(x, y)) {
return;
}
if (seekbar.move(x, y)) {
return;
}
volume.move(x, y);
}

function on_mouse_rbtn_up(x, y) {
if (buttons.buttons.stop.containsXY(x, y)) {
fb.StopAfterCurrent = !fb.StopAfterCurrent;
} else {
var menu = window.CreatePopupMenu();
menu.AppendMenuItem(MF_STRING, 1, 'Configure');

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

switch (idx ) {
case 1:
window.ShowConfigure();
break;
}
}

return true;
}

function on_mouse_wheel(s) {
if (seekbar.wheel(s)) {
return;
}
volume.wheel(s);
}

function on_paint(gr) {
//aquí se pinta el background de todo el pie
gr.Clear(colours.background);

//aquí se pinta la barra nula
    gr.FillRoundedRectangle(seekbar.x, seekbar.y, seekbar.w + _scale(6), seekbar.h, _scale(2), _scale(2), colours.seekbar_background);

buttons.paint(gr);

//Aquí se pinta la barra de volumen
gr.FillRoundedRectangle(volume.x, volume.y, volume.w + _scale(6), volume.h, _scale(2), _scale(2), colours.seekbar_background)

    //aquí se pinta la parte izquierda de la barra de volumen
var pos = volume.pos();
gr.FillRoundedRectangle(volume.x, volume.y, pos, volume.h, _scale(2), _scale(2), colours.seekbar_progress);

    //aquí se pinta el knob del volumen
gr.FillEllipse(volume.x + _scale(3) + pos, volume.y + _scale(3), ancho_knob, alto_knob, colours.knob);

buttons.paint(gr);

//aquí se pinta el recuadro con reborde que aloja los tiempos
FillGradientRectangle(gr, time_x, time_y, time_w, time_h, 0, colours.time_recuadro_degra2, colours.time_recuadro_degra1);

//aquí se pinta el reborde del recuadro
DrawRectangle(gr, time_x, time_y, time_w, time_h, colours.time_reborde);

//aquí se pinta la miniatura fuera de If (fb.IsPlaying) para que no se borre al pulsar stop --------
if (img) {
_drawImage(gr, img, 0, 0, panel.h - 2, panel.h - 2, image.centre);
}

if (fb.IsPlaying) {
//aquí se pinta la linea 1 izq: artist, año, album
//elimino el metadato %album% dejándole su $rgb y tb el %artist% solo en la clásica para después añadir el la string lin1 las strings album y artist ya depuradas de ()
var lin1 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),$rgb(170,170,170)   $rgb(230,230,230)%date%   $rgb(170,170,170),$rgb(170,170,170)[%artist%]   $rgb(230,230,230)[%date%]   $rgb(170,170,170))').Eval();

//elimina texto entre ()
var arr = tfo_album.Eval();
textoFormateado = QuitaTextoEntreParentesis(arr);
var album = textoFormateado

//elimina texto entre ()
var arr = tfo_artist.Eval();
textoFormateado = QuitaTextoEntreParentesis(arr);
var artist = textoFormateado

var genero = tfo_genero.Eval();
//añado a lin1 las strings depuradas de () de forma que DrawColouredText es capaz de aplicar el color definido en fb.TitleFormat
if (genero == 'Clásica') lin1 = album + lin1 + artist;
else lin1 = lin1 + album;

DrawColouredText(gr,lin1, normal2_font, colours.artist, panel.h + posi_vert_lin_izq, posi_horiz_lin1, seekbar.x - panel.h - limite1, panel.h * 0.5, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pinta la linea 2 izq: composer, track, title
var lin2 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),$rgb(130,130,130)"$upper(%composer%)"  ,)$rgb(150,150,150)[%tracknumber%.  ]$rgb(225,225,225)').Eval();

//elimina texto entre ()
var arr = tfo_title.Eval();
textoFormateado = QuitaTextoEntreParentesis(arr);
var title = textoFormateado

var lin2 = lin2 + title

        //la linea siguiente es solo para Susi. En ella se pinta el title sin ninguna depuración de paréntesis
//var lin2 = fb.TitleFormat('$if($strcmp($cut(%genre%,7),Clásica),$rgb(130,130,130)"$upper(%composer%)"  ,)$rgb(150,150,150)[%tracknumber%.  ]$rgb(225,225,225)%title%').Eval();

DrawColouredText(gr, lin2, normal2_font, colours.title, panel.h + posi_vert_lin_izq, posi_horiz_lin2, seekbar.x - panel.h - limite1, panel.h * 0.9, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pinta el porcen a la dcha. de la seekbar
var porcen = fb.TitleFormat('$ifgreater(%_time_total_seconds%,0,$div($mul(%_time_elapsed_seconds%,100),%_time_total_seconds%) ٪,LIVE)').Eval();
gr.WriteText(porcen, normal3_font, colours.porcen, seekbar.x + seekbar.w + _scale(12), posi_horiz_porcen, _scale(130), panel.h, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//tiempo transcurrido
var time_actual = fb.TitleFormat('%playback_time%').Eval();
gr.WriteText(time_actual, normal5_font, colours.time, seekbar.x - _scale(50), posi_horiz_time, posi_vert_time_actual, panel.h, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
//tiempo restante
var time_resto = fb.TitleFormat('[- %playback_time_remaining%]').Eval();
gr.WriteText(time_resto, normal5_font, colours.time, seekbar.x - _scale(50), posi_horiz_time, posi_vert_time_resto, panel.h, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);
//tiempo total
var time_total = fb.TitleFormat('[%length%]').Eval();
gr.WriteText(time_total, normal5_font, colours.time_total, seekbar.x - _scale(50), posi_horiz_time, posi_vert_time_total, panel.h, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pinta texto encima del volumen -------------------------

//aquí se pinta los herzios en 2 colores
var str = fb.TitleFormat('$ifgreater(%samplerate%,49000,$rgb(0,210,0),)%samplerate% Hz').Eval();
DrawColouredText(gr, str, normal3_font, colours.codec, seekbar.x, posi_horiz_linea1, posi_vert_herz, panel.h, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pintan: bitrate, codec
var tfo = fb.TitleFormat('%bitrate% k          $ext($upper(%_path%))');
var arr = tfo.Eval().split('^^');
gr.WriteText(arr[0], normal3_font, colours.codec, seekbar.x, posi_horiz_linea1, posi_vert_codec, panel.h, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

//aquí se pinta texto debajo del volumen -------------------------

//aquí se pinta last played y gain
        var tfo = fb.TitleFormat('[AGain: %replaygain_album_gain%     ]$if($and($strcmp($strstr(%last_played%,-),5),$strcmp($strstr(%last_played%,:),14)),Last Play: $substr(%last_played%,9,10)-$substr(%last_played%,6,7)-$substr(%last_played%,1,4) $substr(%last_played%,12,13):$substr(%last_played%,15,16)     ,)[TGain: %replaygain_track_gain%]');
var arr = tfo.Eval().split('^^');
gr.WriteText(arr[0], normal4_font, colours.gain, seekbar.x, posi_horiz_gain, posi_vert_gain, panel.h, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_PARAGRAPH_ALIGNMENT_CENTER, DWRITE_WORD_WRAPPING_NO_WRAP, DWRITE_TRIMMING_GRANULARITY_CHARACTER);

if (fb.PlaybackLength > 0) {
var pos = seekbar.pos();
//aquí se pinta la parte izquierda de la seekbar
gr.FillRoundedRectangle(seekbar.x, seekbar.y, pos, seekbar.h, _scale(2), _scale(2), colours.seekbar_progress);

//aquí se pinta el knob del seekbar avanzando
gr.FillEllipse(seekbar.x + _scale(3) + pos, seekbar.y + _scale(3), ancho_knob, alto_knob, colours.knob);
}
}
}

function on_playback_dynamic_info_track(type) {
if (type == 0) window.Repaint();
else update_album_art(fb.GetNowPlaying());
}

function on_playback_edited() {
window.Repaint();
}

function on_playback_new_track(metadb) {
update_album_art(metadb);
}

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

function on_playback_seek() {
seekbar.playback_seek();
}

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

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

function on_playback_time() {
//la linea siguiente la sustituí por la siguiente según me indicó marc2k3 en el foro para arreglar el que no se pintaban los tiempos per second
// window.RepaintRect(panel.h, 0, seekbar.x - panel.h, panel.h);
window.Repaint();
}

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

//aquí se definen las coordenadas de la seekbar y el volumen
function on_size() {
panel.size();
seekbar.x = _scale(posi_vert_seekbar_ini);
    seekbar.w = panel.w - seekbar.x - ancho_seekbar;
seekbar.h = alto_seekbar;
seekbar.y = (panel.h - seekbar.h) / posi_horiz_seekbar;

volume.x = seekbar.x + seekbar.w + ancho_volume + (bs * 5);
volume.y = posi_horiz_barra_volume;
volume.w = panel.w - volume.x - separacion_pared_derecha_volume;
volume.h = alto_volume;

buttons.update();
}

function on_volume_change() {
volume.volume_change();
window.Repaint();
}

function QuitaTextoEntreParentesis(arr) {
//elimina texto entre () excepto que esté al principio
//1ª depuración empezando por la derecha
var first = arr.indexOf('(');
var last = arr.lastIndexOf('(');
if (last > first) arr = arr.substr(0, last-1).trim();
else if (first > 0) arr = arr.substr(0, first-1).trim();
//2ª depuración empezando por la derecha
var first = arr.indexOf('(');
var last = arr.lastIndexOf('(');
if (last > first) arr = arr.substr(0, last-1).trim();
else if (first > 0) arr = arr.substr(0, first-1).trim();
//3ª depuración empezando por la derecha
var first = arr.indexOf('(');
var last = arr.lastIndexOf('(');
if (last > first) arr = arr.substr(0, last-1).trim();
else if (first > 0) arr = arr.substr(0, first-1).trim();
        //4ª depuración empezando por la derecha
        var first = arr.indexOf('(');
        var last = arr.lastIndexOf('(');
        if (last > first) arr = arr.substr(0, last-1).trim();
        else if (first > 0) arr = arr.substr(0, first-1).trim();

textoFormateado = arr
return textoFormateado;
}
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-28 13:36:01
I really have no idea what you're trying to say. If $replace/$rgb code from your playlist isn't working when copied to in to the script, just say that. See how few words that took. :/
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-28 15:05:54
I can't be bothered to do the title formating gymnastics necessary to ignore a bracket if it's first character but this example which doesn't care works fine. If this works, why would any other TF pattern not?

Code: [Select]
$replace(%title%,'(',$rgb(255,0,0)'(',')',')'$rgb())

(https://i.imgur.com/asq8pbq.png)

You'll need to provide examples.

Title: Re: JScript Panel
Post by: seongbin on 2024-02-28 15:53:22
3.4.10

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

Not worthy of a changelog entry but the crappy transparency effect for CUI toolbars is once again available when added as panels. Even with my supposed removal of it, flickering can still happen so it might as well stay. All flickering can be avoided by using standard panels in proper splitters - not PSS.

edit: I didn't mean to say transparency in CUI toolbars is crappy - it's essential. Adding toolbars as panels to use with PSS sucks. :P

Since the following piece was added in helpers.txt,

Code: [Select]
Array.prototype.empty = function () {
return this.length == 0;
}

my process_string function in Smooth Playlist is not working

Code: [Select]
function process_string(str) {
var str_ = [];
str = str.toLowerCase();
while (str != (temp = str.replace("  ", " ")))
str = temp;
str = str.split(" ").sort();
for (var i in str) {
if (str[i] != "") {
str_[str_.length] = str[i];
}
}
console.log(str_);
return str_;
}

This is what I got in console.

Code: [Select]
JScript Panel 3.4.10 (id:18088926): initialised in 30 ms
function () {
return this.length == 0;
}

It's all good if I delete the prototype function in helpers.txt.
What shall I change when helpers.txt is untouched?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-28 16:06:37
Sorry about that. I didn't think empty would conflict with anything. It's a keyword usually associated with strings/vectors/other containers in C++ and I thought adding this for myself in JS would be safe.

edit: it will be removed in the next release. You shouldn't have to modify your code for this.
Title: Re: JScript Panel
Post by: Defender on 2024-02-28 16:30:33
I also have a small issue with Smooth Playlist Manager. In some cases the icon is too tall and in all cases there's not enough padding between the icon and the playlist name.

Can I adjust that myself?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-28 17:54:22
3.4.11 fixes the bad helpers.txt update.

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

The horizontal padding in Smooth Playlist Manager has been tweaked but I have no idea why the overall look in that screenshot above is so appalling. I can't make it look that bad if I try. Changing fonts/DPI/scrolling with ctrl key down to increase size - nothing went that wrong. :/
Title: Re: JScript Panel
Post by: seongbin on 2024-02-28 18:37:17
3.4.11 fixes the bad helpers.txt update.

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

The horizontal padding in Smooth Playlist Manager has been tweaked but I have no idea why the overall look in that screenshot above is so appalling. I can't make it look that bad if I try. Changing fonts/DPI/scrolling with ctrl key down to increase size - nothing went that wrong. :/

All good, thx for support!
Title: Re: JScript Panel
Post by: Defender on 2024-02-28 18:50:47
3.4.11 fixes the bad helpers.txt update.

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

The horizontal padding in Smooth Playlist Manager has been tweaked but I have no idea why the overall look in that screenshot above is so appalling. I can't make it look that bad if I try. Changing fonts/DPI/scrolling with ctrl key down to increase size - nothing went that wrong. :/

Doesn't matter. 3.4.11 also fixes my smp issue. Thx!
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-29 13:55:52
3.4.12 add IMetadbHandleList Reverse and Playback Order buttons to included buttons samples. For existing users, they need re-importing.

There is a minimal new Playback Buttons + Playback Order. The others are combined with seekbars.

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

Unlike an example I posted last night in the script discussion thread, these buttons support all modes. I found Segoe Fluent Icon chars which will do. Tooltips are there to help if not. :P
Title: Re: JScript Panel
Post by: Defender on 2024-02-29 14:50:04
Is there an option/way somewhere to change the color of the background of dropdown menu's (which is the same as the topbar of the window where fooBar lives)?

Currently set to #2B2B2B or 43-43-43. I searched all the js files but could not find a reference how to change the color of these dropdowns.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-02-29 15:17:10
Menus are light/dark depending on DUI/CUI dark mode settings and they apply across the whole app -even when components/popup dialogs don't support dark mode. No one gets to choose colours.



Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-01 16:31:57
3.4.13 samples fixes and a new Text Display + Album Art + Seekbar + Buttons

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

Example:

(https://i.imgur.com/obZwiTu.png)

edit: code for first line

Code: [Select]
[%jsp3_playlist_name%: $num(%list_index%,1) of %list_total%]

%list_index% and %list_total% are fb2k native but not many components outside of playlist viewers can display it. This can. And %jsp3_playlist_name% is obviously exclusive.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-04 20:25:37
3.4.14 adds some file/folder copy/rename methods.

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

https://github.com/jscript-panel/release/releases/
Title: Re: JScript Panel
Post by: josemescud on 2024-03-04 21:15:30
3.4.14 adds some file/folder copy/rename methods.

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

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

I have updated jscript_panel3 version 3.4.14 and something has gone wrong as the configuration cannot be accessed from any of the panels.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-04 21:40:31
Apologies. Fixed version uploaded just now.

https://github.com/jscript-panel/release/releases
Title: Re: JScript Panel
Post by: sacdman on 2024-03-05 01:40:15
Wow... love the look of this panel.. .very nice and stylish. I am not at all able to do any king of Javascript. I also don't know how to add this to a JScript Panel 3 panel. If you could show me how I would really appreciate it. I would also like the option of adding a default image in the panel when I have no music added to the playlist. thanks.

3.4.13 samples fixes and a new Text Display + Album Art + Seekbar + Buttons

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

Example:

(https://i.imgur.com/obZwiTu.png)

edit: code for first line

Code: [Select]
[%jsp3_playlist_name%: $num(%list_index%,1) of %list_total%]

%list_index% and %list_total% are fb2k native but not many components outside of playlist viewers can display it. This can. And %jsp3_playlist_name% is obviously exclusive.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-05 02:54:06
No JS knowledge is required. All you had to do was read the docs page. There is a link from the download page.

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

If not running Windows 11, installed the required font detailed on that page.

You install the component like any other. You add the panel to your layout like any other. Now click the panel to open the editor. Now click the Samples button to choose whichever one you want.

(https://i.imgur.com/xCuT9du.png)

Click OK.

All script options are found on the right click menu. Some have more advanced usage notes here...

https://jscript-panel.github.io/gallery/
Title: Re: JScript Panel
Post by: sacdman on 2024-03-05 03:18:13
Thank you and I do have this working except I have no cover art. I use a cover art in each folder for each album. I call each image "01 cover.jpg" How would I add this so it comes up each time?
Title: Re: JScript Panel
Post by: sacdman on 2024-03-05 03:19:16
It would be nice if this could work in conjunction with the "thumbs" option.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-05 03:25:11
Album art should be displayed in exactly the same way as the Default UI / Columns UI artwork panels. A common Preference page exists for all:

File>Preferences>Display>Album Art>Front cover.

You can also configure a stub image for when no artwork is available.

Like stock DUI/CUI panels, album art from radio streams that supply it also works.

edit: just noticed there is a bug while playing streams. Playback time should be displayed by the seekbar but it's not. :/
edit2: fixed version available here... https://raw.githubusercontent.com/jscript-panel/component/main/samples/Text%20Display%20%2B%20Album%20Art%20%2B%20Seekbar%20%2B%20Buttons.txt
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-05 08:05:31
Here's a random tip for anyone who doesn't know. Most samples are DPI aware and this is read on script init. But you can override it on a per panel basis. The default is 96 but you change it to 120 (125%), 144(150%) or even 192(200%).

Just add this at the top of the script...

Code: [Select]
DPI = 144;

Comparison:

(https://i.imgur.com/X0ozMtA.png)
Title: Re: JScript Panel
Post by: Jacob91 on 2024-03-05 22:37:46
Here's a random tip for anyone who doesn't know. Most samples are DPI aware and this is read on script init. But you can override it on a per panel basis. The default is 96 but you change it to 120 (125%), 144(150%) or even 192(200%).

Just add this at the top of the script...

Code: [Select]
DPI = 144;

Comparison:


Cool ! Would it be possible to add a ReplayGain button ?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-06 04:30:24
Anyone except me can. I don't use RG and would have no idea what button icons could show which mode is active.

If anyone else fancies a go, the callback needed to update buttons when RG mode changes is this...

Code: [Select]
function on_replaygain_mode_changed() {
buttons.update();
window.Repaint();
}

And you retrieve/set the mode with fb.ReplaygainMode. Allowed values are here...

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

If people want this functionality but can't do JS, just use a toolbar switcher. Default UI and Columns UI both have them.
Title: Re: JScript Panel
Post by: Defender on 2024-03-06 08:51:53
Anyone except me can. I don't use RG and would have no idea what button icons could show which mode is active.

That's no different from the outputdevices button with the arbitrary cogwheel is it?

Maybe U+E07F or U+E11D would do just fine?

On a more serious note ...
If I had to make a replaygain textbutton that reflects state I'd probably go for U+E878 (Off), U+E879 (Track), U+E87B (Album) and U+E87A (PBO). Clicking on it would give dropdown with currect state checked. Rightmouseclick would reset to ReplayGain (Track).

EDIT: Added the button. Something like this maybe
Code: [Select]
// ==PREPROCESSOR==
// @name "Text Display + Album Art + Seekbar + Buttons, added ReplayGain"
// @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"
// @import "%fb2k_component_path%samples\js\seekbar.js"
// ==/PREPROCESSOR==

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

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

var colours = {
slider_background : RGB(160, 160, 160),
white : RGB(255, 255, 255),
contrast : RGB(196, 30, 35),
};

var tfo = {
playback_time : fb.TitleFormat('[%playback_time%]'),
length : fb.TitleFormat('$if2(%length%,LIVE)'),
};

var rg_chars = ['\uE878', '\uE879', '\uE87B', '\uE87A' ];
var rx = 0; // Placeholder for x of dropdown - ReplayGain
var ry = 0; // Placeholder for y of dropdown - ReplayGain

var font = CreateFontString("Segoe UI", 12);
var buttons = new _buttons();
var bs = _scale(24);

buttons.update = function () {
var x = (panel.w - (bs * 9)) / 2
var y = seekbar.y + _scale(12);
this.buttons.stop = new _button(x, y, bs, bs, { char : chars.stop, colour: fb.StopAfterCurrent ? colours.contrast : colours.white}, null, function () { fb.Stop(); }, 'Stop');
this.buttons.previous = new _button(x + bs, y, bs, bs, { char : chars.prev, colour:colours.white }, null, function () { fb.Prev(); }, 'Previous');
this.buttons.play = new _button(x + (bs * 2), y, bs, bs, { char : !fb.IsPlaying || fb.IsPaused ? chars.play : chars.pause, colour:colours.white}, null, function () { fb.PlayOrPause(); }, !fb.IsPlaying || fb.IsPaused ? 'Play' : 'Pause');
this.buttons.next = new _button(x + (bs * 3), y, bs, bs, { char : chars.next, colour:colours.white }, null, function () { fb.Next(); }, 'Next');

rx = x + (bs * 4); ry = y + _scale(20);
this.buttons.replaygain = new _button(x + (bs * 5), y, bs, bs, { char : rg_chars[fb.ReplaygainMode], colour:colours.white}, null, function (x, y, mask) { _rg(rx, ry); }, 'ReplayGain');

this.buttons.search = new _button(x + (bs * 7), y, bs, bs, { char : chars.search, colour:colours.white }, null, function () { fb.RunMainMenuCommand('Library/Search'); }, 'Library Search');
this.buttons.preferences = new _button(x + (bs * 8), y, bs, bs, { char : chars.preferences, colour:colours.white}, null, function () { fb.ShowPreferences(); }, 'Preferences');
}

panel.item_focus_change();

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

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

function on_item_focus_change() {
if (panel.selection.value == 0 && fb.IsPlaying) return;
panel.item_focus_change();
}

function on_metadb_changed(handles, fromhook) {
if (!fromhook) {
albumart.metadb_changed();
}
text.metadb_changed();
}

function on_mouse_lbtn_dblclk(x, y) {
if (albumart.img && albumart.containsXY(x, y)) {
panel.metadb.ShowAlbumArtViewer();
}
}

function on_mouse_lbtn_down(x, y) {
seekbar.lbtn_down(x, y);
}

function on_mouse_lbtn_up(x, y) {
if (seekbar.lbtn_up(x, y)) {
return;
}
if (buttons.lbtn_up(x, y)) {
return;
}
text.lbtn_up(x, y);
}

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

function on_mouse_move(x, y) {
if (seekbar.move(x, y)) {
return;
}
if (buttons.move(x, y)) {
return;
}
text.move(x, y);
}

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

if (buttons.buttons.replaygain.containsXY(x, y)) {
fb.ReplaygainMode = 1;
return true;
}

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

function on_mouse_wheel(s) {
if (seekbar.wheel(s)) {
return;
}
text.wheel(s);
}

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

gr.FillRoundedRectangle(seekbar.x, seekbar.y, seekbar.w, seekbar.h, _scale(2), _scale(2), colours.slider_background);

if (fb.PlaybackLength > 0) {
gr.FillEllipse(seekbar.x + seekbar.pos(), seekbar.y + _scale(3), _scale(6), _scale(6), colours.white);

var time_width = seekbar.x - _scale(12);
gr.WriteText(tfo.playback_time.Eval(), font, colours.white, 0, seekbar.y - _scale(4), time_width, _scale(12), 1, 2);
gr.WriteText(tfo.length.Eval(), font, colours.white, panel.w - seekbar.x, seekbar.y - _scale(4), seekbar.x, _scale(12), 0, 2);
}
}

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

function on_playback_dynamic_info_track(type) {
if (type == 0) text.metadb_changed();
else if (type == 1 && (text.properties.albumart.enabled || text.properties.layout.value > 0)) albumart.metadb_changed();
}

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

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

function on_playback_seek() {
seekbar.playback_seek();
}

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

function on_playback_stop(reason) {
if (reason != 2) {
panel.item_focus_change();
}

buttons.update();
window.Repaint();
}

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

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

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

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

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

function on_playlist_switch() {
on_item_focus_change();
}

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

function on_size() {
panel.size();
text.size();

seekbar.x = _scale(60);
seekbar.y = window.Height - _scale(44);
seekbar.w = window.Width - (seekbar.x * 2) - _scale(12);
seekbar.h  = _scale(6);

buttons.update();
}

function on_replaygain_mode_changed(new_mode) {
buttons.update();
window.Repaint();
}

function _rg(x, y, flags) {
var menu = window.CreatePopupMenu();
var arr = new Array("Disable", "Set to Track", "Set to Album", "Set to Track/Album by playback order");
var active = -1;
for (var i = 0; i < arr.length; i++) {
menu.AppendMenuItem(MF_STRING, i + 1, arr[i]);
if (arr[i].active) active = i;
}

menu.CheckMenuRadioItem(1, arr.length + 1, fb.ReplaygainMode + 1);

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

if (idx > 0) {fb.ReplaygainMode = idx - 1; };
}
Title: Re: JScript Panel
Post by: Defender on 2024-03-06 10:49:46
Excellent script.

Made some modifications I kinda like and will use myself.

   ReplayGain   - Dropdown to ReplayGain modes: Disable, Track, Album and Playbackorder

   Rightclick:
   Previous   - Seek back 10 sec
   Play      - Starts Random track
   Next      - Seek forward 10 sec
   ReplayGain   - Reset to ReplayGain Track
Title: Re: JScript Panel
Post by: Defender on 2024-03-06 11:33:10
Marc,

I modified the script so mousewheel on art cycles through available art. Works fine, but when I change the album I'm playing it does not reset to the first option (Cover) and tries to show the prior chosen Art (CD/Back/Artist).

How can I achieve that upon playing another album (folder) the art display resets to Cover?

EDIT:

Adding albumart.properties.id.value = 0 before albumart.metadb_changed() does the trick but it resets to cover every track change. What I would like to achieve is only reset albumart.properties.id.value = 0 when the album changes and in the new situation for the current albumart.properties.id.value no art is found.
Title: Re: JScript Panel
Post by: Defender on 2024-03-06 14:42:52
Cool ! Would it be possible to add a ReplayGain button ?

Try this ...

/*
   Mod 2024-03-06 v3
   ------------------
   Optional ReplayGain button (rg_enable):
   ReplayGain   - Dropdown to ReplayGain modes: Disable, Track, Album and Playbackorder

   Choose (mod_version) between two different versions of ReplayGain button behavior
   2= Every mode has different char/icon (all white)
   3= Same as above but Disable mode has same char/icon as Track mode with contrast colour (red)

   Rightclick:
   Stop      - Stop after Current (same as the original script - not modified)
   Previous   - Seek back 10 sec
   Play      - Starts Random track
   Next      - Seek forward 10 sec
   ReplayGain   - Reset to ReplayGain Track mode

   Mousewheel on Art:
   Cycles through Album Art - Cover/Back/CD/Icon/Artist - Resets every trackchange to Cover
*/

Title: Re: JScript Panel
Post by: Jacob91 on 2024-03-06 16:19:15
Cool ! Would it be possible to add a ReplayGain button ?


Try this ...

/*
   Mod 2024-03-06 v3
   ------------------
   Optional ReplayGain button (rg_enable):
   ReplayGain   - Dropdown to ReplayGain modes: Disable, Track, Album and Playbackorder

   Choose (mod_version) between two different versions of ReplayGain button behavior
   2= Every mode has different char/icon (all white)
   3= Same as above but Disable mode has same char/icon as Track mode with contrast colour (red)

   Rightclick:
   Stop      - Stop after Current (same as the original script - not modified)
   Previous   - Seek back 10 sec
   Play      - Starts Random track
   Next      - Seek forward 10 sec
   ReplayGain   - Reset to ReplayGain Track mode

   Mousewheel on Art:
   Cycles through Album Art - Cover/Back/CD/Icon/Artist - Resets every trackchange to Cover
*/

Thanks a lot ! I like It ! 👍👏

(https://i.imgur.com/dcmOmYi.jpeg)
Title: Re: JScript Panel
Post by: Defender on 2024-03-06 17:41:11
Marc,

Two questions.
1) I've implemented fallback images in case of no Cover, Back, Disc and Artist by adding the location of these pictures at the various bottoms of Preferences - Display - Album Art. There is no definition though for Icon. So if Icon is not included in the containing audiofile the Art displayer shows nothing. How can I set the location for the Icon fallbackimage?
2) In case of streaming no Art is displayed (I did activate Per second updates both in the scripts JS3 config and in the parent PSS panel. In case of streaming in per second %artist% is known. I attached a screenshot of my debug panel. Could this be activated in the JS3 panel script as well?

Thx
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-06 18:26:06
Text display doesn't officially support anything other than front cover art but I guess can you replace the existing on_playback_dynamic_info_track with this....

Code: [Select]
function on_playback_dynamic_info_track(type) {
if (type == 0) {
text.metadb_changed();
if (albumart.properties.id.value == 4) {
albumart.metadb_changed();
}
} else if (type == 1) {
if (albumart.properties.id.value == 0) {
albumart.metadb_changed();
}
}
}

Now %artist% from streams should be recognised.
Title: Re: JScript Panel
Post by: Defender on 2024-03-06 19:03:36
Text display doesn't officially support anything other than front cover art but I guess can you replace the existing on_playback_dynamic_info_track with this....

Code: [Select]
function on_playback_dynamic_info_track(type) {
if (type == 0) {
text.metadb_changed();
if (albumart.properties.id.value == 4) {
albumart.metadb_changed();
}
} else if (type == 1) {
if (albumart.properties.id.value == 0) {
albumart.metadb_changed();
}
}
}

Now %artist% from streams should be recognised.

Doesn't do the trick unfortunately. Text display has no issues and shows the actual %artist% like before,

Just like I asked for no Icon, can a fallback image be defined for no Cover in case of streaming? The defines in Preferences - Display - Albumart only accept patterns for $findfile.
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-06 19:10:57
When I ignore stuff like the icon thing, it means I don't give a shit. Asking again isn't going to get you anywhere.

I guess I misunderstood the artist/stream thing. I thought you wanted to display local images you had saved with %artist% from radio streams. /shrug
Title: Re: JScript Panel
Post by: Defender on 2024-03-06 19:13:19
When I ignore stuff like the icon thing, it means I don't give a shit. Asking again isn't going to get you anywhere.

I guess I misunderstood the artist/stream thing. I thought you wanted to display local images you had saved with %artist% from radio streams. /shrug

Good we agree. I don't give a shit about Icon too,
Can you remove it from the Albumart cycle?
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-09 02:38:57
3.4.15

Nothing new, just some bug fixes.

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

https://github.com/jscript-panel/release/releases/tag/latest
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-10 20:55:19
3.4.16

Mainly playlist fixes

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

https://github.com/jscript-panel/release/releases/tag/latest
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-14 12:49:53
3.4.17

This includes new and updated samples already shared in the discussion thread.

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

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

Not in the changelog but I have modified the appearance of certain headers in text only/list based scripts like this updated screenshot:

https://jscript-panel.github.io/gallery/lastfm-bio/
Title: Re: JScript Panel
Post by: josemescud on 2024-03-14 19:41:27
Hi Mark, thanks for your input.
I have a few questions about Smooth Brower.
I have selected to sort by Album. It paints the cover art, Album name, year and Artist. It does it correctly.
I have Artists that released 2 or 3 albums per year. To get it to sort correctly by release date I usually put:
Example
1991-1
1991-2
1991-3
But Smooth Browser paints 0000 in the year.
I have tried different ways which I explain:
1991 = 1991
1991-1 = 0000
1991-01 = 1991
1991/1 = 0000
1991-a = 0000
1991a = 0000
1991 a = 0000
How could I make Smooth Browser be able to paint 5, 6 and 7 digits in the year.
1991-1 = 1991-1 or 1991-01 = 1991-01
Thanks
Title: Re: JScript Panel
Post by: marc2k3 on 2024-03-14 20:55:16
It uses $year(%date%) by default. I'll change it to %date% in the next release. If you want to fix it now, search inside the component folder\samples\smooth\jssb.js
Title: Re: JScript Panel
Post by: JesalRo on 2024-03-14 21:00:19
Hi Mark, thanks for your input.
I have a few questions about Smooth Brower.
I have selected to sort by Album. It paints the cover art, Album name, year and Artist. It does it correctly.
I have Artists that released 2 or 3 albums per year. To get it to sort correctly by release date I usually put:
Example
1991-1
1991-2
1991-3
But Smooth Browser paints 0000 in the year.
I have tried different ways which I explain:
1991 = 1991
1991-1 = 0000
1991-01 = 1991
1991/1 = 0000
1991-a = 0000
1991a = 0000
1991 a = 0000
How could I make Smooth Browser be able to paint 5, 6 and 7 digits in the year.
1991-1 = 1991-1 or 1991-01 = 1991-01
Thanks

Hi, I also usually name the albums of the same year and same artist as you do and indeed the same thing happens to me as you do. I have tried the examples you mention and what you say is correct.
Let's wait to see if Mark can give us a solution and paint more than 4 digits.
Thanks