<!doctype html>
<html>

<head>
    <title>{{ title }}</title>
    <link href="/static/css/w3.css" type="text/css" rel="stylesheet">
    <link href="/static/css/main.css" type="text/css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@100;300;400;500;700;900&display=swap" rel="stylesheet">
</head>

<body>
    <div class="w3-bar w3-teal">
        <button class="w3-button" type="button" onclick="location.href='/ptt'">PTT
            Sententree</button>
        <button class="w3-button" type="button" onclick="location.href='/ptt_push'" style="color: darkseagreen;">推文Sententree</button>
        <button class="w3-button w3-teal" type="button" onclick="location.href='/generalTxt'">泛用文字視覺化工具</button>
    </div>

    <div id="nodeTitle" class="nodeTitle hidden">
        <div id="nodeTitleContent"></div>
    </div>
    <div id="stopWordEditorLayer" class="info hidden">
        <div id="stopWordEditor">
            <h4 id="sweTitle" style="margin:10px; display: inline;">編輯停用詞</h4>
            <ul id="sweContainer" class="w3-ul w3-hoverable" style="margin-bottom: 10px;"></ul>
            <div>
                <input class="w3-input w3-border" style="width: 85%; display: inline;" type="text" id="newStopWord" placeholder="新增停用詞（以空白隔開）">
                <button class="general-button w3-right" type="button" id="confirm" style="background-color: #379; margin-left: 8px;" onclick="addStopWord()">新增</button>
            </div>
            <div id="sweButtons" style="margin: 20px 0px;">
                <button class="general-button" type="button" id="confirm" style="background-color: #379; margin: 0px 10px" onclick="hideStopWordEditor(); sendRequest()">確認</button>
                <button class="general-button" type="button" id="confirm" style="background-color: #379; margin: 0px 10px" onclick="downloadStopWord()">匯出停用詞</button>
                <button class="general-button" type="button" id="confirm" style="background-color: #379; margin: 0px 10px" onclick="clearStopWord()">全部清除</button>
                <button class="general-button w3-right" type="button" id="confirm" style="background-color: #379; margin: 0px 20px" onclick="hideStopWordEditor()">返回</button>
            </div>
        </div>
    </div>
    <div id="idfEditorLayer" class="info hidden">
        <div id="idfEditor">
            <h4 id="ieTitle" style="margin:10px; display: inline;">編輯停用詞</h4>
            <div id='ieTableContainer'>
                <table id="ieContainer" class="w3-table w3-bordered w3-hoverable" style="margin-bottom: 10px;"></table>
            </div>
            <div>
                <input class="w3-input w3-border" style="width: 85%; display: inline;" type="text" id="idfTarget" placeholder="輸入單詞">
                <button class="general-button w3-right" type="button" id="confirm" style="background-color: #379; margin-left: 8px;" onclick="scrollIdfList()">移動</button>
            </div>
            <div id="ieButtons" style="margin: 20px 0px;">
                <button class="general-button" type="button" id="confirm" style="background-color: #379; margin: 0px 10px" onclick="updateIdfTable(); hideIdfEditor(); destroyCurrentGraph(); buildSentetree()">確認</button>
                <button class="general-button" type="button" id="confirm" style="background-color: #379; margin: 0px 10px" onclick="downloadIdfTable()">匯出頻率表</button>
                <button class="general-button w3-right" type="button" id="confirm" style="background-color: #379; margin: 0px 20px" onclick="hideIdfEditor()">返回</button>
            </div>
        </div>
    </div>
    <div id="titleListLayer" class="info hidden">
        <div id="titleList">
            <h2 id="titleListKeyword" style="margin:10px; display: inline;"></h2>
            <span id="titleListKeywordInfo"></span>
            <ul id="titleListContainer" class="w3-ul w3-hoverable"></ul>
            <div id="backButton" style="margin: 20px 0px;">
                <button class="general-button" type="button" id="confirm" style="background-color: #379; margin: 0px 20px" onclick="hideTitles()">返回</button>
            </div>
        </div>
    </div>
    <div id="heading">
        <h2>{{title}}</h2>
        <p>SentenTree <a href="https://github.com/twitter/SentenTree">https://github.com/twitter/SentenTree</a></p>
        <p id="comment">同時使用關鍵詞和詞性搜尋的時候，必須選擇所設關鍵詞本身的詞性，否則會搜尋不到結果。</p>
        <p id="comment">鄉民ID和文章aid之中必須至少設定一個搜尋條件。</p>
        <p>可直接從下方範例搜尋條件中選擇</p>
        <div>
            <button class='w3-button w3-green' onclick='loadTemplate(0)'>範例1</button>
            <button class='w3-button w3-green' onclick='loadTemplate(1)'>範例2</button>
            <button class='w3-button w3-green' onclick='loadTemplate(2)'>範例3</button>
        </div>
        <div id="searchingTarget">
            <form name="form" enctype="multipart/form-data">
                <input id="idBox" class='searchBox' type="text" name="message" placeholder="輸入鄉民ID">
                <input id="titleBox" class='searchBox' type="text" name="message" placeholder="輸入文章aid">
                <input id="keywordBox" class='searchBox' type="text" name="message" placeholder="輸入關鍵詞">
                <button class="general-button" type="button" id="sendButton" onclick="sendRequest()">搜尋關鍵字</button>
                <button class="general-button" type="button" id="resetButton" onclick="document.getElementById('keywordBox').value=''">清除關鍵字</button>
                <button class="general-button" type="button" id="editSWButton" onclick="showStopwordEditor()">編輯停用詞</button>
                <button class="general-button" type="button" id="editIdeButton" onclick="showIdfEditor()">編輯詞頻</button>
            </form>
        </div>
        <div id="advancedArea">
            <form name="advanced" enctype="multipart/form-data">
                <span>選擇詞性</span>
                <input type="checkbox" id="noun" checked="checked">名詞
                <input type="checkbox" id="verb" checked="checked">動詞
                <input type="checkbox" id="adj" checked="checked">形容詞
                <input type="checkbox" id="adv" checked="checked">副詞
                <input type="checkbox" id="pron" checked="checked">代詞
                <input type="checkbox" id="aux" checked="checked">助詞
                <input type="checkbox" id="other" checked="checked">其他詞性
            </form>
        </div>
        <div id='modeSelector'>
            <button type="button" id='mode0' class='w3-button' onclick="changeMode(0)">相鄰詞模式</button>
            <button type="button" id='mode1' class='w3-button ' onclick="changeMode(1)">Idf模式</button>
            <button type="button" id='mode2' class='w3-button ' onclick="changeMode(2)">停用詞模式</button>
            <button type="button" id='mode3' class='w3-button ' onclick="changeMode(3)">根單詞停用模式</button>
        </div>
    </div>
    <div id="graphInfo"></div>
    <div id="graph">
        <div id="vis"></div>
    </div>
</body>
<script src="/static/node_modules/jquery/dist/jquery.js"></script>
<script src="/static/node_modules/jquery-ui-dist/jquery-ui.js"></script>
<script src="/static/node_modules/css-element-queries/src/ResizeSensor.js"></script>
<script src="/static/node_modules/sententree/dist/sententree-standalone.js"></script>
<script src="/static/node_modules/d3/build/d3.js"></script>
<script src="/static/js/loadIdfTable.js"></script>
<script src="/static/js/download.js"></script>
<script src="/static/js/pttPush.js"></script>

</html>