The d3.ijs examples use J nouns to locate the directory that houses code
for the application, as suggested by the definitions of PATH and HPATH and
~root below. And it works very well. I have been unsuccessfully toying with
replacing that approach with an html element/tag for constructing relative
URLs instead of absolute ones: <base href="base.url" /> is supposed to do
so if the value of "base.url" is a path like HPATH or maybe like PATH.
PATH=: jpath'~addons/graphics/d3/'
HPATH=: '~root' , (}.~[:<./i.&'\/') PATH NB. use ~root in HPATH (html path)
for JS/CSS
My attempts have all produced html 409 conflict errors, and I have not been
able to diagnose why, but I do have some other information as can be seen
in my smoutput in the utilh.ijs verb gsrcf. (Although the error message
below suggests a value error for LENGTH, I believe the more fundamental
problem is that the value of y is _1, indicating that the file is empty or
does not exist.)
gsrcf_jhs_ =: dyad define
smoutput 'xy';x;y
htmlresponse y,~gsrchead rplc ''<TYPE>'';x;''<LENGTH>'';":#y
)
┌──┬──────────────────────┬──┐
│xy│application/javascript│_1│
└──┴──────────────────────┴──┘
|value error: LENGTH
| htmlresponse y,~gsrchead rplc''<TYPE>'';x;''< LENGTH>'';":#y
*** response not sent for d3.v2.min.js
*** html409 Conflict
My code changes have been in the script d3boxplot.ijs. I have altered the
following verb and noun -- jev_get and html.
jev_get=: 3 : 0
NB. JS =: JS hrplc 'JPATH';HPATH
('Box Plot: ',>coname'') jhr ''
)
html =: 0 : 0
<div id="boxplot"></div>
<base href="/Users/brian/j64-701/addons/graphics/d3/"/>
)
And I have commented out the following revision of JSSRC.
NB. JSSRC=: ;(<HPATH) , each (<;._2 JSSRC) ,&.> (<LF)
So does it seem possible to employ the "base" tag and I am just not getting
it right, or does it seem better to just use the PATH/HPATH scheme?
--
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm