-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwills.html
144 lines (136 loc) · 4.67 KB
/
wills.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href='css/bootstrap.min.css'>
<!-- Latest jQuery -->
<script src='js/jquery.min.js'></script>
<!-- Latest compiled and minified JavaScript -->
<script src="js/bootstrap.min.js"></script>
<title>ToS Last Will Generator</title>
</head>
<body>
<h1>Town of Salem Last Will Generator</h1>
<div class="btn-group" style="padding-bottom:1%;">
<a role="button" class="btn btn-default" href="/">Death Notes</a>
<a role="button" class="btn disabled btn-primary" href="/wills.html">Last Wills</a>
</div>
<form class="form-inline">
<select id="preview" class="selectpicker form-control" data-live-search="true" title="Please select a will" onchange="change_will(this.value)">
<!-- Populate will list here -->
</select>
<select id="role" class="selectpicker form-control" data-live-search="true" title="Please select a role ..." onchange="change_role(this.value)">
<!-- Populate role list here -->
</select>
<input id="name" class="form-control" placeholder="IGN Name">
<label for="inc_verb">Include Night Action</label>
<input type="checkbox" id="inc_act" class="form-control" checked>
</form>
<h3>Tap or Click inside textbox to copy to clipboard. <span id="copied" class="text-success "></span></h3>
<textarea id="note" readonly="true" cols="57" onclick="copy_will(this)"></textarea>
<script>
var wills = [
// Format:
// ["Text {0} ... {1}", "number of rows textbox should be"]
// {0} will be replaced with the role
// {1} will be replaced with the name
["{1} - {0}","14"]
];
var rolls = {
// Format:
// "Role": "Night Action"
// Night Action should be "false" to not show N1, N2, etc.
// Trailing space will be added automaticly
"Investigator": "Investigated",
"Lookout": "Watched",
"Sheriff": "Interrogated",
"Spy": "",
"Jailor": "Executed",
"Vampire Hunter": "Staked",
"Veteran": "Shot",
"Vigilante": "Shot",
"Bodyguard": "Protected",
"Doctor": "Healed",
"Escort": "Blocked",
"Mayor": "false",
"Medium": "",
"Retributionist": "Revived",
"Transporter": " -",
// Disguiser missing because disguiser should disguise as someone else!
"Forger": "Forged",
"Framer": "Framed",
"Janitor": "Cleaned",
"Godfather": "Killed",
"Mafioso": "Killed",
"Blackmailer": "Blackmailed",
"Consigliere": " is",
"Consort": "Distracted",
"Survivor": "",
"Vampire": "Bit",
"Executioner": "Target:", // Special case: Will not include N1, etc. ever.
"Jester": "false",
"Witch": "Target: ()\n Victim:",
"Arsonist": "Doused",
"Serial Killer": "Stabbed",
"Werewolf": "Mauled",
}
var preview = document.getElementById("preview");
var select = document.getElementById("role");
var note = document.getElementById('note');
var copied = document.getElementById('copied');
// First, checks if it isn't implemented yet.
if (!String.prototype.format) {
String.prototype.format = function() {
var args = arguments;
return this.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match;
});
};
}
function night_num(action) {
var will_string = action + "\n";
for (var night = 1; night <= 10; night++) {
will_string += "N" + night + ": \n";
}
will_string += "http://deathnote.link";
return will_string;
}
function copy_will(argument) {
argument.select();
document.execCommand('copy');
copied.innerHTML = "Copied!";
setTimeout(function(){copied.innerHTML = "";}, 3000);
}
function change_verb(argument) {
verb.innerHTML = killers[argument];
note.value = deathnotes[preview.value][0].format(argument, killers[argument])
note.rows = deathnotes[preview.value][1];
copied.innerHTML = "";
for (var i=1; i<preview.options.length; i++) {
preview[i].innerHTML = preview[i].innerHTML.format(argument, killers[argument]);
}
}
function change_will(argument) {
note.value = deathnotes[argument][0].format(select.value, killers[select.value]);
note.rows = deathnotes[argument][1];
copied.innerHTML = "";
}
for (var role in killers) {
var option = document.createElement('option');
option.innerHTML = role;
option.value = role;
select.appendChild(option);
}
for (var dn in deathnotes) {
var option = document.createElement('option');
option.innerHTML = deathnotes[dn][0].split("\n")[0].format(select.value, killers[select.value]);
option.value = dn;
preview.appendChild(option);
}
note.innerHTML = deathnotes[0][0].format(select.value, killers[select.value])
note.rows = deathnotes[0][1];
verb.innerHTML = killers[select.value];
</script>