mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 20:04:09 +03:00
moved ~/on/<dep>.js injection to mar/urb
The script itself remains in eyre, for usage by error messages.
This commit is contained in:
parent
c5a166c7e6
commit
8504d823c6
@ -197,15 +197,6 @@
|
||||
=+ cuh=(turn `(list ,@t)`cug |=(a=@t set-cookie/a))
|
||||
hit(q (weld cuh q.hit))
|
||||
::
|
||||
++ inject :: inject dependency
|
||||
|= [dep=@uvH max=[[%html ~] [[%head ~] hed=marl] [[%body ~] tal=marl] ~]]
|
||||
^- manx
|
||||
=: hed.max :_(hed.max ;meta(charset "utf-8", urb_injected "");)
|
||||
tal.max (welp tal.max ;script(urb_injected ""):"{(trip etag:js)}" ~)
|
||||
==
|
||||
?~ dep max
|
||||
max(hed :_(hed.max ;script@"/~/on/{<dep>}.js"(urb_injected "");))
|
||||
::
|
||||
++ add-json :: inject window.urb
|
||||
|= [urb=json jaz=cord] ^- cord
|
||||
=- (cat 3 (crip -) jaz)
|
||||
@ -228,13 +219,14 @@
|
||||
[sas ~[content-type/(moon mit)] [~ (taco rez)]]
|
||||
::
|
||||
++ render-tang :: tanks to manx
|
||||
|= tan=tang
|
||||
|= [dep=@uvH tan=tang]
|
||||
;html
|
||||
;head
|
||||
;link(rel "stylesheet", href "/lib/base.css");
|
||||
;title: server error
|
||||
==
|
||||
;body:div#c.err:pre:code:"{(wush 80 tan)}"
|
||||
;script@"/~/on/{<dep>}.js";
|
||||
==
|
||||
::
|
||||
++ favi :: XX favicon
|
||||
@ -461,14 +453,6 @@
|
||||
function(){document.getElementById("c").innerHTML = "" }
|
||||
)}
|
||||
'''
|
||||
++ etag
|
||||
'''
|
||||
if(!window.urb) window.urb = {}
|
||||
urb.waspAll = function(sel){
|
||||
Array.prototype.map.call(document.querySelectorAll(sel), urb.waspElem)
|
||||
}
|
||||
if(urb.wasp){urb.waspAll('script'); urb.waspAll('link')}
|
||||
'''
|
||||
--
|
||||
++ xml
|
||||
|%
|
||||
@ -847,16 +831,7 @@
|
||||
?. ?=(%mime p.cay)
|
||||
=+ bek=-:(need (tome p.tee))
|
||||
=+ bik=?+(r.bek bek [%ud %0] bek(r da/now))
|
||||
=- (execute tee bik [%flag [p.sih `~] -])
|
||||
=- `silk`[%cast %mime `[p.cay -]]
|
||||
?. ?=([%ud 0] r.bek) q.cay
|
||||
?+ p.cay q.cay :: inject dependency long-poll
|
||||
%urb =< (slam !>(.) q.cay)
|
||||
|= urb=manx
|
||||
~| [%malformed-urb urb]
|
||||
?> ?=([[%html ~] [[%head ~] *] [[%body ~] *] ~] urb)
|
||||
(inject p.sih urb)
|
||||
==
|
||||
(execute tee bik [%flag [p.sih `~] %cast %mime q.sih])
|
||||
~| q.q.cay
|
||||
=+ ((hard ,[mit=mite rez=octs]) q.q.cay)
|
||||
=+ dep=(crip "W/{(pojo %s (scot %uv p.sih))}")
|
||||
@ -920,7 +895,7 @@
|
||||
|= [sas=@ud dep=@uvH mez=tang]
|
||||
^+ +>
|
||||
:: (back ha/~ dep %tang !>(mez)) ::tang->urb chain may be source of failure
|
||||
(give-html sas ~ (inject dep (render-tang mez)))
|
||||
(give-html sas ~ (render-tang dep mez))
|
||||
::
|
||||
++ give-html
|
||||
|= [sas=@ud cug=(list ,@t) max=manx]
|
||||
|
28
mar/urb.hoon
28
mar/urb.hoon
@ -3,18 +3,34 @@
|
||||
::
|
||||
/? 314
|
||||
!:
|
||||
|_ own=manx
|
||||
|_ [dep=@uvH own=manx]
|
||||
::
|
||||
++ etag-js
|
||||
'''
|
||||
urb.waspAll = function(sel){
|
||||
Array.prototype.map.call(document.querySelectorAll(sel), urb.waspElem)
|
||||
}
|
||||
if(urb.wasp){urb.waspAll('script'); urb.waspAll('link')}
|
||||
'''
|
||||
++ grow :: convert to
|
||||
|%
|
||||
++ html (crip (poxo own)) :: convert to %html
|
||||
++ mime [/text/html (taco html)] :: convert to %mime
|
||||
++ html (crip (poxo hymn)) :: convert to %html
|
||||
++ hymn :: inject dependencies
|
||||
^- manx
|
||||
=+ ^= max :: XX types
|
||||
~| [%malformed-urb own]
|
||||
?> ?=([[%html ~] [[%head ~] *] [[%body ~] *] ~] own)
|
||||
`[[%html ~] [[%head ~] hed=marl] [[%body ~] tal=marl] ~]`own
|
||||
::
|
||||
=: hed.max :_(hed.max ;meta(charset "utf-8", urb_injected "");)
|
||||
tal.max (welp tal.max ;script(urb_injected ""):"{(trip etag-js)}" ~)
|
||||
==
|
||||
?~ dep max
|
||||
max(hed :_(hed.max ;script@"/~/on/{<dep>}.js"(urb_injected "");))
|
||||
--
|
||||
++ grab
|
||||
|% :: convert from
|
||||
++ noun manx :: clam from %noun
|
||||
:: conversion from hymn is handled specially by %eyre,
|
||||
:: which injects dependency information
|
||||
:: ++ hymn !! :: inject into %hymn
|
||||
++ noun ,[@uvH manx] :: clam from %noun
|
||||
--
|
||||
--
|
||||
|
12
ren/urb.hoon
12
ren/urb.hoon
@ -1,9 +1,9 @@
|
||||
::
|
||||
:::: /hoon/urb/ren
|
||||
::
|
||||
/% /,
|
||||
/talk/log /talklog-hymn/
|
||||
/web/app /|(/!hymn/ /tree-hymn/)
|
||||
/ /tree-hymn/
|
||||
==
|
||||
`manx`-.-
|
||||
/# /% /,
|
||||
/talk/log /talklog-hymn/
|
||||
/web/app /|(/!hymn/ /tree-hymn/)
|
||||
/ /tree-hymn/
|
||||
==
|
||||
`[@uvH manx]`-.-
|
||||
|
Loading…
Reference in New Issue
Block a user