From f465727b1187215d226e912cad24eed44e73e853 Mon Sep 17 00:00:00 2001 From: Metz Date: Wed, 26 Oct 2022 18:19:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20random.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- random.js | 45 --------------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 random.js diff --git a/random.js b/random.js deleted file mode 100644 index b620768a4..000000000 --- a/random.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Created by fangzide on 16/9/5. - */ -$(function () { - var run = 0, - heading = $("h1"), - timer; - - $("#start").click(function () { - var list = $("#list").val().replace(/ +/g, " ").replace(/^ | $/g, "").split(" "); - if (!run) { - heading.html(heading.html().replace("吃这个!", "吃什么?")); - $(this).html("停止"); - timer = setInterval(function () { - var r = Math.ceil(Math.random() * list.length), - food = list[r - 1]; - $("#what").html(food); - var rTop = Math.ceil(Math.random() * $(document).height()), - rLeft = Math.ceil(Math.random() * ($(document).width() - 50)), - rSize = Math.ceil(Math.random() * (37 - 14) + 14); - $("").html(food).hide().css({ - "top": rTop, - "left": rLeft, - "color": "rgba(0,0,0,." + Math.random() + ")", - "fontSize": rSize + "px" - }).appendTo("body").fadeIn("slow", function () { - $(this).fadeOut("slow", function () { - $(this).remove(); - }); - }); - }, 50); - run = 1; - } else { - heading.html(heading.html().replace("吃什么?", "吃这个!")); - $(this).html("不行,换一个"); - clearInterval(timer); - run = 0; - }; - }); - - document.onkeydown = function enter(e) { - var e = e || event; - if (e.keyCode == 13) $("#start").trigger("click"); - }; -}); \ No newline at end of file -- GitLab