@@ -2,59 +2,58 @@ var $ = document.querySelector.bind(document);
2
2
3
3
var API_ROOT = '/ionic-lab/api/v1' ;
4
4
5
- var APP_CONFIG = { }
5
+ var APP_CONFIG = { } ;
6
6
7
7
function loadAppConfig ( ) {
8
8
var req = new XMLHttpRequest ( ) ;
9
9
req . addEventListener ( 'load' , function ( e ) {
10
10
setAppConfig ( JSON . parse ( req . response ) ) ;
11
- } )
12
- req . open ( 'GET' , API_ROOT + '/app-config' , true )
11
+ } ) ;
12
+ req . open ( 'GET' , API_ROOT + '/app-config' , true ) ;
13
13
req . send ( null ) ;
14
14
}
15
15
16
16
function setAppConfig ( data ) {
17
17
APP_CONFIG = data ;
18
18
}
19
19
20
-
21
20
function buildMenu ( ) {
22
21
buildComponentsMenu ( ) ;
23
- const sidebar = $ ( '#sidebar' ) ;
24
- const topLevels = sidebar . querySelectorAll ( '#menu > li > a' ) ;
22
+ var sidebar = $ ( '#sidebar' ) ;
23
+ var topLevels = sidebar . querySelectorAll ( '#menu > li > a' ) ;
25
24
26
- const lastMenuConfig = window . localStorage . getItem ( 'ionic_labmenu' ) ;
27
- if ( lastMenuConfig === 'true' || lastMenuConfig === null ) {
25
+ var lastMenuConfig = window . localStorage . getItem ( 'ionic_labmenu' ) ;
26
+ if ( lastMenuConfig === 'true' || lastMenuConfig === null ) {
28
27
sidebar . classList . remove ( 'hidden' ) ;
29
28
}
30
29
31
- Array . prototype . map . call ( topLevels , a => {
32
- if ( ! a . href ) {
33
- a . addEventListener ( 'click' , e => {
34
- if ( a . parentNode . classList . contains ( 'expanded' ) ) {
30
+ Array . prototype . map . call ( topLevels , function ( a ) {
31
+ if ( ! a . href ) {
32
+ a . addEventListener ( 'click' , function ( e ) {
33
+ if ( a . parentNode . classList . contains ( 'expanded' ) ) {
35
34
a . parentNode . classList . remove ( 'expanded' ) ;
36
35
} else {
37
36
a . parentNode . classList . add ( 'expanded' ) ;
38
37
}
39
38
e . preventDefault ( ) ;
40
39
} ) ;
41
40
}
42
- } )
41
+ } ) ;
43
42
44
- $ ( '#view-ad' ) . addEventListener ( 'click' , ( e ) => {
43
+ $ ( '#view-ad' ) . addEventListener ( 'click' , function ( e ) {
45
44
var win = window . open ( 'http://view.ionic.io/' , '_blank' ) ;
46
45
win . focus ( ) ;
47
- } )
46
+ } ) ;
48
47
49
- const toggleMenu = e => {
50
- if ( sidebar . classList . contains ( 'hidden' ) ) {
48
+ var toggleMenu = function ( e ) {
49
+ if ( sidebar . classList . contains ( 'hidden' ) ) {
51
50
sidebar . classList . remove ( 'hidden' ) ;
52
51
window . localStorage . setItem ( 'ionic_labmenu' , 'true' ) ;
53
52
} else {
54
53
sidebar . classList . add ( 'hidden' ) ;
55
54
window . localStorage . setItem ( 'ionic_labmenu' , 'false' ) ;
56
55
}
57
- }
56
+ } ;
58
57
59
58
$ ( '#menu-toggle' ) . addEventListener ( 'click' , toggleMenu ) ;
60
59
$ ( '#sidebar .close' ) . addEventListener ( 'click' , toggleMenu ) ;
@@ -63,22 +62,22 @@ function buildMenu() {
63
62
function buildComponentsMenu ( ) {
64
63
var items = [ { "href" :"http://ionicframework.com/docs/components/#overview" , "title" :"Overview" } , { "href" :"http://ionicframework.com/docs/components/#action-sheets" , "title" :"Action Sheets" } , { "href" :"http://ionicframework.com/docs/components/#alert" , "title" :"Alerts" } , { "href" :"http://ionicframework.com/docs/components/#badges" , "title" :"Badges" } , { "href" :"http://ionicframework.com/docs/components/#buttons" , "title" :"Buttons" } , { "href" :"http://ionicframework.com/docs/components/#cards" , "title" :"Cards" } , { "href" :"http://ionicframework.com/docs/components/#checkbox" , "title" :"Checkbox" } , { "href" :"http://ionicframework.com/docs/components/#datetime" , "title" :"DateTime" } , { "href" :"http://ionicframework.com/docs/components/#fabs" , "title" :"FABs" } , { "href" :"http://ionicframework.com/docs/components/#gestures" , "title" :"Gestures" } , { "href" :"http://ionicframework.com/docs/components/#grid" , "title" :"Grid" } , { "href" :"http://ionicframework.com/docs/components/#icons" , "title" :"Icons" } , { "href" :"http://ionicframework.com/docs/components/#inputs" , "title" :"Inputs" } , { "href" :"http://ionicframework.com/docs/components/#lists" , "title" :"Lists" } , { "href" :"http://ionicframework.com/docs/components/#loading" , "title" :"Loading" } , { "href" :"http://ionicframework.com/docs/components/#menus" , "title" :"Menus" } , { "href" :"http://ionicframework.com/docs/components/#modals" , "title" :"Modals" } , { "href" :"http://ionicframework.com/docs/components/#navigation" , "title" :"Navigation" } , { "href" :"http://ionicframework.com/docs/components/#popovers" , "title" :"Popover" } , { "href" :"http://ionicframework.com/docs/components/#radio" , "title" :"Radio" } , { "href" :"http://ionicframework.com/docs/components/#range" , "title" :"Range" } , { "href" :"http://ionicframework.com/docs/components/#searchbar" , "title" :"Searchbar" } , { "href" :"http://ionicframework.com/docs/components/#segment" , "title" :"Segment" } , { "href" :"http://ionicframework.com/docs/components/#select" , "title" :"Select" } , { "href" :"http://ionicframework.com/docs/components/#slides" , "title" :"Slides" } , { "href" :"http://ionicframework.com/docs/components/#tabs" , "title" :"Tabs" } , { "href" :"http://ionicframework.com/docs/components/#toast" , "title" :"Toast" } , { "href" :"http://ionicframework.com/docs/components/#toggle" , "title" :"Toggle" } , { "href" :"http://ionicframework.com/docs/components/#toolbar" , "title" :"Toolbar" } ] ;
65
64
66
- const componentsMenu = $ ( '#components-menu' ) ;
67
- items . map ( i => {
68
- const l = document . createElement ( 'li' )
69
- const a = document . createElement ( 'a' )
70
- a . href = i . href
65
+ var componentsMenu = $ ( '#components-menu' ) ;
66
+ items . map ( function ( i ) {
67
+ var l = document . createElement ( 'li' ) ;
68
+ var a = document . createElement ( 'a' ) ;
69
+ a . href = i . href ;
71
70
a . target = "_blank" ;
72
- a . innerText = i . title
73
- l . appendChild ( a )
74
- componentsMenu . appendChild ( l )
75
- } )
71
+ a . innerText = i . title ;
72
+ l . appendChild ( a ) ;
73
+ componentsMenu . appendChild ( l ) ;
74
+ } ) ;
76
75
}
77
76
78
77
function tryShowViewPopup ( ) {
79
78
var view = window . localStorage . getItem ( 'ionic_viewpop' ) ;
80
79
81
- if ( ! view ) {
80
+ if ( ! view ) {
82
81
$ ( '#view-popup' ) . style . display = 'block' ;
83
82
$ ( '#view-popup .close' ) . addEventListener ( 'click' , function ( e ) {
84
83
window . localStorage . setItem ( 'ionic_viewpop' , true ) ;
@@ -101,14 +100,14 @@ function bindToggles() {
101
100
var windows = $ ( '#device-windows' ) ;
102
101
103
102
var devices = [ iphone , android , windows ] ;
104
- for ( i in devices ) {
103
+ for ( var i in devices ) {
105
104
devices [ i ] . addEventListener ( 'change' , function ( e ) {
106
105
var device = this . name ;
107
106
console . log ( 'Device changed' , device , this . checked ) ;
108
107
109
108
showDevice ( device , this . checked ) ;
110
109
saveLastDevices ( device , this . checked ) ;
111
- } )
110
+ } ) ;
112
111
}
113
112
}
114
113
@@ -122,11 +121,11 @@ function showDevice(device, isShowing) {
122
121
var clone = document . importNode ( template , true ) ;
123
122
$ ( 'preview' ) . appendChild ( clone . content ) ;
124
123
//check for extra params in location.url to pass on to iframes
125
- var params = document . location . href . split ( '?' )
124
+ var params = document . location . href . split ( '?' ) ;
126
125
if ( params ) {
127
- var newparams = params [ params . length - 1 ]
128
- var oldsrc = $ ( 'preview .frame' ) . getAttribute ( 'src' )
129
- $ ( 'preview .frame' ) . setAttribute ( 'src' , oldsrc + '&' + newparams )
126
+ var newparams = params [ params . length - 1 ] ;
127
+ var oldsrc = $ ( 'preview .frame' ) . getAttribute ( 'src' ) ;
128
+ $ ( 'preview .frame' ) . setAttribute ( 'src' , oldsrc + '&' + newparams ) ;
130
129
}
131
130
} else {
132
131
rendered . style . display = isShowing ? '' : 'none' ;
@@ -163,7 +162,7 @@ function showLastDevices() {
163
162
}
164
163
165
164
function setCordovaInfo ( data ) {
166
- let el = $ ( '#app-info' ) ;
165
+ var el = $ ( '#app-info' ) ;
167
166
el . innerHTML = data . name + ' - v' + data . version ;
168
167
if ( data . name ) {
169
168
document . title = data . name + ' - Ionic Lab' ;
@@ -174,8 +173,8 @@ function loadCordova() {
174
173
var req = new XMLHttpRequest ( ) ;
175
174
req . addEventListener ( 'load' , function ( e ) {
176
175
setCordovaInfo ( JSON . parse ( req . response ) ) ;
177
- } )
178
- req . open ( 'GET' , API_ROOT + '/cordova' , true )
176
+ } ) ;
177
+ req . open ( 'GET' , API_ROOT + '/cordova' , true ) ;
179
178
req . send ( null ) ;
180
179
}
181
180
0 commit comments