1
- /*global Handlebars */
2
-
3
1
Conductor . require ( '/vendor/jquery.js' ) ;
4
- Conductor . require ( '/example/libs/handlebars-1.0.0-rc.3.js' ) ;
5
2
Conductor . requireCSS ( '/example/cards/tutorial/ad_card.css' ) ;
6
3
7
4
var RSVP = Conductor . Oasis . RSVP ;
8
- var videoSelectTemplate = '<div id="selectWrapper">Load Video: <select id="videoSelect">{{#each videoIds}}<option value="{{this}}">{{this}}</option>{{/each}}</select></div>' ;
5
+ var destinationUrl = window . location . protocol + "//" + window . location . hostname + ":" + ( parseInt ( window . location . port , 10 ) + 2 ) ;
9
6
10
7
var card = Conductor . card ( {
11
8
videoIds : [ '4d8ZDSyFS2g' , 'EquPUW83D-Q' ] ,
@@ -55,23 +52,21 @@ var card = Conductor.card({
55
52
} ,
56
53
57
54
childCards : [
58
- { url : '../ cards/tutorial/youtube_card.js ', id : '1' , options : { capabilities : [ 'video' ] } } ,
59
- { url : '../ cards/tutorial/survey_card.js ', id : '1' , options : { capabilities : [ 'survey' ] } }
55
+ { url : destinationUrl + '/example/ cards/tutorial/youtube_card.html ', id : '1' , options : { capabilities : [ 'video' ] } } ,
56
+ { url : destinationUrl + '/example/ cards/tutorial/survey_card.html ', id : '1' , options : { capabilities : [ 'survey' ] } }
60
57
] ,
61
58
62
59
loadDataForChildCards : function ( data ) {
63
60
var videoCardOptions = this . childCards [ 0 ] ,
64
61
surveyCardOptions = this . childCards [ 1 ] ;
65
62
66
- this . videoId = this . videoIds [ 0 ] ;
67
- videoCardOptions . data = { videoId : this . videoId } ;
63
+ videoCardOptions . data = { videoId : data . videoId } ;
68
64
} ,
69
65
70
- activate : function ( ) {
66
+ activate : function ( data ) {
71
67
Conductor . Oasis . RSVP . EventTarget . mixin ( this ) ;
72
- this . consumers . height . autoUpdate = false ;
73
68
74
- videoSelectTemplate = Handlebars . compile ( videoSelectTemplate ) ;
69
+ this . videoId = data . videoId ;
75
70
this . videoCard = this . childCards [ 0 ] . card ;
76
71
this . surveyCard = this . childCards [ 1 ] . card ;
77
72
} ,
@@ -112,25 +107,8 @@ var card = Conductor.card({
112
107
} ,
113
108
114
109
initializeDOM : function ( ) {
115
- var card = this ;
116
-
117
- $ ( videoSelectTemplate ( this ) ) . appendTo ( 'body' ) ;
118
- $ ( '#videoSelect' ) . change ( function ( ) {
119
- card . changeVideo ( $ ( this ) . val ( ) ) ;
120
- } ) ;
121
-
122
- this . selectWrapperDiv = $ ( '#selectWrapper' ) ;
123
- this . cardWrapperDiv = $ ( '<div id="cardWrapper"></div>' ) ;
124
- this . cardWrapperDiv . appendTo ( 'body' ) ;
125
- this . videoCard . appendTo ( this . cardWrapperDiv [ 0 ] ) ;
126
- this . surveyCard . appendTo ( this . cardWrapperDiv [ 0 ] ) ;
127
- } ,
128
-
129
- changeVideo : function ( videoId ) {
130
- this . videoId = videoId ;
131
- console . log ( 'Change the video to ' + videoId ) ;
132
- this . conductor . loadData ( '../cards/tutorial/youtube_card.js' , '1' , { videoId : this . videoId } ) ;
133
- this . render ( 'video' ) ;
110
+ this . videoCard . appendTo ( document . body ) ;
111
+ this . surveyCard . appendTo ( document . body ) ;
134
112
} ,
135
113
136
114
getDimensions : function ( ) {
@@ -147,7 +125,5 @@ var card = Conductor.card({
147
125
width : window . innerWidth
148
126
} ;
149
127
}
150
-
151
- this . cardWrapperDiv . height ( this . _dimensions . height - this . selectWrapperDiv . height ( ) ) ;
152
128
}
153
129
} ) ;
0 commit comments