|
From: Michael <mb...@st...> - 2001-01-02 23:55:42
|
hi there.
this is my first post to this list, and i would like to use the opportunity to thank you for the great work you're all doing. i just started dealing with
the dynapi after having spent a _lot_ of time putting together something similar on my own (i now finally gave up, mainly because it's just way too much
work keeping everything up to date).
now to the real issue of this post:
the following is an excerpt from part 1 one of the tutorials written by Pascal, describing the include() function:
* DynAPI.include('myownfile.js','location/path')
Include your own file not located in the [dynapi base path] location
* DynAPI.include('myownfile.js','./')
Include your own file located at the current file location.
i like these features, so i tried to use them bu it didn't work. looking at the code i realised that they weren't implemented at all. i don't know if
somebody did already implement them, but both the current distro and the current CVS-version do not contain them.
so here's my version:
include : function(src,path) {
if(src.substring(src.length-3)!=".js") src+=".js";
if (!path) var path=DynAPI.librarypath;
else {
if (path=="./") path = "";
else if (path[path.length-1] != "/") path += "/";
document.write('<script language="Javascript1.2" src="'+ path + src + '"></script>');
return;
}
....some more stuff....
}
hope this is usefull, and sorry if i missed the version containing those features. (BTW: is was pretty hard for me to find out where to get the current
files, so a few hints on the project-webpage would save a great deal of time to people interested in looking at the current work going on)
that all for now.
greets.
michael buerge
|
|
From: Robert R. <rra...@ya...> - 2001-01-03 20:18:32
|
I've updated my current version to do this for a while, but just haven't =
put
it in CVS. I will update CVS soon so that the include will work that way.
Robert
----- Original Message -----
From: "Michael B=FCrge" <mb...@st...>
To: <dyn...@li...>
Sent: Tuesday, January 02, 2001 6:58 PM
Subject: [Dynapi-Dev] DynAPI.include()
> hi there.
>
> this is my first post to this list, and i would like to use the
opportunity to thank you for the great work you're all doing. i just star=
ted
dealing with
> the dynapi after having spent a _lot_ of time putting together somethin=
g
similar on my own (i now finally gave up, mainly because it's just way to=
o
much
> work keeping everything up to date).
>
> now to the real issue of this post:
>
> the following is an excerpt from part 1 one of the tutorials written by
Pascal, describing the include() function:
>
> * DynAPI.include('myownfile.js','location/path')
> Include your own file not located in the [dynapi base path] location
> * DynAPI.include('myownfile.js','./')
> Include your own file located at the current file location.
>
> i like these features, so i tried to use them bu it didn't work. lookin=
g
at the code i realised that they weren't implemented at all. i don't know=
if
> somebody did already implement them, but both the current distro and th=
e
current CVS-version do not contain them.
> so here's my version:
>
> include : function(src,path) {
> if(src.substring(src.length-3)!=3D".js") src+=3D".js";
> if (!path) var path=3DDynAPI.librarypath;
> else {
> if (path=3D=3D"./") path =3D "";
> else if (path[path.length-1] !=3D "/") path +=3D "/";
> document.write('<script language=3D"Javascript1.2" src=3D"'+ path=
+ src
+ '"></script>');
> return;
> }
> ....some more stuff....
> }
>
> hope this is usefull, and sorry if i missed the version containing thos=
e
features. (BTW: is was pretty hard for me to find out where to get the
current
> files, so a few hints on the project-webpage would save a great deal of
time to people interested in looking at the current work going on)
>
> that all for now.
> greets.
> michael buerge
>
>
> _______________________________________________
> Dynapi-Dev mailing list
> Dyn...@li...
> http://lists.sourceforge.net/mailman/listinfo/dynapi-dev
|
|
From: Michael P. <mp...@ph...> - 2001-01-05 14:23:18
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I was looking at a way of making the DynAPI.include method more simple.
Here's what I came up with:
<p><tt>include : function(src,path) {</tt>
<br><tt> srcArray = src.split('.');</tt>
<br><tt> if (!path) var path=DynAPI.librarypath;</tt>
<br><tt> var pckg=srcArray[0];</tt>
<br><tt> var grp=srcArray[1];</tt>
<br><tt> var file=srcArray[2];</tt>
<br><tt> if (file=='*') {</tt>
<br><tt> if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg][grp];</tt>
<br><tt> if (group) for (var i in group) document.write('<script
language="Javascript1.2" src="'+path+pckg+'/'+grp+'/'+group[i]+'.js"><\/script>');</tt>
<br><tt> else alert('include()\n\nThe following package
could not be loaded:\n'+src+'\n\nmake sure you specified the correct path.');</tt>
<br><tt> } else {</tt>
<br><tt> if (path[path.length-1] != "/") path +=
"/";</tt>
<br><tt> document.write('<script language="Javascript1.2"
src="'+path+srcArray.join('/')+'.js"><\/script>');</tt>
<br><tt> };</tt>
<br><tt>}</tt>
<p>This way, there is no more searching for '.' over and over again.
<br>Also, you can now refer to individual files (even you own external
files) using '.' instead of '/'. This way, it fits the library syntax.
Hope this is of some use.
<p>Robert Rainwater wrote:
<blockquote TYPE=CITE>I've updated my current version to do this for a
while, but just haven't put
<br>it in CVS. I will update CVS soon so that the include will work
that way.
<p>Robert
<br>----- Original Message -----
<br>From: "Michael Bürge" <mb...@st...>
<br>To: <dyn...@li...>
<br>Sent: Tuesday, January 02, 2001 6:58 PM
<br>Subject: [Dynapi-Dev] DynAPI.include()
<p>> hi there.
<br>>
<br>> this is my first post to this list, and i would like to use the
<br>opportunity to thank you for the great work you're all doing. i just
started
<br>dealing with
<br>> the dynapi after having spent a _lot_ of time putting together something
<br>similar on my own (i now finally gave up, mainly because it's just
way too
<br>much
<br>> work keeping everything up to date).
<br>>
<br>> now to the real issue of this post:
<br>>
<br>> the following is an excerpt from part 1 one of the tutorials written
by
<br>Pascal, describing the include() function:
<br>>
<br>> * DynAPI.include('myownfile.js','location/path')
<br>> Include your own file not located in the [dynapi base path] location
<br>> * DynAPI.include('myownfile.js','./')
<br>> Include your own file located at the current file location.
<br>>
<br>> i like these features, so i tried to use them bu it didn't work.
looking
<br>at the code i realised that they weren't implemented at all. i don't
know if
<br>> somebody did already implement them, but both the current distro
and the
<br>current CVS-version do not contain them.
<br>> so here's my version:
<br>>
<br>> include : function(src,path) {
<br>> if(src.substring(src.length-3)!=".js") src+=".js";
<br>> if (!path) var path=DynAPI.librarypath;
<br>> else {
<br>> if (path=="./") path = "";
<br>> else if (path[path.length-1]
!= "/") path += "/";
<br>> document.write('<script language="Javascript1.2"
src="'+ path + src
<br>+ '"></script>');
<br>> return;
<br>> }
<br>> ....some more stuff....
<br>> }
<br>>
<br>> hope this is usefull, and sorry if i missed the version containing
those
<br>features. (BTW: is was pretty hard for me to find out where to get
the
<br>current
<br>> files, so a few hints on the project-webpage would save a great deal
of
<br>time to people interested in looking at the current work going on)
<br>>
<br>> that all for now.
<br>> greets.
<br>> michael buerge
<br>>
<br>>
<br>> _______________________________________________
<br>> Dynapi-Dev mailing list
<br>> Dyn...@li...
<br>> <a href="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</a>
<p>_______________________________________________
<br>Dynapi-Dev mailing list
<br>Dyn...@li...
<br><a href="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</a></blockquote>
</html>
|
|
From: Michael P. <mp...@ph...> - 2001-01-05 14:34:35
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
You may also find it interesting that individual files can be referred
to with as many subdirectories as you want. This is one of the advantages
of using an array rather than a fixed search system.
<p>Michael Pemberton wrote:
<blockquote TYPE=CITE>I was looking at a way of making the DynAPI.include
method more simple. Here's what I came up with:
<p><tt>include : function(src,path) {</tt>
<br><tt> srcArray = src.split('.');</tt>
<br><tt> if (!path) var path=DynAPI.librarypath;</tt>
<br><tt> var pckg=srcArray[0];</tt>
<br><tt> var grp=srcArray[1];</tt>
<br><tt> var file=srcArray[2];</tt>
<br><tt> if (file=='*') {</tt>
<br><tt> if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg][grp];</tt>
<br><tt> if (group) for (var i in group) document.write('<script
language="Javascript1.2" src="'+path+pckg+'/'+grp+'/'+group[i]+'.js"><\/script>');</tt>
<br><tt> else alert('include()\n\nThe following package
could not be loaded:\n'+src+'\n\nmake sure you specified the correct path.');</tt>
<br><tt> } else {</tt>
<br><tt> if (path[path.length-1] != "/") path +=
"/";</tt>
<br><tt> document.write('<script language="Javascript1.2"
src="'+path+srcArray.join('/')+'.js"><\/script>');</tt>
<br><tt> };</tt>
<br><tt>}</tt>
<p>This way, there is no more searching for '.' over and over again.
<br>Also, you can now refer to individual files (even you own external
files) using '.' instead of '/'. This way, it fits the library syntax.
Hope this is of some use.
<p>Robert Rainwater wrote:
<blockquote TYPE=CITE>I've updated my current version to do this for a
while, but just haven't put
<br>it in CVS. I will update CVS soon so that the include will work
that way.
<p>Robert
<br>----- Original Message -----
<br>From: "Michael Bürge" <mb...@st...>
<br>To: <dyn...@li...>
<br>Sent: Tuesday, January 02, 2001 6:58 PM
<br>Subject: [Dynapi-Dev] DynAPI.include()
<p>> hi there.
<br>>
<br>> this is my first post to this list, and i would like to use the
<br>opportunity to thank you for the great work you're all doing. i just
started
<br>dealing with
<br>> the dynapi after having spent a _lot_ of time putting together something
<br>similar on my own (i now finally gave up, mainly because it's just
way too
<br>much
<br>> work keeping everything up to date).
<br>>
<br>> now to the real issue of this post:
<br>>
<br>> the following is an excerpt from part 1 one of the tutorials written
by
<br>Pascal, describing the include() function:
<br>>
<br>> * DynAPI.include('myownfile.js','location/path')
<br>> Include your own file not located in the [dynapi base path] location
<br>> * DynAPI.include('myownfile.js','./')
<br>> Include your own file located at the current file location.
<br>>
<br>> i like these features, so i tried to use them bu it didn't work.
looking
<br>at the code i realised that they weren't implemented at all. i don't
know if
<br>> somebody did already implement them, but both the current distro
and the
<br>current CVS-version do not contain them.
<br>> so here's my version:
<br>>
<br>> include : function(src,path) {
<br>> if(src.substring(src.length-3)!=".js") src+=".js";
<br>> if (!path) var path=DynAPI.librarypath;
<br>> else {
<br>> if (path=="./") path = "";
<br>> else if (path[path.length-1]
!= "/") path += "/";
<br>> document.write('<script language="Javascript1.2"
src="'+ path + src
<br>+ '"></script>');
<br>> return;
<br>> }
<br>> ....some more stuff....
<br>> }
<br>>
<br>> hope this is usefull, and sorry if i missed the version containing
those
<br>features. (BTW: is was pretty hard for me to find out where to get
the
<br>current
<br>> files, so a few hints on the project-webpage would save a great deal
of
<br>time to people interested in looking at the current work going on)
<br>>
<br>> that all for now.
<br>> greets.
<br>> michael buerge
<br>>
<br>>
<br>> _______________________________________________
<br>> Dynapi-Dev mailing list
<br>> Dyn...@li...
<br>> <a href="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</a>
<p>_______________________________________________
<br>Dynapi-Dev mailing list
<br>Dyn...@li...
<br><a href="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</a></blockquote>
_______________________________________________ Dynapi-Dev mailing list
Dyn...@li... <A HREF="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</A></blockquote>
</html>
|
|
From: Pascal B. <pa...@dy...> - 2001-01-05 20:09:00
|
minor modification:
include : function(src,path)
srcArray=src.split('.')
if (srcArray.length>3) srcArray.length-=1
if (!path) {
var path=DynAPI.librarypath
var pckg=srcArray[0]
var grp=srcArray[1]
var file=srcArray[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
if (path[path.length-1] != "/") path += "/"
document.write('<script language="Javascript1.2"
src="'+path+srcArray.join('/')+'.js"><\/script>')
}
} else {
document.write('<script language="Javascript1.2"
src="'+path+'/'+src+'"><\/script>')
}
}
makes sure that other files (not in packages, etc) can also be
correctly.included when specifying a path.. Also when a .js extension IS
supplied this code will take care of it.
Other point is that the DynAPI.addLibrary() calls should NOT specify a the
.js extension to make it work correctly.
cya,
Pascal Bestebroer
pa...@dy...
http://www.dynamic-core.net
-----Oorspronkelijk bericht-----
Van: dyn...@li...
[mailto:dyn...@li...]Namens Michael Pemberton
Verzonden: vrijdag 5 januari 2001 15:26
Aan: dyn...@li...
Onderwerp: Re: [Dynapi-Dev] DynAPI.include()
I was looking at a way of making the DynAPI.include method more simple.
Here's what I came up with:
include : function(src,path)
srcArray = src.split('.');
if (!path) var path=DynAPI.librarypath;
var pckg=srcArray[0];
var grp=srcArray[1];
var file=srcArray[2];
if (file=='*')
if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg][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
if (path[path.length-1] != "/") path += "/";
document.write('<script language="Javascript1.2"
src="'+path+srcArray.join('/')+'.js"><\/script>');
};
}
This way, there is no more searching for '.' over and over again.
Also, you can now refer to individual files (even you own external files)
using '.' instead of '/'. This way, it fits the library syntax. Hope this
is of some use.
Robert Rainwater wrote:
I've updated my current version to do this for a while, but just haven't
put
it in CVS. I will update CVS soon so that the include will work that
way.
Robert
----- Original Message -----
From: "Michael Bürge" <mb...@st...>
To: <dyn...@li...>
Sent: Tuesday, January 02, 2001 6:58 PM
Subject: [Dynapi-Dev] DynAPI.include()
> hi there.
>
> this is my first post to this list, and i would like to use the
opportunity to thank you for the great work you're all doing. i just
started
dealing with
> the dynapi after having spent a _lot_ of time putting together
something
similar on my own (i now finally gave up, mainly because it's just way
too
much
> work keeping everything up to date).
>
> now to the real issue of this post:
>
> the following is an excerpt from part 1 one of the tutorials written
by
Pascal, describing the include() function:
>
> * DynAPI.include('myownfile.js','location/path')
> Include your own file not located in the [dynapi base path] location
> * DynAPI.include('myownfile.js','./')
> Include your own file located at the current file location.
>
> i like these features, so i tried to use them bu it didn't work.
looking
at the code i realised that they weren't implemented at all. i don't
know if
> somebody did already implement them, but both the current distro and
the
current CVS-version do not contain them.
> so here's my version:
>
> include : function(src,path)
> if(src.substring(src.length-3)!=".js") src+=".js";
> if (!path) var path=DynAPI.librarypath;
> else
> if (path=="./") path = "";
> else if (path[path.length-1] != "/") path += "/";
> document.write('<script language="Javascript1.2" src="'+ path +
src
+ '"></script>');
> return;
> }
> ....some more stuff....
> }
>
> hope this is usefull, and sorry if i missed the version containing
those
features. (BTW: is was pretty hard for me to find out where to get the
current
> files, so a few hints on the project-webpage would save a great deal
of
time to people interested in looking at the current work going on)
>
> that all for now.
> greets.
> michael buerge
>
>
> _______________________________________________
> Dynapi-Dev mailing list
> Dyn...@li...
> http://lists.sourceforge.net/mailman/listinfo/dynapi-dev
_______________________________________________
Dynapi-Dev mailing list
Dyn...@li...
http://lists.sourceforge.net/mailman/listinfo/dynapi-dev
_______________________________________________ Dynapi-Dev mailing list
Dyn...@li...
http://lists.sourceforge.net/mailman/listinfo/dynapi-dev
|
|
From: Michael P. <mp...@ph...> - 2001-01-06 00:43:15
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Those changes are not needed. If a non library file is entered, there
is no problem. It just gets split and then rejoined later.
<p><tt> srcArray = src.split('.');</tt>
<br><tt>--> if (srcArray[srcArray.length-1] == 'js') array.length
-= 1;</tt>
<br><tt> if (!path) var path=DynAPI.librarypath;</tt>
<p>Adding this additional line allows for removal of the '.js' extension
if it has been included.
<p>Also, there is no point in testing for an array length of > 3.
This allows for any of the following to work:
<p><tt>DynAPI.include('afroapi.ext.keyevents','../../js')</tt>
<br><tt>DynAPI.include('afroapi/ext/keyevents','../../js')</tt>
<br><tt>DynAPI.include('js/afroapi/ext/keyevents','../../')</tt>
<br><tt>DynAPI.include('js.afroapi.ext.keyevents','../../')</tt>
<p>This allows for further breaking down your directories to make them
easier to understand.
<br>
<p>Pascal Bestebroer wrote:
<blockquote TYPE=CITE> <span class=530091120-05012001><font face="Arial"><font color="#0000FF"><font size=-1>minor
modification:</font></font></font></span><span
class=530091120-05012001></span><font face="Arial"><font color="#0000FF"><font size=-1> include
: function(src,path) {</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
srcArray=src.split('.')</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
if (srcArray.length>3) srcArray.length-=1</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
if (!path) {</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
var path=DynAPI.librarypath</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
var pckg=srcArray[0]</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
var grp=srcArray[1]</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
var file=srcArray[2]</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
if (file=='*') {</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg].libs[grp]</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
if (group) for (var i in group) document.write('<script language="Javascript1.2"
src="'+path+pckg+'/'+grp+'/'+group[i]+'.js"><\/script>')</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
else alert('include()\n\nThe following package could not be loaded:\n'+src+'\n\nmake
sure you specified the correct path.')</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
} else {</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
if (path[path.length-1] != "/") path += "/"</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
document.write('<script language="Javascript1.2" src="'+path+srcArray.join('/')+'.js"><\/script>')</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
}</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
} else {</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
document.write('<script language="Javascript1.2" src="'+path+'/'+src+'"><\/script>')</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1>
}</font></font></font>
<br><font face="Arial"><font color="#0000FF"><font size=-1> }</font></font></font> <span class=530091120-05012001><font face="Arial"><font color="#0000FF"><font size=-1>makes
sure that other files (not in packages, etc) can also be correctly.included
when specifying a path.. Also when a .js extension IS supplied this
code will take care of it.</font></font></font></span><span class=530091120-05012001><font face="Arial"><font color="#0000FF"><font size=-1>Other
point is that the DynAPI.addLibrary() calls should NOT specify a
the js extension to make it work correctly.</font></font></font></span><span
class=530091120-05012001></span><span
class=530091120-05012001><font face="Arial"><font color="#0000FF"><font size=-1>cya,</font></font></font></span> <font size=-1>Pascal
Bestebroer</font>
<br><font size=-1>pa...@dy...</font>
<br><font size=-1><a href="http://www.dynamic-core.net/" target="_blank">http://www.dynamic-core.net</a></font>
<blockquote
style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; PADDING-LEFT: 5px">
<div class="OutlookMessageHeader" dir="ltr"><font face="Tahoma"><font size=-1>-----Oorspronkelijk
bericht-----</font></font>
<br><font face="Tahoma"><font size=-1><b>Van:</b> dyn...@li...
[<A HREF="mailto:dyn...@li...">mailto:dyn...@li...</A>]<b>Namens </b>Michael Pemberton</font></font>
<br><font face="Tahoma"><font size=-1><b>Verzonden:</b> vrijdag 5 januari
2001 15:26</font></font>
<br><font face="Tahoma"><font size=-1><b>Aan:</b> dyn...@li...</font></font>
<br><font face="Tahoma"><font size=-1><b>Onderwerp:</b> Re: [Dynapi-Dev]
DynAPI.include()</font></font>
<br> </div>
I was looking at a way of making the DynAPI.include method more simple.
Here's what I came up with:
<p><tt>include : function(src,path) {</tt>
<br><tt> srcArray = src.split('.');</tt>
<br><tt> if (!path) var path=DynAPI.librarypath;</tt>
<br><tt> var pckg=srcArray[0];</tt>
<br><tt> var grp=srcArray[1];</tt>
<br><tt> var file=srcArray[2];</tt>
<br><tt> if (file=='*') {</tt>
<br><tt> if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg][grp];</tt>
<br><tt> if (group) for (var i in group) document.write('<script
language="Javascript1.2" src="'+path+pckg+'/'+grp+'/'+group[i]+'.js"><\/script>');</tt>
<br><tt> else alert('include()\n\nThe following package
could not be loaded:\n'+src+'\n\nmake sure you specified the correct path.');</tt>
<br><tt> } else {</tt>
<br><tt> if (path[path.length-1] != "/") path +=
"/";</tt>
<br><tt> document.write('<script language="Javascript1.2"
src="'+path+srcArray.join('/')+'.js"><\/script>');</tt>
<br><tt> };</tt>
<br><tt>}</tt>
<p>This way, there is no more searching for '.' over and over again.
<br>Also, you can now refer to individual files (even you own external
files) using '.' instead of '/'. This way, it fits the library syntax.
Hope this is of some use.
<p>Robert Rainwater wrote:
<blockquote TYPE="CITE">I've updated my current version to do this for
a while, but just haven't put
<br>it in CVS. I will update CVS soon so that the include will work
that way.
<p>Robert
<br>----- Original Message -----
<br>From: "Michael Bürge" <mb...@st...>
<br>To: <dyn...@li...>
<br>Sent: Tuesday, January 02, 2001 6:58 PM
<br>Subject: [Dynapi-Dev] DynAPI.include()
<p>> hi there.
<br>>
<br>> this is my first post to this list, and i would like to use the
<br>opportunity to thank you for the great work you're all doing. i just
started
<br>dealing with
<br>> the dynapi after having spent a _lot_ of time putting together something
<br>similar on my own (i now finally gave up, mainly because it's just
way too
<br>much
<br>> work keeping everything up to date).
<br>>
<br>> now to the real issue of this post:
<br>>
<br>> the following is an excerpt from part 1 one of the tutorials written
by
<br>Pascal, describing the include() function:
<br>>
<br>> * DynAPI.include('myownfile.js','location/path')
<br>> Include your own file not located in the [dynapi base path] location
<br>> * DynAPI.include('myownfile.js','./')
<br>> Include your own file located at the current file location.
<br>>
<br>> i like these features, so i tried to use them bu it didn't work.
looking
<br>at the code i realised that they weren't implemented at all. i don't
know if
<br>> somebody did already implement them, but both the current distro
and the
<br>current CVS-version do not contain them.
<br>> so here's my version:
<br>>
<br>> include : function(src,path) {
<br>> if(src.substring(src.length-3)!=".js") src+=".js";
<br>> if (!path) var path=DynAPI.librarypath;
<br>> else {
<br>> if (path=="./") path = "";
<br>> else if (path[path.length-1]
!= "/") path += "/";
<br>> document.write('<script language="Javascript1.2"
src="'+ path + src
<br>+ '"></script>');
<br>> return;
<br>> }
<br>> ....some more stuff....
<br>> }
<br>>
<br>> hope this is usefull, and sorry if i missed the version containing
those
<br>features. (BTW: is was pretty hard for me to find out where to get
the
<br>current
<br>> files, so a few hints on the project-webpage would save a great deal
of
<br>time to people interested in looking at the current work going on)
<br>>
<br>> that all for now.
<br>> greets.
<br>> michael buerge
<br>>
<br>>
<br>> _______________________________________________
<br>> Dynapi-Dev mailing list
<br>> Dyn...@li...
<br>> <a href="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</a>
<p>_______________________________________________
<br>Dynapi-Dev mailing list
<br>Dyn...@li...
<br><a href="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</a></blockquote>
_______________________________________________ Dynapi-Dev mailing list
Dyn...@li... <A HREF="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</A></blockquote>
</blockquote>
</html>
|
|
From: Pascal B. <pa...@dy...> - 2001-01-06 09:01:41
|
when you remove that line, and include files with a .js the join later on causes the files to be named dynapi/api/layer/js.js Pascal Bestebroer pa...@dy... http://www.dynamic-core.net -----Oorspronkelijk bericht----- Van: dyn...@li... [mailto:dyn...@li...]Namens Michael Pemberton Verzonden: zaterdag 6 januari 2001 1:46 Aan: dyn...@li... Onderwerp: Re: [Dynapi-Dev] DynAPI.include() Those changes are not needed. If a non library file is entered, there is no problem. It just gets split and then rejoined later. srcArray = src.split('.'); --> if (srcArray[srcArray.length-1] == 'js') array.length -= 1; if (!path) var path=DynAPI.librarypath; Adding this additional line allows for removal of the '.js' extension if it has been included. Also, there is no point in testing for an array length of > 3. This allows for any of the following to work: DynAPI.include('afroapi.ext.keyevents','../../js') DynAPI.include('afroapi/ext/keyevents','../../js') DynAPI.include('js/afroapi/ext/keyevents','../../') DynAPI.include('js.afroapi.ext.keyevents','../../') This allows for further breaking down your directories to make them easier to understand. Pascal Bestebroer wrote: minor modification: include : function(src,path) srcArray=src.split('.') if (srcArray.length>3) srcArray.length-=1 if (!path) var path=DynAPI.librarypath var pckg=srcArray[0] var grp=srcArray[1] var file=srcArray[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 if (path[path.length-1] != "/") path += "/" document.write('<script language="Javascript1.2" src="'+path+srcArray.join('/')+'.js"><\/script>') } } else document.write('<script language="Javascript1.2" src="'+path+'/'+src+'"><\/script>') } } makes sure that other files (not in packages, etc) can also be correctly.included when specifying a path.. Also when a .js extension IS supplied this code will take care of it.Other point is that the DynAPI.addLibrary() calls should NOT specify a the js extension to make it work correctly.cya, Pascal Bestebroer pa...@dy... http://www.dynamic-core.net -----Oorspronkelijk bericht----- Van: dyn...@li... [mailto:dyn...@li...]Namens Michael Pemberton Verzonden: vrijdag 5 januari 2001 15:26 Aan: dyn...@li... Onderwerp: Re: [Dynapi-Dev] DynAPI.include() I was looking at a way of making the DynAPI.include method more simple. Here's what I came up with: include : function(src,path) srcArray = src.split('.'); if (!path) var path=DynAPI.librarypath; var pckg=srcArray[0]; var grp=srcArray[1]; var file=srcArray[2]; if (file=='*') if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg][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 if (path[path.length-1] != "/") path += "/"; document.write('<script language="Javascript1.2" src="'+path+srcArray.join('/')+'.js"><\/script>'); }; } This way, there is no more searching for '.' over and over again. Also, you can now refer to individual files (even you own external files) using '.' instead of '/'. This way, it fits the library syntax. Hope this is of some use. Robert Rainwater wrote: I've updated my current version to do this for a while, but just haven't put it in CVS. I will update CVS soon so that the include will work that way. Robert ----- Original Message ----- From: "Michael Bürge" <mb...@st...> To: <dyn...@li...> Sent: Tuesday, January 02, 2001 6:58 PM Subject: [Dynapi-Dev] DynAPI.include() > hi there. > > this is my first post to this list, and i would like to use the opportunity to thank you for the great work you're all doing. i just started dealing with > the dynapi after having spent a _lot_ of time putting together something similar on my own (i now finally gave up, mainly because it's just way too much > work keeping everything up to date). > > now to the real issue of this post: > > the following is an excerpt from part 1 one of the tutorials written by Pascal, describing the include() function: > > * DynAPI.include('myownfile.js','location/path') > Include your own file not located in the [dynapi base path] location > * DynAPI.include('myownfile.js','./') > Include your own file located at the current file location. > > i like these features, so i tried to use them bu it didn't work. looking at the code i realised that they weren't implemented at all. i don't know if > somebody did already implement them, but both the current distro and the current CVS-version do not contain them. > so here's my version: > > include : function(src,path) > if(src.substring(src.length-3)!=".js") src+=".js"; > if (!path) var path=DynAPI.librarypath; > else > if (path=="./") path = ""; > else if (path[path.length-1] != "/") path += "/"; > document.write('<script language="Javascript1.2" src="'+ path + src + '"></script>'); > return; > } > ....some more stuff.... > } > > hope this is usefull, and sorry if i missed the version containing those features. (BTW: is was pretty hard for me to find out where to get the current > files, so a few hints on the project-webpage would save a great deal of time to people interested in looking at the current work going on) > > that all for now. > greets. > michael buerge > > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev _______________________________________________ Dynapi-Dev mailing list Dyn...@li... http://lists.sourceforge.net/mailman/listinfo/dynapi-dev _______________________________________________ Dynapi-Dev mailing list Dyn...@li... http://lists.sourceforge.net/mailman/listinfo/dynapi-dev _______________________________________________ Dynapi-Dev mailing list Dyn...@li... http://lists.sourceforge.net/mailman/listinfo/dynapi-dev |
|
From: Michael P. <mp...@ph...> - 2001-01-08 06:29:25
|
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> oops. array should be srcArray. That should fix it. <p>Pascal Bestebroer wrote: <blockquote TYPE=CITE> <span class=330130509-06012001><font face="Arial"><font color="#0000FF"><font size=-1>when you remove that line, and include files with a .js</font></font></font></span><span class=330130509-06012001></span><span class=330130509-06012001><font face="Arial"><font color="#0000FF"><font size=-1>the join later on causes the files to be named dynapi/api/layer/js.js</font></font></font></span><span class=330130509-06012001></span> <font size=-1>Pascal Bestebroer</font> <br><font size=-1>pa...@dy...</font> <br><font size=-1><a href="http://www.dynamic-core.net/" target="_blank">http://www.dynamic-core.net</a></font> <blockquote style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; PADDING-LEFT: 5px"> <div class="OutlookMessageHeader" dir="ltr"><font face="Tahoma"><font size=-1>-----Oorspronkelijk bericht-----</font></font> <br><font face="Tahoma"><font size=-1><b>Van:</b> dyn...@li... [<A HREF="mailto:dyn...@li...">mailto:dyn...@li...</A>]<b>Namens </b>Michael Pemberton</font></font> <br><font face="Tahoma"><font size=-1><b>Verzonden:</b> zaterdag 6 januari 2001 1:46</font></font> <br><font face="Tahoma"><font size=-1><b>Aan:</b> dyn...@li...</font></font> <br><font face="Tahoma"><font size=-1><b>Onderwerp:</b> Re: [Dynapi-Dev] DynAPI.include()</font></font> <br> </div> Those changes are not needed. If a non library file is entered, there is no problem. It just gets split and then rejoined later. <p><tt> srcArray = src.split('.');</tt> <br><tt>--> if (srcArray[srcArray.length-1] == 'js') array.length -= 1;</tt> <br><tt> if (!path) var path=DynAPI.librarypath;</tt> <p>Adding this additional line allows for removal of the '.js' extension if it has been included. <p>Also, there is no point in testing for an array length of > 3. This allows for any of the following to work: <p><tt>DynAPI.include('afroapi.ext.keyevents','../../js')</tt> <br><tt>DynAPI.include('afroapi/ext/keyevents','../../js')</tt> <br><tt>DynAPI.include('js/afroapi/ext/keyevents','../../')</tt> <br><tt>DynAPI.include('js.afroapi.ext.keyevents','../../')</tt> <p>This allows for further breaking down your directories to make them easier to understand. <br> <p>Pascal Bestebroer wrote: <blockquote TYPE="CITE"><span class=530091120-05012001><font face="Arial"><font color="#0000FF"><font size=-1>minor modification:</span><span class=530091120-05012001></span> include : function(src,path) {</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> srcArray=src.split('.')</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> if (srcArray.length>3) srcArray.length-=1</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> if (!path) {</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> var path=DynAPI.librarypath</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> var pckg=srcArray[0]</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> var grp=srcArray[1]</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> var file=srcArray[2]</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> if (file=='*') {</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg].libs[grp]</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> if (group) for (var i in group) document.write('<script language="Javascript1.2" src="'+path+pckg+'/'+grp+'/'+group[i]+'.js"><\/script>')</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> else alert('include()\n\nThe following package could not be loaded:\n'+src+'\n\nmake sure you specified the correct path.')</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> } else {</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> if (path[path.length-1] != "/") path += "/"</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> document.write('<script language="Javascript1.2" src="'+path+srcArray.join('/')+'.js"><\/script>')</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> }</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> } else {</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> document.write('<script language="Javascript1.2" src="'+path+'/'+src+'"><\/script>')</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> }</font></font></font> <br><font face="Arial"><font color="#0000FF"><font size=-1> }<span class=530091120-05012001>makes sure that other files (not in packages, etc) can also be correctly.included when specifying a path.. Also when a .js extension IS supplied this code will take care of it.</span><span class=530091120-05012001>Other point is that the DynAPI.addLibrary() calls should NOT specify a the js extension to make it work correctly.</span><span class=530091120-05012001></span><span class=530091120-05012001>cya,</span></font></font></font> <font size=-1>Pascal Bestebroer</font> <br><font size=-1>pa...@dy...</font> <br><font size=-1><a href="http://www.dynamic-core.net/" target="_blank">http://www.dynamic-core.net</a></font> <blockquote style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; PADDING-LEFT: 5px"> <div class=OutlookMessageHeader dir=ltr><font face="Tahoma"><font size=-1>-----Oorspronkelijk bericht-----</font></font> <br><font face="Tahoma"><font size=-1><b>Van:</b> dyn...@li... [<a href="mailto:dyn...@li...">mailto:dyn...@li...</a>]<b>Namens </b>Michael Pemberton</font></font> <br><font face="Tahoma"><font size=-1><b>Verzonden:</b> vrijdag 5 januari 2001 15:26</font></font> <br><font face="Tahoma"><font size=-1><b>Aan:</b> dyn...@li...</font></font> <br><font face="Tahoma"><font size=-1><b>Onderwerp:</b> Re: [Dynapi-Dev] DynAPI.include()</font></font></div> I was looking at a way of making the DynAPI.include method more simple. Here's what I came up with: <p><tt>include : function(src,path) {</tt> <br><tt> srcArray = src.split('.');</tt> <br><tt> if (!path) var path=DynAPI.librarypath;</tt> <br><tt> var pckg=srcArray[0];</tt> <br><tt> var grp=srcArray[1];</tt> <br><tt> var file=srcArray[2];</tt> <br><tt> if (file=='*') {</tt> <br><tt> if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg][grp];</tt> <br><tt> if (group) for (var i in group) document.write('<script language="Javascript1.2" src="'+path+pckg+'/'+grp+'/'+group[i]+'.js"><\/script>');</tt> <br><tt> else alert('include()\n\nThe following package could not be loaded:\n'+src+'\n\nmake sure you specified the correct path.');</tt> <br><tt> } else {</tt> <br><tt> if (path[path.length-1] != "/") path += "/";</tt> <br><tt> document.write('<script language="Javascript1.2" src="'+path+srcArray.join('/')+'.js"><\/script>');</tt> <br><tt> };</tt> <br><tt>}</tt> <p>This way, there is no more searching for '.' over and over again. <br>Also, you can now refer to individual files (even you own external files) using '.' instead of '/'. This way, it fits the library syntax. Hope this is of some use. <p>Robert Rainwater wrote: <blockquote TYPE="CITE">I've updated my current version to do this for a while, but just haven't put <br>it in CVS. I will update CVS soon so that the include will work that way. <p>Robert <br>----- Original Message ----- <br>From: "Michael Bürge" <mb...@st...> <br>To: <dyn...@li...> <br>Sent: Tuesday, January 02, 2001 6:58 PM <br>Subject: [Dynapi-Dev] DynAPI.include() <p>> hi there. <br>> <br>> this is my first post to this list, and i would like to use the <br>opportunity to thank you for the great work you're all doing. i just started <br>dealing with <br>> the dynapi after having spent a _lot_ of time putting together something <br>similar on my own (i now finally gave up, mainly because it's just way too <br>much <br>> work keeping everything up to date). <br>> <br>> now to the real issue of this post: <br>> <br>> the following is an excerpt from part 1 one of the tutorials written by <br>Pascal, describing the include() function: <br>> <br>> * DynAPI.include('myownfile.js','location/path') <br>> Include your own file not located in the [dynapi base path] location <br>> * DynAPI.include('myownfile.js','./') <br>> Include your own file located at the current file location. <br>> <br>> i like these features, so i tried to use them bu it didn't work. looking <br>at the code i realised that they weren't implemented at all. i don't know if <br>> somebody did already implement them, but both the current distro and the <br>current CVS-version do not contain them. <br>> so here's my version: <br>> <br>> include : function(src,path) { <br>> if(src.substring(src.length-3)!=".js") src+=".js"; <br>> if (!path) var path=DynAPI.librarypath; <br>> else { <br>> if (path=="./") path = ""; <br>> else if (path[path.length-1] != "/") path += "/"; <br>> document.write('<script language="Javascript1.2" src="'+ path + src <br>+ '"></script>'); <br>> return; <br>> } <br>> ...some more stuff.... <br>> } <br>> <br>> hope this is usefull, and sorry if i missed the version containing those <br>features. (BTW: is was pretty hard for me to find out where to get the <br>current <br>> files, so a few hints on the project-webpage would save a great deal of <br>time to people interested in looking at the current work going on) <br>> <br>> that all for now. <br>> greets. <br>> michael buerge <br>> <br>> <br>> _______________________________________________ <br>> Dynapi-Dev mailing list <br>> Dyn...@li... <br>> <a href="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</a> <p>_______________________________________________ <br>Dynapi-Dev mailing list <br>Dyn...@li... <br><a href="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</a></blockquote> _______________________________________________ Dynapi-Dev mailing list Dyn...@li... <a href="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</a></blockquote> </blockquote> _______________________________________________ Dynapi-Dev mailing list Dyn...@li... <A HREF="http://lists.sourceforge.net/mailman/listinfo/dynapi-dev">http://lists.sourceforge.net/mailman/listinfo/dynapi-dev</A></blockquote> </blockquote> </html> |