function render_namumark(target) {
function get_today() {
var today_data = new Date();
return '' +
String(today_data.getFullYear()) + '-' +
String(today_data.getMonth() + 1) + '-' +
String(today_data.getDate()) + ' ' +
(today_data.getHours() < 10 ? '0' + String(today_data.getHours()) : String(today_data.getHours())) + ':' +
(today_data.getMinutes() < 10 ? '0' + String(today_data.getMinutes()) : String(today_data.getMinutes())) + ':' +
(today_data.getSeconds() < 10 ? '0' + String(today_data.getSeconds()) : String(today_data.getSeconds())) +
'';
}
function get_link_state(link_data) {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/api/w/" + encodeURIComponent(link_data[0]) + "?exist=1", true);
xhr.send(null);
xhr.onreadystatechange = function() {
var i = 0;
while(1) {
if(document.getElementsByClassName(link_data[1])[i]) {
if(this.readyState === 4 && this.status === 200) {
if(JSON.parse(this.responseText)['exist'] !== '1') {
document.getElementsByClassName(link_data[1])[i].id = "not_thing";
} else {
document.getElementsByClassName(link_data[1])[i].id = "";
}
} else {
document.getElementsByClassName(link_data[1])[i].id = "not_thing";
}
i += 1;
} else {
break;
}
}
}
}
function get_file_state(file_data) {
var file_part = file_data[0].match(/^([^.]+)\.(.+)$/);
if(file_part) {
var file_name = file_part[1];
var file_type = '.' + file_part[2];
} else {
var file_name = file_data;
var file_type = '';
}
var xhr = new XMLHttpRequest();
xhr.open("GET", "/api/sha224/" + encodeURIComponent(file_name), true);
xhr.send(null);
xhr.onreadystatechange = function() {
if(this.readyState === 4 && this.status === 200) {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/api/w/file:" + encodeURIComponent(file_data[0]) + "?exist=1", true);
xhr.send(null);
var img_src = JSON.parse(this.responseText)['data'];
xhr.onreadystatechange = function() {
if(this.readyState === 4 && this.status === 200) {
if(JSON.parse(this.responseText)['exist'] !== '1') {
document.getElementById(file_data[1]).innerHTML = '' +
'' + file_data[0] + '' +
'';
} else {
document.getElementById(file_data[1]).innerHTML = '' +
'' +
'';
}
} else {
document.getElementById(file_data[1]).innerHTML = '' +
'' + file_data[0] + '' +
'';
}
}
}
}
}
function divi_link(link_data) {
var link_part = link_data.match(/^([^|]+)\|(.+)$/);
if(link_part) {
return [link_part[2], link_part[1]]
} else {
return [link_data, link_data]
}
}
function table_analysis(main_data, cel_data, start_cel, num = 0) {
var table_class = 'class="'
var div_style = 'style="'
var table_style = 'style="'
var cel_style = 'style="'
var row_style = 'style="'
var row = ''
var cel = ''
var table_state_get = main_data.match(/<table ?width=((?:(?!>).)*)>/);
if(table_state_get) {
if(main_data.match('^[0-9]+$', table_state_get[1])) {
div_style += 'width: ' + table_state_get[1] + 'px;';
} else {
div_style += 'width: ' + table_state_get[1] + ';';
}
table_style += 'width: 100%;';
}
table_state_get = main_data.match(/<table ?height=((?:(?!>).)*)>/);
if(table_state_get) {
if(main_data.match(/^[0-9]+$/, table_state_get[1])) {
table_style += 'height: ' + table_state_get[1] + 'px;';
} else {
table_style += 'height: ' + table_state_get[1] + ';';
}
}
table_state_get = main_data.match(/<table ?align=((?:(?!>).)*)>/);
if(table_state_get) {
if(table_state_get[1] == 'right') {
div_style += 'float: right;';
} else if(table_state_get[1] == 'center') {
table_style += 'margin: auto;';
}
}
table_state_get = main_data.match(/<table ?textalign=((?:(?!>).)*)>/);
if(table_state_get) {
num = 1
if(table_state_get[1] == 'right') {
table_style += 'text-align: right;';
} else if(table_state_get[1] == 'center') {
table_style += 'text-align: center;';
}
}
table_state_get = main_data.match(/<row ?textalign=((?:(?!>).)*)>/);
if(table_state_get) {
if(table_state_get[1] == 'right') {
row_style += 'text-align: right;';
} else if(table_state_get[1] == 'center') {
row_style += 'text-align: center;';
} else {
row_style += 'text-align: left;';
}
}
table_state_get = main_data.match(/<-((?:(?!>).)*)>/);
if(table_state_get) {
cel = 'colspan="' + table_state_get[1] + '"';
} else {
cel = 'colspan="' + String(Math.round(start_cel.length / 2)) + '"';
}
table_state_get = main_data.match(/<\|((?:(?!>).)*)>/);
if(table_state_get) {
row = 'rowspan="' + table_state_get[1] + '"';
}
table_state_get = main_data.match(/<rowbgcolor=(#(?:[0-9a-f-A-F]{3}){1,2}|\w+)(?:,(#(?:[0-9a-f-A-F]{3}){1,2}|\w+))?>/);
if(table_state_get) {
row_style += 'background: ' + table_state_get[1] + ';';
}
table_state_get = main_data.match(/<rowcolor=(#(?:[0-9a-f-A-F]{3}){1,2}|\w+)(?:,(#(?:[0-9a-f-A-F]{3}){1,2}|\w+))?>/);
if(table_state_get) {
row_style += 'color: ' + table_state_get[1] + ';';
}
table_state_get = main_data.match(/<table ?bordercolor=(#(?:[0-9a-f-A-F]{3}){1,2}|\w+)(?:,(#(?:[0-9a-f-A-F]{3}){1,2}|\w+))?>/);
if(table_state_get) {
table_style += 'border: ' + table_state_get[1] + ' 2px solid;';
}
table_state_get = main_data.match(/<table ?bgcolor=(#(?:[0-9a-f-A-F]{3}){1,2}|\w+)(?:,(#(?:[0-9a-f-A-F]{3}){1,2}|\w+))?>/);
if(table_state_get) {
table_style += 'background: ' + table_state_get[1] + ';';
}
table_state_get = main_data.match(/<table ?color=(#(?:[0-9a-f-A-F]{3}){1,2}|\w+)(?:,(#(?:[0-9a-f-A-F]{3}){1,2}|\w+))?>/);
if(table_state_get) {
table_style += 'color: ' + table_state_get[1] + ';';
}
table_state_get = main_data.match(/<(?:bgcolor=)?(#(?:[0-9a-f-A-F]{3}){1,2}|\w+)(?:,(#(?:[0-9a-f-A-F]{3}){1,2}|\w+))?>/);
if(table_state_get) {
cel_style += 'background: ' + table_state_get[1] + ';';
}
table_state_get = main_data.match(/<color=(#(?:[0-9a-f-A-F]{3}){1,2}|\w+)(?:,(#(?:[0-9a-f-A-F]{3}){1,2}|\w+))?>/);
if(table_state_get) {
cel_style += 'color: ' + table_state_get[1] + ';';
}
table_state_get = main_data.match(/<width=((?:(?!>).)*)>/);
if(table_state_get) {
if(table_state_get[1].match(/^[0-9]+$/)) {
cel_style += 'width: ' + table_state_get[1] + 'px;';
} else {
cel_style += 'width: ' + table_state_get[1] + ';';
}
}
table_state_get = main_data.match(/<height=((?:(?!>).)*)>/);
if(table_state_get) {
if(table_state_get[1].match(/^[0-9]+$/)) {
cel_style += 'height: ' + table_state_get[1] + 'px;';
} else {
cel_style += 'height: ' + table_state_get[1] + ';';
}
}
var text_right = main_data.match(/<\)>/);
var text_center = main_data.match(/<:>/);
var text_left = main_data.match(/<\(>/);
if(text_right) {
cel_style += 'text-align: right;';
} else if(text_center) {
cel_style += 'text-align: center;';
} else if(text_left) {
cel_style += 'text-align: left;';
} else if(num == 0) {
if(cel_data.match(/^ /) && cel_data.match(/ $/)) {
cel_style += 'text-align: center;';
} else if(cel_data.match(/^ /)) {
cel_style += 'text-align: right;';
} else if(cel_data.match(/ $/)) {
cel_style += 'text-align: left;';
}
}
table_state_get = main_data.match(/<table ?class=((?:(?!>).)+)>/);
if(table_state_get) {
table_class += table_state_get[1];
}
div_style += '"';
table_style += '"';
cel_style += '"';
row_style += '"';
table_class += '"';
return [table_style, row_style, cel_style, row, cel, table_class, num, div_style]
}
function table_render(data) {
var table_num = 0;
while(1) {
var table_data = data.match(/\n((?:(?:(?:(?:\|\|)+(?:(?:(?!\|\|).(?:\n)*)*))+)\|\|(?:\n)?)+)/);
if(table_data) {
table_data = table_data[1];
var get_table_data = table_data.match(/^((?:\|\|)+)((?:<(?:(?:(?!>).)+)>)*)\n*((?:(?!\|\|).\n*)*)/);
if(get_table_data) {
table_return_data = table_analysis(get_table_data[2], get_table_data[3], get_table_data[1]);
table_num = table_return_data[6];
table_data = table_data.replace(
/^((?:\|\|)+)((?:<(?:(?:(?!>).)+)>)*)\n*/,
'\n' +
'
| ' ); } table_data = table_data.replace(/\|\|\n?$/, ' |
');
} else if(in_data.match(/#!folding/i)) {
mid_list.push('div_2');
ata.replace(mid_regex, '' +
'' +
'' +
'[+]' +
'' +
'' +
'