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

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #750
Quote
Yes, that's intentional. Package contains all the necessary info about the included scripts, so there is no need to define it in the script itself.

The primary (and the only) purpose of `DefinePanel`/`DefineScript` is to provide the user with the information about the script in case it fails. I.e. it's for troubleshooting only.

In your case, there is zero need for `DefineScript` and it can be easily substituted with smth like
Code: [Select]

if (typeof loaded_scripts === 'undefined') {
    loaded_scripts = {}
}
if (!(script_id in loaded_scripts)) {
   load_script(script_id);
  loaded_scripts[script_id] = true;
}


PS: `window.DefinePanel` is marked as deprecated
That doesn't solve the problem entirely. DefinePanel/defineScript marks the current script as the main one, thus marking the rest (independently of the order they get loaded or the number) as secondary ones and merging them (since consecutive calls throw an error). While your approach has nothing to do with that (or requires a lot more of coding to do the same), but loading multiple known scripts (which can not be duplicated).
I don't need the script_ids at all. I don't even need to know what the main script is at any given point.

I just load:
button bar 1, button 3, button 3, button 6, ... button bar calls define panel once, thus telling the other buttons to be loaded as merged buttons.
But that works the same if I simply add to any panel:
button bar 1, button 5
Or:
button 3

And I don't have to touch the code at all, just include them. Every time DefinePanel/defineScript is called exactly once on the first file. And the same files can be reused as independent buttons scripts, merged as bars or inside other panels. Obviously I could just create a shared var bool bMainLoaded (instead of storing all IDs like you do), but I find DefinePanel/defineScript much cleaner, since it also gives the panel a name (both things done in one step). I guess is your design choice, but that choice clearly creates differences on how the same code works on packages and standalone scripts (definePanel may be deprecated but DefineScript is not and has the same problem).

Code: [Select]
'use strict';

/*
Just a bar of the same search by distance buttons customizable! So every instance can have its own name and do its own different thing.
*/

