From 8f4c8cfa862101e469d05c2efc7807ef75812828 Mon Sep 17 00:00:00 2001 From: soul2 <1052986332@qq.com> Date: Thu, 9 Feb 2023 15:49:44 +0800 Subject: [PATCH] first commit --- checkQuality/checkQuality-move.css | 61 ++++++++++++++++++++++++++++++ checkQuality/checkQuality-pc.css | 61 ++++++++++++++++++++++++++++++ checkQuality/checkQuality.js | 31 +++++++++++++++ checkQuality/index.html | 26 +++++++++++++ globals/footer.css | 11 ++++++ globals/footer.js | 9 +++++ globals/globals.css | 33 ++++++++++++++++ globals/mv-bg.css | 46 ++++++++++++++++++++++ globals/mv-bg.js | 10 +++++ 9 files changed, 288 insertions(+) create mode 100644 checkQuality/checkQuality-move.css create mode 100644 checkQuality/checkQuality-pc.css create mode 100644 checkQuality/checkQuality.js create mode 100644 checkQuality/index.html create mode 100644 globals/footer.css create mode 100644 globals/footer.js create mode 100644 globals/globals.css create mode 100644 globals/mv-bg.css create mode 100644 globals/mv-bg.js diff --git a/checkQuality/checkQuality-move.css b/checkQuality/checkQuality-move.css new file mode 100644 index 0000000..741006d --- /dev/null +++ b/checkQuality/checkQuality-move.css @@ -0,0 +1,61 @@ +@media(max-width:669px) { + + * { + font-size: 22px; + } + + body .mv-bg { + animation-duration: 9s; + } + + body { + height: 100%; + width: 100%; + overflow: hidden; + } + + #page { + padding: 0 5%; + padding-top: 11.5vh; + } + + input[type='text'] { + border-radius: 2.5px; + outline: none; + border: 1px solid rgba(153, 153, 255, .6); + background-color: rgba(0, 0, 0, .3); + color: #fff; + width: 300px; + padding-left: .5em; + height: 40px; + } + + input[type='text']:hover { + box-shadow: cyan 0 0 3px; + background-color: rgba(0, 0, 0, .1); + } + + input[type='text']:focus { + box-shadow: cyan 0 0 3px; + background-color: rgba(0, 0, 0, .1); + } + + input::input-placeholder { + color: #fff; + } + + #check-result { + color: #fff; + margin-top: 8px; + text-shadow: cyan 1px 1px 2.5px; + } + + .outlink { + width: 100%; + margin-top: 40px; + } + .outlink span { + color: white; + } + +} diff --git a/checkQuality/checkQuality-pc.css b/checkQuality/checkQuality-pc.css new file mode 100644 index 0000000..a591d62 --- /dev/null +++ b/checkQuality/checkQuality-pc.css @@ -0,0 +1,61 @@ +@media(min-width:669px) { + + body { + background: url(http://soul2.cn/images/background/home/1.jpg) center no-repeat fixed; + background-size: 100% 100%; + -moz-background-size: 100% 100%; + -webkit-background-size: 100% 100%; + height: 100%; + width: 100%; + overflow: hidden; + } + + #page { + padding: 0 22vh; + padding-top: 4vh; + } + + input[type='text'] { + border-radius: 2.5px; + outline: none; + border: 1px solid rgba(153, 153, 255, .6); + background-color: rgba(255, 255, 255, .1); + color: #fff; + width: 200px; + padding-left: .5em; + height: 30px; + } + + input[type='text']:hover { + box-shadow: cyan 0 0 3px; + background-color: rgba(255, 255, 255, .175); + } + + input[type='text']:focus { + box-shadow: cyan 0 0 3px; + background-color: rgba(255, 255, 255, .25); + } + + input::input-placeholder { + color: #fff; + } + + input::-webkit-input-placeholder { + color: #cccccc; + } + + #check-result { + color: #fff; + margin-top: 2px; + text-shadow: cyan 1px 1px 2.5px; + } + + .outlink { + width: 15%; + margin-top: 30px; + } + .outlink span { + color: white; + } + +} diff --git a/checkQuality/checkQuality.js b/checkQuality/checkQuality.js new file mode 100644 index 0000000..eb8e5fe --- /dev/null +++ b/checkQuality/checkQuality.js @@ -0,0 +1,31 @@ +function isQuality(n) { + let m = Math.floor(n / 2) + 1 + for (var i = 2; i < m; i++) { + if (n % i == 0) { + return false + } + } + return true +} + +function checkNaturalnumber(obj) { + return (/^[0-9]+$/.test(obj) && (obj > 0)) +} + +function handleInputChange() { + var a = document.querySelector("input[type='text']") + var r = document.getElementById("check-result") + if (!a.value) { + r.innerText = '未输入内容' + } else if (a.value.length > 10) { + r.innerText = '输入内容过长' + } else if (!checkNaturalnumber(a.value)) { + r.innerText = '输入内容不合法,请输入自然数!' + } else { + r.innerText = `${a.value} ${isQuality(a.value) ? '是' : '不是'}质数` + if (a.value == 1) { + r.innerText += `\n任何大于1的整数均可被表示成一串唯一素数之乘积。为了确保该定理的唯一性,1被定义为不是素数。——Wiki` + } + } + +} diff --git a/checkQuality/index.html b/checkQuality/index.html new file mode 100644 index 0000000..379f075 --- /dev/null +++ b/checkQuality/index.html @@ -0,0 +1,26 @@ + + +
+ +