Skip to content

Commit

Permalink
Beta 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
umaim committed Mar 17, 2018
1 parent bbca3fc commit 2f41d4a
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 40 deletions.
11 changes: 10 additions & 1 deletion css/main.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
body {
background: url("../img/Background.png");
display: flex;
min-height: 100vh;
flex-direction: column;
min-width: 720px;
}

main {
flex: 1 0 auto;
}

#logo {
Expand All @@ -26,7 +34,8 @@ body {
color: #eeeeee;
}

.input-field>input,.input-field>textarea {
.input-field>input,
.input-field>textarea {
color: #e0e0e0;
}

Expand Down
Binary file added favicon.ico
Binary file not shown.
101 changes: 62 additions & 39 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

<title>Steam Key Extension</title>
</head>

Expand All @@ -27,61 +30,81 @@
<div class="nav-wrapper">
<a class="brand-logo center noselect">
<img id="logo" src="img/SteamLogo.png" alt="Steam Key Extension">
<i id="logo-text" class="right grey-text">Key Extension</i>
<i id="logo-text" class="right grey-text hide-on-small-only">Key Extension</i>
</a>
</div>
</nav>
</div>

<!--Content Wrapper-->
<div id="content-wrapper" class="row">
<div class="col s8 offset-s2">
<main>
<!--Content Wrapper-->
<div id="content-wrapper" class="row">
<div class="col s8 offset-s2">

<!--Bot Name-->
<div class="row">
<div class="input-field col">
<input id="bot-name" type="text" class="blue-text text-lighten-5">
<label for="bot-name">Bot Name</label>
<!--Bot Name-->
<div class="row">
<div class="input-field col">
<input id="bot-name" type="text" class="blue-text text-lighten-5">
<label for="bot-name">Bot 名</label>
</div>
</div>
</div>

<!--Text Input Area-->
<div class="row">
<div class="input-field col s12">
<textarea id="ske-input" class="materialize-textarea"></textarea>
<label for="ske-input">输入</label>
<!--Text Input Area-->
<div class="row">
<div class="input-field col s12">
<textarea id="ske-input" class="materialize-textarea"></textarea>
<label for="ske-input">输入</label>
</div>
</div>
</div>

<!--Function Area-->
<div class="row">
<!--Extract-->
<div class="col s3 offset-s2">
<a id="ske-extract" class="waves-effect waves-light btn">
<i class="material-icons left">colorize</i>提取</a>
</div>
<!--Export-->
<div class="col s3">
<a id="ske-export" class="waves-effect waves-light btn">
<i class="material-icons left">archive</i>导出</a>
</div>
<!--Clear-->
<div class="col s3">
<a id="ske-clear" class="waves-effect waves-light btn">
<i class="material-icons left">clear_all</i>清空</a>
<!--Function Area-->
<div class="row">
<!--Extract-->
<div class="col s2 offset-s2">
<a id="ske-extract" class="waves-effect waves-light btn">
<i class="material-icons left">colorize</i>提取</a>
</div>
<!--Extract-->
<div class="col s2">
<a id="ske-copy" class="waves-effect waves-light btn">
<i class="material-icons left">content_copy</i>复制</a>
</div>
<!--Export-->
<div class="col s2">
<a id="ske-export" class="waves-effect waves-light btn disabled">
<i class="material-icons left">archive</i>导出</a>
</div>
<!--Clear-->
<div class="col s2">
<a id="ske-clear" class="waves-effect waves-light btn">
<i class="material-icons left">clear_all</i>清空</a>
</div>
</div>
</div>

<!--Text Output Area-->
<div class="row">
<div class="input-field col s12">
<textarea id="ske-output" class="materialize-textarea"></textarea>
<label for="ske-output">输出</label>
<!--Text Output Area-->
<div class="row">
<div class="input-field col s12">
<textarea id="ske-output" class="materialize-textarea"></textarea>
<label for="ske-output">输出</label>
</div>
</div>

</div>
</div>
</main>

<footer class="page-footer grey darken-4">
<div class="footer-copyright">
<div class="container">
Copyright © 2018
<a href="https://steamcommunity.com/profiles/76561198263380239/" target="_blank">Cloud</a>
<iframe class="right" allowtransparency="true" scrolling="no" frameborder="0" src="https://buttons.github.io/buttons.html#href=https://github.com/Cloud-Swift/SKE/fork&amp;title=&amp;aria-label=Fork%20SKE%20on%20GitHub&amp;data-icon=octicon-repo-forked&amp;data-text=Fork&amp;data-show-count=true"
style="width: 80px; height: 20px; border: none;"></iframe>
<iframe class="right" allowtransparency="true" scrolling="no" frameborder="0" src="https://buttons.github.io/buttons.html#href=https://github.com/Cloud-Swift/SKE&amp;title=&amp;aria-label=Star%20SKE%20on%20GitHub&amp;data-icon=octicon-star&amp;data-text=Star&amp;data-show-count=true"
style="width: 80px; height: 20px; border: none;"></iframe>
</div>
</div>
</div>
</footer>

<!--JavaScript at end of body for optimized loading-->
<script type="text/javascript" src="js/materialize.js"></script>
Expand Down
46 changes: 46 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const txtBotName = document.getElementById("bot-name");
const txtInput = document.getElementById("ske-input");
const btnExtract = document.getElementById("ske-extract");
const btnCopy = document.getElementById("ske-copy");
const btnExport = document.getElementById("ske-export");
const btnClear = document.getElementById("ske-clear");
const txtOutput = document.getElementById("ske-output");
const keyRegex = /(?:(?:([A-Z0-9])(?!\1{4})){5}-){2,5}[A-Z0-9]{5}/g;
const unique = a => [...new Set(a)];

btnExtract.onclick = () => {
txtOutput.value = "";

const keys = unique(txtInput.value.match(keyRegex));
if (keys.length > 0) {
txtOutput.value = "!redeem " + txtBotName.value + " " + keys.join(",");
txtOutput.focus();
} else {
M.toast({
html: '无 Steam Key!'
});
}
M.updateTextFields();
M.textareaAutoResize(txtOutput);
M.textareaAutoResize(txtInput);
}

btnCopy.onclick = () => {
txtOutput.select();
document.execCommand("Copy");
M.toast({
html: '已复制!'
});
}

btnClear.onclick = () => {
txtInput.value = "";
txtOutput.value = "";
M.updateTextFields();
M.textareaAutoResize(txtOutput);
M.textareaAutoResize(txtInput);

M.toast({
html: '已清空!'
});
}

0 comments on commit 2f41d4a

Please sign in to comment.