-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
1 lines (1 loc) · 887 Bytes
/
index.js
1
var url="",callback=function(e){if(url=$(".i")[0].value,console.log("sdsd"),$("input").remove(),$(".but").remove(),$('<div class="loader"></div>').appendTo(".ip"),setTimeout(function(){$(".loader").fadeOut(),$(".image").removeClass("hide")},1e3),url.includes("=")){var t="https://i.ytimg.com/vi/"+url.split("=")[1]+"/maxresdefault.jpg";$("a").attr("href",t),$("img").attr("src",t),console.log(t),$(".thumbnail").before("<h3>Refresh to try again.</h3>")}else if(url.includes("youtu.be")){t="https://i.ytimg.com/vi/"+url.split("youtu.be/")[1]+"/maxresdefault.jpg";$("a").attr("href",t),$("img").attr("src",t),console.log(t),$(".thumbnail").before("<h3>Refresh to try again.</h3>")}else $(".thumbnail").before("<h3>Enter a valid URL.</h3>"),$(".thumbnail").before("<h3>Refresh to try again.</h3>"),$("img").remove(),$("a").remove()};$("input").keypress(callback),$(".but").click(callback);