SOURCE

console 命令行工具 X clear

                    
>
console
function Add(num) {
    var input = document.getElementById("inputer");
    switch (num) {
        case 0:
            input.innerText += "<br/>";
            break;
        case 1:
            var href = prompt("请输入链接地址:");
            var text = prompt("请输入链接显示的文字");
            input.innerText += "<a href='" + href + "'>" + text + "</a>";
            break;
        case 2:
            var text = prompt("请输入粗体内容");
            input.innerText += "<strong>" + text + "</strong>";
            break;
        case 3:
            var text = prompt("请输入大字内容");
            input.innerText += "<largr>" + text + "</large>";
            break;
        default:
            break;
    }
}


function output() {
    var choice = document.getElementsByClassName("choice");
    var tp = document.getElementsByClassName("tp");
    var ans = [];

    // ans[0] = '{\n';
    ans[1] = document.getElementById("page").value;
    ans[2] = ': {\n         "text":"';
    ans[3] = document.getElementById("inputer").innerText;
    ans[4] = '",\n         "choice":[{';
    var temp=0;
    for (i = 0; i <= 3; i++) {
        if (choice[i].value != "" && tp[i].value != "") {
            ans[i+5]='\n            "text": "'+choice[i].value+'",\n             "tp": '+tp[i].value+'\n         },';
            temp++;
        }
    }
    if(temp==0){
        ans[9]='         }]\n   }';
    }
    else{
        ans[9]='\n         ]}';
    }
    ans[10]=",\n"
    // ans[10]='\n}'


    document.getElementById("outputer").innerText += ans.join("");
}


// var Story = {
//     0: {
//         text: "模板",
//         choice: [{
//             text: "选项0",
//             tp: 1
//         }, {
//             text: "选项1",
//             tp: 1
//         }, {
//             text: "选项2",
//             tp: 1
//         }, {
//             text: "选项3",
//             tp: 1
//         }]
//     },

//     1: {
//         text: "警告!<br/>本游戏内如<br/>“李子阳”<br/>“渣渣珲”<br/>“曹静”<br/>“襄阳四中”<br/>等名词皆为虚构和随机组合!<br/>如有雷同,纯属巧合!",
//         choice: [{
//             text: "开始即表示同意此契约",
//             tp: 2
//         }]
//     },

//     2: {
//         text: "你是<strong>李子阳</strong>,你在襄阳四中上学。<br/>有一天,你看到了<strong>渣渣珲</strong>向你说:<br/>“我家有PS4,快来我家Van♂”<br/>你:...",
//         choice: [{
//             text: "何乐而不为之!",
//             tp: 5
//         }, {
//             text: "不,我再想想...",
//             tp: 3
//         }, {
//             text: "走开啦!",
//             tp: 4
//         }]
//     },

//     3: {
//         text: "你:“我再考虑一下吧...”<br/>渣渣珲:“考虑什么啊,要不我请你喝杯<a href=\"http://www.nongfuspring.com/upload/201406/2014062416093435365.png\">茶</a>吧。”<br/>你:“你可真是直率呢...”",
//         choice: [{
//             text: "那好吧",
//             tp: 6
//         }]
//     },

//     4: {
//         text: "你:“走开啦,泥奏凯!”<br/>渣渣珲:“㤙㤙㤙,嘿嘿嘿,那我请你喝杯<a href=\"http://www.nongfuspring.com/upload/201406/2014062416093435365.png\">茶</a>吧。”",
//         choice: [{
//             text: "那好吧",
//             tp:6
//         }]
//     },

// 5: {
//         text: "你:“好呀好呀!”<br/>渣渣珲:“太好了(抑制自己的喜悦),那我请你喝杯<a href=\"http://www.nongfuspring.com/upload/201406/2014062416093435365.png\">茶</a>好了!”",
//         choice: [{
//             text: "那好吧",
//             tp:6
//         }]
//     },

//     6: {
//         text: "渣渣珲给你买了一杯<large>特殊的</large>茶<br/>你喝了,然后就...癫痫了?<br/>失明I **:**<br/>夜视I **:**",
//         choice: [{
//             text: "那好吧(好个屁)",
//             tp: 7
//         }]
//     },


// }
<!DOCTYPE html>
<html lang="zh">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>甲醛报警器</title>
</head>

<body>
	<h1>剧情编辑器v1.0</h1>
	<div>
		<h3>内容(第一行为页码,第二行为内容)</h3>
        <input id="page" type="number" value="0">
		<div id="inputer" contenteditable="plaintext-only"></div>
		<div class="btnC">
		<button class="btn" onclick="Add(0)">插入换行符</button>
        <button class="btn" onclick="Add(1)">插入链接</button>
        <button class="btn" onclick="Add(2)">插入粗体字</button>
        <button class="btn" onclick="Add(3)">插入大字</button>
    </div>

    <div>
        <h3>选项(左边为选项内容,右边为跳转页码,留白不显示此选项)</h3>
        <div>选项0<input class="choice"><input class="tp"></div>
        <div>选项1<input class="choice"><input class="tp"></div>
        <div>选项2<input class="choice"><input class="tp"></div>
        <div>选项3<input class="choice"><input class="tp"></div>
    </div> 

    <button class="btn" id="ok" onclick="output()">确定并导出页码内容到下面</button>
	<div id="outputer" contenteditable="plaintext-only"></div>
    <p>我从来都是手写剧情的,不用这些工具</p>
</body>

</html>
/* ------------------button-------------------- */
.btn {
  background-color: white;
  color: black;
  width: auto;
  height: auto;
  font-size: 1.1em;
  padding: 5px 5px;
  margin: 4px 2px;
  -webkit-transition-duration: 0.4s;
  /* Safari */
  transition-duration: 0.4s;
  cursor: pointer;
  border: 2px solid #4CAF50;
  border-radius: 5px;
}

.btn:hover {
  background-color: #4CAF50;
  color: white;
}

.btn:active {
  background-color: rgb(13, 107, 19);
}

#ok{
    margin-left: 25%;
    width: 40%;
    border: 2px solid dodgerblue;
}

#ok:hover {
  background-color:  dodgerblue;
  color: white;
}

#ok:active {
  background-color:  rgb(20, 87, 155);
}

/* ------------------/button------------------- */

input{
    padding: 2px;
    margin: 5px;
    background-color: rgba(10, 10, 10, 0.1);
    border-style: none;
    font-size: 1em;
    width: 40%;
}

#page{
    width: auto;
}

#outputer{
    background-color: rgba(10, 10, 10, 0.1);
    font-size: 1em;
    padding: 2px;
    min-height:100px;

    margin-top: 20px;
    border-radius: 5px;
}


#inputer{
    background-color: rgba(10, 10, 10, 0.1);
    padding: 5px;
    min-height:100px;

}

#chooser{
    background-color: rgba(10, 10, 10, 0.1);
    padding: 5px;
    margin: 5px;
    min-height:10px;
}

#btnC{
    vertical-align: center;
}