From 8237ed570a2f829f81c186e89c0df4a36b0cea6c Mon Sep 17 00:00:00 2001 From: Zovjsra <4703michael@gmail.com> Date: Sun, 25 Oct 2020 21:32:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E9=9D=A2=E6=94=B9=E7=94=A8tfidf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 2 +- static/css/main.css | 26 ++++ static/js/dcard.js | 102 +++++++++++++- static/js/loadIdfTable.js | 3 + static/js/ptt.js | 132 +++++++++++++++++- static/js/pttPush.js | 101 ++++++++++++++ .../sententree/dist/sententree-standalone.js | 7 +- templates/dcard.html | 17 +++ templates/ptt.html | 19 ++- templates/ptt_push.html | 17 +++ 10 files changed, 420 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index b55ca18..3ade04a 100755 --- a/app.py +++ b/app.py @@ -157,4 +157,4 @@ def dcard_dev(): if __name__ == "__main__": - app.run(debug=False, port=4998, host='0.0.0.0', threaded=True) + app.run(debug=True, port=4998, host='0.0.0.0', threaded=True) diff --git a/static/css/main.css b/static/css/main.css index ebde5f4..3480344 100755 --- a/static/css/main.css +++ b/static/css/main.css @@ -70,6 +70,32 @@ html { box-shadow: 0px 5px 20px rgba(0, 0, 0, .3); } +#idfEditor { + display: block; + position: fixed; + background-color: #FFF; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + width: 653px; + height: 600px; + border: lightgray; + border-width: 1px; + border-style: solid; + border-radius: 20px; + padding: 26px; + z-index: 99; + box-shadow: 0px 5px 20px rgba(0, 0, 0, .3); +} + +#ieTableContainer { + position: relative; + height: 77%; + overflow: auto; + overflow-y: auto; + transition-duration: 0.5s; +} + #sweContainer { position: relative; height: 77%; diff --git a/static/js/dcard.js b/static/js/dcard.js index 9be574c..836ebab 100644 --- a/static/js/dcard.js +++ b/static/js/dcard.js @@ -16,7 +16,28 @@ function init() { }) }) changeData(1) - return + $('#idfEditorLayer').click(function(e) { + if ($('#idfEditorLayer').is(e.target)) { + hideIdfEditor() + } + }) +} + +function scrollIdfList() { + let targetWord = $('#idfTarget').val() + let wordList = $("#ieContainer").find("tr").slice(1).map((_, a) => { return $($(a).find("td")[0]).html() }).get() + console.log({ "targetWord": targetWord, 'list': wordList }) + if (targetWord != '') { + if (wordList.indexOf(targetWord) >= 0) { + + } else { + wordList.push(targetWord) + $('#ieContainer').find('tbody').append($('