From a02b3b799e9cd656369c1b60cf5ff38bd7108b36 Mon Sep 17 00:00:00 2001 From: SupaGruen Date: Fri, 30 Jun 2023 11:41:33 +0200 Subject: [PATCH] Update spaghetticode.js --- src/spaghetticode.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/spaghetticode.js b/src/spaghetticode.js index bedfa21..7cc75e6 100644 --- a/src/spaghetticode.js +++ b/src/spaghetticode.js @@ -413,7 +413,7 @@ document.addEventListener('DOMContentLoaded',function(event){ if(matches){ var getSimilar = []; for(var i in matches.ratings){ - if(matches.ratings[i].rating > 0.4){ //console.log(matches.ratings[i].target + ' - ' + matches.ratings[i].rating) + if(matches.ratings[i].rating > 0.4){ getSimilar.push(matches.ratings[i].target); } } @@ -437,7 +437,6 @@ document.addEventListener('DOMContentLoaded',function(event){ searchinfo.innerHTML = ' - ' + search_query + ' (' + countshownstyles + ')'; notavail.innerHTML = ''; if(allarrayresults){ notavail.innerHTML = 'Similar names of artists that are unavailable: ' + allarrayresults + ''; } } else if((countshownstyles==0)&&(search_query!=0)) { - //console.log(matches.bestMatch.target); //produces response with rating to each string searchinfo.innerHTML = ''; notavail.innerHTML = ''; if(allarrayresults){ notavail.innerHTML = 'Checking for similar names and artists that are unavailable: ' + onlyavailable + allarrayresults + ''; } } else { @@ -523,7 +522,7 @@ document.addEventListener('DOMContentLoaded',function(event){ }; }; - // Start of Metadata Viewer Stuff + // Start of Metadata Viewer // Drag and Drop Start // Joseph Zimmerman - https://www.smashingmagazine.com/2018/01/drag-drop-file-uploader-vanilla-js/ @@ -600,7 +599,7 @@ document.addEventListener('DOMContentLoaded',function(event){ metadatawrapper.classList.add('hasimg'); } - const tags = await ExifReader.load(file).catch(error => { console.log('No EXIF Data'); allMetaData.innerHTML = '

No EXIF data detected

'; }); + const tags = await ExifReader.load(file).catch(error => { allMetaData.innerHTML = '

No EXIF data detected

'; }); if(tags){ getComment(tags); } // https://www.geeksforgeeks.org/how-to-convert-special-characters-to-html-in-javascript/ @@ -622,7 +621,7 @@ document.addEventListener('DOMContentLoaded',function(event){ // https://github.com/himuro-majika/Stable_Diffusion_image_metadata_viewer function getComment(tags) { - console.dir(JSON.parse(JSON.stringify(tags))); + //console.dir(JSON.parse(JSON.stringify(tags))); let com = ''; // Exif - JPG @@ -638,15 +637,17 @@ document.addEventListener('DOMContentLoaded',function(event){ return; } - // Non SD image but tags available - experimental, might remove again + // Non SD image but tags if(tags && (tags.UserComment === undefined) && (tags.parameters === undefined)) { function printValues(obj) { for(var k in obj) { - if(obj[k] instanceof Object) { - tagoutput = tagoutput + '
' + k + ': '; - printValues(obj[k]); - } else { - tagoutput = tagoutput + obj[k] + ' '; + if(!(k=='value'||k=='Thumbnail'||k=='Special Instructions'||k=='Padding')){ + if(obj[k] instanceof Object) { + tagoutput = tagoutput + '
' + k + ': '; + printValues(obj[k]); + } else { + tagoutput = tagoutput + obj[k] + ' '; + }; }; } };