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: Spider Monkey Panel (foo_spider_monkey_panel) (Read 348721 times) previous topic - next topic
always.beta and 1 Guest are viewing this topic.

Re: Spider Monkey Panel (foo_spider_monkey_panel) - Knops

Reply #625
There's some knobs, some with javascript, hosted on this site ~ https://codepen.io/tag/knob/

implementing one's a little beyond me at this point, perhaps someone with more know how will find this useful
Quis custodiet ipsos custodes?  ;~)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #626
Not sure if this has been brought up, but can very old WSH scripts be updated to work in SMP? This one in particular has probably never been updated from its original release there. Happened to stumble across it in an old config I had tucked away and thought I'd ask.
Guess your linked WSH Coverflow is the basis for this script running well in my config within JScript Panel 2.5.2 from marc2k3/ @snotlicker . Not really maintained by anybody, but there is still some helping hand from @snotlicker or @MordredKLB (Thanks!!)



Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #629
Code: [Select]
			// Doesn't work
arr.push({
'REPLAYGAIN_ALBUM_GAIN' : '',
'REPLAYGAIN_ALBUM_PEAK' : '',
'REPLAYGAIN_TRACK_GAIN' : '',
'REPLAYGAIN_TRACK_PEAK' : ''
});
sel_items.UpdateFileInfoFromJSON(JSON.stringify(arr));
// Works
fb.RunContextCommandWithMetadb("ReplayGain/Remove ReplayGain information from files", sel_items, 8);

Why UpdateFileInfoFromJSON is not able to clear ReplayGain tags?


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #631
So it's a foobar's limit. Yep masstagger has the same limit too.
Had no idea it was so hardcoded, I thought it was just a soft limit to force users to use the proper UI. Makes no sense to me to block it on scripts/components too, but thanks! Will use the component menu.


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #633
I am using the script Album Art. I wonder if it is possible to set it to autorefresh on folder change?

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #634
Simple popups are already possible and have been in my samples for years.
I knew I've seen it somewhere!
it's being too long since I've last coded anything non-trivial on SMP/JSP...

I can see the bug with utils.FileTest here...

https://github.com/TheQwertiest/foo_spider_monkey_panel/blob/150e49cdc072762b1a6b6a90d7e5be1158bbba50/foo_spider_monkey_panel/js_objects/utils.cpp#L298

It should use stem(), not filename().
Thanks!

utils.Glob(folderPath + '*.m3u') matches '*.m3u8' too on win 7.
Yep, as Marc have said, it's a WinAPI bug (*sigh*): https://stackoverflow.com/a/44933735
That said, I'll see if I can reimplement this method to avoid this.

Also check PathWildcardMatch()
PathWildcardMatch (reportedly) does not have such a bug.

 

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #635
One more question, maybe I'm missing something. Is there some way to have a "on_mouse_lbtn_dblclk(x, y)"  and "on_mouse_lbtn_up(x, y)"  at the same time for the same item?
For ex: I have this UI, if I click lbtn then it shows a contextual menu. If I try to double click, I want it to load the playlist.
As workaround, I have used a modifier key and it's good enough for me. But wanted to know anyway.

EDIT: nevermind. I see I can use setTimeout() to delay the contextual menu and then it works. But double clicking will not cancel its the execution of the delayed function so...

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #636
One more question, maybe I'm missing something. Is there some way to have a "on_mouse_lbtn_dblclk(x, y)"  and "on_mouse_lbtn_up(x, y)"  at the same time for the same item?
For ex: I have this UI, if I click lbtn then it shows a contextual menu. If I try to double click, I want it to load the playlist.
As workaround, I have used a modifier key and it's good enough for me. But wanted to know anyway.

EDIT: nevermind. I see I can use setTimeout() to delay the contextual menu and then it works. But double clicking will not cancel its the execution of the delayed function so...
That's just the way SMP/JSP/WSH work: double click produces the following events:
Code: [Select]
on_mouse_lbtn_down
on_mouse_lbtn_up
on_mouse_lbtn_dblclk
on_mouse_lbtn_up

So yeah, you have to take in account all the possible scenarios (if you want to handle both click and double click) . For example, you can store `is_mouse_down` and `was_double_clicked` states (e.g. https://github.com/TheQwertiest/CaTRoX_QWR/blob/61eecfa4159e3714d58f53ae942d5f1861e83fb2/theme/Scripts/Control_List.js#L230).
[EDIT]: See the post below.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #637
Oh, I think I've misunderstood what you are trying to achieve.
Your scenario is impossible to implement properly (i.e. without delays), since to know if the event is click or a double-click one must know the future =)
That's why 99% of the time single-click invokes an action that is a part of a double-click action or at the very least does not contradict a double-click action. E.g. click - `Select`, dblclick - `Execute the selected item`; click - `Select the whole string`, dblclick - `Select only one word from the string`.

IMO, you should rework your scenario and remove the context menu from the click action.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #638
Oh, I think I've misunderstood what you are trying to achieve.
Your scenario is impossible to implement properly (i.e. without delays), since to know if the event is click or a double-click one must know the future =)
That's why 99% of the time single-click invokes an action that is a part of a double-click action or at the very least does not contradict a double-click action. E.g. click - `Select`, dblclick - `Execute the selected item`; click - `Select the whole string`, dblclick - `Select only one word from the string`.

