|
|
@ -76,7 +76,41 @@ function init() {
|
|
|
|
hideIdfEditor()
|
|
|
|
hideIdfEditor()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
$('#pttPageWindow').click(function(e) {
|
|
|
|
|
|
|
|
if ($('#pttPageWindow').is(e.target)) {
|
|
|
|
|
|
|
|
hidePTTPage()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
changeMode(0)
|
|
|
|
changeMode(0)
|
|
|
|
|
|
|
|
destroyCurrentGraph()
|
|
|
|
|
|
|
|
buildSentetree()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadTemplate(num) {
|
|
|
|
|
|
|
|
templates = [{
|
|
|
|
|
|
|
|
startDate: '2020-12-01',
|
|
|
|
|
|
|
|
endDate: '2020-12-31',
|
|
|
|
|
|
|
|
keyword: '',
|
|
|
|
|
|
|
|
mode: 1
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
startDate: '2020-01-01',
|
|
|
|
|
|
|
|
endDate: '2020-03-01',
|
|
|
|
|
|
|
|
keyword: '衛生紙',
|
|
|
|
|
|
|
|
mode: 2
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
startDate: '2020-01-11',
|
|
|
|
|
|
|
|
endDate: '2020-01-12',
|
|
|
|
|
|
|
|
keyword: '',
|
|
|
|
|
|
|
|
mode: 2
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
chosenTemp = templates[num]
|
|
|
|
|
|
|
|
setDate(chosenTemp.startDate, chosenTemp.endDate)
|
|
|
|
|
|
|
|
$('#keywordBox').val(chosenTemp.keyword)
|
|
|
|
|
|
|
|
changeMode(chosenTemp.mode)
|
|
|
|
|
|
|
|
sendRequest()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function clearStopWord() {
|
|
|
|
function clearStopWord() {
|
|
|
@ -117,8 +151,6 @@ function changeMode(_mode) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mode = _mode
|
|
|
|
mode = _mode
|
|
|
|
destroyCurrentGraph()
|
|
|
|
|
|
|
|
buildSentetree()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function scrollIdfList() {
|
|
|
|
function scrollIdfList() {
|
|
|
@ -170,8 +202,12 @@ function showIdfEditor() {
|
|
|
|
.append($('<th>')
|
|
|
|
.append($('<th>')
|
|
|
|
.attr('style', 'position: sticky; top: 0; background: white;')
|
|
|
|
.attr('style', 'position: sticky; top: 0; background: white;')
|
|
|
|
.append('單詞'))
|
|
|
|
.append('單詞'))
|
|
|
|
.append($('<th>'))
|
|
|
|
.append($('<th>')
|
|
|
|
.append($('<th>').attr('class', 'w3-right-align')
|
|
|
|
.attr('class', 'w3-center-align')
|
|
|
|
|
|
|
|
.attr('style', 'position: sticky; top: 0; background: white;')
|
|
|
|
|
|
|
|
.append('操作'))
|
|
|
|
|
|
|
|
.append($('<th>')
|
|
|
|
|
|
|
|
.attr('class', 'w3-right-align')
|
|
|
|
.attr('style', 'position: sticky; top: 0; background: white;')
|
|
|
|
.attr('style', 'position: sticky; top: 0; background: white;')
|
|
|
|
.append('單詞頻率')
|
|
|
|
.append('單詞頻率')
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -259,6 +295,15 @@ function hideIdfEditor() {
|
|
|
|
$('#idfEditorLayer').addClass('hidden')
|
|
|
|
$('#idfEditorLayer').addClass('hidden')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function showPTTPage(url) {
|
|
|
|
|
|
|
|
$('#pttPageWindowContent iframe').attr('src', url)
|
|
|
|
|
|
|
|
$('#pttPageWindow').removeClass('hidden')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function hidePTTPage() {
|
|
|
|
|
|
|
|
$('#pttPageWindow').addClass('hidden')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function updateIdfTable() {
|
|
|
|
function updateIdfTable() {
|
|
|
|
let wordList = $("#ieContainer").find("tr").slice(1).map((_, a) => {
|
|
|
|
let wordList = $("#ieContainer").find("tr").slice(1).map((_, a) => {
|
|
|
|
return [
|
|
|
|
return [
|
|
|
@ -315,6 +360,23 @@ function closeEventListner() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function sendRequest() {
|
|
|
|
function sendRequest() {
|
|
|
|
|
|
|
|
content = getContent()
|
|
|
|
|
|
|
|
startDate = $('#startDate').val()
|
|
|
|
|
|
|
|
endDate = $('#endDate').val()
|
|
|
|
|
|
|
|
console.log(content)
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
|
|
url: '/addRequest',
|
|
|
|
|
|
|
|
data: content,
|
|
|
|
|
|
|
|
contentType: 'application/json',
|
|
|
|
|
|
|
|
success: function(data) {
|
|
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
|
|
changeGraph(data.Result)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getContent() {
|
|
|
|
content = JSON.stringify({
|
|
|
|
content = JSON.stringify({
|
|
|
|
startDate: $('#startDate').val(),
|
|
|
|
startDate: $('#startDate').val(),
|
|
|
|
endDate: $('#endDate').val(),
|
|
|
|
endDate: $('#endDate').val(),
|
|
|
@ -330,19 +392,7 @@ function sendRequest() {
|
|
|
|
other: $('#other').is(':checked')
|
|
|
|
other: $('#other').is(':checked')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
startDate = $('#startDate').val()
|
|
|
|
return content
|
|
|
|
endDate = $('#endDate').val()
|
|
|
|
|
|
|
|
console.log(content)
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
|
|
|
type: 'POST',
|
|
|
|
|
|
|
|
url: '/addRequest',
|
|
|
|
|
|
|
|
data: content,
|
|
|
|
|
|
|
|
contentType: 'application/json',
|
|
|
|
|
|
|
|
success: function(data) {
|
|
|
|
|
|
|
|
console.log(data)
|
|
|
|
|
|
|
|
changeGraph(data.Result)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function changeGraph(data) {
|
|
|
|
function changeGraph(data) {
|
|
|
@ -466,8 +516,9 @@ function buildSentetree() {
|
|
|
|
$('#titleListContainer').empty()
|
|
|
|
$('#titleListContainer').empty()
|
|
|
|
for (i of titleList) {
|
|
|
|
for (i of titleList) {
|
|
|
|
$('#titleListContainer').append(
|
|
|
|
$('#titleListContainer').append(
|
|
|
|
$('<li>').attr('class', 'w3-panel').append(
|
|
|
|
$('<li>').attr('class', 'w3-panel')
|
|
|
|
$('<a>').attr('href', i.url).attr('target', '_blank').append(
|
|
|
|
.css('cursor', 'pointer').append(
|
|
|
|
|
|
|
|
$('<p>').attr('target', '_blank').append(
|
|
|
|
$('<h4>').html(i.title)
|
|
|
|
$('<h4>').html(i.title)
|
|
|
|
).append(
|
|
|
|
).append(
|
|
|
|
$('<span>').attr('style', 'margin: 0px 10px').html(i.author)
|
|
|
|
$('<span>').attr('style', 'margin: 0px 10px').html(i.author)
|
|
|
@ -476,7 +527,10 @@ function buildSentetree() {
|
|
|
|
).append(
|
|
|
|
).append(
|
|
|
|
$('<span>').attr('style', 'margin: 0px 10px').html('推文數:' + i.pushes)
|
|
|
|
$('<span>').attr('style', 'margin: 0px 10px').html('推文數:' + i.pushes)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
).click(function() {
|
|
|
|
|
|
|
|
let indx = $(this).index()
|
|
|
|
|
|
|
|
showPTTPage((titleList[indx].url).replace('www.ptt.cc', 'www.pttweb.cc'))
|
|
|
|
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|