Skip to main content

Notice

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

Re: JScript Panel

Reply #1075
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).

Re: JScript Panel

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

Re: JScript Panel

Reply #1077
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).

Re: JScript Panel

Reply #1078
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)


Re: JScript Panel

Reply #1080
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>

Re: JScript Panel

Reply #1081
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  ;)


Re: JScript Panel

Reply #1083
Hi, @marc2k3
damn typo  8)
thank you for "chars.close will look better than 'X'"

Re: JScript Panel

Reply #1084
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??

Re: JScript Panel

Reply #1085
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);

Re: JScript Panel

Reply #1086
@mark2k3 thy a lot :-)

Re: JScript Panel

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

Re: JScript Panel

Reply #1088
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)

Re: JScript Panel

Reply #1089
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)

Re: JScript Panel

Reply #1090
Ahh, thank you

Re: JScript Panel

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

Re: JScript Panel

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

Re: JScript Panel

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

Re: JScript Panel

Reply #1094
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

Re: JScript Panel

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

Re: JScript Panel

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

Re: JScript Panel

Reply #1097
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

Re: JScript Panel

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



Using dynamic colours...



Just remember, you won't always get a nice contrast like that. Being computed automatically means the the results can be rather dull. YMMV.  :))

Re: JScript Panel

Reply #1099
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://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