@@ -53,6 +53,26 @@ function disableFieldsThatShouldNotBeSubmitted() {
53
53
$ ( '.version-selectorizor' ) . prop ( 'disabled' , 'disabled' ) ;
54
54
}
55
55
56
+ function highlightPactPublicationsWithSameContent ( td ) {
57
+ const pactVersionSha = $ ( td ) . data ( 'pact-version-sha' ) ;
58
+ $ ( '*[data-pact-version-sha="' + pactVersionSha + '"]' ) . addClass ( 'bg-info' ) ;
59
+ }
60
+
61
+ function unHighlightPactPublicationsWithSameContent ( td , event ) {
62
+ var destinationElement = $ ( event . toElement || event . relatedTarget ) ;
63
+ // Have to use mouseout instead of mouseleave, because the tooltip is a child
64
+ // of the td, and the mouseleave will consider that hovering over the tooltip
65
+ // does not count as leaving. Unfortunately, if you then leave the tooltip,
66
+ // the div gets removed without firing the mouseleave event, so the cells remain
67
+ // highlighted.
68
+ // The tooltip needs to be a child of the td so that we can style the one showing
69
+ // the SHA so that it's wide enough to fit the SHA in.
70
+ if ( ! $ ( td ) . find ( 'a' ) . is ( destinationElement ) ) {
71
+ const pactVersionSha = $ ( td ) . data ( 'pact-version-sha' ) ;
72
+ $ ( '*[data-pact-version-sha="' + pactVersionSha + '"]' ) . removeClass ( 'bg-info' ) ;
73
+ }
74
+ }
75
+
56
76
$ ( document ) . ready ( function ( ) {
57
77
$ ( '.version-selectorizor' ) . change ( handleSelectorizorChanged ) ;
58
78
$ ( '.version-selectorizor' ) . each ( function ( ) { showApplicableTextBoxes ( $ ( this ) ) ; } ) ;
@@ -65,6 +85,11 @@ $(document).ready(function(){
65
85
} ) ;
66
86
67
87
$ ( '[data-toggle="tooltip"]' ) . each ( function ( index , el ) {
68
- $ ( el ) . tooltip ( { container : $ ( el ) } ) ;
88
+ $ ( el ) . tooltip ( { container : $ ( el ) } )
69
89
} ) ;
90
+
91
+ initializeClipper ( '.clippable' ) ;
92
+
93
+ $ ( 'td.pact-published' ) . mouseover ( function ( event ) { highlightPactPublicationsWithSameContent ( this ) } ) ;
94
+ $ ( 'td.pact-published' ) . mouseout ( function ( event ) { unHighlightPactPublicationsWithSameContent ( this , event ) } ) ;
70
95
} ) ;
0 commit comments