// 좀 더 개선 필요
// use strict 적용 필요 (eval 동작에 문제 있음)
function opennamu_do_thread_make(topic_num, type_do = 'top', some = '', where = 'top_topic') {
let url = '';
if(type_do === 'top') {
url = "/api/thread/" + topic_num + "/top";
} else if(type_do === 'main') {
url = "/api/thread/" + topic_num;
} else {
url = "/api/thread/" + topic_num + some;
}
let xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.send(null);
xhr.onreadystatechange = function() {
if(this.readyState === 4 && this.status === 200) {
let data_t = JSON.parse(this.responseText);
let start = 0;
let key_v = '/normal/1';
let admin = '';
let ip_first = '';
let data_all = '';
let data_all_js = '';
let count = 0;
for(let key in data_t) {
let data_a = '';
if(start === 0) {
admin = data_t['data_main']['admin'];
ip_first = data_t['data_main']['ip_first'];
start = 1;
}
if(key === 'data_main') {
continue;
}
key_v = '/normal/' + String(Number(key) + 1);
let color_b = '';
let color_t = '';
let ip = data_t[key]['ip_pas'];
let ip_o = data_t[key]['ip'];
let blind = data_t[key]['blind'];
let data_i_pas = data_t[key]['data_pas'][0];
if(data_i_pas === '') {
data_i_pas = '
';
} else {
data_i_pas = data_i_pas.replace(
/<topic_a>((?:(?!<\/topic_a>).)+)<\/topic_a>/g,
'$1'
);
data_i_pas = data_i_pas.replace(
/<topic_call>@((?:(?!<\/topic_call>).)+)<\/topic_call>/g,
'@$1',
);
}
if(blind === 'O') {
color_b = 'toron_color_not';
} else {
color_b = 'toron_color';
}
if(blind === 'O') {
ip += ' (B)';
if(admin === '1') {
ip += ' (R)';
}
}
if(admin === '1' || blind !== 'O') {
ip += ' (T)';
}
if(type_do === 'top') {
color_t = 'toron_color_red';
} else if(blind === '1') {
color_t = 'toron_color_blue';
} else if(ip_o === ip_first) {
color_t = 'toron_color_green';
} else {
color_t = 'toron_color_normal';
}
data_a += '' +
'
| ' + '#' + key + ' ' + ip + '' + data_t[key]['date'] + '' + ' | ' + '
| ' +
' ' + data_i_pas + ' ' +
' | ' +
'