Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(window, document, options, undefined) {
- var shout = document.getElementById(options.shout_id),
- chats = shout.children[0],
- form = shout.children[1];
- appendMessage = function(epoch, user_id, username, group_id, raw_content, autoscroll) {
- var must_scroll = autoscroll && chats.scrollTop == (chats.scrollHeight - chats.offsetHeight);
- if(must_scroll) {
- chats.scrollTop = chats.scrollHeight;
- }
- var local_date = new Date(0);
- local_date.setUTCSeconds(epoch);
- var count = chats.childElementCount,
- p = document.createElement('p'),
- a = document.createElement('a'),
- name = document.createTextNode(username),
- d = document.createElement('span');
- // Format the username
- a.setAttribute('href', 'profile.php?id=' + parseInt(user_id));
- a.setAttribute('target', '_blank');
- a.className = usergroup_id_to_class_name(group_id);
- a.appendChild(name);
- // Format date
- d.textContent = '[' + local_date.toLocaleTimeString() + '] ';
- d.className = 'dateTime';
- // Format the message
- p.textContent = ': ' + decodeHtml(raw_content);
- // Create links
- p.innerHTML = anchorme(p.innerHTML, {
- attributes:[
- {
- name: "target",
- value: "_blank"
- }
- ]});
- p.insertBefore(a, p.firstChild);
- p.insertBefore(d, p.firstChild);
- if ((count % 2) == 0) {
- p.className = 'rowEven';
- } else {
- p.className = 'rowOdd';
- }
- chats.appendChild(p);
- };
- var chat_input = document.getElementById('shouttext');
- })(
- this,
- this.document,
- {
- lang_code: 'en',
- shout_id: 'shout',
- }
- );
- var seconds = Math.round((new Date()).getTime() / 1000);
- appendMessage(seconds, 2, 'admin', 1, encodeHtml('apolo gay'), true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement