1
<?xml version="1.0" encoding="utf-8"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
5
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
8
<script type="text/javascript">
13
function initEvents() {
14
if(document.getElementById("heading") == null){
15
document.getElementById("bodyNode").style.marginTop = "5px";
18
if(isDebug == false) {
19
document.getElementById("debug").style.display = "none";
27
var node = document.createElement("div");
28
var debugCon = document.getElementById("debug");
30
debugCon.appendChild(node);
34
//Appending new content to the message view
35
function appendMessage(html) {
36
var shouldScroll = nearBottom();
38
//Remove any existing insertion point
39
var insert = document.getElementById("insert");
41
if(insert) insert.parentNode.removeChild(insert);
43
//Append the new message to the bottom of our chat block
44
var chat = document.getElementById("Chat");
45
var range = document.createRange();
46
range.selectNode(chat);
47
var documentFragment = range.createContextualFragment(html);
49
var myFrag = chat.appendChild(documentFragment);
51
var frag = document.querySelectorAll(".chatItem")[document.querySelectorAll(".chatItem").length-1];
57
function fadeIn(myNode) {
58
myNode.style.visibility = "visible";
59
myNode.style.opacity = 0;
60
setTimeout(function() {
61
myNode.style.WebkitTransition = "opacity 0.35s ease-in";
62
myNode.style.opacity = 1;
67
function appendNextMessage(html){
68
var shouldScroll = nearBottom();
70
//Locate the insertion point
71
var insert = document.getElementById("insert");
74
range = document.createRange();
75
range.selectNode(insert.parentNode);
76
newNode = range.createContextualFragment(html);
79
var pointer = insert.parentNode;
80
insert.parentNode.replaceChild(newNode,insert);
81
var els = pointer.getElementsByTagName("div");
87
//Auto-scroll to bottom. Use nearBottom to determine if a scrollToBottom is desired.
88
function nearBottom() {
89
return ( document.body.scrollTop >= ( document.body.offsetHeight - ( window.innerHeight * 1.2 ) ) );
93
function scrollToBottom() {
94
//document.body.scrollTop = (document.body.scrollHeight-window.innerHeight);
96
if( intervall_scroll ) clearInterval( intervall_scroll );
97
intervall_scroll = setInterval( function() {
98
var target_scroll = (document.body.scrollHeight-window.innerHeight);
99
var scrolldiff = target_scroll - document.body.scrollTop;
100
if ( document.body.scrollTop != target_scroll ) {
101
var saved_scroll = document.body.scrollTop;
102
document.body.scrollTop += scrolldiff / 5 + ( scrolldiff >= 0 ? (scrolldiff != 0 ) : -1 );
105
clearInterval( intervall_scroll );
111
//Dynamically exchange the active stylesheet
112
function setStylesheet( id, url ) {
113
var code = "<style id=\"" + id + "\" type=\"text/css\" media=\"screen,print\">";
114
if( url.length ) code += "@import url( \"" + url + "\" );";
116
var range = document.createRange();
117
var head = document.getElementsByTagName( "head" ).item(0);
118
range.selectNode( head );
119
documentFragment = range.createContextualFragment( code );
120
head.removeChild( document.getElementById( id ) );
121
head.appendChild( documentFragment );
124
//Align our chat to the bottom of the window. If true is passed, view will also be scrolled down
125
function alignChat(shouldScroll) {
127
var windowHeight = window.innerHeight;
129
if(windowHeight > 0) {
130
var contentElement = document.getElementById('Chat');
131
var contentHeight = contentElement.offsetHeight;
132
if (windowHeight - contentHeight > 0) {
133
contentElement.style.position = 'relative';
134
contentElement.style.top = '0px';
136
contentElement.style.position = 'static';
140
if(shouldScroll) scrollToBottom();
143
function windowDidResize() {
144
alignChat(true); //nearBottom buggy with inavtive tabs
147
window.onresize = windowDidResize;
151
<style id="mainStyle" type="text/css" media="screen,print"> @import url( "%@" ); @import url("Variants/Green on Yellow Alternating.css"); </style>
154
<body style="==bodyBackground==" id="bodyNode" onload="initEvents()">
159
<div id="debug"></div>
b'\\ No newline at end of file'