Thank you very much for the update and the guide @marc2k3
---
This is a composite image of an image from the foo_uie_webview thread, so I don't know. Sorry.
No worries, mate. With latest JSP update, we can also replicate it on a text display.
The script and image files with the PNG and SVG icons are available below.
In your foobar config folder, extract it to the images folder.
Just modify the link on script or the icons as needed.
// ==PREPROCESSOR==
// @name "Text Display + Album Art + Custom SVG and PNG 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\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/
//.svg files
var google = utils.LoadSVG(fb.ProfilePath + 'images\\google.svg');
var youtube = utils.LoadSVG(fb.ProfilePath + 'images\\youtube.svg');
var spotify = utils.LoadSVG(fb.ProfilePath + 'images\\spotify.svg');
var wikipedia = utils.LoadSVG(fb.ProfilePath + 'images\\wikipedia.svg');
var lastfm = utils.LoadSVG(fb.ProfilePath + 'images\\lastfm.svg');
var search = utils.LoadSVG(fb.ProfilePath + 'images\\search.svg');
var settings = utils.LoadSVG(fb.ProfilePath + 'images\\settings.svg');
//.png files
var discogs = utils.LoadImage(fb.ProfilePath + 'images\\discogs.png');
var tfo = {
artist: fb.TitleFormat('%artist%'),
title: fb.TitleFormat('%title%'),
// playback_time : fb.TitleFormat('[%playback_time%]'),
// length : fb.TitleFormat('$if2(%length%,LIVE)'),
}
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 font = CreateFontString('Segoe UI', 12);
var buttons = new _buttons();
var bs = _scale(24);
var bottom_y = 0;
buttons.update = function () {
var x = (panel.w - (bs * 7)) / 2
var y = seekbar.y + _scale(12);
this.buttons.google = new _button(x, y, bs, bs, { img : google }, null, function () { utils.Run('https://www.google.com/search?tbm=isch&q=' + encodeURIComponent(tfo.artist.Eval() + " " + tfo.title.Eval())); }, 'Google');
this.buttons.youtube = new _button(x + bs, y, bs, bs, { img : youtube }, null, function () { utils.Run('http://www.youtube.com/results?search_query=' + encodeURIComponent(tfo.artist.Eval() + " " + tfo.title.Eval())); }, 'youtube');
this.buttons.spotify = new _button(x + (bs * 2), y, bs, bs, { img : spotify}, null, function () { utils.Run('https://open.spotify.com/search/' + encodeURIComponent(tfo.artist.Eval() + " " + tfo.title.Eval())); }, 'spotify');
this.buttons.wikipedia = new _button(x + (bs * 3), y, bs, bs, { img : wikipedia }, null, function () { utils.Run('http://en.wikipedia.org/wiki/Special:Search?search=' + encodeURIComponent(tfo.artist.Eval())); }, 'wikipedia');
this.buttons.lastfm = new _button(x + (bs * 4), y, bs, bs, { img : lastfm }, null, function () { utils.Run('https://www.last.fm/search?q=' + encodeURIComponent(tfo.artist.Eval())); }, 'lastfm');
this.buttons.discogs = new _button(x + (bs * 5), y, bs, bs, { img : discogs }, null, function () { utils.Run('http://www.discogs.com/search?q=' + encodeURIComponent(tfo.artist.Eval())); }, 'discogs');
this.buttons.search = new _button(x + (bs * 6), y, bs, bs, { img : search }, null, function () { fb.RunMainMenuCommand('Library/Search'); }, 'Library Search');
this.buttons.preferences = new _button(x + (bs * 7), y, bs, bs, { img : settings}, 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) {
window.SetCursor(buttons.buttons.google.containsXY(x, y) ? IDC_HAND
: buttons.buttons.youtube.containsXY(x, y) ? IDC_HAND
: buttons.buttons.spotify.containsXY(x, y) ? IDC_HAND
: buttons.buttons.wikipedia.containsXY(x, y) ? IDC_HAND
: buttons.buttons.lastfm.containsXY(x, y) ? IDC_HAND
: buttons.buttons.discogs.containsXY(x, y) ? IDC_HAND
: buttons.buttons.search.containsXY(x, y) ? IDC_HAND
: buttons.buttons.preferences.containsXY(x, y) ? IDC_HAND
: IDC_ARROW);
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;
// }
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.IsPlaying) {
// var time_width = seekbar.x - _scale(12);
// gr.WriteText(tfo.playback_time.Eval(), font, colours.white, 0, bottom_y, time_width, _scale(12), 1, 2);
// gr.WriteText(tfo.length.Eval(), font, colours.white, seekbar.x + seekbar.w + _scale(12), bottom_y, time_width, _scale(12), 0, 2);
// if (fb.PlaybackLength > 0) {
// gr.FillEllipse(seekbar.x + seekbar.pos(), seekbar.y + _scale(3), _scale(6), _scale(6), colours.white);
// }
// }
}
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) 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();
// window.RepaintRect(0, bottom_y, panel.w, panel.h - bottom_y);
// }
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 = panel.h - _scale(44);
seekbar.w = panel.w - (seekbar.x * 2);
seekbar.h = _scale(6);
bottom_y = seekbar.y - _scale(4);
buttons.update();
}