Fix bug on JS cut out on disconnect

master
Pentium44 2020-12-16 22:28:35 -08:00
parent 2f7ddd989d
commit 898ecdd410
1 changed files with 27 additions and 26 deletions

View File

@ -173,12 +173,6 @@ if (isset($_GET['do']) && $_GET['do']=="login" && isset($_POST['submitBtn']) &&
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=.5, shrink-to-fit=yes">
<script language="javascript" type="text/javascript">
<?php
if(file_exists("users/." . $_SESSION['idleirc-user'] . ".pingfile"))
{
?>
<!--
var httpObject = null;
var link = "";
@ -312,17 +306,6 @@ if(file_exists("users/." . $_SESSION['idleirc-user'] . ".pingfile"))
ajaxVar.send(null);
}
}
function getInput() {
// Send the server function the input
var userInput = document.getElementById('msg');
serverWrite(userInput.value);
// Clean out the input values
var msgBar = document.getElementById("msg");
msgBar.value = "";
msgBar.focus();
}
// Implement business logic
function serverReload() {
@ -342,13 +325,7 @@ if(file_exists("users/." . $_SESSION['idleirc-user'] . ".pingfile"))
checkMentionUrl();
setTimeout(UpdateTimer, 1000);
}
function keypressed(e) {
if(e.keyCode=='13'){
getInput();
}
}
function doLogin() {
ajaxVar = getHTTPObject();
if(ajaxVar != null) {
@ -395,11 +372,35 @@ if(file_exists("users/." . $_SESSION['idleirc-user'] . ".pingfile"))
msgInput.value = beforeContent + '[' + tag + ']' + selectedContent + '[/' + tag + ']' + afterContent;
}
<?php
if(file_exists("users/." . $_SESSION['idleirc-user'] . ".pingfile"))
{
?>
function getInput() {
// Send the server function the input
var userInput = document.getElementById('msg');
serverWrite(userInput.value);
// Clean out the input values
var msgBar = document.getElementById("msg");
msgBar.value = "";
msgBar.focus();
}
function keypressed(e) {
if(e.keyCode=='13'){
getInput();
}
}
if(Notification.permission !== "granted") {
Notification.requestPermission();
}
<?php
} else {
} else {
?>
function getInput() {
@ -413,7 +414,7 @@ if(file_exists("users/." . $_SESSION['idleirc-user'] . ".pingfile"))
}
}
<?php
}
}
?>
//-->
</script>