@@ -2,59 +2,58 @@ var $ = document.querySelector.bind(document);
22
33var API_ROOT = '/ionic-lab/api/v1' ;
44
5- var APP_CONFIG = { }
5+ var APP_CONFIG = { } ;
66
77function loadAppConfig ( ) {
88 var req = new XMLHttpRequest ( ) ;
99 req . addEventListener ( 'load' , function ( e ) {
1010 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 ) ;
1313 req . send ( null ) ;
1414}
1515
1616function setAppConfig ( data ) {
1717 APP_CONFIG = data ;
1818}
1919
20-
2120function buildMenu ( ) {
2221 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' ) ;
2524
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 ) {
2827 sidebar . classList . remove ( 'hidden' ) ;
2928 }
3029
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' ) ) {
3534 a . parentNode . classList . remove ( 'expanded' ) ;
3635 } else {
3736 a . parentNode . classList . add ( 'expanded' ) ;
3837 }
3938 e . preventDefault ( ) ;
4039 } ) ;
4140 }
42- } )
41+ } ) ;
4342
44- $ ( '#view-ad' ) . addEventListener ( 'click' , ( e ) => {
43+ $ ( '#view-ad' ) . addEventListener ( 'click' , function ( e ) {
4544 var win = window . open ( 'http://view.ionic.io/' , '_blank' ) ;
4645 win . focus ( ) ;
47- } )
46+ } ) ;
4847
49- const toggleMenu = e => {
50- if ( sidebar . classList . contains ( 'hidden' ) ) {
48+ var toggleMenu = function ( e ) {
49+ if ( sidebar . classList . contains ( 'hidden' ) ) {
5150 sidebar . classList . remove ( 'hidden' ) ;
5251 window . localStorage . setItem ( 'ionic_labmenu' , 'true' ) ;
5352 } else {
5453 sidebar . classList . add ( 'hidden' ) ;
5554 window . localStorage . setItem ( 'ionic_labmenu' , 'false' ) ;
5655 }
57- }
56+ } ;
5857
5958 $ ( '#menu-toggle' ) . addEventListener ( 'click' , toggleMenu ) ;
6059 $ ( '#sidebar .close' ) . addEventListener ( 'click' , toggleMenu ) ;
@@ -63,22 +62,22 @@ function buildMenu() {
6362function buildComponentsMenu ( ) {
6463 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" } ] ;
6564
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 ;
7170 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+ } ) ;
7675}
7776
7877function tryShowViewPopup ( ) {
7978 var view = window . localStorage . getItem ( 'ionic_viewpop' ) ;
8079
81- if ( ! view ) {
80+ if ( ! view ) {
8281 $ ( '#view-popup' ) . style . display = 'block' ;
8382 $ ( '#view-popup .close' ) . addEventListener ( 'click' , function ( e ) {
8483 window . localStorage . setItem ( 'ionic_viewpop' , true ) ;
@@ -101,14 +100,14 @@ function bindToggles() {
101100 var windows = $ ( '#device-windows' ) ;
102101
103102 var devices = [ iphone , android , windows ] ;
104- for ( i in devices ) {
103+ for ( var i in devices ) {
105104 devices [ i ] . addEventListener ( 'change' , function ( e ) {
106105 var device = this . name ;
107106 console . log ( 'Device changed' , device , this . checked ) ;
108107
109108 showDevice ( device , this . checked ) ;
110109 saveLastDevices ( device , this . checked ) ;
111- } )
110+ } ) ;
112111 }
113112}
114113
@@ -122,11 +121,11 @@ function showDevice(device, isShowing) {
122121 var clone = document . importNode ( template , true ) ;
123122 $ ( 'preview' ) . appendChild ( clone . content ) ;
124123 //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 ( '?' ) ;
126125 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 ) ;
130129 }
131130 } else {
132131 rendered . style . display = isShowing ? '' : 'none' ;
@@ -163,7 +162,7 @@ function showLastDevices() {
163162}
164163
165164function setCordovaInfo ( data ) {
166- let el = $ ( '#app-info' ) ;
165+ var el = $ ( '#app-info' ) ;
167166 el . innerHTML = data . name + ' - v' + data . version ;
168167 if ( data . name ) {
169168 document . title = data . name + ' - Ionic Lab' ;
@@ -174,8 +173,8 @@ function loadCordova() {
174173 var req = new XMLHttpRequest ( ) ;
175174 req . addEventListener ( 'load' , function ( e ) {
176175 setCordovaInfo ( JSON . parse ( req . response ) ) ;
177- } )
178- req . open ( 'GET' , API_ROOT + '/cordova' , true )
176+ } ) ;
177+ req . open ( 'GET' , API_ROOT + '/cordova' , true ) ;
179178 req . send ( null ) ;
180179}
181180
0 commit comments