Bill's last reply in this thread seems to characterize well the situation I
am dealing with in my attempt to employ html5 canvas in a jhs app. The good
news is that I understand better the use of `~root/` as a trick to load .js
files (libraries, mostly) into my app, but I seem to be up against a
serious problem. One of the libraries I want to load is named swizzle.js
and notice the result of a grep shows that swizzle.js *itself* calls a
version of swizzle, apparently.

server:j64-701-user brian$ grep -n -d recurse "dist\/sizzle\.min\.map" *
tgsjhs/scripts/sizzle.js:3://# sourceMappingURL=dist/sizzle.min.map

Now this is a real puzzle to me because it looks to me like that line is
just a comment in the file sizzle.js, and should not be executed, but it
is. Am I incorrect about that being just a comment, or if it is not just a
comment, then is there any practical way to workaround this problem?

By the way, the error I am getting is because my scheme of revising the
verb jev_get_jfilesrc_ as follows. [To see the original script, open the
file j64-701/addons/ide/jhs/jfilesrc.ijs . Scanning below for the NB.
comments containing `Brian` should point you to my kludges.]

NB. serves .htm .js etc pages from anywhere
NB. possible security issues! careful on allowing other suffixes!
NB. ~root kludge to read gnuplot js files from
/usr/share/gnuplot/gnuplot/4.4/js/
jev_get=: 3 : 0
smoutput 'y';y
if. y-:'favicon.ico' do. favicon 0 return. end.
NB. next line revised below it by Brian with an if. clause
NB. y=. jpath(5*'~root/'-:6{.y)}.y
if. '~root/'-:6{.y
do. y=.5}.y
else. y=. PATH,y
smoutput 'no ~root given ', y
end.
d=. fread y
NB. Firefox 8 requires a response header
if. ('.htm'-:_4{.y)+.'.html'-:_5{.y do. htmlresponse d,~fsrchead rplc
'<TYPE>';'text/html' return. end.
if. (#mimetypes) > i=. ({:"1 mimetypes) i. <@tolower@}.(}.~ i:&'.') y do.
 t=. i{:: {."1 mimetypes
else. smoutput 'will not get file ',y return. end.
NB. Brian also created the following if statement for debugging
NB. prior to that only the following line existed: t gsrcf d
smoutput 't';t
smoutput 'd';d
if. d~:_1 do.
t gsrcf d
else. 'failed'
end.
)



On Sun, Jan 12, 2014 at 10:59 AM, bill lam <bbill....@gmail.com> wrote:

> Oh, yes, jhs is on the server side, your browser is on the
> client side, if the original request is in the form
> http://localhost/ then you probably don't need the base tag, the
> uri src of the javascript can either be a http://.... or just
> bare path /.... . In the fist case ,the browser will ask the other
> website to get the js, while in the second, the browser will
> issue a http get cmd to jhs, and it is up to jhs how to handle
> the get request. eg jhs may interpret the ~root as filesystem's
> root.
>
>
Thanks,

-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to