|
|
|
@ -132,6 +132,33 @@ function alert() { |
|
|
|
|
(new Audio("A-Tone-His_Self-1266414414.mp3")).play(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Toggle Menu Display
|
|
|
|
|
function togglemenu() { |
|
|
|
|
$("#menu").toggle(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Download Profile Backup
|
|
|
|
|
function backup() { |
|
|
|
|
status("<p>Starting Download...</p>"); |
|
|
|
|
var download = document.createElement('a'); |
|
|
|
|
download.href = 'data:attachment/text,'+encodeURI(JSON.stringify(localStorage)); |
|
|
|
|
download.target = '_blank'; |
|
|
|
|
function pad(n) {return n<10 ? '0'+n : n} |
|
|
|
|
var now = new Date(); |
|
|
|
|
download.download = |
|
|
|
|
pad(now.getFullYear())+pad(now.getMonth()+1)+pad(now.getDate())+ |
|
|
|
|
"-safechat.bak"; |
|
|
|
|
var clickEvent = new MouseEvent("click", { |
|
|
|
|
"view": window, |
|
|
|
|
"bubbles": true, |
|
|
|
|
"cancelable": false |
|
|
|
|
}); |
|
|
|
|
download.dispatchEvent(clickEvent); |
|
|
|
|
status("<p>Download:</p><pre>"+download.outerHTML.replace("<", "<")+"</pre>"); |
|
|
|
|
togglemenu(); |
|
|
|
|
setTimeout(start, 20000); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// Check if user name is available
|
|
|
|
|
/** Calls checknewuser.php on server and displays an error, if the |
|
|
|
|
user name is already in use. This function is used when creating a |
|
|
|
@ -484,6 +511,7 @@ function getpwd() { |
|
|
|
|
get() which polls for new messages. */ |
|
|
|
|
function chat() { |
|
|
|
|
if (!password) return getpwd(); |
|
|
|
|
$("#username").html(userid()+"@safechat.ch"); |
|
|
|
|
$.ajax({url: "chat.html", success: function(res) { |
|
|
|
|
status(res); |
|
|
|
|
setTimeout(get, 2000); |
|
|
|
|