Skip to content

Commit 0249403

Browse files
add missing elements to add list
1 parent a04d219 commit 0249403

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

userscripts/24sandualexandru/PopUpFoldersByAlex/index.user.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,8 @@ if (localStorage.getItem("folderSizes") != null) {
749749
let listElements=[];
750750
let listDialog=document.createElement("dialog");
751751
let closeButton=document.createElement("span");
752+
let typosP=document.createElement("p");
753+
let typos=[];
752754
closeButton.textContent="❌";
753755
closeButton.style.float="right";
754756
closeButton.addEventListener("click",()=>{
@@ -782,16 +784,36 @@ if (localStorage.getItem("folderSizes") != null) {
782784
let elenents=textArea.value.split("\n");
783785
const uniqueList = [...new Set(elenents)];
784786
listElements=[];
787+
typos=[];
785788
for(let element of uniqueList)
786789
{
787790
if(IC.getItems().find(x=>x.text.toLowerCase()==element.toLowerCase()))
788791
{
789792
listElements.push(element);
790-
}
793+
}else
794+
{
795+
typos.push( element);
796+
}
791797

792798
}
793799
textPrompt="Elements ("+listElements.length+")";
794800
textP.textContent=textPrompt;
801+
typos=typos.filter(x=>x.trim()!="")
802+
if(typos.length>0)
803+
{
804+
805+
typosP.textContent="Elements you don't have in the savefile ("+typos.length+"):\n ";
806+
for(let typo of typos)
807+
{
808+
809+
typosP.textContent = typosP.textContent+typo+", " ;
810+
811+
}
812+
}else
813+
{
814+
typosP.textContent="";
815+
}
816+
795817
})
796818

797819
let addButton=document.createElement("button");
@@ -825,6 +847,7 @@ if (localStorage.getItem("folderSizes") != null) {
825847
listDialog.appendChild(textArea);
826848
listDialog.appendChild(document.createElement("br"));
827849
listDialog.appendChild(addButton);
850+
listDialog.appendChild(typosP);
828851
listDialog.style.position="absolute";
829852
listDialog.style.top="50%";
830853
listDialog.style.left="50%";

0 commit comments

Comments
 (0)