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 294938 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.


Re: JScript Panel

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


Re: JScript Panel

Reply #754
Thank you for your reply

> JS Smooth Browser can now show Media Library contents only.

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

Re: JScript Panel

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

Re: JScript Panel

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



Re: JScript Panel

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


Re: JScript Panel

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

Re: JScript Panel

Reply #760
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;


Re: JScript Panel

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





Re: JScript Panel

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

Re: JScript Panel

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

Re: JScript Panel

Reply #765
really great improvement especially that directwrite be introduced;
scripts like js-smooth-playlist require only about 4ms to draw a frame.
A rose will bloom, it then will fade.

Re: JScript Panel

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


Re: JScript Panel

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


Re: JScript Panel

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



Re: JScript Panel

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

Re: JScript Panel

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


Re: JScript Panel

Reply #774
So many new and nice features! I better mentally prepare to rewrite my scripts after first release.