11$ ( function ( ) {
22 'use strict' ;
33
4- function configureCopyButton ( id ) {
5- var copyButton = $ ( '#' + id + '-button' ) ;
6- copyButton . popover ( { trigger : 'manual' } ) ;
7-
8- copyButton . click ( function ( ) {
9- var text = $ ( '#' + id + '-text' ) . text ( ) . trim ( ) ;
10- window . nuget . copyTextToClipboard ( text , copyButton ) ;
11- copyButton . popover ( 'show' ) ;
12- setTimeout ( function ( ) {
13- copyButton . popover ( 'destroy' ) ;
14- } , 1000 ) ;
4+ // Configure the deprecation information container
5+ var container = $ ( '#show-deprecation-content-container' ) ;
6+ if ( $ ( '#deprecation-content-container' ) . children ( ) . length ) {
7+ // If the deprecation information container has content, configure it as an expander.
8+ window . nuget . configureExpander ( "deprecation-content-container" , "ChevronDown" , null , "ChevronUp" ) ;
9+ container . keydown ( function ( event ) {
10+ if ( event . which === 13 ) { // Enter
11+ $ ( event . target ) . click ( ) ;
12+ }
1513 } ) ;
16- }
17-
14+ }
15+ else {
16+ // If the container does not have content, remove its expander attributes
17+ var expanderAttributes = [ 'data-toggle' , 'data-target' , 'aria-expanded' , 'aria-controls' , 'tabindex' ] ;
18+ for ( var i in expanderAttributes ) {
19+ container . removeAttr ( expanderAttributes [ i ] ) ;
20+ }
21+
22+ $ ( '#deprecation-expander-icon-right' ) . hide ( ) ;
23+ }
24+
25+ // Configure ReadMe container
1826 var readmeContainer = $ ( "#readme-container" ) ;
1927 if ( readmeContainer [ 0 ] )
2028 {
@@ -41,6 +49,7 @@ $(function () {
4149 } ) ;
4250 }
4351
52+ // Configure expanders
4453 window . nuget . configureExpanderHeading ( "dependency-groups" ) ;
4554 window . nuget . configureExpanderHeading ( "version-history" ) ;
4655 window . nuget . configureExpander (
@@ -50,6 +59,21 @@ $(function () {
5059 "CalculatorSubtract" ,
5160 "Show more" ) ;
5261
62+ // Configure package manager copy buttons
63+ function configureCopyButton ( id ) {
64+ var copyButton = $ ( '#' + id + '-button' ) ;
65+ copyButton . popover ( { trigger : 'manual' } ) ;
66+
67+ copyButton . click ( function ( ) {
68+ var text = $ ( '#' + id + '-text' ) . text ( ) . trim ( ) ;
69+ window . nuget . copyTextToClipboard ( text , copyButton ) ;
70+ copyButton . popover ( 'show' ) ;
71+ setTimeout ( function ( ) {
72+ copyButton . popover ( 'destroy' ) ;
73+ } , 1000 ) ;
74+ } ) ;
75+ }
76+
5377 for ( var i in packageManagers )
5478 {
5579 configureCopyButton ( packageManagers [ i ] ) ;
0 commit comments