@@ -311,8 +311,8 @@ function embedNbApp() {
311311 isSyncNotificationPopup : false ,
312312 isSyncSpotlightNewThread : false ,
313313 isNbLog : false ,
314+ nbLogEventsEnabled : [ ] ,
314315 syncSpotlightNewThreadConfig : { } ,
315- isNbLogScroll : false ,
316316 nbLogScrollSpoConfig : 2000 ,
317317 isShowQuickEditor : false ,
318318 sortByConfig : 'init' ,
@@ -554,8 +554,8 @@ function embedNbApp() {
554554 this . currentConfigs . isSyncNotificationPopup = configs [ 'SYNC_NOTIFICATION_POPUP' ] === 'true' ? true : false
555555 this . currentConfigs . isSyncSpotlightNewThread = configs [ 'SYNC_SPOTLIGHT_NEW_THREAD' ] === 'true' ? true : false
556556 this . currentConfigs . isNbLog = configs [ 'NB_LOG' ] === 'true' ? true : false
557+ this . currentConfigs . nbLogEventsEnabled = configs [ 'CONFIG_NB_LOG_EVENTS_ENABLED' ] ? JSON . parse ( configs [ 'CONFIG_NB_LOG_EVENTS_ENABLED' ] ) : [ ]
557558 this . currentConfigs . syncSpotlightNewThreadConfig = configs [ 'CONFIG_SYNC_SPOTLIGHT_NEW_THREAD' ] ? JSON . parse ( configs [ 'CONFIG_SYNC_SPOTLIGHT_NEW_THREAD' ] ) : { }
558- this . currentConfigs . isNbLogScroll = configs [ 'NB_LOG_SCROLL' ] === 'true' ? true : false
559559 this . currentConfigs . nbLogScrollSpoConfig = configs [ 'CONFIG_NB_LOG_SCROLL' ] ? Number ( configs [ 'CONFIG_NB_LOG_SCROLL' ] ) : 2000
560560 this . currentConfigs . isShowQuickEditor = configs [ 'SHOW_QUICK_EDITOR' ] === 'true' ? true : false
561561 this . currentConfigs . sortByConfig = configs [ 'CONFIG_SORT_BY' ] ? configs [ 'CONFIG_SORT_BY' ] : 'recent'
@@ -1277,7 +1277,7 @@ function embedNbApp() {
12771277 window . removeEventListener ( 'scroll' , this . handleScroll )
12781278 } ,
12791279 onLogNb : async function ( event = 'NONE' , initiator = 'NONE' , spotlightType = 'NONE' , isSyncAnnotation = false , hasSyncAnnotation = false , notificationTrigger = 'NONE' , annotationId = null , countAnnotationReplies = 0 ) {
1280- if ( this . currentConfigs . isNbLog ) {
1280+ if ( this . currentConfigs . isNbLog && this . currentConfigs . nbLogEventsEnabled . includes ( event ) ) {
12811281 // console.log(`onLogNb \nevent: ${event} \ninitiator: ${initiator} \nspotlightType: ${spotlightType} \nisSyncAnnotation: ${isSyncAnnotation} \nhasSyncAnnotation: ${hasSyncAnnotation} \nnotificationTrigger: ${notificationTrigger} \nannotationId: ${annotationId} \nannotation_replies_count: ${countAnnotationReplies}`)
12821282 const token = localStorage . getItem ( "nb.user" ) ;
12831283 const config = { headers : { Authorization : 'Bearer ' + token } , params : { url : this . sourceURL } }
@@ -1327,7 +1327,7 @@ function embedNbApp() {
13271327 return new Promise ( resolve => setTimeout ( resolve , ms ) )
13281328 } ,
13291329 handleScroll : function ( e ) {
1330- if ( this . currentConfigs . isNbLogScroll ) {
1330+ if ( this . currentConfigs . nbLogEventsEnabled . includes ( 'SCROLL' ) ) {
13311331 clearTimeout ( this . scrollLogTimer )
13321332 this . scrollLogTimer = setTimeout ( ( ) => this . onLogNb ( 'SCROLL' ) , this . currentConfigs . nbLogScrollSpoConfig )
13331333 }
0 commit comments