개인적으로 사용하기 위해 비밀번호 관리자로 만들고 싶습니다. 안전하지 못하지만 걱정하지 않습니다.크롬 확장 프로그램 : 내 팝업 파일에 내재 된 appendchild
ui/default_popup 파일에 내 암호 목록을 만드는 데 문제가 있습니다. 스크롤바를 사용하여 div를 만들었습니다. 자바 스크립트에서이 div 안에 div를 몇 개 추가하고 싶습니다. 암호는 입력해야하지만 항목을 추가 할 수 없습니다.
지금 바로 설정해 보겠습니다. 버튼이있어서 그것을 누르면 div에 div가 추가됩니다. 브라우저에서 열면 제대로 작동하지만 확장 기능으로 사용하면 작동하지 않습니다. 버튼을 클릭해도 아무 일도 일어나지 않습니다.
의 manifest.json :
{
"name": "Password Manager",
"manifest_version": 2,
"version": "2",
"version_name": "alpha 1",
"description": "Alpha for my password manager project",
"permissions": [
"activeTab",
"tabs",
"http://*/*", "https://*/*"
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "main.html"
}
}
Default_popup :
<!DOCTYPE html>
<html>
<head>
<link href="style.css" rel="stylesheet">
<meta charset="utf-8">
<script>
function test() {
var element = document.createElement("div");
element.appendChild(document.createTextNode('The man who mistook his wife for a hat'));
document.getElementById('pswcontainer').appendChild(element);
}
</script>
</head>
<body>
<div class="bluebox"><h1 style="color : white;">Password Manager</h1></div>
<div id="maindiv">
<div id="passInBox">
<h3 style="margin-top : 0px; width : 100%; text-align : center;">Please input your universal password:</h3>
<input style="width : 100%;" type="password" id="pswIn">
</div>
<div id="pswcontainer">
<div class="psw">
<button onclick="test()"
</div>
</div>
</div>
<div class="bluebox" style="position: absolute; bottom : 10px; width : 485px;"></div>
</body>
</html>
CSS :
html {
width : 500px;
height : 590px;
padding-left: 5px;
padding-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
font-family: Arial, Helvetica, sans-serif;
}
.bluebox {
width : 100%;
height : 50px;
background-color: #3b9ddd;
border-radius: 7px;
padding-bottom: 1px;
display: flex;
align-items: center;
justify-content: center;
margin-top: 3px;
margin-bottom: 3px;
}
.psw {
height : 60px;
width : 440px;
margin : 5px;
border : 1px solid black;
}
#passInBox {
margin: auto;
width: 60%;
border: 1px solid grey;
padding: 10px;
}
#maindiv {
padding : 3px;
height : 100%;
}
#pswcontainer {
margin-left: 3px;
margin-right: 3px;
margin-bottom: 3px;
margin-top: 5px;
border-radius: 2px;
width: 467px;
height: 373px;
overflow-y : scroll;
border : 2px solid black;
}
실행 인라인 JS는 확장에 금지되어 있습니다. JS 코드를 외부 파일로 이동하십시오. – Deliaz