Commit d0b4651f by 庄欣

fixbug

parent 94ef8128
......@@ -17,8 +17,8 @@ services:
server:
image: milvusbootcamp/pic-search-webserver:0.10.0
volumes:
- /home/code001/data/avatar:/tmp/tains #挂载jj
- ./data/models/:/app/data/models #模型地址
- /home/code001/Pictures:/tmp/tains
- ./data/models/:/app/data/models
environment:
- DATA_PATH=/tmp/images-data #存放经训练的图片
- MILVUS_HOST=milvus #milvus地址
......
......@@ -15,7 +15,7 @@
}
],
"web_accessible_resources": [
"ui.html", "static/icon.png"
"ui.html", "static/icon.png", "static/close.png"
],
"browser_action": {
"default_icon": "static/icon.png",
......
......@@ -25,7 +25,7 @@
position: fixed;
width: 1080px;
height: 610px;
z-index: 999;
z-index: 90;
}
.__container {
width: 500px;
......@@ -34,7 +34,7 @@
position: fixed;
top:20px;
left:20px;
z-index: 999;
z-index: 90;
background: #ffffff;
}
.__container .hidden {
......@@ -86,4 +86,21 @@
.__container .focus {
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();
var checkedProp = false;
img.src = chrome.extension.getURL("ui.html");
let icon = chrome.extension.getURL("static/icon.png");
let closeBtnImg = chrome.extension.getURL("static/close.png");
var closeBtnDiv = null;
var parentDom = document.createElement("div");
parentDom.innerHTML = "<div class='mpDonloaderParentDom'><img src='"+ icon +"'/></div>";
parentDom.onclick = () => {
......@@ -40,53 +42,62 @@ function openUi() {
var isFrist = true;
$.get(UI, (html) => {
container = $(html);
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);
};
var closeBtnDiv = document.createElement("div");
var closeBtn = new Image();
closeBtn.src = closeBtnImg;
$(closeBtnDiv).click(function() {
toggleButton();
});
$.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();
};
$(closeBtnDiv).addClass("x");
closeBtnDiv.append(closeBtn);
body.append(closeBtnDiv);
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() {
if (container !== null) {
$(container).remove();
}
$(container).remove();
$(".x").remove();
}
function refreshIndex() {
index = getIndex();
}
......@@ -142,22 +153,30 @@ function getImages() {
userNickname = $($(".user-info > span.nickname")[0]).text();
$.each(lists, (i,n) => {
urls = n.currentSrc.split("!");
imgSrc = urls[0];
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, "");
let fullUrl = n.currentSrc;
if (fullUrl === "") {
fullUrl === $(n).attr("data-original");
}
if (fullUrl !== "") {
urls = fullUrl .split("!");
imgSrc = urls[0];
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();
......
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