@@ -39,23 +39,24 @@ function drawApplicationTimeline(groupArray, eventObjArray, startTime) {
39
39
40
40
function setupJobEventAction ( ) {
41
41
$ ( ".item.range.job.application-timeline-object" ) . each ( function ( ) {
42
- var getJobId = function ( baseElem ) {
42
+ var getSelectorForJobEntry = function ( baseElem ) {
43
43
var jobIdText = $ ( $ ( baseElem ) . find ( ".application-timeline-content" ) [ 0 ] ) . text ( ) ;
44
44
var jobId = jobIdText . match ( "\\(Job (\\d+)\\)" ) [ 1 ] ;
45
- return jobId ;
45
+ return "#job-" + jobId ;
46
46
} ;
47
47
48
48
$ ( 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
50
51
} ) ;
51
52
52
53
$ ( this ) . hover (
53
54
function ( ) {
54
- $ ( "#job-" + getJobId ( this ) ) . addClass ( "corresponding-item-hover" ) ;
55
+ $ ( getSelectorForJobEntry ( this ) ) . addClass ( "corresponding-item-hover" ) ;
55
56
$ ( $ ( this ) . find ( "div.application-timeline-content" ) [ 0 ] ) . tooltip ( "show" ) ;
56
57
} ,
57
58
function ( ) {
58
- $ ( "#job-" + getJobId ( this ) ) . removeClass ( "corresponding-item-hover" ) ;
59
+ $ ( getSelectorForJobEntry ( this ) ) . removeClass ( "corresponding-item-hover" ) ;
59
60
$ ( $ ( this ) . find ( "div.application-timeline-content" ) [ 0 ] ) . tooltip ( "hide" ) ;
60
61
}
61
62
) ;
@@ -97,32 +98,24 @@ function drawJobTimeline(groupArray, eventObjArray, startTime) {
97
98
98
99
function setupStageEventAction ( ) {
99
100
$ ( ".item.range.stage.job-timeline-object" ) . each ( function ( ) {
100
- var getStageIdAndAttempt = function ( baseElem ) {
101
+ var getSelectorForStageEntry = function ( baseElem ) {
101
102
var stageIdText = $ ( $ ( baseElem ) . find ( ".job-timeline-content" ) [ 0 ] ) . text ( ) ;
102
103
var stageIdAndAttempt = stageIdText . match ( "\\(Stage (\\d+\\.\\d+)\\)" ) [ 1 ] . split ( "." ) ;
103
- return stageIdAndAttempt ;
104
+ return "#stage-" + stageIdAndAttempt [ 0 ] + "-" + stageIdAndAttempt [ 1 ] ;
104
105
} ;
105
106
106
107
$ ( 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
111
110
} ) ;
112
111
113
112
$ ( this ) . hover (
114
113
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" ) ;
119
115
$ ( $ ( this ) . find ( "div.job-timeline-content" ) [ 0 ] ) . tooltip ( "show" ) ;
120
116
} ,
121
117
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" ) ;
126
119
$ ( $ ( this ) . find ( "div.job-timeline-content" ) [ 0 ] ) . tooltip ( "hide" ) ;
127
120
}
128
121
) ;
0 commit comments