<commit_before>if( typeof( StudyEdit ) === "undefined" ) { 
	StudyEdit = {};
};

StudyEdit.design = {
	timelineObject: null,
	initialize: function( data, studyStartDate, groupReference ) {
		StudyEdit.design.timelineObject = StudyEdit.design.editableTimeline( 
			"#timeline-eventgroups", 
			data, 
			{ 
				dragAreaWidth: 0, 
				dragFrom: "#eventgroups",
				t0: studyStartDate
			},
			StudyEdit.design.subjectEventGroups.eventListeners
		);
		StudyEdit.design.timelineObject.groupReference = groupReference;
		StudyEdit.design.eventGroups.initialize( studyStartDate );
		StudyEdit.design.subjectGroups.initialize();
	},
	
	editableTimeline: function( container, data, options, eventHandlers ) {
		if( typeof( options ) === "undefined" )
			options = {}
		
		var dragFrom = false;
		if( options.dragFrom ) {
			dragFrom = options.dragFrom;
			delete options.dragFrom;
		}
		
		options = $.extend( options, { 
			editable: true, 
			groupsChangeable: true,
			showCurrentTime: false,
			showCustomTime: false,
			droppable: ( dragFrom ? true : false )
		} );
	    var timeline = new dbnp.study.Timeline( $(container).get(0) );
	    timeline.draw( data, options );
    	
	    if( dragFrom ) {
		    $( dragFrom ).find( "li:not(.add)" ).draggable({ helper: 'clone' });
	    }
	    
	    // Add event listeners
	    links.events.addListener(timeline, 'dragin', eventHandlers.add );
	    links.events.addListener(timeline, 'change', eventHandlers.change);
	    links.events.addListener(timeline, 'delete', eventHandlers.delete);
	    
	    // Prevent adding new items by doubleclick
	    links.events.addListener(timeline, 'add', function() { timeline.cancelAdd(); } );
	    
	    return timeline;
	},


};

StudyEdit.design.subjectEventGroups = {
	add: function( studyId, start, group, eventGroupId, afterAdd ) {
		var url = $( 'form#subjectEventGroup' ).attr( 'action' ) + "Add";
		var data = {
			id: studyId,
			start: start.getTime(),
			subjectGroup: group,
			eventGroupId: eventGroupId<commit_msg>The timeline update to 2.6.1 has changed an event name. <commit_after>if( typeof( StudyEdit ) === "undefined" ) { 
	StudyEdit = {};
};

StudyEdit.design = {
	timelineObject: null,
	initialize: function( data, studyStartDate, groupReference ) {
		StudyEdit.design.timelineObject = StudyEdit.design.editableTimeline( 
			"#timeline-eventgroups", 
			data, 
			{ 
				dragAreaWidth: 0, 
				dragFrom: "#eventgroups",
				t0: studyStartDate
			},
			StudyEdit.design.subjectEventGroups.eventListeners
		);
		StudyEdit.design.timelineObject.groupReference = groupReference;
		StudyEdit.design.eventGroups.initialize( studyStartDate );
		StudyEdit.design.subjectGroups.initialize();
	},
	
	editableTimeline: function( container, data, options, eventHandlers ) {
		if( typeof( options ) === "undefined" )
			options = {}
		
		var dragFrom = false;
		if( options.dragFrom ) {
			dragFrom = options.dragFrom;
			delete options.dragFrom;
		}
		
		options = $.extend( options, { 
			editable: true, 
			groupsChangeable: true,
			showCurrentTime: false,
			showCustomTime: false,
			droppable: ( dragFrom ? true : false )
		} );
		
	    var timeline = new dbnp.study.Timeline( $(container).get(0) );
	    timeline.draw( data, options );
    	
	    if( dragFrom ) {
		    $( dragFrom ).find( "li:not(.add)" ).draggable({ helper: 'clone' });
	    }
	    
	    // Add event listeners
	    links.events.addListener(timeline, 'dragin', eventHandlers.add );
	    links.events.addListener(timeline, 'changed', eventHandlers.change);
	    links.events.addListener(timeline, 'delete', eventHandlers.delete);
	    
	    // Prevent adding new items by doubleclick
	    links.events.addListener(timeline, 'add', function() { timeline.cancelAdd(); } );
	    
	    return timeline;
	},


};

StudyEdit.design.subjectEventGroups = {
	add: function( studyId, start, group, eventGroupId, afterAdd ) {
		var url = $( 'form#subjectEventGroup' ).attr( 'action' ) + "Add";
		var data = {
			id: studyId,
			start: start.getTime(),
			subjectGroup: group,
			eventGroupId: eventGroupId
{'fraction_non_alphanumeric': 0.13285679073206802, 'fraction_numerical': 0.002218387971407444, 'mean_word_length': 3.513904338153504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3373320', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1264, 'n_words': 265}