Commit d0b4651f by 庄欣

fixbug

parent 94ef8128
...@@ -17,8 +17,8 @@ services: ...@@ -17,8 +17,8 @@ services:
server: server:
image: milvusbootcamp/pic-search-webserver:0.10.0 image: milvusbootcamp/pic-search-webserver:0.10.0
volumes: volumes:
- /home/code001/data/avatar:/tmp/tains #挂载jj - /home/code001/Pictures:/tmp/tains
- ./data/models/:/app/data/models #模型地址 - ./data/models/:/app/data/models
environment: environment:
- DATA_PATH=/tmp/images-data #存放经训练的图片 - DATA_PATH=/tmp/images-data #存放经训练的图片
- MILVUS_HOST=milvus #milvus地址 - MILVUS_HOST=milvus #milvus地址
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
} }
], ],
"web_accessible_resources": [ "web_accessible_resources": [
"ui.html", "static/icon.png" "ui.html", "static/icon.png", "static/close.png"
], ],
"browser_action": { "browser_action": {
"default_icon": "static/icon.png", "default_icon": "static/icon.png",
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
position: fixed; position: fixed;
width: 1080px; width: 1080px;
height: 610px; height: 610px;
z-index: 999; z-index: 90;
} }
.__container { .__container {
width: 500px; width: 500px;
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
position: fixed; position: fixed;
top:20px; top:20px;
left:20px; left:20px;
z-index: 999; z-index: 90;
background: #ffffff; background: #ffffff;
} }
.__container .hidden { .__container .hidden {
...@@ -86,4 +86,21 @@ ...@@ -86,4 +86,21 @@
.__container .focus { .__container .focus {
box-shadow: 2px 2px 10px #FF9F2A; box-shadow: 2px 2px 10px #FF9F2A;
} }
\ No newline at end of file
.x {
width: 20px;
height: 20px;
background-color: white;
color: #666600;
display: flex;
border-radius: 15px;
justify-content: center;
align-items: center;
align-content: center;
justify-items: center;
position: fixed;
left: 505px;
top: 15px;
z-index: 999;
}
...@@ -14,6 +14,8 @@ var img = new Image(); ...@@ -14,6 +14,8 @@ var img = new Image();
var checkedProp = false; var checkedProp = false;
img.src = chrome.extension.getURL("ui.html"); img.src = chrome.extension.getURL("ui.html");
let icon = chrome.extension.getURL("static/icon.png"); let icon = chrome.extension.getURL("static/icon.png");
let closeBtnImg = chrome.extension.getURL("static/close.png");
var closeBtnDiv = null;
var parentDom = document.createElement("div"); var parentDom = document.createElement("div");
parentDom.innerHTML = "<div class='mpDonloaderParentDom'><img src='"+ icon +"'/></div>"; parentDom.innerHTML = "<div class='mpDonloaderParentDom'><img src='"+ icon +"'/></div>";
parentDom.onclick = () => { parentDom.onclick = () => {
...@@ -40,53 +42,62 @@ function openUi() { ...@@ -40,53 +42,62 @@ function openUi() {
var isFrist = true; var isFrist = true;
$.get(UI, (html) => { $.get(UI, (html) => {
container = $(html); container = $(html);
let tpl = container.find("#tpl")[0].outerHTML; var closeBtnDiv = document.createElement("div");
let images = getImages(); var closeBtn = new Image();
var doms = []; closeBtn.src = closeBtnImg;
for(var i in images) { $(closeBtnDiv).click(function() {
if (isNaN(i)) { toggleButton();
break;
}
var _ = $(tpl);
$($(_).find("img")[0]).attr("src" , images[i].url + "!340w.jpg");
if (isFrist) {
$($(_).find("img")[0]).addClass("focus");
}
isFrist = false;
$($(_).children().find("input[type=checkbox]")[0]).val(images[i].url);
$($(_).children().find("input[type=checkbox]")[0]).attr("fileid", images[i].name);
$($(_).find(".fileid")[0]).text(images[i].name);
doms.push(_.html());
};
$(container.find(".images")[0]).html(doms.join(""));
$.each(container.find(".item"), (i,n) => {
$(n).find("img")[0].onclick = () => {
setSelect($(n).find("img")[0], images);
};
}); });
$.each(container.find(".item"), (i,n) => { $(closeBtnDiv).addClass("x");
$(n).find("img")[0].onclick = () => { closeBtnDiv.append(closeBtn);
setSelect($(n).find("img")[0], images); body.append(closeBtnDiv);
};
});
$(container).find(".selectAll")[0].onclick=function() {
selectAll();
};
$(container).find(".startDownload")[0].onclick=function() {
downloadAll();
};
body.append(container); body.append(container);
setTimeout(function() {
let tpl = container.find("#tpl")[0].outerHTML;
let images = getImages();
var doms = [];
for(var i in images) {
if (isNaN(i)) {
break;
}
var _ = $(tpl);
$($(_).find("img")[0]).attr("src" , images[i].url + "!340w.jpg");
if (isFrist) {
$($(_).find("img")[0]).addClass("focus");
}
isFrist = false;
$($(_).children().find("input[type=checkbox]")[0]).val(images[i].url);
$($(_).children().find("input[type=checkbox]")[0]).attr("fileid", images[i].name);
$($(_).find(".fileid")[0]).text(images[i].name);
doms.push(_.html());
};
$(container.find(".images")[0]).html(doms.join(""));
$.each(container.find(".item"), (i,n) => {
$(n).find("img")[0].onclick = () => {
setSelect($(n).find("img")[0], images);
};
});
$.each(container.find(".item"), (i,n) => {
$(n).find("img")[0].onclick = () => {
setSelect($(n).find("img")[0], images);
};
});
$(container).find(".selectAll")[0].onclick=function() {
selectAll();
};
$(container).find(".startDownload")[0].onclick=function() {
downloadAll();
};
}, 500);
}); });
} }
function closeUi() { function closeUi() {
if (container !== null) { $(container).remove();
$(container).remove(); $(".x").remove();
}
} }
function refreshIndex() { function refreshIndex() {
index = getIndex(); index = getIndex();
} }
...@@ -142,22 +153,30 @@ function getImages() { ...@@ -142,22 +153,30 @@ function getImages() {
userNickname = $($(".user-info > span.nickname")[0]).text(); userNickname = $($(".user-info > span.nickname")[0]).text();
$.each(lists, (i,n) => { $.each(lists, (i,n) => {
urls = n.currentSrc.split("!"); let fullUrl = n.currentSrc;
imgSrc = urls[0]; if (fullUrl === "") {
if (imgSrc.indexOf("videos.mepai.me") < 0) { fullUrl === $(n).attr("data-original");
if (records.indexOf(imgSrc) < 0) { }
if (userId === "") { if (fullUrl !== "") {
var idStrings = imgSrc.match(reg); urls = fullUrl .split("!");
if (idStrings !== undefined && idStrings.length > 0) { imgSrc = urls[0];
userId = idStrings[0].replace(/\//g, ""); if (imgSrc.indexOf("videos.mepai.me") < 0) {
if (records.indexOf(imgSrc) < 0) {
if (userId === "") {
var idStrings = imgSrc.match(reg);
if (idStrings !== undefined && idStrings.length > 0) {
userId = idStrings[0].replace(/\//g, "");
}
} }
records.push(imgSrc);
images.push({
name: worksId + "-" + userNickname + '-' +userId + "-" + index(),
url: imgSrc
});
} }
records.push(imgSrc);
images.push({
name: worksId + "-" + userNickname + '-' +userId + "-" + index(),
url: imgSrc
});
} }
} else {
console.log($(n))
} }
}); });
refreshIndex(); refreshIndex();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment