|
|
|
@ -76,7 +76,41 @@ function init() {
|
|
|
|
|
hideIdfEditor()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
$('#pttPageWindow').click(function(e) {
|
|
|
|
|
if ($('#pttPageWindow').is(e.target)) {
|
|
|
|
|
hidePTTPage()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
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() {
|
|
|
|
@ -117,8 +151,6 @@ function changeMode(_mode) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
mode = _mode
|
|
|
|
|
destroyCurrentGraph()
|
|
|
|
|
buildSentetree()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function scrollIdfList() {
|
|
|
|
@ -170,8 +202,12 @@ function showIdfEditor() {
|
|
|
|
|
.append($('<th>')
|
|
|
|
|
.attr('style', 'position: sticky; top: 0; background: white;')
|
|
|
|
|
.append('單詞'))
|
|
|
|
|
.append($('<th>'))
|
|
|
|
|
.append($('<th>').attr('class', 'w3-right-align')
|
|
|
|
|
.append($('<th>')
|
|
|
|
|
.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;')
|
|
|
|
|
.append('單詞頻率')
|
|
|
|
|
)
|
|
|
|
@ -259,6 +295,15 @@ function hideIdfEditor() {
|
|
|
|
|
$('#idfEditorLayer').addClass('hidden')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function showPTTPage(url) {
|
|
|
|
|
$('#pttPageWindowContent iframe').attr('src', url)
|
|
|
|
|
$('#pttPageWindow').removeClass('hidden')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function hidePTTPage() {
|
|
|
|
|
$('#pttPageWindow').addClass('hidden')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateIdfTable() {
|
|
|
|
|
let wordList = $("#ieContainer").find("tr").slice(1).map((_, a) => {
|
|
|
|
|
return [
|
|
|
|
@ -315,6 +360,23 @@ function closeEventListner() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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({
|
|
|
|
|
startDate: $('#startDate').val(),
|
|
|
|
|
endDate: $('#endDate').val(),
|
|
|
|
@ -330,19 +392,7 @@ function sendRequest() {
|
|
|
|
|
other: $('#other').is(':checked')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changeGraph(data) {
|
|
|
|
@ -466,8 +516,9 @@ function buildSentetree() {
|
|
|
|
|
$('#titleListContainer').empty()
|
|
|
|
|
for (i of titleList) {
|
|
|
|
|
$('#titleListContainer').append(
|
|
|
|
|
$('<li>').attr('class', 'w3-panel').append(
|
|
|
|
|
$('<a>').attr('href', i.url).attr('target', '_blank').append(
|
|
|
|
|
$('<li>').attr('class', 'w3-panel')
|
|
|
|
|
.css('cursor', 'pointer').append(
|
|
|
|
|
$('<p>').attr('target', '_blank').append(
|
|
|
|
|
$('<h4>').html(i.title)
|
|
|
|
|
).append(
|
|
|
|
|
$('<span>').attr('style', 'margin: 0px 10px').html(i.author)
|
|
|
|
@ -476,7 +527,10 @@ function buildSentetree() {
|
|
|
|
|
).append(
|
|
|
|
|
$('<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'))
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|