-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
happypycode
wants to merge
2
commits into
menzi11:master
Choose a base branch
from
happypycode:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,14 +184,39 @@ | |
} | ||
|
||
function 生成文章(){ | ||
主题 = $('input').value | ||
let 文章 = [] | ||
for(let 空 in 主题){ | ||
主题 = $('#主题').value | ||
段数 = parseInt($('#段数').value) | ||
if (段数 === -1){ | ||
段数 = 主题.length | ||
} | ||
字数 = parseInt($('#字数').value) | ||
// 字数的数值并不代表总字数,只是评估标准 | ||
if (段数 === -1){ | ||
段数 = 主题.length; | ||
} | ||
if (字数 === 1){ | ||
字数 = 8000; | ||
} | ||
else if (字数 === 2){ | ||
字数 = 700; | ||
} | ||
else if (字数 === 3){ | ||
字数 = 3000; | ||
} | ||
else if (字数 === 4){ | ||
字数 = 30000; | ||
} | ||
else if (字数 === 5){ | ||
字数 = 300; | ||
} | ||
let 文章 = []; | ||
每段字数 = 字数 / 段数; | ||
for(var 空 = 0; 空 < 段数; 空++){ | ||
let 章节 = ""; | ||
let 章节长度 = 0; | ||
while( 章节长度 < 6000 ){ | ||
while( 章节长度 < 字数 ){ | ||
let 随机数 = 随便取一个数(); | ||
if(随机数 < 5 && 章节.length > 200){ | ||
if(章节.length > 每段字数){ | ||
章节 = 增加段落(章节); | ||
文章.push(章节); | ||
章节 = ""; | ||
|
@@ -203,17 +228,28 @@ | |
let 句子 = 来点论述(); | ||
章节长度 = 章节长度 + 句子.length; | ||
章节 = 章节 + 句子; | ||
// 防止章节最后套话没有名言做铺垫 | ||
if ((每段字数 - 章节.length) < 50){ | ||
let 句子 = 来点名人名言(); | ||
章节长度 = 章节长度 + 句子.length; | ||
章节 = 章节 + 句子; | ||
} | ||
} | ||
} | ||
章节 = 增加段落(章节); | ||
文章.push(章节); | ||
} | ||
let 排版 = "<div>" + 文章.join("</div><div>") + "</div>"; | ||
let 结论 = " " + "综上所述, x的重要性真是无与伦比, 正如成语说的:缺一不可。有x, 就如".replace('x', 主题).replace('x', 主题) + 随便取一句(名人名言) + "。 " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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>输入字数(1多,2少,3中,4特多,5特少)<input value="3" id="字数"></input></div> | ||
<div>输入段数(可选)<input value="-1" id="段数"></input></div> | ||
<div></div><button onclick="生成文章()">生成</button></div> | ||
<div id="论文"></div> | ||
<div id="结论"></div> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
中文符号后有多余空格
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
恕我眼力不好,也不擅长JavaScript,请告诉我在哪里?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"综上所述, x的重要性真是无与伦比, 正如成语说的:缺一不可。有x, 就如" ——所有中文逗号后面都有个额外空格