From: Michael P. <mp...@ph...> - 2000-12-01 15:50:38
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> Does anyone here name their javascript files with any extension other than .js? <p>I only ask this because I find it annoying that I have to put .js at the end of each library entry and also in all of the include lines. <p>Surely it is easier if you just place .js in the include code and then we don't have to worry about it ever again. <p>Here's what I'm talking about:<tt></tt> <p><tt> include : function(src,path) {</tt> <br><tt> if(src.substring(src.length-3)!=".js") src+=src.substring(0,src.length-3)</tt> <br><tt> if (!path) var path=DynAPI.librarypath</tt> <br><tt> var pckg=src.substring(0,src.indexOf('.'))</tt> <br><tt> var groupname=src.substring(src.indexOf('.')+1)</tt> <br><tt> var realsrc=groupname.substring(groupname.indexOf('.')+1)</tt> <br><tt> groupname=groupname.substring(0,groupname.indexOf('.'))</tt> <br><tt> if (src.indexOf('.*')>0) {</tt> <br><tt> src=src.substring(0,src.indexOf('.*'))</tt> <br><tt> if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg].libs[groupname]</tt> <br><tt> if (group) for (var i in group) document.write('<script language="Javascript1.2"_</tt> <br><tt> src="'+path+pckg+'/'+groupname+'/'+group[i]+'<b>.js</b>"><\/script>')</tt> <br><tt> else alert(DynAPI.toString()+'\n\nError occured\nThe following package could not_</tt> <br><tt> be loaded:\n'+src+'\n\nmake sure you specified the correct path.')</tt> <br><tt> } else document.write('<script Language="Javascript1.2"_</tt> <br><tt> src="'+path+pckg+'/'+groupname+'/'+realsrc+'<b>.js</b>"><\/script>')</tt> <br><tt> }</tt><tt></tt> <p><tt> DynAPI.addLibrary('dynapi.api',["dynlayer","browser","dyndocument","events","dragevent"])</tt><tt></tt> <p>I know this is not as important as getting the bugs worked out, but it does make it alot more "MS User" friendly. (what, the files have extensions? : P ) <p>-- <br>Michael Pemberton <br>mp...@ph... <br>ICQ: 12107010</html> |
From: Michael P. <mp...@ph...> - 2000-12-01 17:02:05
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> The code I posted earlier was too quickly cut and paste. <p>Here's the correct code: <p><tt>include : function(src,path) {</tt> <br><tt> if(src.substring(src.length-3)==".js") src=src.substring(0,src.length-3)</tt> <br><tt> if (!path) var path=DynAPI.librarypath</tt> <br><tt> var groupname=src.substring(src.indexOf('.')+1)</tt> <br><tt> var realsrc=groupname.substring(groupname.indexOf('.')+1)</tt> <br><tt> groupname=groupname.substring(0,groupname.indexOf('.'))</tt> <br><tt> if (src.indexOf('.*')>0) {</tt> <br><tt> src=src.substring(0,src.indexOf('.*'))</tt> <br><tt> if (DynAPI.packages[pckg]) var group=DynAPI.packages[pckg][groupname]</tt> <br><tt> if (group) for (var i in group) document.write('<script language="Javascript1.2" src="'+path+pckg+'/'+groupname+'/'+group[i]+'.js"><\/script>')</tt> <br><tt> } else document.write('<script language="Javascript1.2" src="'+path+pckg+'/'+groupname+'/'+realsrc+'.js"><\/script>')</tt> <br><tt>}</tt><tt></tt> <p><tt>DynAPI.addLibrary('dynapi.api',["dynlayer","browser","dyndocument","events","dragevent"])</tt> <p>-- <br>Michael Pemberton <br>mp...@ph... <br>ICQ: 12107010</html> |
From: Robert R. <rra...@ya...> - 2000-12-01 19:03:42
|
When you use DynAPI.include(), you do not have to put the .js extension with the current implementation. The reason it is done in the addLibrary is so it does not have to be concatenated on each library item in the for loop. So, it is more efficient to add the .js to the files in addLibrary (this is usually done internally in the DynAPI, anyways). And, currently the .js is not required in the include(). So, I don't see a reason to change this. I don't think any other solution will be quite as fast as now (unless you require the .js). -- // Robert Rainwater On Sat, 02 Dec 2000 02:48:28 +1100 Michael Pemberton <mp...@ph...> wrote: > Does anyone here name their javascript files with any extension other than.js?I only ask this because I find it annoying that I have to put .js atthe end of each library entry and also in all of the include lines.Surely it is easier if you just place .js in the include code and thenwe don't have to worry about it ever again.Here's what I'm talking about: include : function(src,path) { > if(src.substring(src.length-3)!=".js")src+=src.substring(0,src.length-3) > if (!path) var path=DynAPI.librarypath > var pckg=src.substring(0,src.indexOf('.')) > var groupname=src.substring(src.indexOf('.')+1) > var realsrc=groupname.substring(groupname.indexOf('.')+1) > groupname=groupname.substring(0,groupname.indexOf('.')) > if (src.indexOf('.*')>0){ > src=src.substring(0,src.indexOf('.*')) > if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg].libs[groupname] > if (group) for (var i in group) document.write('<script language="Javascript1.2"_ > src="'+path+pckg+'/'+groupname+'/'+group[i]+'.js"><\/script>') > else alert(DynAPI.toString()+'\n\nError occured\nThe following packagecould not_ > be loaded:\n'+src+'\n\nmake sure you specified the correct path.') > } else document.write('<scriptLanguage="Javascript1.2"_ > src="'+path+pckg+'/'+groupname+'/'+realsrc+'.js"><\/script>') > } > DynAPI.addLibrary('dynapi.api',["dynlayer","browser","dyndocument","events","dragevent"]) > I know this is not as important as getting the bugs worked out, butit does make it alot more "MS User" friendly. (what, the files have extensions?: P ) > -- > Michael Pemberton > mp...@ph... > ICQ: 12107010_______________________________________________Dynapi-Dev mailing lis...@li...http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |
From: Alexey M. <ma...@ca...> - 2000-12-02 23:01:22
|
> Does anyone here name their javascript files with any extension other > than .js? > does make it alot more "MS User" friendly. (what, the files have > extensions? : P ) But in contrary for Unix user it would be very strange. Becouse unix have no extensions , so "name.js" is just a file name like "other.file.name.". And it is strange not to write part of file name. :))))) Malx -- All our life is digging in memories. Some of them 0.01 sec old. |