2019-03-24 16:43:29 +01:00
|
|
|
|
|
|
|
function clear(node) {
|
|
|
|
while (node.hasChildNodes()) {
|
|
|
|
clear(node.firstChild);
|
|
|
|
}
|
|
|
|
node.parentNode.removeChild(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
function clearInner(node) {
|
|
|
|
while (node.hasChildNodes()) {
|
|
|
|
clear(node.firstChild);
|
|
|
|
}
|
2019-03-29 20:41:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// encoding helper (found here: https://stackoverflow.com/a/2794366)
|
|
|
|
function encodeHTML(s) {
|
|
|
|
return s.replace(/&/g, '&').replace(/</g, '<').replace(/"/g, '"');
|
2019-04-01 16:17:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Date.create_from_mysql = function(mysql_string)
|
|
|
|
{
|
|
|
|
var t, result = null;
|
|
|
|
|
|
|
|
if( typeof mysql_string === 'string' )
|
|
|
|
{
|
|
|
|
t = mysql_string.split(/[- :]/);
|
|
|
|
|
|
|
|
//when t[3], t[4] and t[5] are missing they defaults to zero
|
|
|
|
result = new Date(t[0], t[1] - 1, t[2], t[3] || 0, t[4] || 0, t[5] || 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|