try { //May be loaded along other buttons
window.DefinePanel('Merged SBD Custom Buttons bar', {author:'xxx'});
include(fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\helpers\\buttons_xxx.js');
var g_font = gdi.Font('Segoe UI', 12);
var buttonCoordinates = {x: 0, y: 0, w: 98, h: 22};
var buttonOrientation = 'x';
} catch (e) {
buttonCoordinates = {x: 0, y: 0, w: buttonOrientation == 'x' ? 98 : buttonCoordinates.w , h: buttonOrientation == 'y' ? 22 : buttonCoordinates.h}; // Reset
console.log('Merged SBD Custom Buttons bar loaded.');
}

// Global width - Height overrides
buttonCoordinates.w += 0; // Only works for 'y' orientation
buttonCoordinates.h += 0; //For 'x' orientation

// Global toolbar color
bToolbar = false; // Change this on buttons bars files to set the background color
toolbarColor = RGB(211,218,237);


{ // Buttons
let buttonsPath = [ // Add here your buttons path
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_bydistance_customizable.js',
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_bydistance_customizable.js',
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_bydistance_customizable.js',
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_bydistance_customizable.js',
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_bydistance_customizable.js',
fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_bydistance_customizable.js',
];

for (let i = 0; i < buttonsPath.length; i++) {
if ((isCompatible('1.4.0') ? utils.IsFile(buttonsPath[i]) : utils.FileTest(buttonsPath[i], "e"))) {
include(buttonsPath[i], {always_evaluate: true});
} else {
console.log(buttonsPath[i] +' not loaded');
}
}

/*
OR just add them manually:
include(fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\buttons\\buttons_search_same_style.js', {always_evaluate: true});
...
*/
}

Code: [Select]
'use strict';

try { //May be loaded along other buttons
window.DefinePanel('Search by Distance Customizable Button', {author:'xxx'});
include(fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\helpers\\buttons_xxx.js');
var g_font = gdi.Font('Segoe UI', 12);
var buttonCoordinates = {x: 0, y: 0, w: 98, h: 22};
var buttonOrientation = 'x';
} catch (e) {
buttonCoordinates = {x: 0, y: 0, w: buttonOrientation == 'x' ? 98 : buttonCoordinates.w , h: buttonOrientation == 'y' ? 22 : buttonCoordinates.h}; // Reset
console.log('Search by Distance Buttons loaded.');
}
include(fb.ProfilePath + 'scripts\\SMP\\xxx-scripts\\search_bydistance.js'); // Load after buttons_xxx.js so properties are only set once
var prefix = "sbd_";
prefix = getUniquePrefix(prefix, "_"); // Puts new ID before "_"

var newButtonsProperties = { //You can simply add new properties here
customName: ['Name for the custom UI button', 'Customize!']
};
newButtonsProperties = {...SearchByDistance_properties, ...newButtonsProperties}; // Add default properties at the beginning to be sure they work
setProperties(newButtonsProperties, prefix); //This sets all the panel properties at once

// we change the default coordinates here to accommodate text
if (buttonOrientation == 'x') {buttonCoordinates.w -= 5;}

/*
Some button examples for "search_bydistance.js". Look at that file to see what they do.
*/

var newButtons = {
    SimilarUserSet: new SimpleButton(calcNextButtonCoordinates(buttonCoordinates, buttonOrientation, buttonOrientation == 'x' ? true : false).x, calcNextButtonCoordinates(buttonCoordinates, buttonOrientation, buttonOrientation == 'x' ? false : true).y, buttonCoordinates.w, buttonCoordinates.h, getProperties(newButtonsProperties, prefix)['customName'], function () {
let t0 = Date.now();
let t1 = 0;
const properties = getPropertiesPairs(this.buttonsProperties, this.prefix);
if (properties['customName'][1] == 'Customize!') {
const new_name = utils.InputBox(window.ID, 'Enter button name. Then configure properties according to your liking (look for "' + this.prefix + '...").', window.Name + ': Search by Distance Customizable Button');
            if (!new_name.length) {
                return;
            } else {
this.buttonsProperties['customName'][1] = new_name;
setProperties(this.buttonsProperties, this.prefix, undefined, undefined, true); // Force overwriting
window.ShowProperties(); // This also forces a reload if you press ok/apply, but pressing cancel doesn't! That would leave the button with the old name... even if the property is already set
window.Reload(); // Forces redraw with new name
}
} else {
do_searchby_distance({properties: properties}); // All set according to properties panel!
}
t1 = Date.now();
console.log("Call to do_searchby_distance " + getProperties(this.buttonsProperties, this.prefix)['customName'] + " took " + (t1 - t0) + " milliseconds.");
}, null, g_font,'Search according to user set variables at properties panel', prefix, newButtonsProperties)
};
// Check if the button list already has the same button ID
for (var buttonName in newButtons) {
if (buttons.hasOwnProperty(buttonName)) {
// fb.ShowPopupMessage('Duplicated button ID (' + buttonName + ') on ' + window.Name);
console.log('Duplicated button ID (' + buttonName + ') on ' + window.Name);
Object.defineProperty(newButtons, buttonName + Object.keys(buttons).length, Object.getOwnPropertyDescriptor(newButtons, buttonName));
delete newButtons[buttonName];
}
}
buttons = {...buttons, ...newButtons};

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #751
Bug:

Try copying this into any property:
Code: [Select]
style,Psychedelic Folk;style,Latin Rock;style,Electropop;style,Jam;style,Modal Jazz;style,Chicano Rock;style,Soul Blues;style,Thrash Metal;style,Contemporary Jazz;style,British Blues;style,Italian Prog. Rock;style,Jazz-Rock;style,Southern Soul;style,Raga Rock;style,Doom Metal;style,Shoegaze;style,Contemporary Blues;style,Tulsa Sound;style,Jazz-Rap;style,Chanson;style,Guitar Jazz;style,Power Pop;style,Aussie Rock;style,Britpop;style,Eclectic Prog;style,Arena Rock;style,Glam Rock;style,Romantic;style,Classic Grunge;style,Boogie Rock;style,Noise Rock;style,Post-Grunge;style,Desert Blues;style,New Wave;style,Cantautor;style,Freak Folk;style,Heartland Rock;style,Post-Punk Revival;style,Space Rock;style,Post-Bop;style,Ambiental;style,Alt. Country;style,Bebop;style,Conscious;style,Spanish Folk;style,Fusion;style,Outlaw Country;style,Pop Metal;style,Classic Metal;style,Neo Soul;style,Beat Music;style,Alt. Rap;style,British Metal;style,Chicago Blues;style,Jam Band;style,British Folk-Rock;style,Roots Rock;style,Folk Pop;style,Rockabilly;style,Lo-Fi;style,Soft Rock;style,Baroque Pop;style,R&B;style,Heavy Prog;style,Country Folk;style,Garage Rock Revival;style,Acoustic;style,Garage Rock;style,Symphonic Prog;style,Experimental;style,Hard-Bop;style,Country Rock;style,Neo-Psychedelia;style,Stoner Rock;style,Traditional Pop;style,Crossover Prog;style,Piano Jazz;style,Southern Rock;style,Spanish Rock;style,Swing;style,Songwriter;style,Hi-Fi;style,Pop Rock;style,Indie;style,Acid Rock;style,Americana;style,Electric Blues;style,Blues Rock;style,Live;style,Classic Rock;style,Female Vocal;style,Garage Pop;style,Honky Tonk;style,Hip-Hop Soul;style,Easy Listening;style,Chill-Out Downtempo;style,Nu Jazz;style,Jazz-Pop;style,Old-School;style,Jump Blues;style,Punk Pop;style,Hindustani;style,German Rock;style,Son;style,Jazz-Funk;style,Future Bass;style,House;style,Traditional Country;style,Isicathamiya;style,Comedy;style,Celtic Punk;style,Lounge;style,Proto-Punk;style,Niger Folk;style,Traditional American Folk;style,Psychedelic Grunge;style,Nashville Sound;style,Mexican Rock;style,Dub;style,Renaissance;style,Proto-Prog;style,Folk Metal;style,Uruguayan Rock;style,Folk Punk;style,Modernist;style,Israeli Rock;style,Underground Rap;style,Hair Metal;style,Contemporary Classical;style,Jazz Drumming;style,Folktronica;style,Nubian Folk;style,Melodic Hardcore;style,Funk Metal;style,Reggae Fusion;style,Philadelphia Soul;style,Rap Metal;style,Close Harmony;style,Gypsy-Jazz;style,New Acoustic;style,Flamenco Rock;style,Deep Funk Revival;style,Canterbury Scene;style,Disco;style,Trap;style,Brill Building Sound;style,Spanish Hip-Hop;style,Classic Funk;style,Detroit Blues;style,Gothic Metal;style,Black Metal;style,Electro;style,British Folk-Jazz;style,P-Funk;style,Sludge Metal;style,Contemporary Country;style,Pop Rap;style,Pop Folk;style,Vaudeville Blues;style,New Orleans R&B;style,Synth-Pop;style,Post-Rock;style,Proto-Stoner Rock;style,Baroque;style,Hardcore Punk;style,Tex-Mex;style,Avant-Garde Jazz;style,Horrorcore;style,South Coast;style,Motown Sound;style,Instrumental Country;style,Smooth Jazz;style,Riot Grrrl;style,Cowpunk;style,Glam Metal;style,Memphis Blues;style,Big Band;style,Irish;style,Rockabilly Revival;style,Midwest;style,Torch Songs;style,Free Jazz;style,Medieval;style,Roots Reggae;style,Piano Blues;style,Soul-Jazz;style,Vocal Pop;style,Symphonic Metal;style,Bossa Nova;style,Cool Jazz;style,Psychedelic Soul;style,Latin-Jazz;style,Afro-Cuban;style,Grunge Metal;style,Celtic New Age;style,Surf Rock;style,Hardcore;style,Gangsta;style,Country Pop;style,Delta Blues;style,Pop Punk;style,Grunge Punk;style,American Primitive Guitar;style,Modern Electric Blues;style,East Coast;style,Texas Blues;style,Dixieland;style,Country Boogie;style,Free Improvisation;style,Hill Country Blues;style,Retro Rock;style,Post-Punk;style,Grunge Rock;style,Bluegrass;style,Sadcore;style,Progressive Metal;style,Ska Punk;style,Rock Opera;style,Alt. Metal;style,Mainstream Jazz;style,Pub Rock;style,Sunshine Pop;style,Garage Punk;style,Instrumental Rock;style,Speed Metal;style,Malian Folk;style,Flamenco;style,Trip Hop;style,Bal Folk;style,Detroit Rock;style,Geek Rock;style,Folk Baroque;style,Tishoumaren;style,Smooth Soul;style,Proto-Metal;style,Pagan Folk;style,Traditional European Folk;style,Nu Metal;style,Country Blues;style,Celtic;style,Krautrock;style,West Coast;style,Dream Pop;style,Harmonica Blues;style,Psychedelic Funk;style,Contemporary Funk;style,Psychedelic Rap;style,Argentinian Folk;style,Funk Rock;style,Punk Rock;style,Psychedelic Pop;style,British Psychedelia;style,Contemporary Folk;style,Progressive Folk;style,Argentinian Rock;style,Contemporary Rock;style,90s Rock;style,80s Rock;genre,Música Popular Brasileira;genre,Musical;genre,Indian;genre,Gospel;genre,Japanese;genre,Greek;genre,Nubian;genre,Christmas;genre,New Age;genre,Reggae;genre,Soundtrack;genre,Electronic;genre,Funk;genre,African;genre,Classical;genre,Grunge;genre,Latin;genre,Rock & Roll;genre,Punk;genre,Hip-Hop;genre,World;genre,Pop;genre,Soul;genre,Country;genre,Jazz Vocal;genre,Heavy Metal;genre,Instrumental;genre,Jazz;genre,Folk;genre,Blues;genre,Hard Rock;genre,Alt. Rock;genre,Folk-Rock;genre,Rock;genre,Progressive Rock;genre,Psychedelic Rock;style,Venezuelan Folk;style,Neo-Prog;style,Rond;style,Andro;style,Ska Revival;style,Third Stream;style,Kabuki;style,Japanese Classical;style,Christian Rock;style,Tuareg Music;style,Deep Funk;style,Israeli;style,Afghan Folk;style,Tuvan;style,Asian Folk;style,Jazz-Blues;style,Post-Metal;style,Spoken Word;style,Cumbia;style,Gnawa;style,Candombe Beat;style,Future Jazz;style,Avant-Garde Classical;style,Gothic Rock;style,Sahrawi Folk;style,Dance-Rock;style,Calypso;style,Italian Rock;style,Old-Timey;style,Reggaeton;style,Chillwave;style,Stoner Doom;style,Psychedelic Blues;style,Funk Blues;style,Ragga Hip-Hop;style,Contemporary R&B;style,Choral;style,Polka;style,Afrobeat;style,Radio Program;style,Hang Music;style,Groove Metal;style,Europop;style,Japanese Prog. Rock;style,Jig;style,Circle;style,Traditional Folk;style,Bakersfield Sound;style,Scottish;style,Golden Age;style,Stoner Sludge;style,Bourree;style,Healing Music;style,Doo Wop;style,Zydeco;style,Mauritanian Folk;style,Rumba Fusión;style,Progressive Bluegrass;style,Industrial Metal;style,Exotica;style,Power Metal;style,British Hip-Hop;style,Vals;style,Israeli Folk;style,German Folk;style,Mazurka;style,Afro-Rock;style,Children's Music;style,Griot;style,Acid Jazz;style,Classical Period;style,Mexican Folk;style,Éntekhno;style,Instrumental Hip-Hop;style,Avant-Prog;artist,Trobar de Morte;artist,A Tribe Called Quest;artist,Bob Dylan & The Band;artist,Nancy Sinatra;artist,Ben Harper & The Innocent Criminals;artist,HIM;artist,Nneka;artist,Alice In Chains;artist,Beethoven;artist,Comus;artist,Itoiz;artist,Jamiroquai;artist,The Siegel-Schwall Band;artist,Link Wray;artist,The Kooks;artist,Uncle Tupelo;artist,Blondie;artist,Molly Hatchet;artist,Nilsson;artist,Anacrusa;artist,Buena Vista Social Club;artist,Focus;artist,Muse;artist,The Darkness;artist,Procol Harum;artist,Awon & Phoniks;artist,Poco;artist,Radio Moscow;artist,Rival Sons;artist,The Moody Blues;artist,Lauryn Hill;artist,Stills & Nash;artist,P.O.D.;artist,The Dave Brubeck Quartet;artist,The Troggs;artist,Motorpsycho;artist,Slayer;artist,The Tragically Hip;artist,Traffic;artist,Almendra;artist,Blackalicious;artist,Tito & Tarantula;artist,Fairport Convention;artist,La Raíz;artist,T. Rex;artist,Stills;artist,Nash & Young;artist,Veruca Salt;artist,Vivaldi;artist,Love;artist,Candlebox;artist,Stevie Ray Vaughan & Double Trouble;artist,The Blasters;artist,The Steve Miller Band;artist,The Allman Brothers Band;artist,Elephant Revival;artist,Vox Dei;artist,The Cranberries;artist,Miles Davis Quintet;artist,Cheap Trick;artist,Renaissance;artist,Dover;artist,The Jeff Healey Band;artist,Monster Magnet;artist,Steeleye Span;artist,Journey;artist,Pappo's Blues;artist,Nick Cave & The Bad Seeds;artist,Linkin Park;artist,Bill Evans Trio;artist,Quicksilver Messenger Service;artist,Uriah Heep;artist,Frank Sinatra & The Count Basie Orchestra;artist,The Ozark Mountain Daredevils;artist,Wagner;artist,Joss Stone;artist,Bob Seger & The Silver Bullet Band;artist,Mott The Hoople;artist,The Black Crowes;artist,Blackmore's Night;artist,Bon Jovi;artist,The Pretty Things;artist,Steely Dan;artist,Coldplay;artist,Jimi Hendrix & Curtis Knight;artist,Curtis Knight & The Squires;artist,Magna Carta;artist,Rainbow;artist,The Yardbirds;artist,La Oreja de Van Gogh;artist,Queens Of The Stone Age;artist,Van Halen;artist,Big Brother and The Holding Company;artist,Paul McCartney & Wings;artist,Cypress Hill;artist,Buffalo Springfield;artist,Mark Lanegan Band;artist,Savoy Brown;artist,Son Volt;artist,Them;artist,Mountain;artist,Les Menestriers;artist,The Guess Who;artist,Planxty;artist,John Mayall's Bluesbreakers;artist,Grant Green;artist,Eva Cassidy;artist,Mighty Sam McClain;artist,The West Coast Pop Art Experimental Band;artist,Oasis;artist,Blue Öyster Cult;artist,Heron;artist,Ten Years After;artist,Van Der Graaf Generator;artist,America;artist,Cold Chisel;artist,The Black Keys;artist,Grand Funk Railroad;artist,Mazzy Star;artist,Pixies;artist,The Smashing Pumpkins;artist,The Band;artist,Awon;artist,Pescado Rabioso;artist,The Flamin' Groovies;artist,The 13th Floor Elevators;artist,Heart;artist,Lady Gaga;artist,Small Faces;artist,The Mothers of Invention;artist,The Velvet Underground;artist,Faun;artist,Black Flag;artist,Free;artist,UFO;artist,Derek and The Dominos;artist,Scorpions;artist,R.E.M.;artist,Soundgarden;artist,The Shadows of Knight;artist,Whitesnake;artist,La Pegatina;artist,Platero y Tú;artist,King Crimson;artist,The Robert Cray Band;artist,38 Special;artist,Spirit;artist,Big Star;artist,OutKast;artist,Bob Marley & The Wailers;artist,Nirvana;artist,The Jayhawks;artist,Omnia;artist,Yes;artist,Elvis Costello & The Attractions;artist,Kula Shaker;artist,Red Hot Chili Peppers;artist,Wigwam;artist,Nightwish;artist,The Incredible String Band;artist,Megadeth;artist,Dinosaur Jr.;artist,Phoniks;artist,PJ Harvey;artist,Queen;artist,Passenger;artist,Guns N' Roses;artist,Extremoduro;artist,Tom Petty & The Heartbreakers;artist,Diana Krall;artist,Hawkwind;artist,Captain Beefheart and The Magic Band;artist,Jefferson Airplane;artist,Rush;artist,Eagles;artist,Pearl Jam;artist,Cream;artist,Neil Young & Crazy Horse;artist,Simon & Garfunkel;artist,Creedence Clearwater Revival;artist,The Mamas and The Papas;artist,Barclay James Harvest;artist,Eels;artist,Deep Purple;artist,Aerosmith;artist,Supertramp;artist,Thin Lizzy;artist,Black Sabbath;artist,The Oscar Peterson Trio;artist,Dire Straits;artist,Nat King Cole;artist,The Who;artist,Chet Atkins;artist,Chopin;artist,The Beach Boys;artist,Fleetwood Mac;artist,Iron Maiden;artist,Jethro Tull;artist,Donovan;artist,Santana;artist,The Beatles;artist,The Kinks;artist,The Jimi Hendrix Experience;artist,Led Zeppelin;artist,The Rolling Stones

The string is not displayed. The same on a popup, although the string exists and can be copied/pasted into notepad without problems.

X

X

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #752
I'm getting:

Error: Spider Monkey Panel v1.4.1 ({0F768A08-0736-4D01-A78B-C76F049A4A65})
unexpected token: identifier

File: <main>
Line: 1, Column: 21
Source: samples/js-smooth/JS Smooth Playlist Manager.js

Quis custodiet ipsos custodes?  ;~)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #753
Question.
Simple script
Code: [Select]
    var arr = [0, 1, , 2, 3, 4, , 5, 6, 7, , 8, 9];
    for (var i = 0; i < arr.length; i++) {
        gr.GdiDrawText( arr[i], font, RGB(255, 255, 100), 20, 10 + i * 15, ww, wh, DT_LEFT );
    }
lines "undefined" with SMP.
Is it a mistake or it should be.
Thank you.
I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #754
Question.
Simple script
Code: [Select]
    var arr = [0, 1, , 2, 3, 4, , 5, 6, 7, , 8, 9];
    for (var i = 0; i < arr.length; i++) {
        gr.GdiDrawText( arr[i], font, RGB(255, 255, 100), 20, 10 + i * 15, ww, wh, DT_LEFT );
    }
lines "undefined" with SMP.
Is it a mistake or it should be.
Thank you.

"0, 1, , 2"

There is a hole on the array, so it outputs undefined (as it should be). Remove the hole, or use array.filter(...)

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #755
Quote
"0, 1, , 2"
There is a hole on the array...........
regor.
This i know.
I compared the WSH panel and the SM panel. There is no such thing in the WSH panel.
It is clear, it should be on the SM panel.
No problems. Thank you.
I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #756
Quote
"0, 1, , 2"
There is a hole on the array, so it outputs undefined (as it should be). Remove the hole, or use array.filter(...)
regor.
This i know.
I compared the WSH panel and the SM panel. There is no such thing in the WSH panel.
It is clear, it should be on the SM panel.
No problems. Thank you.

Have no idea why it works different in WSH, but the thing you see in SMP is how standard javascript works yep.  WSH may haved extra code to treat undefined strings as empty strings for that func, or it's just a side effect of not using standard js, that's all (which is a problem, since then you can not identify there is a problem and someone may think undefined and '' should be the same, like you).

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #757
Quote
but the thing you see in SMP is how standard javascript works
I have not dreamed of this.
Thank you, regor.
I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #758
It should be noted that WSHP and JSP components use JScript, which is actually a separate dialect of ECMAScript and is not the same as JavaScript that's used in all modern browsers (and SMP), hence all the differences like case-sensitivity, different treatment of empty elements in array and etc.
So, even though the names of these languages are (very) similar and they both are based on ECMAScript specifications, they are *not* the same language.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #759
I can't find EnableMenuItem(...).
Or this function is not present in SMP.
I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #760
I can't find EnableMenuItem(...).
Or this function is not present in SMP.
Use search:
https://theqwertiest.github.io/foo_spider_monkey_panel/assets/generated_files/docs/html/

Then on jsp... you are told to use flags
https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes#v203
Quote
Consider using flags like MF_GRAYED/MF_DISABLED on AppendMenuItem instead. Also, the optional bypos arguments for CheckMenuItem and CheckMenuRadioItem have both been removed. See the updated docs for full details.

Which is how SMP works too
https://theqwertiest.github.io/foo_spider_monkey_panel/assets/generated_files/docs/html/MenuObject.html#AppendMenuItem

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #761
Quote
Consider using flags like MF_GRAYED/MF_DISABLED on AppendMenuItem instead
It's clear.
I mean, one function of EnableMenuItem can replace "ten" lines of code like MF_GRAYED / MF_DISABLED on AppendMenuItem.
If not, then no.
I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #762
It should be noted that WSHP and JSP components use JScript, which is actually a separate dialect of ECMAScript and is not the same as JavaScript that's used in all modern browsers (and SMP), hence all the differences like case-sensitivity, different treatment of empty elements in array and etc.
So, even though the names of these languages are (very) similar and they both are based on ECMAScript specifications, they are *not* the same language.
Thanks Microsoft!

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #763
I have created an entire framework to create menus on demand. Should be useful for more people at some point. (have edited and added many things  since that post, but until I share it on github, send me a PM and I will share all scripts)
https://hydrogenaud.io/index.php?topic=120394.msg994919#msg994919
I agree it can be simplified, and creating menus with it is just a matter of a few lines. Instead of duplicating codes on callbacks (for ID matching) and checking conditions.
For ex. I have used it to create this menu button (with multiple checks and even custom entries addition/deletion by user): https://hydrogenaud.io/index.php?topic=120394.msg995845#msg995845

But not really sure why you have to write ten lines to disable menus, could you share an example of your code? Maybe I can help.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #764
v 1.4.1
Very rare crashes when just typing a code.
Like crash when passing objects to console.log().
I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #765
v 1.4.1
Very rare crashes when just typing a code.
Like crash when passing objects to console.log().
What kind of objects are you trying to pass?

Paste some code that's causing crashes.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #766
Crashes.
I didn't get it. I wrote the code ...
Next time I'll try to be more attentive.
I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #767
Crashes.
I didn't get it. I wrote the code ...
Next time I'll try to be more attentive.
Without the code can not help.

Is there any way to access properties from other panels (read only) without on_notify callbacks?
i.e. if you know the window name (something set on the script which doesn't change), instead of forcing other script's authors to add some code for script interaction, you could simply get the properties from its panel and work with that.

For ex. my map script has a selection mode which should match the selection mode of WilB's Biography script if you use them together. I can warn about it with a popup, ask the author to expose that property with NotifyOthers() or offer a modified version by myself... but being able to read properties from any panel would solve that issue, while still rendering NotifyOthers useful for other use cases and be much cleaner.

It would greatly expand and simplify script interoperability for sure.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #768
Please write a script to search for images in the "Covers" folder, which is located in two versions

1. In the same folder with the album
2. One level above the album being played, when listening to a two-disc edition, it is located in the album folder

--

And I also want to set up the viewing of the artist's photo, which has the name of the "Images" and is located in the artist's folder, along with other folders containing albums

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #769
Is it possible to change column ui colors with spider monkey panel? I was trying to change the global selection color, but I'm not really sure how.

 

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #770
gdi.Font crashes when size is set to 0.

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #771
Please write a script to search for images in the "Covers" folder, which is located in two versions
1. In the same folder with the album
2. One level above the album being played, when listening to a two-disc edition, it is located in the album folder
Most scripts are going to look in the art locations entered in Preferences > Display > Front Cover tab -

Code: [Select]
$if(%discnumber%,..\)Covers\Front.jpg

^ If tracks are tagged with DISCNUMBER, it goes up one level ..\
(Ideally DISCNUMBER field should not be tagged for one-disc releases)

Quote
And I also want to set up the viewing of the artist's photo, which has the name of the "Images" and is located in the artist's folder, along with other folders containing albums
If you mean the folder is named "Images"? Preferences > Display > Artist tab -

Code: [Select]
$if(%discnumber%,..\)..\Images\Artist.jpg

Cheers

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #772
Help.
example:
bg_color = window.GetColourCUI(ColorTypeCUI.background);   
color = bg_color
color  - is Ok.

But if:
bg_color = window.GetColourCUI(ColorTypeCUI.background);   
arr = [bg_color, ... , ...];
color = arr[0]
color  - is nothing.



I.m. UR5EQF

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #773
Help.
example:
bg_color = window.GetColourCUI(ColorTypeCUI.background);   
color = bg_color
color  - is Ok.

But if:
bg_color = window.GetColourCUI(ColorTypeCUI.background);   
arr = [bg_color, ... , ...];
color = arr[0]
color  - is nothing.

In flags...
Code: [Select]
/ Used in window.GetColourCUI()
var ColourTypeCUI = {
text: 0,
selection_text: 1,
inactive_selection_text: 2,
background: 3,
selection_background: 4,
inactive_selection_background: 5,
active_item_frame: 6
};

I don't see at all how your code can work unless you are using other flags. ColorTypeCUI -> ColourTypeCUI

Code: [Select]
let bg_color = window.GetColourCUI(ColourTypeCUI.background);
let arr = [bg_color];
let color = arr[0] ;
console.log(color);
It's ok

Re: Spider Monkey Panel (foo_spider_monkey_panel)

Reply #774
regor.
Thanks, found a bug
I.m. UR5EQF

 
SimplePortal 1.0.0 RC1 © 2008-2021