-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathindex.html
360 lines (336 loc) · 31 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<!DOCTYPE html>
<html>
<head>
<title>绝绝子生成器</title>
<meta http-equiv="content-type" content="txt/html; charset=utf-8" />
<meta content="width=device-width,user-scalable=no" name="viewport" />
</head>
<style>
body {
font-family: 'Hiragino Sans GB', 'SFMono', 'Lato', '-apple-system';
}
h1,
p {
text-align: center;
}
input {
border-bottom: 1px solid #000;
border-top: 0px;
border-left: 0px;
border-right: 0px;
height: 30px;
font-size: 28px;
margin-right: 10px;
max-width: 80%;
}
button {
font-size: 22px;
font-weight: bold;
background-color: #73AD21;
color: cornsilk;
border-radius: 10px;
text-align: center;
vertical-align: middle;
border: 1px solid transparent;
font-weight: 900;
padding: 5px;
}
blockquote {
border-radius: 20px;
background-color: rgba(145, 199, 60, 0.54);
padding: 10px;
width: 90%;
}
.main_body {
margin-top: 20px;
border-radius: 25px;
border: 2px solid #73AD21;
padding: 10px;
margin-left: 10px;
margin-right: 10px;
display: flex;
flex-direction: column;
align-items: center;
}
.jjz {
font-weight: bold;
font-style: italic;
text-decoration: underline;
}
.operation_container {
display: flex;
justify-content: center;
align-items: center;
max-width: 90%;
}
.submit_button {
min-width: 50px;
width: 100px;
font-size: medium;
}
.copy_button {
height: 40px;
margin-top: 10px;
font-size: medium;
}
.footer {
display: flex;
justify-content: space-between;
font-size: small;
}
.left-footer {
border-radius: 25px;
border: 2px solid #6e817d;
padding: 20px;
min-width: 30%;
margin-right: 10px;
flex: 1;
margin-top: 10px;
margin-left: 10px;
word-wrap: break-word;
}
.right-footer {
border-radius: 25px;
border: 2px solid #81CAa1;
padding: 20px;
min-width: 30%;
flex: 1;
margin-top: 10px;
margin-right: 10px;
word-wrap: break-word;
}
#content_container {
border-radius: 25px;
background-color: rgba(145, 199, 60, 0.84);
padding: 20px;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
}
/* unselectable: all; */
/* onselectstart: all; */
/* #generate_content {
-moz-user-select: all;
-webkit-user-select: all;
-webkit-touch-callout: all;
-webkit-user-select: all;
-moz-user-select: all;
-ms-user-select: all;
user-select: all;
} */
</style>
<body>
<div class="main_body">
<h1>
绝绝子生成器
</h1>
<div>
<span class="jjz">绝绝子</span> 的你用了就是 <span class="jjz">YYDS</span> !
</div>
<blockquote>
小可爱下班啦🥤 噎死莫拉 今天去体验了玩绝绝子生成器😊😊😊 不是吧 害害害 这件绝绝子生成器太可了❔❔❔这个咖啡也绝绝子‼️‼️‼️救命🆘 不管啦 呐呐呐 星星月亮和我都要睡啦☀️
</blockquote>
<div class="operation_container">
<input id="keyword_input"></input><button class="submit_button" onclick="chongYa()">点我冲鸭 !!!</button>
</div>
<p style="font-size: small;"><sup>*</sup>请使用空格间隔动词与名词,例如:喝奶茶 => 喝 奶茶</p>
<div id="content_container">
<div id="generate_content">qeqwe
</div>
<button class="copy_button" data-clipboard-action="copy"
data-clipboard-target="#generate_content">点我复制</button>
<!-- Clipboard.js -->
<script>
!function (e) { if ("object" == typeof exports && "undefined" != typeof module) module.exports = e(); else if ("function" == typeof define && define.amd) define([], e); else { var t; t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this, t.Clipboard = e() } }(function () { var e, t, n; return function e(t, n, o) { function i(a, c) { if (!n[a]) { if (!t[a]) { var l = "function" == typeof require && require; if (!c && l) return l(a, !0); if (r) return r(a, !0); var u = new Error("Cannot find module '" + a + "'"); throw u.code = "MODULE_NOT_FOUND", u } var s = n[a] = { exports: {} }; t[a][0].call(s.exports, function (e) { var n = t[a][1][e]; return i(n ? n : e) }, s, s.exports, e, t, n, o) } return n[a].exports } for (var r = "function" == typeof require && require, a = 0; a < o.length; a++)i(o[a]); return i }({ 1: [function (e, t, n) { function o(e, t) { for (; e && e.nodeType !== i;) { if (e.matches(t)) return e; e = e.parentNode } } var i = 9; if ("undefined" != typeof Element && !Element.prototype.matches) { var r = Element.prototype; r.matches = r.matchesSelector || r.mozMatchesSelector || r.msMatchesSelector || r.oMatchesSelector || r.webkitMatchesSelector } t.exports = o }, {}], 2: [function (e, t, n) { function o(e, t, n, o, r) { var a = i.apply(this, arguments); return e.addEventListener(n, a, r), { destroy: function () { e.removeEventListener(n, a, r) } } } function i(e, t, n, o) { return function (n) { n.delegateTarget = r(n.target, t), n.delegateTarget && o.call(e, n) } } var r = e("./closest"); t.exports = o }, { "./closest": 1 }], 3: [function (e, t, n) { n.node = function (e) { return void 0 !== e && e instanceof HTMLElement && 1 === e.nodeType }, n.nodeList = function (e) { var t = Object.prototype.toString.call(e); return void 0 !== e && ("[object NodeList]" === t || "[object HTMLCollection]" === t) && "length" in e && (0 === e.length || n.node(e[0])) }, n.string = function (e) { return "string" == typeof e || e instanceof String }, n.fn = function (e) { var t = Object.prototype.toString.call(e); return "[object Function]" === t } }, {}], 4: [function (e, t, n) { function o(e, t, n) { if (!e && !t && !n) throw new Error("Missing required arguments"); if (!c.string(t)) throw new TypeError("Second argument must be a String"); if (!c.fn(n)) throw new TypeError("Third argument must be a Function"); if (c.node(e)) return i(e, t, n); if (c.nodeList(e)) return r(e, t, n); if (c.string(e)) return a(e, t, n); throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList") } function i(e, t, n) { return e.addEventListener(t, n), { destroy: function () { e.removeEventListener(t, n) } } } function r(e, t, n) { return Array.prototype.forEach.call(e, function (e) { e.addEventListener(t, n) }), { destroy: function () { Array.prototype.forEach.call(e, function (e) { e.removeEventListener(t, n) }) } } } function a(e, t, n) { return l(document.body, e, t, n) } var c = e("./is"), l = e("delegate"); t.exports = o }, { "./is": 3, delegate: 2 }], 5: [function (e, t, n) { function o(e) { var t; if ("SELECT" === e.nodeName) e.focus(), t = e.value; else if ("INPUT" === e.nodeName || "TEXTAREA" === e.nodeName) { var n = e.hasAttribute("readonly"); n || e.setAttribute("readonly", ""), e.select(), e.setSelectionRange(0, e.value.length), n || e.removeAttribute("readonly"), t = e.value } else { e.hasAttribute("contenteditable") && e.focus(); var o = window.getSelection(), i = document.createRange(); i.selectNodeContents(e), o.removeAllRanges(), o.addRange(i), t = o.toString() } return t } t.exports = o }, {}], 6: [function (e, t, n) { function o() { } o.prototype = { on: function (e, t, n) { var o = this.e || (this.e = {}); return (o[e] || (o[e] = [])).push({ fn: t, ctx: n }), this }, once: function (e, t, n) { function o() { i.off(e, o), t.apply(n, arguments) } var i = this; return o._ = t, this.on(e, o, n) }, emit: function (e) { var t = [].slice.call(arguments, 1), n = ((this.e || (this.e = {}))[e] || []).slice(), o = 0, i = n.length; for (o; o < i; o++)n[o].fn.apply(n[o].ctx, t); return this }, off: function (e, t) { var n = this.e || (this.e = {}), o = n[e], i = []; if (o && t) for (var r = 0, a = o.length; r < a; r++)o[r].fn !== t && o[r].fn._ !== t && i.push(o[r]); return i.length ? n[e] = i : delete n[e], this } }, t.exports = o }, {}], 7: [function (t, n, o) { !function (i, r) { if ("function" == typeof e && e.amd) e(["module", "select"], r); else if ("undefined" != typeof o) r(n, t("select")); else { var a = { exports: {} }; r(a, i.select), i.clipboardAction = a.exports } }(this, function (e, t) { "use strict"; function n(e) { return e && e.__esModule ? e : { default: e } } function o(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } var i = n(t), r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { return typeof e } : function (e) { return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e }, a = function () { function e(e, t) { for (var n = 0; n < t.length; n++) { var o = t[n]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o) } } return function (t, n, o) { return n && e(t.prototype, n), o && e(t, o), t } }(), c = function () { function e(t) { o(this, e), this.resolveOptions(t), this.initSelection() } return a(e, [{ key: "resolveOptions", value: function e() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; this.action = t.action, this.emitter = t.emitter, this.target = t.target, this.text = t.text, this.trigger = t.trigger, this.selectedText = "" } }, { key: "initSelection", value: function e() { this.text ? this.selectFake() : this.target && this.selectTarget() } }, { key: "selectFake", value: function e() { var t = this, n = "rtl" == document.documentElement.getAttribute("dir"); this.removeFake(), this.fakeHandlerCallback = function () { return t.removeFake() }, this.fakeHandler = document.body.addEventListener("click", this.fakeHandlerCallback) || !0, this.fakeElem = document.createElement("textarea"), this.fakeElem.style.fontSize = "12pt", this.fakeElem.style.border = "0", this.fakeElem.style.padding = "0", this.fakeElem.style.margin = "0", this.fakeElem.style.position = "absolute", this.fakeElem.style[n ? "right" : "left"] = "-9999px"; var o = window.pageYOffset || document.documentElement.scrollTop; this.fakeElem.style.top = o + "px", this.fakeElem.setAttribute("readonly", ""), this.fakeElem.value = this.text, document.body.appendChild(this.fakeElem), this.selectedText = (0, i.default)(this.fakeElem), this.copyText() } }, { key: "removeFake", value: function e() { this.fakeHandler && (document.body.removeEventListener("click", this.fakeHandlerCallback), this.fakeHandler = null, this.fakeHandlerCallback = null), this.fakeElem && (document.body.removeChild(this.fakeElem), this.fakeElem = null) } }, { key: "selectTarget", value: function e() { this.selectedText = (0, i.default)(this.target), this.copyText() } }, { key: "copyText", value: function e() { var t = void 0; try { t = document.execCommand(this.action) } catch (e) { t = !1 } this.handleResult(t) } }, { key: "handleResult", value: function e(t) { this.emitter.emit(t ? "success" : "error", { action: this.action, text: this.selectedText, trigger: this.trigger, clearSelection: this.clearSelection.bind(this) }) } }, { key: "clearSelection", value: function e() { this.target && this.target.blur(), window.getSelection().removeAllRanges() } }, { key: "destroy", value: function e() { this.removeFake() } }, { key: "action", set: function e() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "copy"; if (this._action = t, "copy" !== this._action && "cut" !== this._action) throw new Error('Invalid "action" value, use either "copy" or "cut"') }, get: function e() { return this._action } }, { key: "target", set: function e(t) { if (void 0 !== t) { if (!t || "object" !== ("undefined" == typeof t ? "undefined" : r(t)) || 1 !== t.nodeType) throw new Error('Invalid "target" value, use a valid Element'); if ("copy" === this.action && t.hasAttribute("disabled")) throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); if ("cut" === this.action && (t.hasAttribute("readonly") || t.hasAttribute("disabled"))) throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); this._target = t } }, get: function e() { return this._target } }]), e }(); e.exports = c }) }, { select: 5 }], 8: [function (t, n, o) { !function (i, r) { if ("function" == typeof e && e.amd) e(["module", "./clipboard-action", "tiny-emitter", "good-listener"], r); else if ("undefined" != typeof o) r(n, t("./clipboard-action"), t("tiny-emitter"), t("good-listener")); else { var a = { exports: {} }; r(a, i.clipboardAction, i.tinyEmitter, i.goodListener), i.clipboard = a.exports } }(this, function (e, t, n, o) { "use strict"; function i(e) { return e && e.__esModule ? e : { default: e } } function r(e, t) { if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function") } function a(e, t) { if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return !t || "object" != typeof t && "function" != typeof t ? e : t } function c(e, t) { if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + typeof t); e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t) } function l(e, t) { var n = "data-clipboard-" + e; if (t.hasAttribute(n)) return t.getAttribute(n) } var u = i(t), s = i(n), f = i(o), d = function () { function e(e, t) { for (var n = 0; n < t.length; n++) { var o = t[n]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o) } } return function (t, n, o) { return n && e(t.prototype, n), o && e(t, o), t } }(), h = function (e) { function t(e, n) { r(this, t); var o = a(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this)); return o.resolveOptions(n), o.listenClick(e), o } return c(t, e), d(t, [{ key: "resolveOptions", value: function e() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; this.action = "function" == typeof t.action ? t.action : this.defaultAction, this.target = "function" == typeof t.target ? t.target : this.defaultTarget, this.text = "function" == typeof t.text ? t.text : this.defaultText } }, { key: "listenClick", value: function e(t) { var n = this; this.listener = (0, f.default)(t, "click", function (e) { return n.onClick(e) }) } }, { key: "onClick", value: function e(t) { var n = t.delegateTarget || t.currentTarget; this.clipboardAction && (this.clipboardAction = null), this.clipboardAction = new u.default({ action: this.action(n), target: this.target(n), text: this.text(n), trigger: n, emitter: this }) } }, { key: "defaultAction", value: function e(t) { return l("action", t) } }, { key: "defaultTarget", value: function e(t) { var n = l("target", t); if (n) return document.querySelector(n) } }, { key: "defaultText", value: function e(t) { return l("text", t) } }, { key: "destroy", value: function e() { this.listener.destroy(), this.clipboardAction && (this.clipboardAction.destroy(), this.clipboardAction = null) } }], [{ key: "isSupported", value: function e() { var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ["copy", "cut"], n = "string" == typeof t ? [t] : t, o = !!document.queryCommandSupported; return n.forEach(function (e) { o = o && !!document.queryCommandSupported(e) }), o } }]), t }(s.default); e.exports = h }) }, { "./clipboard-action": 7, "good-listener": 4, "tiny-emitter": 6 }] }, {}, [8])(8) });
</script>
<script>
var clipboard = new Clipboard('.copy_button');
clipboard.on('success', function (e) {
console.log(e);
});
clipboard.on('error', function (e) {
console.log(e);
});
</script>
</div>
</div>
<div class="footer">
<div class="left-footer">
Powered by <a href="https://github.com/kingcos/JueJueZiGenerator">kingcos/JueJueZiGenerator</a> with
<span style="font-size: smaller;">❤️</span>
<br>
<br>
Language: TypeScript & JavaScript
<br>
License: MIT
<br>
<br>
<li>我的博客:<a href="https://kingcos.me">kingcos.me</a></li>
<li>我的公众号:萌面大道(No Ads.)</li>
</div>
<br>
<div class="right-footer">
相关代码已完全开源,才疏学浅,结构分析使用人脑,<span style="
font-weight: bold;">完全没有</span>使用到任何关于 AI、人工智能、深度学习、机器学习、神经网络等相关领域知识。
<br>
<br>
开源组件使用情况:
<br>
<li>基于 <a href="https://github.com/zenorocha/clipboard.js">zenorocha/clipboard.js</a> 提供复制功能。</li>
<br>
<br>
欢迎 <a href="https://github.com/kingcos/JueJueZiGenerator">Pull Requests / Issue</a> ~
</div>
</div>
</body>
</html>
<script>
"use strict";
// JueJueZiGenerator
// --- SETUPS ---
var matierailsJSON = "\n{\n \"emotions\": {\n \"emoji\": [\n \"\uD83D\uDE0A\",\n \"\uD83C\uDF1F\",\n \"\uD83E\uDDE9\",\n \"\u2728\",\n \"\u2600\uFE0F\",\n \"\uD83C\uDF39\",\n \"\uD83C\uDF38\",\n \"\uD83C\uDF3C\",\n \"\uD83E\uDD5D\",\n \"\uD83E\uDD64\",\n \"\uD83C\uDF51\",\n \"\uD83C\uDF79\",\n \"\uD83E\uDD51\",\n \"\uD83D\uDE4B\u200D\u2640\uFE0F\",\n \"\uD83C\uDF80\",\n \"\u2764\uFE0F\",\n \"\uD83E\uDDE1\",\n \"\uD83D\uDC9B\",\n \"\uD83D\uDC9A\",\n \"\uD83D\uDC99\",\n \"\uD83D\uDC9C\",\n \"\uD83D\uDDA4\",\n \"\uD83E\uDD0D\",\n \"\uD83E\uDD0E\",\n \"\uD83D\uDC95\",\n \"\uD83D\uDC9E\",\n \"\uD83D\uDC93\",\n \"\uD83D\uDC97\",\n \"\uD83D\uDC96\",\n \"\uD83D\uDC9D\"\n ],\n \"xiaohongshu\": [\n \"[\u5FAE\u7B11R]\",\n \"[\u5BB3\u7F9ER]\",\n \"[\u5931\u671BR]\",\n \"[\u6C57\u989CR]\",\n \"[\u54C7R]\",\n \"[\u559D\u5976\u8336R]\",\n \"[\u81EA\u62CDR]\",\n \"[\u5077\u7B11R]\",\n \"[\u98DE\u543BR]\",\n \"[\u77F3\u5316R]\",\n \"[\u7B11\u54EDR]\",\n \"[\u8D5ER]\",\n \"[\u6697\u4E2D\u89C2\u5BDFR]\",\n \"[\u4E70\u7206R]\",\n \"[\u5927\u7B11R]\",\n \"[\u8272\u8272R]\",\n \"[\u751F\u6C14R]\",\n \"[\u54ED\u60F9R]\",\n \"[\u840C\u840C\u54D2R]\",\n \"[\u659C\u773CR]\",\n \"[\u53EF\u601CR]\",\n \"[\u9119\u89C6R]\",\n \"[\u76B1\u7709R]\",\n \"[\u6293\u72C2R]\",\n \"[\u6D3E\u5BF9R]\",\n \"[\u5427\u5527R]\",\n \"[\u60CA\u6050R]\",\n \"[\u62A0\u9F3BR]\",\n \"[\u518D\u89C1R]\",\n \"[\u53F9\u6C14R]\",\n \"[\u7761\u89C9R]\",\n \"[\u5F97\u610FR]\",\n \"[\u5403\u74DCR]\",\n \"[\u6276\u5899R]\",\n \"[\u9ED1\u85AF\u95EE\u53F7R]\",\n \"[\u9EC4\u91D1\u85AFR]\",\n \"[\u5410\u820C\u5934H]\",\n \"[\u626F\u8138H]\",\n \"[doge]\"\n ],\n \"weibo\": []\n },\n \"symbols\": [\n \"\uFF01\",\n \"\uFF1F\",\n \"\uFF5E\",\n \"\u2753\",\n \"\u2754\",\n \"\u203C\uFE0F\",\n \"\u2049\uFE0F\",\n \"\u2757\uFE0F\",\n \"\u2755\"\n ],\n \"auxiliaryWords\": [\n \"\u9E2D\",\n \"\u545C\",\n \"\u5566\",\n \"\u5450\",\n \"\u5440\",\n \"\u54A9\",\n \"\u5462\",\n \"\u54C8\",\n \"\u563F\",\n \"\u54D2\",\n \"\u5BB3\",\n \"\u554A\"\n ],\n \"dividers\": [\n \" \",\n \"\uFF0C\"\n ],\n \"beginning\": [\n \"\u4ECA\u65E5\u4EFDwho\u8425\u4E1A\u5566\",\n \"who\u4E0B\u73ED\u5566\",\n \"\u6295\u9012\u65E5\u5E38\",\n \"\u4ECA\u5929\u7684who\u4E5F\u8425\u4E1A\u5566\",\n \"\u4ECA\u65E5\u4EFD\u751C\u751C\u788E\u7247\u5DF2\u52A0\u8F7D\u5B8C\u6BD5\",\n \"\u5FD9\u91CC\u5077\u95F2\u7684\u751F\u6D3B\u788E\u7247\",\n \"\u548Csomeone\u901B\u5403\u7684\u4E00\u5929\",\n \"\u5206\u4EAB\u958B\u5FC3\",\n \"\u5206\u4EAB\u4ECA\u65E5\u4EFD\u958B\u5FC3\",\n \"\u8425\u4E1A\u4E00\u4E0B\"\n ],\n \"who\": [\n \"\u6253\u5DE5\u4EBA\",\n \"\u4ED9\u5973\",\n \"\u666E\u4FE1\u7537\",\n \"Java\u7537\",\n \"\u666E\u4FE1\u5973\",\n \"\u5C0F\u53EF\u7231\",\n \"\u672C\u516C\u4E3B\"\n ],\n \"someone\": [\n \"\u5C0F\u72D7\u52FE\",\n \"\u5C0F\u59D0\u59D0\",\n \"\u96C6\u7F8E\",\n \"\u96C6\u7F8E\u4EEC\",\n \"\u95FA\u871C\",\n \"\u95FA\u871C\uD83D\uDC6D\",\n \"\u59D0\u59B9\",\n \"\u59D0\u59B9\u4EEC\",\n \"\u59D0\u59B9\uD83D\uDC6D\",\n \"\u597D\u59D0\u59B9\",\n \"\u597D\u59D0\u59B9\uD83D\uDC6D\",\n \"\u5C0F\u59D0\u59B9\",\n \"\u5C0F\u59D0\u59B9\uD83D\uDC6D\"\n ],\n \"todosth\": [\n \"\u4ECA\u5929\u53BBdosth\",\n \"\u4ECA\u5929\u53BBdosth\u4E86\",\n \"\u4ECA\u5929\u53BBdosth\u5566\",\n \"\u4ECA\u5929\u53BBdosth\u9E2D\",\n \"\u4ECA\u5929\u53BBdosth\u565C\",\n \"\u4ECA\u5929\u53C8\u53C8\u53C8dosth\u5566\",\n \"\u4ECA\u5929\u53C8\u53C8\u53C8dosth\u9E2D\",\n \"\u53C8\u53BBdosth\u5566\",\n \"\u53C8\u662Fdosth\u7684\u4E00\u5929\u5566\",\n \"\u4ECA\u5929\u53C8\u662Fdosth\u7684\u4E00\u5929\u5566\",\n \"\u5B9D\uFF5E\u6211\u4ECA\u5929dosth\u4E86\",\n \"\u5B9D\uFF01\u6211\u4ECA\u5929dosth\u4E86\",\n \"\u8FD8\u662F\u53BBdosth\u4E86\",\n \"\u65E0\u804A\u53BBdosth\",\n \"\u4ECA\u5929\u53BB\u4F53\u9A8C\u4E86dosth\"\n ],\n \"another\": [\n \"\u4E70 \u5C0F\u86CB\u7CD5\",\n \"\u4E70 \u5C0F\u5E03\u4E01\",\n \"\u559D \u5976\u8336\",\n \"\u7A7F JK\",\n \"\u5403 \u8FF7hotel\",\n \"\u559D \u5496\u5561\",\n \"\u4E70 \u871C\u96EA\u51B0\u57CE\",\n \"\u4E70 \u559C\u8336\",\n \"\u559D \u8C2C\u53EF\"\n ],\n \"ending\": [\n \"\u4E5F\u662F\u5728\u9003\u516C\u4E3B\u7684\u4E00\u5929\",\n \"\u597D\u60F3\u8C08\u4E00\u573A\u53CC\u5411\u5954\u8D74\u7684\u604B\u7231\",\n \"\u661F\u661F\u6708\u4EAE\u548C\u6211\u90FD\u8981\u7761\u5566\",\n \"\u6563\u4F1A\",\n \"\u6211\u662F\u4E00\u9762\u955C\u5B50 \u6240\u4EE5 \u665A\u5B89 \u6211\u788E\u5566\",\n \"\u5C81\u6708\u6F2B\u957F \u90A3\u5C31\u4E00\u8D77\u62EF\u6551\u5730\u7403\u4E0E\u4E50\u8DA3\u5427\"\n ],\n \"collections\": [\n \"\u8DEF\u4E0A\u8FD8\u770B\u89C1\u4E00\u4E2A\u666E\u4FE1\u7537\",\n \"\u8DEF\u8FB9\u6361\u5230\u4E86\u4E00\u5206\u94B1\",\n \"\u4E0D\u5C0F\u5FC3\u8E29\u4E86\u72D7\u5C4E\",\n \"\u8DEF\u4E0A\u8FD8\u770B\u89C1\u4E00\u4E2AJava\u7537\"\n ],\n \"attribute\": [\n \"\u7EDD\u7EDD\u5B50\",\n \"\u65E0\u8BED\u5B50\",\n \"\u771F\u4E0B\u5934\",\n \"yyds\",\n \"\u5948\u65AF\",\n \"\u6709\u88AB\u60CA\u8273\u5230\",\n \"\uD83C\uDE51\uFE0F\",\n \"\u592A\u53EF\u4E86\",\n \"\u592A\uD83C\uDE51\uFE0F\u4E86\",\n \"\u771F\u7684\u7EDD\",\n \"\u592A\u725B\u4E86\",\n \"\u592A\uD83D\uDC2E\u4E86\",\n \"\u597Ddosth\u5230\u8DFA\u811A\",\n \"\u597Ddosth\u5230\u7206\",\n \"\u597Ddosth\u5230\u8DFAjiojio\",\n \"\u592A\u7231\u4E86\"\n ],\n \"fashion\": [\n \"\u6551\u547D\uD83C\uDD98\",\n \"\u564E\u6B7B\u83AB\u62C9\",\n \"\u4E0D\u7BA1\u5566\",\n \"\u5C31\u662F\u73A9\u513F\",\n \"\u65E0\u8BED\u5B50\",\n \"\u6211\u771F\u7684\u54ED\u6B7B\",\n \"\u51B2\u9E2D\",\n \"\u7B11\u6B7B\",\n \"\u90A3\u6211\u8D70\",\n \"\u6211\u90FD\u60CA\u4E86\",\n \"\u5927\u65E0\u8BED\u4E8B\u4EF6\",\n \"\u5C31\u5F88\u70E6\",\n \"\u5FC3\u6001\u70B8\u88C2\",\n \"\u641E\u5FEB\u70B9\",\n \"\u4E0D\u662F\u5427\",\n \"\u4E0D\u662F8\u20E3\uFE0F\",\n \"\u5168\u90FD\u7ED9\u6211\u51B2\",\n \"\u5565\u4E5F\u4E0D\u662F\"\n ],\n \"default\": [\n \"\u8C41 \u5976\u8336\",\n \"\u64B8 \u4EE3\u7801\",\n \"\u5237 \u5FAE\u535A\",\n \"\u4E70 \u57FA\u91D1\",\n \"\u6478 \u9C7C\",\n \"\u73A9 \u7EDD\u7EDD\u5B50\u751F\u6210\u5668\"\n ]\n}\n";
var ContentLengthConstraint = 300; // 内容长度约束
// --- UTILITIES ---
function parseMatieraials(matierailsJSON) {
return JSON.parse(matierailsJSON);
}
function randomWord(words, nullable, divider) {
if (nullable === void 0) { nullable = false; }
if (divider === void 0) { divider = ''; }
var maxRange = words.length;
if (nullable) {
// 增加 1/3 概率
maxRange += maxRange / 3;
}
var index = Math.floor(Math.random() * maxRange);
if (index >= words.length) {
return '';
}
else {
return words[index] + divider;
}
}
function randomWords(words, count) {
if (words.length < count) {
return words;
}
// Inspired by: https://www.imooc.com/wenda/detail/440036
return words.sort(function () { return Math.random() - 0.5; }).slice(0, count);
}
function randomRepeat(word, times) {
if (times === void 0) { times = -1; }
if (times > 0) {
var result = "";
for (var index_1 = 0; index_1 < times; index_1++) {
result += word;
}
return result;
}
var index = Math.floor(Math.random() * 3);
if (index == 2) {
return randomRepeat(word, 3);
}
if (index == 0) {
return randomRepeat(word, 1);
}
return '';
}
// --- CORE ---
function generateBeginning(matierail, divider) {
var beginning = randomWord(matierail.beginning);
if (beginning.indexOf('who') != -1) {
// 拼 who
beginning = beginning.replace('who', randomWord(matierail.who));
}
if (beginning.indexOf('someone') != -1) {
// 拼 someone
beginning = beginning.replace('someone', randomWord(matierail.someone));
}
var emotion = randomWord(matierail.emotions.emoji, true);
// if (emotion == '') {
// emotion = divider
// }
return beginning + emotion + divider;
}
function generateDoSth(matierail, something, divider) {
var todosth = randomWord(matierail.todosth);
if (todosth.indexOf('dosth') != -1) {
// 拼 something
if (something.indexOf(' ') != -1) {
something = something.replace(' ', ''); // 去间隔
}
todosth = todosth.replace('dosth', something);
}
// 拼 emotions
var emotions = randomRepeat(randomWord(matierail.emotions.emoji));
// if (emotions.length == 0) {
// emotions = divider
// }
return todosth + emotions + divider;
}
function praiseSth(something, praisedWords, hasAlso) {
if (hasAlso === void 0) { hasAlso = false; }
var praiseWord = randomWord(praisedWords);
var verb = something.split(' ')[0];
var noun = something.split(' ')[1];
var result = '';
var intro = randomWord(['这家的', '这家店的', '这个', '这件', '这杯']);
var also = hasAlso ? '也' : '';
if (praiseWord.indexOf('dosth') != -1) {
// eg. 好dosth到爆
praiseWord = praiseWord.replace('dosth', verb);
result = intro + noun + also + praiseWord;
}
else {
// eg. 绝绝子
result = intro + noun + also + praiseWord;
}
return result;
}
function randomButNotContain(words, already) {
var random = randomWord(words);
// Inspired by: https://www.cnblogs.com/mengff/p/7350005.html
var set = new Set(already.replace(' ', '').split(''));
var intersect = new Set(random.replace(' ', '').split('').filter(function (x) { return set.has(x); }));
if (Array.from(intersect).length == 0) {
return random;
}
else {
return randomButNotContain(words, already);
}
}
function generate(matierail, something) {
// 开场白
var divider = randomWord(matierail.dividers); // 分隔符
var fashionWords = randomWords(matierail.fashion, matierail.fashion.length); // 不重复的词组
var first = generateBeginning(matierail, divider);
var second = fashionWords[0] + divider;
var third = generateDoSth(matierail, something, divider);
var forth = fashionWords[1] + divider;
var fifth = randomRepeat(randomWord(matierail.auxiliaryWords), 3) + divider;
var sixth = praiseSth(something, matierail.attribute) + randomRepeat(randomWord(matierail.symbols), 3);
var seventh = praiseSth(randomButNotContain(matierail.another, something), matierail.attribute, true) + randomRepeat(randomWord(matierail.symbols), 3);
var eighth = fashionWords[2] + divider;
var ninth = randomWord(matierail.collections, true, divider) + fashionWords[3] + divider;
var tenth = randomRepeat(randomWord(matierail.auxiliaryWords), 3) + divider;
var last = randomWord(matierail.ending) + randomWord(matierail.emotions.emoji);
return first + second + third + forth + fifth + sixth + seventh + eighth + ninth + tenth + last;
}
var matierail = parseMatieraials(matierailsJSON);
function randomSetDefaultWord() {
var input = document.getElementById('keyword_input');
input.value = randomWord(matierail.default);
}
function chongYa() {
var input = document.getElementById('keyword_input');
var content = generate(matierail, input.value);
var container = document.getElementById('content_container');
container.style.display = 'flex';
if (container.firstElementChild != null) {
container.firstElementChild.innerHTML = content;
}
}
// console.log(generate(matierail, randomWord(matierail.default)))
randomSetDefaultWord();
</script>