这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,32 @@
border-top-right-radius: 3px;
}

.gitzip-dark .gitzip-header {
color: #f0f6fc;
background-color: #1e2126;
border-bottom: 1px solid #222;
}

.gitzip-body{
margin: 15px;
padding: 0px;
height: 246px;
overflow: auto;
}

.gitzip-dark .gitzip-body{
color: #b3b3b3;
}

.gitzip-dark .gitzip-body p.warn, .gitzip-dark .gitzip-body p.error{
background-color: inherit;
border: none;
}

.gitzip-dark .gitzip-body p.warn{
color: #e3b341;
}

.gitzip-downloading{
width: 480px !important;
height: 320px !important;
Expand All @@ -50,7 +69,6 @@
margin:0 !important;
visibility: hidden;
opacity: 0;
color: black;
}

.gitzip-collect-wrap{
Expand Down Expand Up @@ -97,6 +115,12 @@
opacity: 0;
}

.gitzip-dark .gitzip-collect-dash {
box-shadow: 1px 1px 10px 0px #2f2f2f;
background-color: #13171d;
border: 1px solid #222;
}

.gitzip-downloading .gitzip-collect-dash{
height: 100%;
display: block;
Expand Down
16 changes: 10 additions & 6 deletions js/content/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,15 @@ var Pool = {
// create dom
// Make the dom on right bottom
var self = this;
var isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;

if(!self._el){
var wrap = document.createElement('div'),
dash = document.createElement('div'),
down = document.createElement('p'),
tip = document.createElement('p');

wrap.className = "gitzip-collect-wrap";
wrap.className = "gitzip-collect-wrap" + (isDark ? " gitzip-dark" : "");
dash.className = "gitzip-collect-dash";
down.className = "gitzip-collect-down";
tip.className = "gitzip-collect-tip";
Expand Down Expand Up @@ -323,7 +324,7 @@ function hookItemEvents(){
blob = item.querySelector(".octicon-file-text, .octicon-file"),
tree = item.querySelector(".octicon-file-directory");

if(link && (tree || blob)){
if(!item._hasBind && link && (tree || blob)){
createMark(
item,
item.offsetHeight,
Expand All @@ -332,22 +333,23 @@ function hookItemEvents(){
link.href
);
item.addEventListener("dblclick", onItemDblClick);
item._hasBind = true;
}
}
}
}

var lazyCaseObserver = null;
var repoContent = document.querySelector(".repository-content");
var lazyElement = repoContent ? repoContent.querySelector("include-fragment .js-details-container") : null;
var lazyElement = repoContent ? repoContent.querySelector(".js-navigation-container") : null;

if(lazyElement){
// lazy case
lazyCaseObserver = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
var addNodes = mutation.addedNodes;
addNodes && addNodes.length && addNodes.forEach(function(el){
if(el.classList && el.classList.contains("js-details-container") && lazyCaseObserver){
if(el.classList && (el.classList.contains("js-details-container") || el.classList.contains("js-navigation-container"))){
appendToIcons();
lazyCaseObserver.disconnect();
lazyCaseObserver = null;
Expand All @@ -356,8 +358,10 @@ function hookItemEvents(){
});
});
lazyCaseObserver.observe(repoContent, { childList: true, subtree: true } );
} else {
appendToIcons();
}

if (document.querySelector(itemCollectSelector)) {
appendToIcons();
}

Pool.init();
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"name": "GitZip",
"description": "It can make the sub-directories and files of github repository as zip and download it",
"version": "0.3.1",
"version": "0.3.2",

"page_action": {
"default_icon": "images/icon-empty.png",
Expand Down