@@ -53,6 +53,7 @@ FITB.prototype = new RunestoneBase();
5353FITB . prototype . init = function ( opts ) {
5454 RunestoneBase . apply ( this , arguments ) ;
5555 var orig = opts . orig ; // entire <p> element
56+ this . useRunestoneServices = opts . useRunestoneServices ;
5657 this . origElem = orig ;
5758 this . divid = orig . id ;
5859 this . questionArray = [ ] ;
@@ -188,21 +189,24 @@ FITB.prototype.renderFITBButtons = function () {
188189 this . submitButton . addEventListener ( "click" , function ( ) {
189190 this . checkFITBStorage ( ) ;
190191 } . bind ( this ) , false ) ;
191- this . compareButton = document . createElement ( "button" ) ; // Compare me button
192- $ ( this . compareButton ) . attr ( {
193- "class" : "btn btn-default" ,
194- "id" : this . origElem . id + "_bcomp" ,
195- "disabled" : "" ,
196- "name" : "compare"
197- } ) ;
198- this . compareButton . textContent = "Compare Me" ;
199- this . compareButton . addEventListener ( "click" , function ( ) {
200- this . compareFITBAnswers ( ) ;
201- } . bind ( this ) , false ) ;
202192 this . containerDiv . appendChild ( document . createElement ( "br" ) ) ;
203193 this . containerDiv . appendChild ( document . createElement ( "br" ) ) ;
204194 this . containerDiv . appendChild ( this . submitButton ) ;
205- this . containerDiv . appendChild ( this . compareButton ) ;
195+ if ( this . useRunestoneServices ) {
196+ this . compareButton = document . createElement ( "button" ) ; // Compare me button
197+ $ ( this . compareButton ) . attr ( {
198+ "class" : "btn btn-default" ,
199+ "id" : this . origElem . id + "_bcomp" ,
200+ "disabled" : "" ,
201+ "name" : "compare"
202+ } ) ;
203+ this . compareButton . textContent = "Compare Me" ;
204+ this . compareButton . addEventListener ( "click" , function ( ) {
205+ this . compareFITBAnswers ( ) ;
206+ } . bind ( this ) , false ) ;
207+ this . containerDiv . appendChild ( this . compareButton ) ;
208+ }
209+
206210 this . containerDiv . appendChild ( document . createElement ( "div" ) ) ;
207211} ;
208212
@@ -367,8 +371,9 @@ FITB.prototype.compareFITB = function (data, status, whatever) { // Creates a
367371=================================*/
368372$ ( document ) . ready ( function ( ) {
369373 $ ( "[data-component=fillintheblank]" ) . each ( function ( index ) { // FITB
374+ var opts = { 'orig' : this , 'useRunestoneServices' : eBookConfig . useRunestoneServices }
370375 if ( $ ( this . parentNode ) . data ( "component" ) !== "timedAssessment" ) { // If this element exists within a timed component, don't render it here
371- FITBList [ this . id ] = new FITB ( { "orig" : this } ) ;
376+ FITBList [ this . id ] = new FITB ( opts ) ;
372377 }
373378 } ) ;
374379} ) ;
0 commit comments