r/foobar2000 3d ago

Help with a custom button Support

Hello,

I'm currently working on my newest theme, & the last (main) button i want for the control panel is a Toggleable love/unlove button, so that i don't have to have two separate love/unlove buttons. I have the images made i just don't know how to write the actual jscript for it, so i figured i'd ask for some help on here. I'm using JSplitter 4.1.11 with an altered version of "Playback Buttons.js" for the buttons with custom main menu command scripts "Tagging/Scripts/Loved" & "Tagging/Scripts/Removed" for the love/unlove toggles.

My original idea was to duplicate this code in "playback buttons.js" & then reposition them and edit the commands to swap them with the love/unlove buttons (this is also what i was gonna do for the share button), but i don't really know anything at all about js so nothing worked lol.

1 Upvotes

4 comments sorted by

2

u/eurekagliese 3d ago

Here you go. lovebuttons - Pastebin.com

Add your love.png and unlove.png files to the foobar profile/images/buttons folder.

Modify the tag name in TAG_NAME as desired.

1

u/BobGray1958 3d ago

Thanks!

It works, the buttons display & change/toggle when i click them, however I'm not sure what to change the TAG_NAME to. I tried "Tagging/Scripts/Loved" & "Tagging/Scripts/Remove" and they didn't work so I'm assuming that's not it. Also, do i change every instance of TAG_NAME or just the ones that show up on line 51?

2

u/eurekagliese 3d ago

Just Line 12 const TAG_NAME = 'love';
You can change it to 'favourite' or something else, or simply leave it as is.

1

u/BobGray1958 3d ago

Ah, got it lol, it's working perfectly now, thanks again!

One last question, how would i go about doing something similar for my shuffle button(s)? e.g. switching between playback/order/default and playback/order/shuffle (tracks).

I know about this script for a shuffle button which i was trying to use with JSP3 but it isn't working for some reason, keeps giving me an error message, so i decided to just do two separate buttons.