File tree Expand file tree Collapse file tree
bases/rsptx/interactives/runestone/common/js Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -716,12 +716,19 @@ function createStudyCluesWidget() {
716716 if ( ! query ) {
717717 return ;
718718 }
719-
719+ var sectionInfo = "this page" ;
720720 // find the section title on the page to include in the initial query
721- let section = document . querySelector ( 'section.section' ) ;
722- let sectionTitle = section . querySelector ( 'span.title' ) . innerText ;
723- let sectionNumber = section . querySelector ( 'span.codenumber' ) . innerText ;
724- let sectionInfo = `${ sectionNumber } ${ sectionTitle } ` ;
721+ if ( document . querySelector ( "body.pretext" ) ) {
722+ let section = document . querySelector ( 'section.section' ) ;
723+ let sectionTitle = section . querySelector ( 'span.title' ) . innerText ;
724+ let sectionNumber = section . querySelector ( 'span.codenumber' ) . innerText ;
725+ sectionInfo = `${ sectionNumber } ${ sectionTitle } ` ;
726+ } else {
727+ let sectionSpan = document . querySelector ( "span.section-number" ) ;
728+ if ( sectionSpan ) {
729+ sectionInfo = sectionSpan . parentElement . innerText . trim ( ) ;
730+ }
731+ }
725732 if ( studyCluesConversationId === - 1 ) {
726733 query = `Regarding section "${ sectionInfo } ": ${ query } ` ;
727734 }
You can’t perform that action at this time.
0 commit comments