11'use strict' ;
22
3- function plotLocations ( item ) {
3+ var plotLocations = function ( item ) {
44 var xhr = new XMLHttpRequest ( ) ;
55 xhr . onload = function ( ) {
66 var response = this . response ;
77 for ( var i = 0 ; i < response . locations . length ; i ++ ) {
8- map . plotLocation (
8+ window . map . plotLocation (
99 response . locations [ i ] . geo . lat ,
1010 response . locations [ i ] . geo . lng ,
11- showLocation ( response , response . locations [ i ] ) ) ;
11+ window . showLocation ( response , response . locations [ i ] ) ) ;
1212 }
1313 } ;
1414 xhr . open ( 'GET' , '/movies/locations?title=' +
@@ -17,9 +17,9 @@ function plotLocations(item) {
1717 encodeURIComponent ( item . director ) ) ;
1818 xhr . responseType = 'json' ;
1919 xhr . send ( ) ;
20- }
20+ } ;
2121
22- function displayLoadingPanel ( response ) {
22+ var displayLoadingPanel = function ( response ) {
2323 var locationDiv = document . getElementById ( 'location_detail' ) ;
2424 if ( locationDiv ) {
2525 locationDiv . style . display = 'none' ;
@@ -37,36 +37,36 @@ function displayLoadingPanel(response) {
3737 controlText = document . createElement ( 'div' ) ;
3838 controlText . id = 'film_detail' ;
3939 controlText . className = 'film_detail' ;
40- controlText . innerHTML = templates . loading ( response ) ;
40+ controlText . innerHTML = window . templates . loading ( response ) ;
4141
4242 document . getElementById ( 'bottom_panel' ) . appendChild ( controlText ) ;
4343
4444 } else {
4545
4646 controlText = document . getElementById ( 'film_detail' ) ;
47- controlText . innerHTML = templates . loading ( response ) ;
47+ controlText . innerHTML = window . templates . loading ( response ) ;
4848 controlText . style . display = '' ;
4949
5050 }
51- }
51+ } ;
5252
53- function getMoveDetail ( title , director ) {
53+ var getMoveDetail = function ( title , director ) {
5454 var xhr = new XMLHttpRequest ( ) ;
5555 xhr . onload = function ( ) {
5656 var detail = this . response ;
57-
58- document . getElementById ( 'film_detail' ) . innerHTML = templates . movie ( detail ) ;
57+ var template = window . templates . movie ( detail ) ;
58+ document . getElementById ( 'film_detail' ) . innerHTML = template ;
5959 } ;
6060 xhr . open ( 'GET' , '/movies/content?title=' +
6161 encodeURIComponent ( title ) +
6262 '&director=' +
6363 encodeURIComponent ( director ) ) ;
6464 xhr . responseType = 'json' ;
6565 xhr . send ( ) ;
66- }
66+ } ;
6767
68- function showMovieDetail ( item , map ) {
68+ window . showMovieDetail = function ( item , map ) {
6969 displayLoadingPanel ( item . title ) ;
7070 getMoveDetail ( item . title , item . director ) ;
7171 plotLocations ( item , map ) ;
72- }
72+ } ;
0 commit comments