Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

防止段落最后套话没有名言做铺垫,增加结尾部分 #201

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,13 @@
}

function 生成文章(){
主题 = $('input').value
主题 = $('#主题').value
段数 = parseInt($('#段数').value)
if (段数 === -1){
段数 = 主题.length
}
let 文章 = []
for(letin 主题){
for(var= 0; 空 < 段数; 空++){
let 章节 = "";
let 章节长度 = 0;
while( 章节长度 < 6000 ){
Expand All @@ -203,17 +207,27 @@
let 句子 = 来点论述();
章节长度 = 章节长度 + 句子.length;
章节 = 章节 + 句子;
// 防止章节最后套话没有名言做铺垫
if ((300 - 章节.length) < 50){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为何不用 章节.length > 250

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

作者天命,难以违抗

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为何不用 章节.length > 250

鬼知道...

let 句子 = 来点名人名言();
章节长度 = 章节长度 + 句子.length;
章节 = 章节 + 句子;
}
}
}
章节 = 增加段落(章节);
文章.push(章节);
}
let 排版 = "<div>" + 文章.join("</div><div>") + "</div>";
let 结论 = "  " + "综上所述, x的重要性真是无与伦比, 正如成语说的:缺一不可。有x, 就如".replace('x', 主题).replace('x', 主题) + 随便取一句(名人名言) + "。 "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中文符号后有多余空格

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

恕我眼力不好,也不擅长JavaScript,请告诉我在哪里?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"综上所述, x的重要性真是无与伦比, 正如成语说的:缺一不可。有x, 就如" ——所有中文逗号后面都有个额外空格

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可替换为:

let 结论 = `综上所述, ${主题}的重要性真是无与伦比, 正如成语说的:缺一不可。有${主题}, 就如${随便取一句(名人名言)}`

$("#论文").innerHTML = 排版;
$('#结论').innerHTML = "<div>" + 结论 + "</div>"
}

</script>
<div>bullshit generator</div>
<div>主题<input value="一天掉多少根头发"></input></div>
<div>主题<input value="一天掉多少根头发" id="主题"></input></div>
<div>输入段数(可选)<input value="-1" id="段数"></input></div>
<div></div><button onclick="生成文章()">生成</button></div>
<div id="论文"></div>
<div id="结论"></div>