Skip to content

Commit

Permalink
feat: 新增查看對方舊ID功能
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiang511 committed Jan 21, 2025
1 parent 44c6617 commit 3cd884b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 34 deletions.
56 changes: 32 additions & 24 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ li:hover {
padding-left: 0 !important;
padding-right: 0 !important;
}
.mob{
display: inline-block;
}
}
@media screen and (min-width:769px) {
.mob{
display: inline;
}
}

h1,
Expand Down Expand Up @@ -212,7 +220,7 @@ code {
transition: all 0.1s cubic-bezier(0.71, -0.46, 0.88, 0.6), opacity 0.1s;
}

.btn{
.btn {
display: block !important;
}

Expand Down Expand Up @@ -246,7 +254,7 @@ code {
opacity: 1;
}

.bxl-github::before{
.bxl-github::before {
font-size: 1.5em;
vertical-align: sub;
}
Expand All @@ -255,32 +263,32 @@ code {
/* sweetaalert2 css toast */
.colored-toast.swal2-icon-success {
background-color: #a5dc86 !important;
}
.colored-toast.swal2-icon-error {
}

.colored-toast.swal2-icon-error {
background-color: #f27474 !important;
}
.colored-toast.swal2-icon-warning {
}

.colored-toast.swal2-icon-warning {
background-color: #f8bb86 !important;
}
.colored-toast.swal2-icon-info {
}

.colored-toast.swal2-icon-info {
background-color: #3fc3ee !important;
}
.colored-toast.swal2-icon-question {
}

.colored-toast.swal2-icon-question {
background-color: #87adbd !important;
}
.colored-toast .swal2-title {
}

.colored-toast .swal2-title {
color: white;
}
.colored-toast .swal2-close {
}

.colored-toast .swal2-close {
color: white;
}
.colored-toast .swal2-html-container {
}

.colored-toast .swal2-html-container {
color: white;
}
}
46 changes: 37 additions & 9 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ let fileInput2 = document.getElementById('fileInput2');
var result = document.getElementById('result');
let YMDCheck = document.getElementById('YMDCheck');
let CheckLastFile = document.getElementById('CheckLastFile');
let CheckOldName = document.getElementById('CheckOldName');


const Toast = Swal.mixin({
Expand All @@ -23,23 +24,26 @@ const Toast = Swal.mixin({
timerProgressBar: true,
})



CheckLastFile.addEventListener('change', function () {
if (CheckLastFile.checked) {
// 清空input
fileInput.value = '';
fileInput2.value = '';
result.innerHTML = '';

// toast 您以切換為第二選項
Toast.fire({
icon: 'success',
title: '已切換為第二選項',
})
}else{
} else {
// 清空input
fileInput.value = '';
fileInput2.value = '';

result.innerHTML = '';
CheckOldName.checked = false
// toast 您以切換為第一選項
Toast.fire({
icon: 'success',
Expand All @@ -51,6 +55,22 @@ CheckLastFile.addEventListener('change', function () {



CheckOldName.addEventListener('change', function () {
if (CheckOldName.checked && CheckLastFile.checked) {

} else if (CheckOldName.checked) {
Swal.fire({
title: "請先選擇第二選項",
text: "此功能與第二項綁定",
icon: "question"
});
CheckOldName.checked = false; // Uncheck CheckOldName if CheckLastFile is not checked
}

});



function Follower() {

followerValues = followersData.map(follower =>
Expand Down Expand Up @@ -103,8 +123,8 @@ document.getElementById('fileInput').addEventListener('change', function () {
icon: 'success',
title: '上傳成功',
})


Follower();
} catch (error) {
console.error('解析 JSON 失敗:', error);
Expand All @@ -116,7 +136,7 @@ document.getElementById('fileInput').addEventListener('change', function () {
fileInput.value = ''; // 清空檔案輸入欄位
}
};

reader.readAsText(file); // 讀取檔案內容作為文字
} else {
Swal.fire({
Expand All @@ -132,7 +152,7 @@ document.getElementById('fileInput2').addEventListener('change', function () {
if (fileInput2.files.length > 0) {
let file = fileInput2.files[0];
let reader = new FileReader();

reader.onload = function (e) {
let content = e.target.result;
try {
Expand Down Expand Up @@ -235,18 +255,26 @@ function main() {
!OldfollowerValues.some(follower => follower.value === following.value)
);

let oldname = OldfollowerValues
.filter(following =>
!followerValues.some(follower => follower.value === following.value)
);


// console.log(filteredFollowingValues);
// console.log(filteredFollowingValuesLast);
if (CheckLastFile.checked) {
if (CheckOldName.checked && CheckLastFile.checked) {
return creatList(oldname);
}
else if (CheckLastFile.checked) {
return creatList(filteredFollowingValuesLast);
}
else {
return creatList(filteredFollowingValues);
}


}
}
else {
Swal.fire({
icon: "error",
Expand Down
3 changes: 2 additions & 1 deletion zh-TW.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ <h3>Following or Old Follower file</h3>
</div>
</div>
<input type="checkbox" class="ui-checkbox" id="YMDCheck" name=""> 顯示詳細日期
<input type="checkbox" class="ui-checkbox" id="CheckLastFile" name=""> 查看新粉絲以及更名用戶
<div class="mob"><input type="checkbox" class="ui-checkbox" id="CheckLastFile" name=""> <span>查看新粉絲以及更名用戶</span></div>
<div class="mob"><input type="checkbox" class="ui-checkbox" id="CheckOldName" name=""> <span>查看對方舊ID</span></div>
<button class="btn btn-outline-primary my-3" onclick="main()">開始搜尋</button>


Expand Down

0 comments on commit 3cd884b

Please sign in to comment.