-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
433 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
<!DOCTYPE html> | ||
<html lang="zh-Hant-HK"> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>抽籤系統</title> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous"> | ||
<style> | ||
body{ | ||
font-family: "Microsoft JhengHei", "微軟正黑體", sans-serif; | ||
} | ||
</style> | ||
</head> | ||
<body class="bg-light text-dark"> | ||
<div class="container"> | ||
|
||
<header> | ||
<h1 style="margin-top: 20px; margin-bottom: 20px; text-align: center;">抽籤系統</h1> | ||
</header> | ||
<div class="alert alert-light border" role="alert"> | ||
<div class="row justify-content-center"> | ||
<div class="col col-sm-6 col-md-6 col-lg-6 col-xl-6"> | ||
<div class="alert alert-info" role="alert"> | ||
<p style="text-align: center; margin-bottom: -10px; margin-top: -5px; font-size: large;">目前已抽出 <span id="count">0</span> 個</p> | ||
<hr> | ||
<h1 class="alert-heading display-2" style="text-align: center;"> | ||
<input type="text" value="-" class="form-control form-control-lg" style="border:0px; background-color:transparent; color:#055160; text-align: center; font-size: xxx-large;font-weight: bold;" id="txt" disabled=""> | ||
</h1> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<div class="row justify-content-center"> | ||
<div class="col col-auto"> | ||
<div class="btn-group" role="group"> | ||
<input type="radio" class="btn-check" name="btnradio" id="btnradio1" autocomplete="off" onClick="timedCount();"> | ||
<label class="btn btn-outline-primary bg-gradient" for="btnradio1">開始/加速</label> | ||
|
||
<input type="radio" class="btn-check" name="btnradio" id="btnradio2" autocomplete="off" onClick="stopCount();Random();"> | ||
<label class="btn btn-outline-primary bg-gradient" for="btnradio2">停止/減速</label> | ||
|
||
<input type="radio" class="btn-check" name="btnradio" id="btnradio3" autocomplete="off" onclick="Clear();"> | ||
<label class="btn btn-outline-primary bg-gradient" for="btnradio3">清空數據</label> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="alert alert-light border" role="alert"> | ||
<div class="row justify-content-center"> | ||
<div class="col col-sm-12 col-md-12 col-lg-7 col-xl-7"> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th scope="col">#</th> | ||
<th scope="col">抽取</th> | ||
</tr> | ||
</thead> | ||
<tbody id="display"></tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
<footer> | ||
|
||
<div class="alert alert-secondary" role="alert"> | ||
<p style="font-size: smaller;"> | ||
版權聲明: | ||
<br /> | ||
<em> | ||
本軟體及相關文件受著作權法(《數碼千禧年版權法案》、《中華人民共和國著作權法》、《中華人民共和國香港特別行政區版權條例》)及國際公約(《伯爾尼條約》)之保護。未經授權擅自複製或散佈本程式之全部或它的任何部分,將導致嚴厲的的民事和刑事處分,且將被依法提起最大範圍的追訴。</em> | ||
<br /> | ||
<p style="font-size: smaller;"> | ||
Copyright Notice: | ||
<br /> | ||
<em> | ||
This computer program is protected by copyright laws (Digital Millennium Copyright Act, the Copyright Law of the People's Republic of China and the Copyright Regulations of the Hong Kong Special Administrative Region of PRC) and international treaties (Berne Treaty). Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under law. | ||
</em> | ||
</p> | ||
<p style="font-size: smaller;"> | ||
作者: <em><a class="alert-link" href="https://www.github.com/TurboHK">TurboHK</a></em><br /> | ||
介面美化:<em><a class="alert-link" href="https://www.github.com/chiyi4488">chiyi4488</a></em><br /> | ||
特別鳴謝: <em><a class="alert-link" href="https://www.cotpear.com">台灣 Cotpear</a></em><br /> | ||
查看源代碼:<em><a class="alert-link" href="https://github.com/TurboHK/RandomContentGenerator">Github</a></em> | ||
</p> | ||
|
||
</div> | ||
</footer> | ||
</div> | ||
|
||
<script> | ||
var num = 0; | ||
var arr = []; | ||
var vis = []; | ||
var mark = []; | ||
var stringpro = "CONTENT A,CONTENT B,CONTENT C,CONTENT D,CONTENT E,CONTENT F" | ||
var pro = stringpro.split(','); | ||
var c = 0; | ||
var k = 0; | ||
var t; | ||
var tt; | ||
var flag = true; | ||
//for(var i = 0; i < 19; i++) | ||
// vis[i] = i+1; | ||
|
||
var cont = 0; | ||
|
||
while(true) { | ||
var tt = parseInt(Math.random() * 6 + 1); | ||
|
||
if(!mark[tt]) { | ||
mark[tt] = 1; | ||
vis[cont++] = tt; | ||
} | ||
|
||
if(cont === 6) { | ||
break; | ||
} | ||
} | ||
|
||
function timedCount() { | ||
document.getElementById('txt').value = c; | ||
k = k + 1; | ||
k = k % (vis.length); | ||
c = vis[k]; | ||
t = setTimeout("timedCount()",50) | ||
} | ||
|
||
function solve1() { | ||
if(flag) { | ||
timedCount(); | ||
flag = false; | ||
} | ||
} | ||
|
||
function stopCount() { | ||
clearTimeout(t); | ||
tt = document.getElementById('txt').value; | ||
} | ||
|
||
function Random() { | ||
var draw = document.getElementById('display'); | ||
|
||
num += 1; | ||
arr.push(tt); | ||
var tmp = tt; | ||
|
||
tmp -= 1; | ||
draw.innerHTML = draw.innerHTML + '<tr><th scope="row">' + num + '</th>'+'<td>' + pro[tmp] + '</td>'+'</tr>'; | ||
var tmp = []; | ||
|
||
tmp.length = 0; | ||
var cnt = 0; | ||
|
||
for(var i = 0, len = vis.length; i < len; i += 1) { | ||
if(vis[i] != tt) { | ||
tmp[cnt] = vis[i]; | ||
cnt = cnt+1; | ||
} | ||
} | ||
|
||
vis.length = 0; | ||
for(var i = 0, len = tmp.length; i < len; i += 1) { | ||
vis[i] = tmp[i]; | ||
} | ||
|
||
document.getElementById("count").innerHTML = arr.length; | ||
if(arr.length === 6){ | ||
alert('已經全部抽完!'); | ||
} | ||
} | ||
|
||
function solve2() { | ||
if(!flag) { | ||
stopCount(); | ||
Random(); | ||
flag = true; | ||
} | ||
} | ||
|
||
function Clear() { | ||
arr = null; | ||
arr = []; | ||
|
||
mark = []; | ||
var cont = 0; | ||
|
||
while(true) { | ||
var tt = parseInt(Math.random() * 6 + 1); | ||
|
||
if(!mark[tt]) { | ||
mark[tt] = 1; | ||
vis[cont++] = tt; | ||
} | ||
|
||
if(cont === 6) { | ||
break; | ||
} | ||
} | ||
|
||
k = 0; | ||
num = 0; | ||
c = 0; | ||
clearTimeout(t); | ||
document.getElementById('txt').value = '0'; | ||
document.getElementById('count').innerHTML = '0'; | ||
document.getElementById('display').innerHTML = ''; | ||
} | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.