/usr/share/kadu/scripts/chat-scripts.js is in kadu-common 4.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /* <![CDATA[ */
// MessageStatus enum vaules identical with those defined in kadu-core/chat/message/message-common.h
StatusUnknown = 0;
StatusDelivered = 4;
StatusWontDeliver = 5;
// ContactActivity enum vaules identical with those defined in protocols/services/chat-state-service.h
StateActive = 0;
StateComposing = 1;
StateGone = 2;
StateInactive = 3;
StateNone = 4;
StatePaused = 5;
function adium_clearMessages()
{
var chatElement = document.getElementById('Chat');
chatElement.innerHTML = "";
}
function adium_removeFirstMessage()
{
var chatElement = document.getElementById('Chat');
if (chatElement && chatElement.firstChild)
chatElement.removeChild(chatElement.firstChild);
}
function adium_contactActivityChanged(state, message, name)
{
if (typeof(contactActivityChanged) != 'undefined')
contactActivityChanged(state, message, name);
}
function adium_chatImageAvailable(name, src)
{
if (typeof(name) == 'undefined' || typeof(src) == 'undefined')
return;
var image = document.getElementsByName(name)[0];
if (!image)
return;
if (image.tagName.toLowerCase() != 'img')
return;
image.src = src;
}
function kadu_clearMessages()
{
// A style can place its own content before any messages with <kadu:top>,
// so we don't want to delete that content here. Also bear in mind that
// kadu_takeScriptNodes() usage might result in <script> tags being put as
// direct <body> children (but surely not preceding the first
// <span class="kadu_message">).
var messages = document.getElementsByClassName('kadu_message');
if (0 == messages.length)
return;
var node = messages[0];
while (node)
{
var nextNode = node.nextSibling;
if (node.parentNode)
node.parentNode.removeChild(node);
node = nextNode;
}
}
function kadu_appendMessage(html)
{
var body = document.getElementsByTagName('body')[0];
var range = document.createRange();
range.selectNode(body);
var documentFragment = range.createContextualFragment(html);
var scriptnodes = kadu_takeScriptNodes(documentFragment);
body.appendChild(documentFragment);
for (var k in scriptnodes)
body.appendChild(scriptnodes[k]);
}
function kadu_takeScriptNodes(node)
{
var scriptnodes = new Array();
for (var k in node.childNodes)
{
var childnode = node.childNodes[k];
if (childnode.nodeName && childnode.nodeName.toLowerCase() == "script")
{
var scriptnode = node.removeChild(childnode);
scriptnodes.push(scriptnode.cloneNode(true));
}
else
scriptnodes = scriptnodes.concat(kadu_takeScriptNodes(childnode));
}
return scriptnodes;
}
function scrollToBottom()
{
// we have better implementation in C++, so we should ignore it
// document.body.scrollTop = document.body.offsetHeight;
}
function kadu_removeFirstMessage()
{
var messages = document.getElementsByClassName('kadu_message');
for (var k in messages)
{
var message = messages[k];
if (message.parentNode)
{
var node = message.nextSibling;
message.parentNode.removeChild(message);
// There can be some <script> tags, see kadu_clearMessages() for explanation.
while (node.className != 'kadu_message')
{
var nextNode = node.nextSibling;
if (node.parentNode)
node.parentNode.removeChild(node);
node = nextNode;
}
break;
}
}
}
function kadu_messageStatusChanged(messageid, status)
{
if (typeof(messageStatusChanged) != 'undefined')
messageStatusChanged(messageid, status);
}
function kadu_contactActivityChanged(state, message, name)
{
if (typeof(contactActivityChanged) != 'undefined')
contactActivityChanged(state, message, name);
}
function kadu_chatImageAvailable(name, src)
{
if (typeof(name) == 'undefined' || typeof(src) == 'undefined')
return;
var image = document.getElementsByName(name)[0];
if (!image)
return;
if (image.tagName.toLowerCase() != 'img')
return;
image.src = src;
}
function toggleImageScaling() {
var node = event.target;
if (!node || !node.className)
return;
if (node.className.indexOf("scalable") >= 0) {
if (node.className.indexOf("unscaled") >= 0) {
node.className = node.className.replace(" unscaled", "");
} else
node.className = node.className + " unscaled";
}
}
document.addEventListener("click", toggleImageScaling, true);
/* ]]> */
|