|
115 | 115 |
|
116 | 116 | updateLink('issues'); |
117 | 117 | updateLink('pullRequests'); |
| 118 | + updateLink('repos'); |
118 | 119 |
|
119 | 120 | if (CONFIG.marketplace.add) updateLink('marketplace'); |
120 | 121 | if (CONFIG.explore.add) updateLink('explore'); |
|
651 | 652 | } |
652 | 653 |
|
653 | 654 | function updateLink(configKey) { |
654 | | - log(DEBUG, 'updateLink()'); |
| 655 | + log(DEBUG, `updateLink() with ${configKey}`); |
655 | 656 |
|
656 | 657 | const elementConfig = CONFIG[configKey]; |
657 | 658 | const elementSelector = SELECTORS[configKey]; |
|
661 | 662 |
|
662 | 663 | if (tooltipElement) { |
663 | 664 | link = tooltipElement.previousElementSibling; |
| 665 | + log(DEBUG, `Found link for ${configKey} using tooltipElement.previousElementSibling`); |
664 | 666 | } else { |
665 | 667 | log(DEBUG, `Tooltip for '${configKey}' not found`); |
666 | 668 |
|
667 | 669 | const linkId = createId(SELECTORS[configKey].id); |
| 670 | + log(DEBUG, `Trying HEADER.querySelector(${linkId}) for ${configKey}`); |
668 | 671 | link = HEADER.querySelector(linkId); |
669 | 672 |
|
670 | 673 | if (!link) { |
671 | | - logError(`Selector '${linkId}' not found`); |
672 | | - |
673 | | - return; |
| 674 | + log(DEBUG, `HEADER.querySelector(${linkId}) not found, trying SELECTORS[configKey].link: ${elementSelector.link}`); |
| 675 | + link = HEADER.querySelector(elementSelector.link); |
| 676 | + if (!link) { |
| 677 | + logError(`Selector '${linkId}' and '${elementSelector.link}' not found for ${configKey}`); |
| 678 | + return; |
| 679 | + } else { |
| 680 | + log(DEBUG, `Found link for ${configKey} using selector: ${elementSelector.link}`); |
| 681 | + } |
| 682 | + } else { |
| 683 | + log(DEBUG, `Found link for ${configKey} using id selector: ${linkId}`); |
674 | 684 | } |
675 | 685 | } |
676 | 686 |
|
|
679 | 689 |
|
680 | 690 | if (elementConfig.remove) { |
681 | 691 | HEADER_STYLE.textContent += cssHideElement(createId(configKey)); |
682 | | - |
683 | 692 | return; |
684 | 693 | } |
685 | 694 |
|
|
689 | 698 |
|
690 | 699 | if (elementConfig.alignLeft) { |
691 | 700 | const response = cloneAndLeftAlignElement(createId(elementSelector.id), elementSelector.id); |
692 | | - |
693 | 701 | if (response.length === 0) return; |
694 | | - |
695 | 702 | const [cloneId, cloneElement] = response; |
696 | | - |
697 | | - elementSelector[CONFIG_NAME] = { |
698 | | - leftAlignedId: cloneId, |
699 | | - }; |
| 703 | + elementSelector[CONFIG_NAME] = { leftAlignedId: cloneId }; |
700 | 704 | link = cloneElement; |
701 | | - |
702 | 705 | linkSelector = createId(cloneId); |
703 | 706 | } |
704 | 707 |
|
|
711 | 714 | if (elementConfig.icon.remove) { |
712 | 715 | const svgId = `${configKey}-svg`; |
713 | 716 | const svg = link.querySelector('svg'); |
714 | | - |
715 | 717 | if (!svg) { |
716 | 718 | logError(`Selector '${configKey} svg' not found`); |
717 | | - |
| 719 | + log(INFO, `Could not find svg for ${configKey} in link element`); |
718 | 720 | return; |
719 | 721 | } |
720 | | - |
721 | 722 | svg.setAttribute('id', svgId); |
722 | | - |
723 | 723 | HEADER_STYLE.textContent += cssHideElement(createId(svgId)); |
724 | 724 | } else { |
725 | 725 | link.querySelector('svg').style.setProperty('fill', elementConfig.icon.color); |
|
3578 | 3578 | topDiv: '.AppHeader-globalBar-start .AppHeader-logo', |
3579 | 3579 | svg: '.AppHeader-logo svg', |
3580 | 3580 | }, |
3581 | | - hamburgerButton: '.AppHeader-globalBar-start deferred-side-panel', |
| 3581 | + hamburgerButton: '.AppHeader-globalBar-start div:first-child react-partial-anchor button', |
3582 | 3582 | pageTitle: { |
3583 | 3583 | id: 'custom-page-title', |
3584 | 3584 | topDiv: '.AppHeader-context', |
|
3613 | 3613 | }, |
3614 | 3614 | issues: { |
3615 | 3615 | id: 'issues', |
| 3616 | + link: '.AppHeader-globalBar-end .AppHeader-actions a[href="/issues"]', |
3616 | 3617 | textContent: 'issues-text-content-span', |
3617 | 3618 | }, |
3618 | 3619 | pullRequests: { |
3619 | 3620 | id: 'pullRequests', |
3620 | 3621 | link: '.AppHeader-globalBar-end .AppHeader-actions a[href="/pulls"]', |
3621 | 3622 | textContent: 'pullRequests-text-content-span', |
3622 | 3623 | }, |
| 3624 | + repos: { |
| 3625 | + id: 'repos', |
| 3626 | + link: '.AppHeader-globalBar-end .AppHeader-actions a[href="/repos"]', |
| 3627 | + textContent: 'repos-text-content-span', |
| 3628 | + }, |
3623 | 3629 | marketplace: { |
3624 | 3630 | id: 'marketplace', |
3625 | 3631 | link: '.AppHeader-globalBar-end .AppHeader-actions a[href="/marketplace"]', |
|
3807 | 3813 | color: '', |
3808 | 3814 | }, |
3809 | 3815 | }, |
| 3816 | + repos: { |
| 3817 | + remove: false, |
| 3818 | + border: true, |
| 3819 | + tooltip: false, |
| 3820 | + alignLeft: false, |
| 3821 | + boxShadow: '', |
| 3822 | + icon: { |
| 3823 | + remove: false, |
| 3824 | + color: '', |
| 3825 | + }, |
| 3826 | + text: { |
| 3827 | + content: 'Repos', |
| 3828 | + color: '', |
| 3829 | + }, |
| 3830 | + hover: { |
| 3831 | + backgroundColor: '', |
| 3832 | + color: '', |
| 3833 | + }, |
| 3834 | + }, |
3810 | 3835 | marketplace: { |
3811 | 3836 | add: false, |
3812 | 3837 | border: false, |
|
4053 | 4078 | color: '', |
4054 | 4079 | }, |
4055 | 4080 | }, |
| 4081 | + repos: { |
| 4082 | + remove: false, |
| 4083 | + border: true, |
| 4084 | + tooltip: false, |
| 4085 | + alignLeft: false, |
| 4086 | + boxShadow: '', |
| 4087 | + icon: { |
| 4088 | + remove: false, |
| 4089 | + color: '', |
| 4090 | + }, |
| 4091 | + text: { |
| 4092 | + content: 'Repos', |
| 4093 | + color: '', |
| 4094 | + }, |
| 4095 | + hover: { |
| 4096 | + backgroundColor: '', |
| 4097 | + color: '', |
| 4098 | + }, |
| 4099 | + }, |
4056 | 4100 | marketplace: { |
4057 | 4101 | add: false, |
4058 | 4102 | border: false, |
|
4301 | 4345 | color: oldSchoolHoverColor, |
4302 | 4346 | }, |
4303 | 4347 | }, |
| 4348 | + repos: { |
| 4349 | + remove: true, |
| 4350 | + border: true, |
| 4351 | + tooltip: false, |
| 4352 | + alignLeft: false, |
| 4353 | + boxShadow: '', |
| 4354 | + icon: { |
| 4355 | + remove: false, |
| 4356 | + color: '', |
| 4357 | + }, |
| 4358 | + text: { |
| 4359 | + content: 'Repos', |
| 4360 | + color: '', |
| 4361 | + }, |
| 4362 | + hover: { |
| 4363 | + backgroundColor: '', |
| 4364 | + color: '', |
| 4365 | + }, |
| 4366 | + }, |
4304 | 4367 | marketplace: { |
4305 | 4368 | add: true, |
4306 | 4369 | border: false, |
|
4549 | 4612 | color: oldSchoolHoverColor, |
4550 | 4613 | }, |
4551 | 4614 | }, |
| 4615 | + repos: { |
| 4616 | + remove: true, |
| 4617 | + border: true, |
| 4618 | + tooltip: false, |
| 4619 | + alignLeft: false, |
| 4620 | + boxShadow: '', |
| 4621 | + icon: { |
| 4622 | + remove: false, |
| 4623 | + color: '', |
| 4624 | + }, |
| 4625 | + text: { |
| 4626 | + content: 'Repos', |
| 4627 | + color: '', |
| 4628 | + }, |
| 4629 | + hover: { |
| 4630 | + backgroundColor: '', |
| 4631 | + color: '', |
| 4632 | + }, |
| 4633 | + }, |
4552 | 4634 | marketplace: { |
4553 | 4635 | add: true, |
4554 | 4636 | border: false, |
|
0 commit comments