Enable strict mode on scripts, clean up some unremoved references

This commit is contained in:
NatePri 2016-04-10 12:33:40 -07:00 committed by Griatch
parent 2134d6dd4a
commit f12adcf976
3 changed files with 15 additions and 7 deletions

View file

@ -50,6 +50,7 @@ An "emitter" object must have a function
*/ */
(function() { (function() {
"use strict"
var cmdid = 0; var cmdid = 0;
var cmdmap = {}; var cmdmap = {};
@ -237,7 +238,7 @@ An "emitter" object must have a function
// AJAX/COMET Connector // AJAX/COMET Connector
// //
AjaxCometConnection = function() { var AjaxCometConnection = function() {
log("Trying ajax ..."); log("Trying ajax ...");
var client_hash = '0'; var client_hash = '0';

View file

@ -12,6 +12,9 @@
* *
*/ */
(function () {
"use strict"
// //
// GUI Elements // GUI Elements
// //
@ -25,12 +28,12 @@ var input_history = function() {
history[0] = ''; // the very latest input is empty for new entry. history[0] = ''; // the very latest input is empty for new entry.
var back = function (scratchInput) { var back = function () {
// step backwards in history stack // step backwards in history stack
history_pos = Math.min(++history_pos, history.length - 1); history_pos = Math.min(++history_pos, history.length - 1);
return history[history.length - 1 - history_pos]; return history[history.length - 1 - history_pos];
}; };
var fwd = function (scratchInput) { var fwd = function () {
// step forwards in history stack // step forwards in history stack
history_pos = Math.max(--history_pos, 0); history_pos = Math.max(--history_pos, 0);
return history[history.length - 1 - history_pos]; return history[history.length - 1 - history_pos];
@ -74,7 +77,6 @@ var input_history = function() {
// Grab text from inputline and send to Evennia // Grab text from inputline and send to Evennia
function doSendText() { function doSendText() {
inputfield = $("#inputfield"); inputfield = $("#inputfield");
isInputDirty = false;
var outtext = inputfield.val(); var outtext = inputfield.val();
if (outtext.length > 7 && outtext.substr(0, 7) == "##send ") { if (outtext.length > 7 && outtext.substr(0, 7) == "##send ") {
// send a specific oob instruction // send a specific oob instruction
@ -178,7 +180,7 @@ function doWindowResize() {
function onText(args, kwargs) { function onText(args, kwargs) {
// append message to previous ones, then scroll so latest is at // append message to previous ones, then scroll so latest is at
// the bottom. // the bottom.
mwin = $("#messagewindow"); var mwin = $("#messagewindow");
mwin.append("<div class='msg out'>" + args[0] + "</div>"); mwin.append("<div class='msg out'>" + args[0] + "</div>");
mwin.animate({ mwin.animate({
scrollTop: document.getElementById("messagewindow").scrollHeight scrollTop: document.getElementById("messagewindow").scrollHeight
@ -249,3 +251,4 @@ $(document).ready(function() {
); );
}); });
})();

View file

@ -56,14 +56,18 @@ JQuery available.
{% endblock %} {% endblock %}
</div> </div>
<noscript class="err"> <div id="noscript" class="err">
<h3>Javascript Error: The Evennia MUD client requires that you <h3>Javascript Error: The Evennia MUD client requires that you
have Javascript activated.</h3> have Javascript activated.</h3>
<p>Turn off eventual script blockers and/or switch to a <p>Turn off eventual script blockers and/or switch to a
web browser supporting javascript. <p> web browser supporting javascript. <p>
This error could also be due to not being able to access This error could also be due to not being able to access
the online jQuery javascript library.</p> the online jQuery javascript library.</p>
</noscript> <!-- This is will only fire if javascript is actually active -->
<script language="javascript" type="text/javascript">
$('#noscript').remove();
</script>
</div>
<!-- main client --> <!-- main client -->
<div id=clientwrapper> <div id=clientwrapper>