git.s-ol.nu mmm / 8979cdb
layout + options s-ol 3 years ago
3 changed file(s) with 23 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
00 import header, aside, footer, div, svg, script, g, circle, h1, span, b, a, img from require 'mmm.dom'
1 import navigate_to from (require 'mmm.mmmfs.util') require 'mmm.dom'
12
23 pick = (...) ->
34 num = select '#', ...
4344 -- pick 'mostly code', 'code and wires', 'silicon', 'electronics'
4445 }
4546 aside {
46 a 'about me', href: '/about'
47 a 'games', href: '/games'
48 a 'other', href: '/projects'
47 navigate_to '/about', 'about me'
48 navigate_to '/games', 'games'
49 navigate_to '/projects', 'other'
4950 a {
5051 href: 'mailto:s%20[removethis]%20[at]%20s-ol.nu'
5152 'contact'
5253 script "
5354 var l = document.currentScript.parentElement;
54 console.log(l);
5555 l.href = l.href.replace('%20[at]%20', '@');
5656 l.href = l.href.replace('%20[removethis]', '') + '?subject=Hey there :)';
5757 "
198198 \append @inspect_prop\map (prop) ->
199199 @get_content prop, (prop) =>
200200 value, key = @get prop
201 assert key, "couldn't @get #{prop}"
201202
202203 conversions = get_conversions 'mmm/dom', key.type, casts
203204 assert conversions, "cannot cast '#{key.type}'"
0 merge = (orig={}, extra) ->
1 with attr = {k,v for k,v in pairs orig}
2 for k,v in pairs extra
3 attr[k] = v
4
05 (elements) ->
16 import a from elements
27
712 else
813 assert fileder, "no fileder passed."
914
10 link_to = (fileder, name, origin) ->
15 navigate_to = (path, name, opts={}) ->
16 opts.href = path
17 opts.onclick = if MODE == 'CLIENT' then (e) =>
18 e\preventDefault!
19 BROWSER\navigate path
20 opts.target = 'default'
21 a name, opts
22
23 link_to = (fileder, name, origin, attr) ->
1124 fileder = find_fileder fileder, origin
1225
1326 name or= fileder\get 'title: mmm/dom'
1427 name or= fileder\gett 'name: alpha'
1528
1629 if href = fileder\get 'link: URL.*'
17 a name, :href, target: '_blank'
30 a name, merge attr, :href, target: '_blank'
1831 else
19 a name, {
32 a name, merge attr, {
2033 href: fileder.path
2134 onclick: if MODE == 'CLIENT' then (e) =>
2235 e\preventDefault!
2942 node = fileder\gett name, 'mmm/dom'
3043
3144 return node if opts.nolink
32 link_to fileder, node
45 link_to fileder, node, nil, opts.attr
3346
3447 {
3548 :find_fileder
3649 :link_to
50 :navigate_to
3751 :embed
3852 }