<commit_before><%--
  ~ APDPlat - Application Product Development Platform
  ~ Copyright (c) 2013, 杨尚川, <EMAIL>
  ~
  ~  This program is free software: you can redistribute it and/or modify
  ~  it under the terms of the GNU General Public License as published by
  ~  the Free Software Foundation, either version 3 of the License, or
  ~  (at your option) any later version.
  ~
  ~  This program is distributed in the hope that it will be useful,
  ~  but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~  GNU General Public License for more details.
  ~
  ~  You should have received a copy of the GNU General Public License
  ~  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  --%>

<%@ page import="org.apdplat.superword.tools.WordLinker.Dictionary" %>
<%@ page import="org.apdplat.superword.tools.WordLinker" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    String word = request.getParameter("word");
    if(word == null){
        word = "fantastic";
    }
    StringBuilder definitionHtmls = new StringBuilder();
    definitionHtmls.append("<table>")
                   .append("<tr><td>序号</td><td>词典</td><td>单词</td></tr>");
    int i=1;
    for(Dictionary dictionary : Dictionary.values()){
        String definitionHtml = WordLinker.toLink(word, dictionary);
        definitionHtmls.append("<tr><td>").append(i++).append("</td><td>").append(dictionary.getDes()).append("</td><td>").append(definitionHtml).append("</td></tr>");
    }
    definitionHtmls.append("</table>");
%>

<html>
<head>
    <title>定义查询</title>
    <link href="<%=request.getContextPath()%>/css/superword.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/superword.js"></script>
    <script type="text/javascript">
        var lock = false;
        function query() {
            var word = document.getElementById("word").value;
            if (word == "") {
                document.getElementById("tip").innerText = "请输入查询定义的单词";
                return;
            }
            if (lock) {
                return;
            }
            lock = true;
            location.href = "definition.jsp?word="+word;
        }
        document.onkeypress=function(e){
            var e = window.event || e ;
            if(e.charCode == 13){
                query();
            }
        }
    </script>
</head>
<body id="top">
    <jsp:include page="common/head.jsp"/>
    <p>
        <font color="red"><span id="tip"></span></font><br/>
        <font color="red">输入单词：</font><input id="word" name="word" value="<%=word%>" size="50" maxlength="50"/><br/><br/>
        <button type="button" onclick="query();">查询定义</button><br/>
    </p>
    <script type="text/javascript">
        document.getElementById('word').select();
        document.getElementById('word').focus();
    </script>

    <%=definitionHtmls.toString()%>
    <jsp:include page="common/bottom.jsp"/>
</body>
</html>
<commit_msg>重构定义查看页面<commit_after><%--
  ~ APDPlat - Application Product Development Platform
  ~ Copyright (c) 2013, 杨尚川, <EMAIL>
  ~
  ~  This program is free software: you can redistribute it and/or modify
  ~  it under the terms of the GNU General Public License as published by
  ~  the Free Software Foundation, either version 3 of the License, or
  ~  (at your option) any later version.
  ~
  ~  This program is distributed in the hope that it will be useful,
  ~  but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~  GNU General Public License for more details.
  ~
  ~  You should have received a copy of the GNU General Public License
  ~  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  --%>

<%@ page import="org.apdplat.superword.tools.WordLinker.Dictionary" %>
<%@ page import="org.apdplat.superword.tools.WordLinker" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
    String word = request.getParameter("word");
    if(word == null){
        word = "fantastic";
    }
    StringBuilder definitionHtmls = new StringBuilder();
    definitionHtmls.append("<table>")
                   .append("<tr><td>序号</td><td>词典</td><td>单词</td></tr>");
    int i=1;
    for(Dictionary dictionary : Dictionary.values()){
        String definitionURL = WordLinker.serverRedirect+"?url="+WordLinker.getLinkPrefix(dictionary)+word+"&word="+word+"&dict="+dictionary.name();
        String definitionHtml = "<span style=\"cursor:pointer;color:red\" onclick=\"viewDefinition('"+definitionURL+"');\">"+word+"</span>";
        definitionHtmls.append("<tr><td>").append(i++).append("</td><td>").append(dictionary.getDes()).append("</td><td>").append(definitionHtml).append("</td></tr>");
    }
    definitionHtmls.append("</table>");
%>

<html>
<head>
    <title>定义查询</title>
    <link href="<%=request.getContextPath()%>/css/superword.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath()%>/js/superword.js"></script>
    <script type="text/javascript">
        function viewDefinition(url){
            window.open(url, word, 'width=1200,height=600');
        }
        var lock = false;
        function query() {
            var word = document.getElementById("word").value;
            if (word == "") {
                document.getElementById("tip").innerText = "请输入查询定义的单词";
                return;
            }
            if (lock) {
                return;
            }
            lock = true;
            location.href = "definition.jsp?word="+word;
        }
        document.onkeypress=function(e){
            var e = window.event || e ;
            if(e.charCode == 13){
                query();
            }
        }
    </script>
</head>
<body id="top">
    <jsp:include page="common/head.jsp"/>
    <p>
        <font color="red"><span id="tip"></span></font><br/>
        <font color="red">输入单词：</font><input id="word" name="word" value="<%=word%>" size="50" maxlength="50"/><br/><br/>
        <button type="button" onclick="query();">查询定义</button><br/>
    </p>
    <script type="text/javascript">
        document.getElementById('word').select();
        document.getElementById('word').focus();
    </script>

    <%=definitionHtmls.toString()%>
    <jsp:include page="common/bottom.jsp"/>
</body>
</html>

{'fraction_non_alphanumeric': 0.1731316459487794, 'fraction_numerical': 0.005840946532874045, 'mean_word_length': 2.928235294117647, 'pattern_counts': {'":': 0, '<': 133, '<?xml version=': 0, '>': 133, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '220662', 'n_tokens_mistral': 2081, 'n_tokens_neox': 2062, 'n_words': 439}