Hi all,
I'm new to the list so I hope this hasn't been covered already. I'm writing
a genealogy add-on that will have lots of searches in it but I want it to
just be one add-on. I also want to have a library js file be loaded so that
all my searches can use some common functions.
I've updated the loadAddons function in loader.js and have provided it
below - hoping someone with cvs access can ok it and add it in so I can
continue with my addon. It is backwards compatible with the googlespell
addon.
The problem I'm having is that in my new function I do the following:
document.write("<script type=\"text/Jscript\"
src=\""+addonLibraryFileName+"\"></script>");
and I want to be able to access functions in it when the search xml files
are loaded. However, my library js file doesn't finish loading before the
search xml files need it causing an error. Is there a way to not load the
search xml files until the library js file is fully loaded? I need to do
some fairly major initialization once for each search (somewhat time
consuming) and not each time the search is called.
I hope this makes sense and hope that one of you script wizards can help me
out.
Thanks and my proposed new function is below,
Brent
function loadAddons()
{
try
{
// Get searches in the 'addons' subdirectory
var addonDirs = getFiles( "addons\\*" ).split('\n');
for ( var i = 0; i < addonDirs.length; i++ )
{
if ( addonDirs[i] == "." )
continue;
// load addon js library file
var addonLibraryFileName =
"addons\\"+addonDirs[i]+"\\"+addonDirs[i]+"_lib.js";
var addonLibrary = getFiles(addonLibraryFileName).split('\n');
if (addonLibrary != null && addonLibrary.length == 1) {
document.write("<script type=\"text/Jscript\"
src=\""+addonLibraryFileName+"\"></script>");
}
// load all addon xml search files
var addonSearches =
getFiles("addons\\"+addonDirs[i]+"\\*.xml").split('\n');
for (var j = 0; j < addonSearches.length; j++)
{
// getFiles doesn't always work as expected; a problem with
FindFirstFile/FindNextFile
// especially with files named *.xml_sav or something similar.
if ( !/\.xml$/.test( addonSearches[j] ) )
continue;
loadSearchFile( "addons\\" + addonDirs[i] + "\\" +
addonSearches[j] );
}
}
}
catch (except) {}
}
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
DQSD-Devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dqsd-devel