7
7
< link rel ="stylesheet " href ="https://fonts.googleapis.com/icon?family=Material+Icons ">
8
8
< link rel ="stylesheet " href ="https://code.getmdl.io/1.3.0/material.blue-light_blue.min.css " />
9
9
< script defer src ="https://code.getmdl.io/1.3.0/material.min.js "> </ script >
10
- < script src ="https://code.jquery.com/jquery-3.1.1.slim. min.js " integrity ="sha256-/SIrNqv8h6QGKDuNoLGA4iret+kyesCkHGzVUUV0shc = "
10
+ < script src ="https://code.jquery.com/jquery-3.1.1.min.js " integrity ="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8 = "
11
11
crossorigin ="anonymous "> </ script >
12
- < style >
13
- body {
14
- background : # ccc ;
15
- color : # fff ;
16
- }
17
- </ style >
18
- < script src ="./build/indexedDB.js "> </ script >
12
+ < style >
13
+ body {
14
+ background : # ccc ;
15
+ color : # fff ;
16
+ }
17
+
18
+ # main-container {
19
+ display : none;
20
+ }
21
+
22
+ .spinner {
23
+ width : 40px ;
24
+ height : 40px ;
25
+ position : absolute;
26
+ top : 0 ;
27
+ bottom : 0 ;
28
+ left : 0 ;
29
+ right : 0 ;
30
+ margin : auto;
31
+ }
32
+
33
+ .double-bounce1 ,
34
+ .double-bounce2 {
35
+ width : 100% ;
36
+ height : 100% ;
37
+ border-radius : 50% ;
38
+ background-color : # 333 ;
39
+ opacity : 0.6 ;
40
+ position : absolute;
41
+ top : 0 ;
42
+ left : 0 ;
43
+ -webkit-animation : sk-bounce 2.0s infinite ease-in-out;
44
+ animation : sk-bounce 2.0s infinite ease-in-out;
45
+ }
46
+
47
+ .double-bounce2 {
48
+ -webkit-animation-delay : -1.0s ;
49
+ animation-delay : -1.0s ;
50
+ }
51
+
52
+ @-webkit-keyframes sk-bounce {
53
+ 0% ,
54
+ 100% {
55
+ -webkit-transform : scale (0.0 )
56
+ }
57
+ 50% {
58
+ -webkit-transform : scale (1.0 )
59
+ }
60
+ }
61
+
62
+ @keyframes sk-bounce {
63
+ 0% ,
64
+ 100% {
65
+ transform : scale (0.0 );
66
+ -webkit-transform : scale (0.0 );
67
+ }
68
+ 50% {
69
+ transform : scale (1.0 );
70
+ -webkit-transform : scale (1.0 );
71
+ }
72
+ }
73
+ </ style >
74
+ < script src ="./build/indexedDB.js "> </ script >
19
75
</ head >
20
76
21
77
< body >
22
- < div class ="mdl-grid " style ="margin: 0 auto; ">
23
- < div class ="mdl-cell mdl-cell--12-col ">
24
- < h3 style ="text-align: center "> TODO Task</ h3 >
25
- </ div >
78
+ < div class ="spinner " id ="spinner ">
79
+ < div class ="double-bounce1 "> </ div >
80
+ < div class ="double-bounce2 "> </ div >
26
81
</ div >
27
- < div class ="mdl-grid " style ="margin: 0 auto; ">
28
- < div class ="mdl-cell mdl-cell--12-col ">
29
- < div class ="mdl-card mdl-shadow--2dp " style ="min-height: auto;margin: 0 auto;width:410px ">
30
- < div class ="mdl-card__supporting-text ">
31
- < div class ="mdl-textfield mdl-js-textfield mdl-textfield--floating-label ">
32
- < input class ="mdl-textfield__input " type ="text " id ="val ">
33
- < label class ="mdl-textfield__label " for ="val "> Add Task ...</ label >
82
+ < div id ="main-container ">
83
+ < div class ="mdl-grid " style ="margin: 0 auto; ">
84
+ < div class ="mdl-cell mdl-cell--12-col ">
85
+ < h3 style ="text-align: center "> TODO Task</ h3 >
86
+ </ div >
87
+ </ div >
88
+ < div class ="mdl-grid " style ="margin: 0 auto; ">
89
+ < div class ="mdl-cell mdl-cell--12-col ">
90
+ < div class ="mdl-card mdl-shadow--2dp " style ="min-height: auto;margin: 0 auto;width:410px ">
91
+ < div class ="mdl-card__supporting-text ">
92
+ < div class ="mdl-textfield mdl-js-textfield mdl-textfield--floating-label ">
93
+ < input class ="mdl-textfield__input " type ="text " id ="val ">
94
+ < label class ="mdl-textfield__label " for ="val "> Add Task ...</ label >
95
+ </ div >
96
+ < button id ="add " class ="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent " style ="vertical-align: super;color:#fff "> Add</ button >
34
97
</ div >
35
- < button id ="add "class ="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent " style ="vertical-align: super;color:#fff "> Add</ button >
36
98
</ div >
37
99
</ div >
38
100
</ div >
39
- </ div >
40
- < div class ="mdl-grid " style =" margin: 0 auto; ">
41
- < div class =" mdl-cell mdl-cell--12-col " id =" task-container " >
101
+ < div class =" mdl-grid " style =" margin: 0 auto; " >
102
+ < div class ="mdl-cell mdl-cell--12-col " id =" task-container ">
103
+ </ div >
42
104
</ div >
43
105
</ div >
106
+
44
107
< script type ="text/template " id ="task-template ">
45
108
< div class = "mdl-card mdl-shadow--2dp" style = "min-height: auto;margin: 0 auto;width:410px;margin-bottom: 0.5%" >
46
109
< div class = "mdl-card__supporting-text" >
@@ -57,12 +120,22 @@ <h3 style="text-align: center">TODO Task</h3>
57
120
repository : ( function ( ) {
58
121
IndexedDB . DbContextBuilder . Debug ( false ) ;
59
122
var sampleContextBuilder = new IndexedDB . DbContextBuilder ( dbConnection ) ;
123
+ sampleContextBuilder . Ready = function ( ) {
124
+ $ ( "#spinner" ) . fadeOut ( "slow" , function ( ) {
125
+ $ ( "#main-container" ) . fadeIn ( "slow" ) ;
126
+ } ) ;
127
+ } ;
60
128
var repositories = sampleContextBuilder
61
129
. CreateDB ( "Sample" )
62
130
. ConfigureModel ( {
63
131
name : "Sample" ,
64
132
keyPath : "id" ,
65
- autoIncrement : false
133
+ autoIncrement : false ,
134
+ seed : [
135
+ { id : 1 , value : "Task1" } ,
136
+ { id : 2 , value : "Task2" } ,
137
+ { id : 3 , value : "Task3" }
138
+ ]
66
139
} ) . Build ( ) ;
67
140
return repositories . Sample ;
68
141
} ) ( )
@@ -100,7 +173,7 @@ <h3 style="text-align: center">TODO Task</h3>
100
173
render : function ( data ) {
101
174
$ ( view . $container ) . html ( '' ) ;
102
175
for ( var d of data ) {
103
- var str = view . $taskTemplate . replace ( / { { Checkbox} } / g, d . value ) . replace ( / { { ID} } / g, d . id ) ;
176
+ var str = view . $taskTemplate . replace ( / { { Checkbox} } / g, d . value ) . replace ( / { { ID} } / g, d . id ) ;
104
177
$ ( view . $container ) . append ( str ) ;
105
178
}
106
179
componentHandler . upgradeDom ( ) ;
0 commit comments