From fedd9c2c81fb0e6e5a0e55bbcd9721829917f070 Mon Sep 17 00:00:00 2001 From: iceyrazor Date: Mon, 15 Sep 2025 17:23:54 -0500 Subject: - added ability to disable thumbnails on web --- web/ytlist/ytlist.js | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'web/ytlist') diff --git a/web/ytlist/ytlist.js b/web/ytlist/ytlist.js index 2f13a79..9354b02 100644 --- a/web/ytlist/ytlist.js +++ b/web/ytlist/ytlist.js @@ -1,34 +1,43 @@ let db_file="youtube_stuffs.db" +let gen_thumb=true function insert_item(item,imgurl){ + let imgtag="

" + if(imgurl){ + imgtag=`` + } the_box.innerHTML+=`
${item[0]}: ${item[1]} ${item[3]}
- + ${imgtag}
` } function get_item(item){ - fetch(`/ytlist/thumbnails/${item[2]}.webp`, - { method: "HEAD" } - ).then((res) => { - if (res.ok) { - insert_item(item,res.url); - } else { - fetch(`/ytlist/thumbnails/${item[2]}.jpg`, - { method: "HEAD" } - ).then((res) => { - if (res.ok) { - insert_item(item,res.url); - } else { - insert_item(item,null); - } - }); - } - }); + if(gen_thumb==true){ + fetch(`/ytlist/thumbnails/${item[2]}.webp`, + { method: "HEAD" } + ).then((res) => { + if (res.ok) { + insert_item(item,res.url); + } else { + fetch(`/ytlist/thumbnails/${item[2]}.jpg`, + { method: "HEAD" } + ).then((res) => { + if (res.ok) { + insert_item(item,res.url); + } else { + insert_item(item,null); + } + }); + } + }); + } else { + insert_item(item,null) + } } async function search(){ @@ -54,6 +63,7 @@ async function search(){ let res = db.exec(query); the_box.innerHTML=""; + gen_thumb=gen_thumb_check.checked res[0].values.forEach(item=>{get_item(item)}); } -- cgit v1.3