From e8c11f453fdb0bbc0f35ee3ae2261d2db4ce9b3e Mon Sep 17 00:00:00 2001
From: Han Dai
Date: Sat, 13 Aug 2016 08:04:08 +0800
Subject: [PATCH 1/3] fix focus effect on up-tree
---
src/inject.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/inject.js b/src/inject.js
index 0ea4655a..ee4318f9 100755
--- a/src/inject.js
+++ b/src/inject.js
@@ -207,6 +207,7 @@ var domUtils = {
addFileSizeAndDownloadLink: function () {
var links = document.querySelectorAll('tr.js-navigation-item > td.content a');
var ns = document.querySelectorAll('tr.js-navigation-item > td.age');
+ var uptree = document.querySelectorAll('tr.up-tree > td');
if (ns.length && ns.length === links.length) { // verify length for showing in-sync
apiUtils.getRepoContent(function (data) {
@@ -235,6 +236,7 @@ var domUtils = {
ns[i].insertAdjacentHTML('afterend', '
| ');
}
}
+ uptree[3].insertAdjacentHTML('afterend', ' | ');
});
}
}
From db498886d31ec98bb7cfa64437ee98f4561caabd Mon Sep 17 00:00:00 2001
From: Han Dai
Date: Sat, 13 Aug 2016 19:03:43 +0800
Subject: [PATCH 2/3] add '.download' to avoid duplicating
---
src/inject.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/inject.js b/src/inject.js
index ee4318f9..c570fa3a 100755
--- a/src/inject.js
+++ b/src/inject.js
@@ -236,9 +236,12 @@ var domUtils = {
ns[i].insertAdjacentHTML('afterend', ' | ');
}
}
- uptree[3].insertAdjacentHTML('afterend', ' | ');
});
}
+ if (uptree && uptree[3]) {
+ utils.removePrevInstancesOf('.download'); // remove before adding new ones
+ uptree[3].insertAdjacentHTML('afterend', ' | ');
+ }
}
};
From 282c6dfe01761316e5166fdfbacbf48e5b003bbf Mon Sep 17 00:00:00 2001
From: Han Dai
Date: Sat, 13 Aug 2016 20:11:41 +0800
Subject: [PATCH 3/3] fix: will remove all '.download' by mistake
---
src/inject.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/inject.js b/src/inject.js
index c570fa3a..e59a0652 100755
--- a/src/inject.js
+++ b/src/inject.js
@@ -216,6 +216,10 @@ var domUtils = {
if (!data) { return; }
utils.removePrevInstancesOf('.download'); // remove before adding new ones
+
+ if (uptree && uptree[3]) {
+ uptree[3].insertAdjacentHTML('afterend', ' | ');
+ }
for (var i = 0; i < ns.length; i++) {
if (data[i].type === 'file') {
@@ -238,10 +242,6 @@ var domUtils = {
}
});
}
- if (uptree && uptree[3]) {
- utils.removePrevInstancesOf('.download'); // remove before adding new ones
- uptree[3].insertAdjacentHTML('afterend', ' | ');
- }
}
};