@@ -5,10 +5,7 @@ const cross_icon = '<path d="M2.343 13.657A8 8 0 1 1 13.658 2.343 8 8 0 0 1 2.34
55
66const icon_elem = '<svg version="1.1" width="1.0em" height="1.0em" class="sd-octicon sd-octicon-feed-plus sd-text-info code-annotation-icon" viewBox="0 0 16 16" aria-hidden="true">' + plus_icon + '</svg>' ;
77
8- var selectedAnnotation = {
9- "icon" : null ,
10- "text" : null
11- }
8+ var selectedAnnotation = null ;
129
1310var selected_icon = null ;
1411var selected_text = null ;
@@ -24,8 +21,7 @@ function areSelectedAnnotation() {
2421 * Update the selected annotation.
2522 */
2623function selectAnnotation ( icon , text ) {
27- selectedAnnotation [ "icon" ] = icon ;
28- selectedAnnotation [ "text" ] = text ;
24+ selectedAnnotation = { icon, text} ;
2925}
3026
3127/**
@@ -34,9 +30,8 @@ function selectAnnotation(icon, text) {
3430 */
3531function hideSelectedAnnotation ( ) {
3632 if ( areSelectedAnnotation ( ) ) {
37- hideAnnotation ( selected_icon , selected_text ) ;
38- selectedAnnotation [ "icon" ] = null ;
39- selectedAnnotation [ "text" ] = null ;
33+ hideAnnotation ( selectedAnnotation ) ;
34+ selectedAnnotation = null ;
4035 }
4136}
4237
@@ -129,9 +124,9 @@ function onClickAnnotation(id) {
129124 const text = document . getElementById ( 'code-annotation-text-' + id ) ;
130125
131126 if ( text . style . display == "none" ) {
132- show_annotation ( icon , text ) ;
127+ show_annotation ( { icon, text} ) ;
133128 } else {
134- hideAnnotation ( icon , text ) ;
129+ hideAnnotation ( { icon, text} ) ;
135130 }
136131}
137132
0 commit comments