Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Park, Jonghyeon committed May 7, 2020
0 parents commit f983907
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
22 changes: 22 additions & 0 deletions assets/content.js
@@ -0,0 +1,22 @@
var jobs = [
'도둑',
'절대강자',
'스피드레이서'
]

var locations = {
0: ['노인정'],
1: ['사우나', '성인용품점', '러브호텔', '피시방', '학원', '독서실', '마트', '스터디카페'],
2: ['노약자석', '임산부석', '장애인석', '대형마트시식대'],
3: ['어린이보호구역']
}

/* 0: Common, 1: 도둑, 2: 절대강자, 3: 스피드레이서 */

var objects = [
'수건', '흑돌', '백돌', '러브젤', '노트', '교재', '연필심', '샤프심', '충전기', '마우스', '지우개'
]

var exampleName = [
'엄준식', '고강건', '박종현', '유현재', '안주현', '이건우', '김민식', '엄종현', '방인', '이용호', '김길수', '정성섭', '정지웅'
]
36 changes: 36 additions & 0 deletions assets/generate.js
@@ -0,0 +1,36 @@
var totalVarLen = 0
var totalVar = []

for (i=0; i<4; i++) {
totalVarLen += locations[i].length
for (j=0; j<locations[i].length; j++) {
totalVar = totalVar.concat(locations[i][j])
}
}

function generate (isExmapled, targetID) {
var varName = ''
if (isExmapled) {
varName = exampleName[Math.floor(Math.random() * exampleName.length)]
} else {
varName = document.getElementById('name').value
}
var varLocation = document.getElementById('location').value
var location = totalVar[Math.floor(Math.random() * totalVar.length)]
var result = ''
if (locations[0].indexOf(location) >= 0) {
result = '미구현'
} else if (locations[1].indexOf(location) >= 0) {
var randomObject = objects[Math.floor(Math.random() * objects.length)]
result = varLocation + location + randomObject + '도둑' + varName
} else if (locations[2].indexOf(location) >= 0) {
result = varLocation + location + '절대강자' + varName
} else /*if (locations[3].indexOf(location) >= 0)*/ {
result = varLocation + location + '스피드레이서' + varName
}
document.getElementById(targetID).innerHTML = result
}

setInterval(function () {
generate(true, 'example')
}, 5000)
68 changes: 68 additions & 0 deletions index.html
@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>악질이름 생성기</title>
</head>
<body>
<style>
@font-face { font-family: 'SDKukdetopokki-Lt'; src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.1/SDKukdetopokki-aLt00.woff') format('woff'); font-weight: normal; font-style: normal; }
body {
background-color: #fff;
}
.body {
margin: auto;
max-width: 500px;
}
form, .unit {
position: relative;
align-items: center;
background-color: #e2e2e2;
padding: 10px;
border-radius: 5px;
border: 0px solid;
width: 100%;
max-width: 500px;
text-align: center;
}
.button {
display: inline-block;
margin-top: 10px;
padding: 5px;
background-color: #999;
color: white;
border-radius: 3px;
cursor: pointer;
}
input {
width: 100px;
height: 30px;
padding: 0px 5px;
outline: none;
border: 1px solid;
border-radius: 3px;
}
h1, h2 {
font-family: 'SDKukdetopokki-Lt', sans-serif;
}
</style>
<div class="body">
<form action="">
<h1>악질이름 생성기</h1>
<div>
<input type="text" name="location" id="location" placeholder="지역">
<input type="text" name="name" id="name" placeholder="이름">
</div>
<div class="button" onclick="generate(false, 'result')">생성</div>
<p id="result">결과?</p>
</form>
<div class="unit">
<h2>예시</h2>
<p id="example">동탄사우나수건도둑엄준식</p>
</div>
</div>
<script src="./assets/content.js"></script>
<script src="./assets/generate.js"></script>
</body>
</html>

0 comments on commit f983907

Please sign in to comment.