@@ -4,33 +4,6 @@ var myApp = new Framework7({
44
55} ) ;
66
7- myApp . onPageInit ( 'defaultpage' , function ( page ) {
8- myApp . params . swipePanel = false ;
9- new GMaps ( {
10- div : '#map' ,
11- lat : - 12.043333 ,
12- lng : - 77.028333
13- } ) ;
14- $$ ( '#addressButton' ) . on ( 'click' , function ( e ) {
15- address ( ) ;
16- } ) ;
17- } ) ;
18-
19- function address ( ) {
20- GMaps . geocode ( {
21- address : $ ( '#address' ) . val ( ) ,
22- callback : function ( results , status ) {
23- if ( status == 'OK' ) {
24- var latlng = results [ 0 ] . geometry . location ;
25- map . setCenter ( latlng . lat ( ) , latlng . lng ( ) ) ;
26- map . addMarker ( {
27- lat : latlng . lat ( ) ,
28- lng : latlng . lng ( )
29- } ) ;
30- }
31- }
32- } ) ;
33- }
347// If we need to use custom DOM library, let's save it to $$ variable:
358var $$ = Dom7 ;
369
@@ -43,136 +16,3 @@ var mainView = myApp.addView('.view-main', {
4316$$ ( document ) . on ( 'deviceready' , function ( ) {
4417 console . log ( "Device is ready!" ) ;
4518} ) ;
46-
47-
48-
49- // Now we need to run the code that will be executed only for About page.
50-
51- // Option 1. Using page callback for page (for "about" page in this case) (recommended way):
52- myApp . onPageInit ( 'about' , function ( page ) {
53- // Do something here for "about" page
54- myApp . alert ( 'Here comes About page' ) ;
55- } )
56-
57- //Each message Page
58- myApp . onPageInit ( 'indMsg' , function ( page ) {
59- messagesMain ( ) ;
60- } )
61-
62-
63- //Messages Page
64- myApp . onPageInit ( 'messages' , function ( page ) {
65- //messagesMain();
66- /*
67- 1. Do AJAX call
68- 2. Put data into Array
69- 3. Set array
70- */
71- const people = [
72- /*
73- {
74- name: nameOfPerson
75- message: This is a mess...
76-
77- }*/
78- ] ;
79-
80- for ( var i = 0 ; i < 10 ; i ++ ) {
81- people . push ( {
82- item : i
83- } ) ;
84- }
85-
86- const myListOfPeople = myApp . virtualList ( '.list-block.virtual-list' , {
87- items : people ,
88- template :
89- '<li>' +
90- '<a href="indMsg.html?messageId={{item}}" class="item-link item-content">' +
91- '<div>{{item}}</div>' +
92- '</a>' +
93- '</div>' +
94- '</li>'
95- } ) ;
96- } )
97-
98- myApp . onPageInit ( 'post' , function ( page ) {
99- /*
100- 1. Do AJAX call to get post based on postID
101- 2. Generate post data!
102- */
103-
104-
105- const testPost = {
106- season : 'img/green.jpg' ,
107- title : 'Grass Mowing Required' ,
108- date : 'January 21, 2015' ,
109- text : 'Guys please help my grass is growing too large'
110- }
111-
112- const posts = [ ] ;
113-
114- if ( page . query ) {
115- console . log ( page . query ) ;
116- posts . push ( testPost ) ;
117-
118-
119- } else {
120- posts . push ( testPost ) ;
121- posts . push ( testPost ) ;
122- posts . push ( testPost ) ;
123- }
124-
125-
126- const myList = myApp . virtualList ( '.list-block.virtual-list.cardslist' , {
127- items : posts ,
128- template :
129- '<div class="card demo-card-header-pic" >' +
130- ' <div style="background-image:url(img/green.jpg)" valign="bottom" class="card-header color-white no-border"></div>' +
131- ' <div class="card-content">' +
132- ' <div class="card-content-inner">' +
133- ' <h1>Grass Mowing Required</h1>' +
134- ' <p class="color-gray">Posted on January 21, 2015</p>' +
135- ' <p>Quisque eget vestibulum nulla...</p>' +
136- ' </div>' +
137- ' </div>' +
138- ' <div class="card-footer">' +
139- ' <a href="#" class="button button-big">Contact</a>' +
140- ' <a href="#" class="button button-big">Map</a>' +
141- ' </div>' +
142- '</div >'
143- } ) ;
144- } )
145-
146- myApp . onPageInit ( 'postList' , function ( page ) {
147- console . log ( 'posted!' ) ;
148-
149- /*
150- 1. Do AJAX call
151- 2. Put data into Array
152- 3. Set array
153- */
154- const posts = [
155- /*
156- {
157- title: 'Need people to show shovel for me tomorrow!',
158- text: 'House is not too large, so should not be an issue!',
159- price: '5',*/
160- ] ;
161-
162- for ( var i = 0 ; i < 50 ; i ++ ) {
163- posts . push ( {
164- item : i
165- } ) ;
166- }
167-
168- const myList = myApp . virtualList ( '.list-block.virtual-list.postlist' , {
169- items : posts ,
170- template :
171- '<li>' +
172- ' <a href="post.html?postID={{item}}" class="item-link item-content">' +
173- ' <div>{{item}}</div>' +
174- ' </a>' +
175- '</li>'
176- } ) ;
177- } )
178-
0 commit comments