Update of /cvsroot/dynapi/dynapi/src
In directory usw-pr-cvs1:/tmp/cvs-serv13840
Modified Files:
dynapi.js
Log Message:
Fixed removeFromArray, which was broken in IE5 (splice not supported).
I've reverted to the old way of doing things but I'm keeping array.length in
a variable so array.length is only referenced once. I know there are lots of
suggestions on how to do this, but I thought I'd stick with the old tried and
tested way.
Index: dynapi.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/dynapi.js,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** dynapi.js 2001/02/25 11:31:10 1.27
--- dynapi.js 2001/03/07 12:13:42 1.28
***************
*** 3,7 ****
Main DynAPI class
! The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
*/
DynAPI = {
--- 3,7 ----
Main DynAPI class
! The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
*/
DynAPI = {
***************
*** 110,122 ****
var which=(typeof(index)=="object")?index:array[index];
if (id) delete array[which.id];
! else for (var i=0; i<array.length; i++)
! if (array[i] == which) {
! array.splice(i,1);
! break;
}
return array;
},
! unloadHandler : function() {
for (var i=0;i<DynAPI.plugins.length; i++) if
(DynAPI.plugins[i].onUnload) DynAPI.plugins[i].onUnload();
for (var i=0;i<DynAPI.children.length; i++)
DynAPI.children[i].deleteAllChildren();
--- 110,127 ----
var which=(typeof(index)=="object")?index:array[index];
if (id) delete array[which.id];
! else {
! var l=array.length;
! for (var i=0; i<l; i++) {
! if (array[i] == which) {
! for(var x=i; x<l-1; x++) array[x]=array[x+1];
! array.length -= 1;
! break;
! }
}
+ }
return array;
},
! unloadHandler : function() {
for (var i=0;i<DynAPI.plugins.length; i++) if
(DynAPI.plugins[i].onUnload) DynAPI.plugins[i].onUnload();
for (var i=0;i<DynAPI.children.length; i++)
DynAPI.children[i].deleteAllChildren();
***************
*** 125,151 ****
},
! setLibraryPath : function(path) {
if (path.substring(path.length-1)!='/') path+='/';
DynAPI.librarypath=path;
},
! mountplugin : function (plugin) {
if (!plugin.pluginName) alert(DynAPI.toString()+'\n\nError occured\nAn
invalid plugin was added to the DynApi code:\n\n'+plugin.constructor.toString());
else DynAPI.plugins[DynAPI.plugins.length] = plugin;
},
! include : function(src,pth) {
! src=src.split('.');
! if (src[src.length-1] == 'js') src.length -= 1;
! var path=pth||DynAPI.librarypath||'';
! if (path.substr(path.length-1) != "/") path += "/";
! var pckg=src[0];
! var grp=src[1];
! var file=src[2];
! if (file=='*') {
! if (DynAPI.packages[pckg])
group=DynAPI.packages[pckg].libs[grp];
if (group) for (var i in group) document.write('<script
language="Javascript1.2" src="'+path+pckg+'/'+grp+'/'+group[i]+'.js"><\/script>');
else alert('include()\n\nThe following package could not be
loaded:\n'+src+'\n\nmake sure you specified the correct path.');
} else document.write('<script language="Javascript1.2"
src="'+path+src.join('/')+'.js"><\/script>');
! }
};
DynAPI.hookLoad=window.onload;
--- 130,156 ----
},
! setLibraryPath : function(path) {
if (path.substring(path.length-1)!='/') path+='/';
DynAPI.librarypath=path;
},
! mountplugin : function (plugin) {
if (!plugin.pluginName) alert(DynAPI.toString()+'\n\nError occured\nAn
invalid plugin was added to the DynApi code:\n\n'+plugin.constructor.toString());
else DynAPI.plugins[DynAPI.plugins.length] = plugin;
},
! include : function(src,pth) {
! src=src.split('.');
! if (src[src.length-1] == 'js') src.length -= 1;
! var path=pth||DynAPI.librarypath||'';
! if (path.substr(path.length-1) != "/") path += "/";
! var pckg=src[0];
! var grp=src[1];
! var file=src[2];
! if (file=='*') {
! if (DynAPI.packages[pckg])
group=DynAPI.packages[pckg].libs[grp];
if (group) for (var i in group) document.write('<script
language="Javascript1.2" src="'+path+pckg+'/'+grp+'/'+group[i]+'.js"><\/script>');
else alert('include()\n\nThe following package could not be
loaded:\n'+src+'\n\nmake sure you specified the correct path.');
} else document.write('<script language="Javascript1.2"
src="'+path+src.join('/')+'.js"><\/script>');
! }
};
DynAPI.hookLoad=window.onload;
_______________________________________________
Dynapi-CVS mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-cvs