-
Notifications
You must be signed in to change notification settings - Fork 93
/
index.html
214 lines (201 loc) · 9.55 KB
/
index.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Comicgen: Comic Creator</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Add comics to your website or app with an API. Choose a character, angle, emotion and pose. Embed on your page.">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:site" content="Gramener">
<meta property="og:url" content="https://gramener.com/comicgen/">
<meta property="og:type" content="website">
<meta property="og:title" content="Comicgen: Comic Creator">
<meta property="og:description" content="Create comics for your website or app with a JavaScript library. Choose a character, angle, emotion and pose. Size the image. Embed in your page.">
<meta property="og:image" content="https://gramener.com/comicgen/v1/docs/comicgen-share.png">
<style>
/* Ensure that this is the first rule in the first stylesheet. Used by JS */
#character { background-color: #ffffff; }
/* The rest can be any styles */
#character { position: relative; }
.navbar { background-color: #675b9e !important; }
:root {
--bs-font-sans-serif: Neucha, Chalkboard, "Comic Sans MS", sans-serif !important;
}
#code {white-space: pre-wrap;}
.text-centre { text-align: centre; }
.form-control.form-control-color { width: 2.5rem; padding: .31rem 0.275rem; }
.form-control.form-control-number { width: 4rem; padding-right: 0.275rem; }
.param {
display: inline-block;
vertical-align: bottom;
}
</style>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Neucha" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/highlightjs@9.12.0/styles/github.css">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-42126862-1"></script>
<script>
window.dataLayer = window.dataLayer || []
function gtag() { window.dataLayer.push(arguments) }
gtag('js', new Date())
gtag('config', 'UA-42126862-1')
</script>
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark text-light border-bottom body-color">
<div class="container">
<a class="navbar-brand font-weight-bold" href="#">Comicgen</a>
<button class="navbar-toggler d-lg-none" type="button" data-bs-toggle="collapse" data-target="#collapsibleNavId" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavId">
<ul class="navbar-nav me-auto">
<li class="navbar-item"><i class="far fa-smile"></i></li>
</ul>
<ul class="navbar-nav">
<a class="navbar-brand" href="https://gramener.com/" target="_blank" rel="noopener">
<img src="docs/gramener.png" alt="Gramener" height="40">
</a>
</ul>
</div>
</div>
</nav>
<div class="container my-3">
<ul class="nav nav-tabs" id="comic-tab">
<li class="nav-item"><a class="nav-link active" id="home-tab" data-bs-toggle="tab" href="#home">Home</a></li>
<li class="nav-item"><a class="nav-link" id="usage-tab" data-bs-toggle="tab" href="#usage">Usage</a></li>
<li class="nav-item"><a class="nav-link" id="api-tab" data-bs-toggle="tab" href="#api">API</a></li>
<li class="nav-item"><a class="nav-link" id="design-tab" data-bs-toggle="tab" href="#design">Design</a></li>
<li class="nav-item"><a class="nav-link" id="about-tab" data-bs-toggle="tab" href="#about">About</a></li>
</ul>
<div class="tab-content" id="comic-tab-content">
<div class="tab-pane active" id="home">
<div class="row my-4">
<div class="col-xl-4">
<h1>Make your own comic</h1>
<md data-target="introduction"></md>
<a href="https://gramener.com/datacomics/" class="btn btn-lg btn-primary my-5">Data Comicgen Gallery</a>
</div>
<div class="col-xl-8">
<form class="selector form-inline">
<div id="menu"></div>
</form>
<div id="character" class="my-2">
<div class="target"></div>
</div>
<div id="codetemp"></div>
</div><!-- .col -->
</div><!-- .row -->
</div><!-- .tab-pane -->
<div class="tab-pane" id="usage">
<md data-target="usage"></md>
</div>
<div class="tab-pane" id="api">
<md data-target="api"></md>
</div>
<div class="tab-pane" id="design">
<md data-target="design"></md>
</div>
<div class="tab-pane" id="about">
<md data-target="credits"></md>
<md data-target="character-credits"></md>
</div>
</div><!-- .tab-content -->
<md data-target="social"></md>
</div><!-- .container -->
<footer class="mt-auto text-center pt-3 bg-light border-top">
<p>Made by <a href="https://gramener.com/">Gramener</a>.
Code released under the <a href="https://opensource.org/licenses/MIT">MIT License</a>.
Images under <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY</a>
or <a href="https://creativecommons.org/choose/zero/">CC0</a>
</p>
</footer>
<script type="text/html" id="codegen">
<div class="mb-3">
<a class="btn btn-sm pt-0 btn-light border" download href="<%= url %>">
<i class="far fa-arrow-alt-circle-down"></i> SVG
</a>
<a class="btn btn-sm pt-0 btn-light border" download href="<%= url %>&ext=png">
<i class="far fa-arrow-alt-circle-down"></i> PNG
</a>
<button type="button" class="btn btn-sm pt-0 btn-light border copy" data-clipboard-target="#code">
<i class="far fa-copy"></i> Copy link
</button>
<label class="mx-1">
Background <input type="color" value="<%= state.bgcolor %>" class="btn btn-light border p-0 bg-color">
</label>
</div>
<pre id="code"><%= url %></pre>
</script>
<script type="text/html" id="menu-template">
<% if (!(q.name in chars)) q.name = Object.keys(chars)[0] %>
<% var info = chars[q.name] %>
<% for (var [key, vals] of Object.entries(options)) { %>
<div class="param pe-2 mb-2 text-center">
<label for="<%= key %>"><%= key %></label>
<select class="form-select" id="<%= key %>" name="<%= key %>">
<% for (var val of vals) { %>
<option <%= q[key] == val ? 'selected' : '' %>><%= val %></option>
<% } %>
</select>
</div>
<% } %>
<% for (let [key, val] of Object.entries(info.replace || {})) { %>
<div class="param pe-2 mb-2 text-center">
<label for="<%= key %>"><%= key %></label>
<% if (val.type == 'select') { %>
<% let selected = q[key] || val.default %>
<select id="<%= key %>" name="<%= key %>" class="form-select <%= config.typeclass[val.type] || '' %>">
<% for (let option of val.options) { %>
<option <%= selected == option ? 'selected' : '' %>><%= option %></option>
<% } %>
</select>
<% } else { %>
<input type="<%= val.type %>" value="<%= q[key] || val.default %>" id="<%= key %>" name="<%= key %>"
class="form-control <%= config.typeclass[val.type] || '' %>"
<% for (let [attr, attrval] of Object.entries(val.attrs || {})) { %>
<%= attr %>="<%= attrval %>"
<% } %>
>
<% } %>
</div>
<% } %>
<div class="param pe-2 mb-2 text-center">
<label for="box">box</label>
<select class="form-select" id="box" name="box">
<option></option>
<% for (let box of [1, 2, 3, 5, 7, 10]) { %>
<option value="<%= box %>" <%= q.box == box ? 'selected' : '' %>><%= box %></option>
<% } %>
</select>
</div>
<div class="param pe-2 mb-2 text-center">
<label for="boxcolor">boxcolor</label>
<input name="boxcolor" id="boxcolor" type="color" value="<%= q.boxcolor %>" class="form-control form-control-color">
</div>
<div class="param pe-2 mb-2 text-center">
<label for="boxgap">boxgap</label>
<input name="boxgap" id="boxgap" type="number" min="0" value="<%= q.boxgap %>" class="form-control form-control-number">
</div>
<div class="param pe-2 mb-2 text-center">
<label for="mirror">mirror</label>
<select class="form-select" id="mirror" name="mirror">
<option></option>
<option value="mirror" <%= q.mirror == 'mirror' ? 'selected' : '' %>>mirror</option>
</select>
</div>
</script>
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/plain-draggable@2.5.12/plain-draggable.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/g1@0.17.4/dist/g1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/showdown@1.9.1/dist/showdown.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/highlightjs@9.16.2/highlight.pack.min.js"></script>
<script src="script.js"></script>
</body>
</html>