@@ -4,26 +4,30 @@ import React from 'dom-chef';
44import * as pageDetect from 'github-url-detection' ;
55import PinIcon from 'octicons-plain-react/Pin' ;
66import { $ , closestElement , elementExists } from 'select-dom' ;
7+ import { assertDefined } from 'ts-extras' ;
78
89import features from '../feature-manager.js' ;
9- import { is } from '../helpers/css-selectors.js' ;
1010import observe from '../helpers/selector-observer.js' ;
1111import { issueIcons } from './select-notifications.js' ;
1212
1313function mark ( issueLink : HTMLAnchorElement ) : void {
14- if ( ! elementExists ( `[class*='PinnedIssues-module__container '] a[href$="${ issueLink . pathname } "]` ) ) {
14+ if ( ! elementExists ( `ul[aria-label='Drag and drop pinned issues list. '] a[href$="${ issueLink . pathname } "]` ) ) {
1515 return ;
1616 }
1717
1818 // Keep the container and its classes, replace just the contents
1919 const paths = ( < PinIcon /> ) . children ;
20- const icon = $ ( is ( issueIcons ) , closestElement ( 'li' , issueLink ) ) ;
20+ const icon = $ ( issueIcons , closestElement ( 'li' , issueLink ) ) ;
2121 icon . replaceChildren ( ...paths ) ;
2222 icon . parentElement ! . classList . add ( 'rgh-pinned-issue-icon' ) ;
23+
24+ const colorClass = [ ...icon . classList ] . find ( className => className . startsWith ( 'fgColor' ) ) ;
25+ assertDefined ( colorClass ) ;
26+ icon . parentElement ! . classList . add ( colorClass ) ;
2327}
2428
2529function init ( signal : AbortSignal ) : void {
26- observe ( 'a[data-testid="issue-pr -title-link"]' , mark , { signal} ) ;
30+ observe ( 'a[data-testid="issue-listitem -title-link"]' , mark , { signal} ) ;
2731}
2832
2933void features . add ( import . meta. url , {
@@ -37,8 +41,6 @@ void features.add(import.meta.url, {
3741
3842Test URLs:
3943
40- https://github.com/refined-github/sandbox/issues?q=title
41-
42- Only for the screenshot: https://github.com/gulpjs/gulp/issues?q=in%3Atitle%20update%20docs%20for%20sort%3Aupdated-asc
44+ https://github.com/bfred-it-org/one-file-repo/issues (click "clear" on search field or else pinned issues don't show)
4345
4446*/
0 commit comments