Skip to content

Commit d5166a3

Browse files
committed
fix(extension): content appearing multiple times, fix #66
1 parent e28b036 commit d5166a3

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## **v4.0.1** - 17th July, 2020
8+
9+
- Fix #66 i.e. content appearing multiple times
10+
711
## **v4.0.0** - 26th June, 2020
812

913
- Support new GitHub Design. Refer [GitHub Blog](https://github.blog/changelog/2020-06-23-design-updates-to-repositories-and-github-ui/)

src/utils/domUtil.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let domUtil = {
2929
return elemClass.split(' ').indexOf(className) > -1;
3030
},
3131
appendRepoSizeElement: function() {
32-
commonUtil.removePrevInstancesOf('.repo-size');
32+
commonUtil.removePrevInstancesOf('.eg-repo-size');
3333

3434
let formattedFileSize = commonUtil.convertSizeToHumanReadableFormat(storageUtil.get('repoSize') * 1024); // GitHub API return size in KB for repo
3535

@@ -39,7 +39,7 @@ let domUtil = {
3939

4040
if (elem) {
4141
let html = `
42-
<div class="mt-3">
42+
<div class="mt-3 eg-repo-size">
4343
<a href="javascript:void(0)" class="muted-link">
4444
<svg class="octicon octicon-database mr-2" mr="2" aria-hidden="true" height="16" version="1.1" viewBox="0 0 12 16" width="16">
4545
<path d="M6 15c-3.31 0-6-.9-6-2v-2c0-.17.09-.34.21-.5.67.86 3 1.5 5.79 1.5s5.12-.64 5.79-1.5c.13.16.21.33.21.5v2c0 1.1-2.69 2-6 2zm0-4c-3.31 0-6-.9-6-2V7c0-.11.04-.21.09-.31.03-.06.07-.13.12-.19C.88 7.36 3.21 8 6 8s5.12-.64 5.79-1.5c.05.06.09.13.12.19.05.1.09.21.09.31v2c0 1.1-2.69 2-6 2zm0-4c-3.31 0-6-.9-6-2V3c0-1.1 2.69-2 6-2s6 .9 6 2v2c0 1.1-2.69 2-6 2zm0-5c-2.21 0-4 .45-4 1s1.79 1 4 1 4-.45 4-1-1.79-1-4-1z"></path>
@@ -55,6 +55,7 @@ let domUtil = {
5555

5656
return;
5757
}
58+
commonUtil.removePrevInstancesOf('.repo-size');
5859
let elem = document.querySelector('ul.numbers-summary');
5960

6061
if (elem) {

src/utils/handlersUtil.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ let handlersUtil = {
4545

4646
if (commonUtil.isForGithUbNewUi()) {
4747
setTimeout(function() {
48+
commonUtil.removePrevInstancesOf('.eg-download'); // remove before adding new ones
49+
4850
const containerItems = document.querySelectorAll(
4951
'.js-navigation-container.js-active-navigation-container .js-navigation-item'
5052
);
@@ -62,7 +64,7 @@ let handlersUtil = {
6264
let formattedFileSize = commonUtil.getFileSizeAndUnit(data[actualDataIndex]);
6365

6466
let html = `
65-
<div role="gridcell" class="mr-1 text-gray-light" style="width: 95px;">
67+
<div role="gridcell" class="mr-1 text-gray-light eg-download" style="width: 95px;">
6668
<span class="css-truncate css-truncate-target d-block">
6769
<span style="margin-right: 5px;">
6870
${formattedFileSize}
@@ -80,7 +82,7 @@ let handlersUtil = {
8082
commitElem.insertAdjacentHTML('afterend', html);
8183
} else {
8284
const defaultHtml = `
83-
<div role="gridcell" class="mr-1" style="width: 90px;"></div>
85+
<div role="gridcell" class="mr-1 eg-download" style="width: 90px;"></div>
8486
`;
8587

8688
commitElem.insertAdjacentHTML('afterend', defaultHtml);

0 commit comments

Comments
 (0)