@@ -39,23 +39,24 @@ function drawApplicationTimeline(groupArray, eventObjArray, startTime) {
3939
4040 function setupJobEventAction ( ) {
4141 $ ( ".item.range.job.application-timeline-object" ) . each ( function ( ) {
42- var getJobId = function ( baseElem ) {
42+ var getSelectorForJobEntry = function ( baseElem ) {
4343 var jobIdText = $ ( $ ( baseElem ) . find ( ".application-timeline-content" ) [ 0 ] ) . text ( ) ;
4444 var jobId = jobIdText . match ( "\\(Job (\\d+)\\)" ) [ 1 ] ;
45- return jobId ;
45+ return "#job-" + jobId ;
4646 } ;
4747
4848 $ ( this ) . click ( function ( ) {
49- window . location . href = "job/?id=" + getJobId ( this ) ;
49+ var jobPagePath = $ ( getSelectorForJobEntry ( this ) ) . find ( "a" ) . attr ( "href" )
50+ window . location . href = jobPagePath
5051 } ) ;
5152
5253 $ ( this ) . hover (
5354 function ( ) {
54- $ ( "#job-" + getJobId ( this ) ) . addClass ( "corresponding-item-hover" ) ;
55+ $ ( getSelectorForJobEntry ( this ) ) . addClass ( "corresponding-item-hover" ) ;
5556 $ ( $ ( this ) . find ( "div.application-timeline-content" ) [ 0 ] ) . tooltip ( "show" ) ;
5657 } ,
5758 function ( ) {
58- $ ( "#job-" + getJobId ( this ) ) . removeClass ( "corresponding-item-hover" ) ;
59+ $ ( getSelectorForJobEntry ( this ) ) . removeClass ( "corresponding-item-hover" ) ;
5960 $ ( $ ( this ) . find ( "div.application-timeline-content" ) [ 0 ] ) . tooltip ( "hide" ) ;
6061 }
6162 ) ;
@@ -97,32 +98,24 @@ function drawJobTimeline(groupArray, eventObjArray, startTime) {
9798
9899 function setupStageEventAction ( ) {
99100 $ ( ".item.range.stage.job-timeline-object" ) . each ( function ( ) {
100- var getStageIdAndAttempt = function ( baseElem ) {
101+ var getSelectorForStageEntry = function ( baseElem ) {
101102 var stageIdText = $ ( $ ( baseElem ) . find ( ".job-timeline-content" ) [ 0 ] ) . text ( ) ;
102103 var stageIdAndAttempt = stageIdText . match ( "\\(Stage (\\d+\\.\\d+)\\)" ) [ 1 ] . split ( "." ) ;
103- return stageIdAndAttempt ;
104+ return "#stage-" + stageIdAndAttempt [ 0 ] + "-" + stageIdAndAttempt [ 1 ] ;
104105 } ;
105106
106107 $ ( this ) . click ( function ( ) {
107- var idAndAttempt = getStageIdAndAttempt ( this ) ;
108- var id = idAndAttempt [ 0 ] ;
109- var attempt = idAndAttempt [ 1 ] ;
110- window . location . href = "../../stages/stage/?id=" + id + "&attempt=" + attempt ;
108+ var stagePagePath = $ ( getSelectorForStageEntry ( this ) ) . find ( "a" ) . attr ( "href" )
109+ window . location . href = stagePagePath
111110 } ) ;
112111
113112 $ ( this ) . hover (
114113 function ( ) {
115- var idAndAttempt = getStageIdAndAttempt ( this ) ;
116- var id = idAndAttempt [ 0 ] ;
117- var attempt = idAndAttempt [ 1 ] ;
118- $ ( "#stage-" + id + "-" + attempt ) . addClass ( "corresponding-item-hover" ) ;
114+ $ ( getSelectorForStageEntry ( this ) ) . addClass ( "corresponding-item-hover" ) ;
119115 $ ( $ ( this ) . find ( "div.job-timeline-content" ) [ 0 ] ) . tooltip ( "show" ) ;
120116 } ,
121117 function ( ) {
122- var idAndAttempt = getStageIdAndAttempt ( this ) ;
123- var id = idAndAttempt [ 0 ] ;
124- var attempt = idAndAttempt [ 1 ] ;
125- $ ( "#stage-" + id + "-" + attempt ) . removeClass ( "corresponding-item-hover" ) ;
118+ $ ( getSelectorForStageEntry ( this ) ) . removeClass ( "corresponding-item-hover" ) ;
126119 $ ( $ ( this ) . find ( "div.job-timeline-content" ) [ 0 ] ) . tooltip ( "hide" ) ;
127120 }
128121 ) ;
0 commit comments