IMO, you should rework your scenario and remove the context menu from the click action.
Yep, was that.
I have managed to do it though, with delays...
Code: [Select]
	this.lbtn_up = (x, y) => { // on_mouse_lbtn_up(x, y)
...
if (!this.bDoubleclick) { // it's not a second lbtn click
this.timeOut = this.delayedEdit(x,y, undefined, this.index);
} else {this.bDoubleclick = false;}
...
}
this.lbtn_dblclk = (x, y) => { // Called by on_mouse_lbtn_dblclk(x, y)
clearTimeout(this.timeOut);
this.timeOut = null;
this.bDoubleclick = true;
...doyourthing
}
this.edit = (x, y, menuIdx = null, forcedIndex = null) => { // use index from on_mouse_move(x, y), so you have to forceIndex from first call
...doyourthing
}
this.delayedEdit = delayFn(this.edit, 100);
this.timeOut = null;
this.bDoubleclick = false;

on helpers
Code: [Select]
const delayFn = (func, ms) => {
return (...args) => {return setTimeout(func.bind(this, ...args), ms);}
}

I have to pass the index to this.edit() because the mouse may move after clicking once and select another thing different to the original one which fired the contextual menu, but it works flawless now.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #639
Just downloaded the nightly build (@22:30 GMT). On restart of foobar I see the following a stack of many popup windows all with the same message:
WinAPI error:
  IIDFromString failed with error (0x80070057):
    The parameter is incorrect.

This also appears in the console. Unable to use foobar at this point. I have resorted to a previous nightly build and all is okay. I have lost WilB's library tree and biography panel contents, properties but I've managed to recover 90%.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #640
More questions. I got a panel like this, with drag n drop enabled.
X

I have 2 use cases:
- "Moving" tracks to a playlist item at the panel.
Quote
(Spider Monkey Panel specific) All mouse callbacks are suppressed during drag operation (including on_mouse_lbtn_up, but excluding on_mouse_mbtn_up and on_mouse_rbtn_up).
But according to the documentation, I can not track the mouse movement within the panel (?) to check the index the mouse is over. So judging the dragndrop sample  I should use on_drag_enter() , etc. with the same functions I already have at on_mouse_move(x, y) to check the index I'm over, and then link that index to the handles I drop. Right?

--  "Moving" files to the panel (which is linked to a folder). I'm talking about the physical playlist file here.
As far as I have seen, all the drag n drop functions expect at some point handles... and moving a file within foobar treats it automatically as a track, or a collection of tracks if it's a playlist. Is there some way to get the actual playlist file path (and not its tracks) when using drag n drop? i.e. make no assumption about what the files are, and just get their path.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #641
This script works in JSP , but not in SMP.

Code: [Select]
var xml = '<person><name>John Doe</name></person>';

var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(xml);

var data = xmlDoc.getElementsByTagName('name');
console.log(data[0].childNodes[0].nodeValue);


Any ideas why ??

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #642
Just downloaded the nightly build (@22:30 GMT). On restart of foobar I see the following a stack of many popup windows all with the same message:
WinAPI error:
  IIDFromString failed with error (0x80070057):
    The parameter is incorrect.

This also appears in the console. Unable to use foobar at this point. I have resorted to a previous nightly build and all is okay. I have lost WilB's library tree and biography panel contents, properties but I've managed to recover 90%.
Darn, I'm sorry for these problems. I'll fix it ASAP.


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #644
This the latest working version:
Spider Monkey Panel v1.3.2-beta+5e1f7be3 by TheQwertiest
Based on JScript Panel by marc2003
Based on WSH Panel Mod by T.P. Wang

Build: 00:22:51, Feb  4 2021
Columns UI SDK Version: 6.5


Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #646
- "Moving" tracks to a playlist item at the panel.
Quote
(Spider Monkey Panel specific) All mouse callbacks are suppressed during drag operation (including on_mouse_lbtn_up, but excluding on_mouse_mbtn_up and on_mouse_rbtn_up).
But according to the documentation, I can not track the mouse movement within the panel (?) to check the index the mouse is over. So judging the dragndrop sample  I should use on_drag_enter() , etc. with the same functions I already have at on_mouse_move(x, y) to check the index I'm over, and then link that index to the handles I drop. Right?
Yes, on_mouse_move is replaced with on_drag_over.

--  "Moving" files to the panel (which is linked to a folder). I'm talking about the physical playlist file here.
As far as I have seen, all the drag n drop functions expect at some point handles... and moving a file within foobar treats it automatically as a track, or a collection of tracks if it's a playlist. Is there some way to get the actual playlist file path (and not its tracks) when using drag n drop? i.e. make no assumption about what the files are, and just get their path.
Noted, but I don't think this will be implemented in this release.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #647
@Qwertiest
Not sure if this helps you but I've tried the nightly build:
Spider Monkey Panel v1.3.2-beta+dd28ed6b by TheQwertiest
Based on JScript Panel by marc2003
Based on WSH Panel Mod by T.P. Wang

Build: 19:12:53, Feb  5 2021
Columns UI SDK Version: 6.5

And all working fine.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #648
This the latest working version:
Spider Monkey Panel v1.3.2-beta+5e1f7be3 by TheQwertiest
Based on JScript Panel by marc2003
Based on WSH Panel Mod by T.P. Wang

Build: 00:22:51, Feb  4 2021
Columns UI SDK Version: 6.5
Should be fixed in the latest nightly.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #649
Thank you so much.