-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
62 lines (49 loc) · 1.48 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<script src="domo.js"></script>
<script type="text/javascript" src="atom.js"></script>
<script src="domo_atom.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js"></script>
<script>
fade = function ( toggle, nodes, moveOn ) {
if ( toggle === 'init' ) {
$( nodes ).css( 'opacity', 0 );
moveOn();
return;
}
$( nodes ).stop().animate({'opacity': toggle ? 1 : 0 }, moveOn );
}
M = atom();
M.set({ 'news1': { 'headline': 'This is news 1', 'txt': 'This is a text!' } })
M.set({ 'news2': { 'headline': 'This is news 2', 'txt': 'This is a text!' } })
var news = function ( key ) {
return (
ATOM(
{ key: key , atom: M, listen: [ 'on' ], dramaturgy: fade }
, function ( key, listener ) {
return FRAGMENT(
H1( 'News:',key.headline )
, P( key.txt ) );
})
)
}
HTML(
BODY(
news( 'news1' )
, news( 'news2' )
, news( 'news3' )
, A({ id: 'addNews' }, 'Add News' )
, ' | '
, A({ id: 'updateNews' }, 'Update News' )
)
)
$( '#updateNews' ).click( function () { M.set('news1',{ 'headline': 'blaa', txt: 'sdfghfjg' }) })
$( '#addNews' ).click( function () { M.set('news3',{ 'headline': 'blaa', txt: 'sdfghfjg' }) })
/*var newsList = ATOM( { on: 'news', atom: newsStorage }, function ( news ) {
return EACH( news, function ( i ) {
return DIV( H1( i.headline ), P( i.body ) )
})
})
;
*/
//DIV( newsList );
</script>