@@ -262,7 +262,9 @@ export default class Timed extends RunestoneBase {
262262 this . leftContainer . appendChild ( this . leftNavButton ) ;
263263 this . pagNavList . appendChild ( this . leftContainer ) ;
264264 //
265- this . leftContainer = document . createElement ( "li" ) ;
265+ this . flaggingPlace = document . createElement ( "ul" ) ;
266+ $ ( this . flaggingPlace ) . addClass ( "pagination" ) ;
267+ this . flagContainer = document . createElement ( "li" ) ;
266268 this . flagButton = document . createElement ( "button" ) ;
267269 $ ( this . flagButton ) . addClass ( "class1" ) ;
268270 this . flagButton . innerHTML = "Flag" ;
@@ -271,8 +273,8 @@ export default class Timed extends RunestoneBase {
271273 $ ( this . flagButton ) . attr ( "role" , "button" ) ;
272274 $ ( this . flagButton ) . attr ( "id" , "flag" ) ;
273275 $ ( this . flagButton ) . css ( "cursor" , "pointer" ) ;
274- this . leftContainer . appendChild ( this . flagButton ) ;
275- this . pagNavList . appendChild ( this . leftContainer ) ;
276+ this . flagContainer . appendChild ( this . flagButton ) ;
277+ this . flaggingPlace . appendChild ( this . flagContainer ) ;
276278 //
277279 this . rightContainer = document . createElement ( "li" ) ;
278280 this . rightNavButton = document . createElement ( "button" ) ;
@@ -286,6 +288,7 @@ export default class Timed extends RunestoneBase {
286288 this . pagNavList . appendChild ( this . rightContainer ) ;
287289 this . ensureButtonSafety ( ) ;
288290 this . navDiv . appendChild ( this . pagNavList ) ;
291+ this . navDiv . appendChild ( this . flaggingPlace ) ;
289292 this . break = document . createElement ( "br" ) ;
290293 this . navDiv . appendChild ( this . break ) ;
291294 // render the question number jump buttons
@@ -308,6 +311,7 @@ export default class Timed extends RunestoneBase {
308311 this . qNumList . appendChild ( this . qNumWrapperList ) ;
309312 this . navDiv . appendChild ( this . qNumList ) ;
310313 this . navBtnListeners ( ) ;
314+ this . flagBtnListener ( ) ;
311315 }
312316
313317 // when moving off of a question in an active exam:
@@ -381,6 +385,14 @@ export default class Timed extends RunestoneBase {
381385 ) . addClass ( "active" ) ;
382386 }
383387
388+ async handleFlag ( event ) {
389+ var target = $ ( event . target ) . text ( )
390+ if ( target . match ( / F l a g / ) ) {
391+ $ ( "ul#pageNums > ul > li:eq(" + this . currentQuestionIndex + ")"
392+ ) . addClass ( "flagcolor" ) ;
393+ }
394+ }
395+
384396 async handleNumberedNav ( event ) {
385397 if ( ! this . taken ) {
386398 await this . navigateAway ( ) ;
@@ -428,6 +440,15 @@ export default class Timed extends RunestoneBase {
428440 ) ;
429441 }
430442
443+ // set up events for flag
444+ flagBtnListener ( ) {
445+ this . flaggingPlace . addEventListener (
446+ "click" ,
447+ this . handleFlag . bind ( this ) ,
448+ false
449+ ) ;
450+ }
451+
431452 renderSubmitButton ( ) {
432453 this . buttonContainer = document . createElement ( "div" ) ;
433454 $ ( this . buttonContainer ) . attr ( {
0 commit comments