Fixed up the webclient html+css to make for a workable example.
This commit is contained in:
parent
b11c746f8f
commit
b8d7fae786
4 changed files with 67 additions and 44 deletions
|
|
@ -10,13 +10,15 @@
|
||||||
/* Overall element look */
|
/* Overall element look */
|
||||||
html, body { height: 100% }
|
html, body { height: 100% }
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
background: #000;
|
background: #000;
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
font-size: .9em;
|
font-size: .9em;
|
||||||
font-family: 'DejaVu Sans Mono', Consolas, Inconsolata, 'Lucida Console', monospace;
|
font-family: 'DejaVu Sans Mono', Consolas, Inconsolata, 'Lucida Console', monospace;
|
||||||
line-height: 1.6em }
|
line-height: 1.6em;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
a:link, a:visited { color: #fff }
|
a:link, a:visited { color: #fff }
|
||||||
|
|
@ -84,57 +86,70 @@ div {margin:0px;}
|
||||||
.bgdimgray { background-color: #696969;}
|
.bgdimgray { background-color: #696969;}
|
||||||
.bgblack { background-color: black;}
|
.bgblack { background-color: black;}
|
||||||
|
|
||||||
/* Container surrounding entire chat */
|
/* Container surrounding entire client */
|
||||||
#wrapper {
|
#wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100% }
|
height: 100%
|
||||||
|
}
|
||||||
|
|
||||||
/* Main scrolling message area */
|
/* Main scrolling message area */
|
||||||
#messagewindow {
|
#messagewindow {
|
||||||
height: 93%;
|
position: relative;
|
||||||
overflow: auto }
|
height: 90%;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
/* Input area containing input field and button */
|
/* Input area containing input field and button */
|
||||||
#inputform {
|
#inputform {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: .8em 0;
|
padding: .8em 0;
|
||||||
bottom: 0 }
|
bottom: -50px;
|
||||||
|
}
|
||||||
|
|
||||||
#inputcontrol {
|
#inputcontrol {
|
||||||
padding: 0 .8em;
|
padding: 0 .8em;
|
||||||
overflow: auto }
|
overflow: auto
|
||||||
|
}
|
||||||
|
|
||||||
/* Input field */
|
/* Input field */
|
||||||
#inputfield {
|
#inputfield {
|
||||||
float: left;
|
float: left;
|
||||||
width: 87%;}
|
width: 93%;
|
||||||
|
height: 40px;
|
||||||
|
margin-right: .5em
|
||||||
|
}
|
||||||
|
|
||||||
#inputfield:focus {
|
#inputfield:focus {
|
||||||
outline: 0 }
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Input 'send' button */
|
/* Input 'send' button */
|
||||||
#inputsend {
|
#inputsend {
|
||||||
float: left;
|
float: left;
|
||||||
width: 8% }
|
width: 4%
|
||||||
|
}
|
||||||
#inputfield { margin-right: .5em }
|
|
||||||
|
|
||||||
#inputfield, #inputsend {
|
#inputfield, #inputsend {
|
||||||
border: 1px solid #555;
|
height: 40px;
|
||||||
background: #000;
|
border: 1px solid #555;
|
||||||
color: #fff;
|
background: #000;
|
||||||
padding: .4em .45em;
|
color: #fff;
|
||||||
font-size: 1.1em;
|
padding: .4em .45em;
|
||||||
font-family: 'DejaVu Sans Mono', Consolas, Inconsolata, 'Lucida Console', monospace }
|
font-size: 1.1em;
|
||||||
|
font-family: 'DejaVu Sans Mono', Consolas, Inconsolata, 'Lucida Console', monospace;
|
||||||
|
}
|
||||||
|
|
||||||
/* prompt area above input field */
|
/* prompt area above input field */
|
||||||
#prompt {
|
#prompt {
|
||||||
margin-top: .8em;}
|
margin-top: .8em;
|
||||||
|
}
|
||||||
|
|
||||||
/* No javascript warning */
|
/* No javascript warning */
|
||||||
#connecting {
|
#connecting {
|
||||||
padding: .5em .9em }
|
padding: .5em .9em
|
||||||
|
}
|
||||||
|
|
||||||
/*Example player count display */
|
/*Example player count display */
|
||||||
#playercount { margin-left: .8em }
|
#playercount { margin-left: .8em }
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ function doWindowResize() {
|
||||||
var winh = $(document).height();
|
var winh = $(document).height();
|
||||||
var formh = $('#inputform').outerHeight(true);
|
var formh = $('#inputform').outerHeight(true);
|
||||||
$("#messagewindow").css({'height': winh - formh - 1});
|
$("#messagewindow").css({'height': winh - formh - 1});
|
||||||
|
$("#inputform").css({'bottom': JSON.stringify(-$("#inputform").height()-10)+"px"});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle text coming from the server
|
// Handle text coming from the server
|
||||||
|
|
@ -96,7 +97,9 @@ function onText(args, kwargs) {
|
||||||
// the bottom.
|
// the bottom.
|
||||||
mwin = $("#messagewindow");
|
mwin = $("#messagewindow");
|
||||||
mwin.append("<div class='msg out'>" + args[0] + "</div>");
|
mwin.append("<div class='msg out'>" + args[0] + "</div>");
|
||||||
mwin.scrollTop(mwin[0].scrollHeight);
|
mwin.animate({
|
||||||
|
scrollTop: document.getElementById("messagewindow").scrollHeight
|
||||||
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle prompt output from the server
|
// Handle prompt output from the server
|
||||||
|
|
@ -106,10 +109,10 @@ function onPrompt(args, kwargs) {
|
||||||
"<div id='prompt' class='msg out'>" + args[0] + "</div>");
|
"<div id='prompt' class='msg out'>" + args[0] + "</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handler silencing events we don't do anything with.
|
// Handle silencing events we don't do anything with.
|
||||||
function onSilence(cmdname, args, kwargs) {}
|
function onSilence(cmdname, args, kwargs) {}
|
||||||
|
|
||||||
// Handler unrecognized commands from server
|
// Handle unrecognized commands from server
|
||||||
function onDefault(cmdname, args, kwargs) {
|
function onDefault(cmdname, args, kwargs) {
|
||||||
mwin = $("#messagewindow");
|
mwin = $("#messagewindow");
|
||||||
mwin.append(
|
mwin.append(
|
||||||
|
|
@ -127,7 +130,8 @@ function onDefault(cmdname, args, kwargs) {
|
||||||
//
|
//
|
||||||
|
|
||||||
// Event when client window changes
|
// Event when client window changes
|
||||||
$(window).resize(doWindowResize);
|
$(window).bind("resize", doWindowResize);
|
||||||
|
$("#inputfield").bind("resize", doWindowResize);
|
||||||
|
|
||||||
// Evenit when any key is pressed
|
// Evenit when any key is pressed
|
||||||
$(document).keydown(onKeydown);
|
$(document).keydown(onKeydown);
|
||||||
|
|
@ -148,6 +152,7 @@ $(document).ready(function() {
|
||||||
// Event when closing window (have to have Evennia initialized)
|
// Event when closing window (have to have Evennia initialized)
|
||||||
$(window).bind("beforeunload", Evennia.connection.close);
|
$(window).bind("beforeunload", Evennia.connection.close);
|
||||||
|
|
||||||
|
doWindowResize();
|
||||||
// set an idle timer to send idle every 3 minutes,
|
// set an idle timer to send idle every 3 minutes,
|
||||||
// to avoid proxy servers timing out on us
|
// to avoid proxy servers timing out on us
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ JQuery available.
|
||||||
var wsactive = true;
|
var wsactive = true;
|
||||||
{% else %}
|
{% else %}
|
||||||
var wsactive = false;
|
var wsactive = false;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if websocket_url %}
|
{% if websocket_url %}
|
||||||
var wsurl = "{{websocket_url}}:{{websocket_port}}";
|
var wsurl = "{{websocket_url}}:{{websocket_port}}";
|
||||||
|
|
@ -50,7 +50,7 @@ JQuery available.
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="connecting">
|
<div id="connecting">
|
||||||
{% block connecting %}
|
{% block connecting %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
@ -58,12 +58,12 @@ JQuery available.
|
||||||
|
|
||||||
<div id="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>
|
||||||
<!-- This is will only fire if javascript is actually active -->
|
<!-- This is will only fire if javascript is actually active -->
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
$('#noscript').remove();
|
$('#noscript').remove();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,14 @@
|
||||||
|
|
||||||
{% block client %}
|
{% block client %}
|
||||||
|
|
||||||
<div id="client">
|
<div id="wrapper">
|
||||||
<div id="messagewindow"></div>
|
<div id="messagewindow"></div>
|
||||||
<div id="inputform">
|
<div id="inputform">
|
||||||
<textarea id="inputfield" type="text"> </textarea>
|
<div id="prompt"></div>
|
||||||
<input id="send" type="button" onClick="doSendText()" value=">"/>
|
<div id="inputcontrol">
|
||||||
|
<textarea id="inputfield" type="text"> </textarea>
|
||||||
|
<input id="inputsend" type="button" onClick="doSendText()" value=">"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue