Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
HipChat v3.0 for Mac + Remove 'Show more'
/* Prevent font scaling when switching orientations */
html {
-webkit-text-size-adjust: none;
}
* {
margin: 0;
padding: 0;
word-wrap: break-word;
}
li {
margin-left: 35px;
}
a {
color: #3572b0;
}
.systemMessage.green a {
color: #106E23;
}
.systemMessage.red a {
color: #BD382C;
}
table {
table-layout: fixed;
}
.historyLink {
width: 100%;
text-align: center;
background-color: #F0F0F0;
padding: 5px 0;
display: none;
}
/* Setup cases where borders should show between messages */
.chatBlock {
border-collapse: collapse;
}
.chatBlock.them+.chatBlock.them, .scrollAnchor+.chatBlock.them, .preview+.chatBlock.them {
border-top: 1px solid #EFEFEF;
}
.chatBlock.them+.systemMessage.them {
border-top: none;
}
.chatBlock.me+.chatBlock.me, .preview+.chatBlock.me {
border-top: 1px solid #ffffff;
}
.systemMessage.red+.systemMessage.red,
.systemMessage.green+.systemMessage.green,
.systemMessage.purple+.systemMessage.purple,
.systemMessage.gray+.systemMessage.gray {
border-top: 1px solid #FFFFFF;
}
.systemMessage.yellow+.systemMessage.yellow {
border-top: 1px solid #EAEAEA;
}
.chatBlock .messageWrapper {
margin: 1px 10px 0 10px;
}
.chatBlock p.additionalLine {
margin-top: 5px;
}
.chatBlock p:nth-child(2) {
margin-top: 0;
}
.chatBlock td {
padding: 8px 0;
}
.fileBlock .icon {
margin: 2px 7px 4px 0;
}
.fileBlock .fileSize {
color: #666;
}
.linkBlock .icon {
height: 16px;
width: 16px;
margin: 2px 5px 4px 10px;
vertical-align: middle;
float: left;
}
.linkBlock .linkPreview {
margin-top: 5px;
}
.linkBlock .linkPreview:first-child {
margin-top: 0;
}
.linkBlock .linkPreview p {
margin: 0;
margin-left: 30px;
}
.me {
background-color: #F3F7FB;
border-top-color: #FFFFFF;
}
.them {
background-color: #fff;
}
.messageBlock img {
vertical-align: middle;
}
.messageBlock {
}
.me .messageBlock {
vertical-align: middle;
margin-bottom: 4px;
}
.messageBlock .monospace {
font-family: monospace;
}
.messageBlock .msgText {
clear: left;
}
.messageBlock .msgText:nth-child(2) {
margin-top: 1px;
}
.messageBlock .msgTextError {
clear: left;
color: #ABABAB;
padding-left: 21px;
background: url('yield.png') no-repeat left center;
}
.messageBlock .msgTextError a {
color: #9999EE;
}
.messageBlock pre {
font-family: monospace;
margin: 5px 10px 0 10px;
white-space: pre-wrap;
tab-interval: 10px;
}
.messageBlock pre:first-child, .messageBlock pre:nth-child(2) {
margin-top: 0;
}
.messageBlock pre * {
font-family: monospace;
}
.messageBlock .monospace * {
font-family: monospace;
}
.messageBlock img[align='left'] {
margin-right: 5px;
margin-bottom: 5px;
}
.nameBlock {
vertical-align: top;
text-align: right;
}
.nameBlock p {
color: #707070;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin-top: 1px;
}
.nameBlock a {
color: #707070;
text-decoration: none;
}
.me .nameBlock p {
color: #707070;
}
.me .nameBlock {
border-top-color: #F3F7FB;
}
/* Add padding to make up for the missing borders on name/message blocks */
.infoBlock p {
color: #999;
padding-left: 2px;
}
.infoBlock .messageBlock {
border-left: none;
}
.infoBlock .nameBlock {
background-color: inherit;
border: none;
}
/* Time blocks are different on the iPhone client - they are floated 'p' blocks instead of seprate table cells
Use p.timeBlock so we override the default info block p style */
p.timeBlock {
white-space: nowrap;
color: #999;
text-align: right;
vertical-align: top;
float: right;
margin-top: 3px;
}
.systemMessage, .systemMessage.yellow {
background-color: #FFFBE7;
}
.systemMessage .nameBlock, .systemMessage.yellow .nameBlock {
border-top-color: #FFFAEA;
border-right-color: #FFFAEA;
}
.systemMessage .messageBlock {
margin-bottom: 4px;
}
.systemMessage.red {
background-color: #F9E6E6;
}
.systemMessage.red .nameBlock {
border-top-color: #FFF2F2;
}
.systemMessage.gray {
background-color: #F4F4F4;
}
.systemMessage.gray .nameBlock {
border-top-color: #f5f5f5;
}
.systemMessage.purple {
background-color: #F2F4FD;
}
.systemMessage.purple .nameBlock {
border-top-color: #EEE8FC;
}
.systemMessage.green {
background-color: #F5F8E6;
}
.systemMessage.green .nameBlock {
border-top-color: #FFFAEA;
}
.welcomeMessage {
background-color: #F5F8E7;
border-top-color: #BDE18C;
}
.welcomeMessage .nameBlock {
color: #75510F;
border-top-color: #FFFAEA;
}
.welcomeMessage .messageBlock {
margin-bottom: 4px;
}
#chat_state {
padding: 3px 5px 4px 138px;
display: none;
}
.tooltip {
position: absolute;
display: none;
color: #fff;
}
.atTag {
display: inline-block;
padding: 0 3px;
border: 1px solid #D0D0D0;
background-color: #F5F5F5;
-webkit-border-radius: 4px;
}
.atTagMe {
color: #fff;
border: 1px solid #4783BF;
background: #3572b0;
}
.hexPreview {
-webkit-border-radius: 3px;
text-decoration: none;
border: 1px solid #999;
padding: 0 5px;
width: 15px;
}
.image {
margin: 5px 10px;
}
p.hiddenImage {
font-style: italic;
margin-left: 0;
}
p.hiddenImage a {
text-decoration: none;
color: #999;
}
p.hiddenImage a:hover {
text-decoration: underline;
}
.dateDivider {
text-align: center;
height: 1px;
background-color: #e5e5e5;
margin: 30px 0;
}
.dateDivider span {
background-color: #fff;
font-size: 16px;
color: #333;
font-weight: normal;
position: relative;
top: -10px;
padding: 0 10px;
}
.xdateDivider:first-line {
background-color: white;
}
.xdateDivider:before {
content: "-_";
color: white;
background-color: white;
}
.xdateDivider:after {
content: "-_";
color: white;
background-color: white;
}
.chatDivider {
background-color: #3572b0;
color: #fff;
height: 2px;
}
.preview {
padding: 3px 0;
background-color: #F5F5F5;
}
.fileBlock .preview {
background-color: inherit;
}
.preview td {
padding: 0;
vertical-align: top;
}
.preview p {
margin: 0 10px;
}
.preview .hide, .fileBlock .hide {
padding: 5px 10px 10px 10px;
float: right;
margin: -2px 10px 0 0;
cursor: pointer;
display: inline-block;
}
.linkImage {
float: left;
margin: 5px 10px;
}
.scrollAnchor {
display: block;
position: relative;
top: -42px;
}
.tooltip {
position: absolute;
z-index: 10;
padding: 3px;
background-color: #333;
border: 1px solid #000;
opacity: 0.9;
display: none;
border-radius: 6px;
}
.tooltip a {
color: #fff;
text-decoration: none;
display: inline-block;
padding: 0 5px;
}
.unconfirmedIcon {
float: left;
padding-right: 5px;
}
/* tweak:
.truncated {
max-height: __TRUNCATION_HEIGHT__;
text-overflow: clip;
overflow: hidden;
padding-left: 10px;
}*/
.truncated,
.untruncated {
padding-left: 10px;
}
.showHideLinkContainer {
margin-top: 5px;
padding-top: 5px;
padding-left: 10px;
padding-right: 10px;
font-family: monospace;
}
.truncated+.showHideLinkContainer {
border-top: 1px solid #efefef;
}
.prettyprinted {
background-color: #efefef;
border: 1px solid #cccccc;
border-radius: 3px;
padding: 5px;
}
.timeBlock ~ .prettyprinted {
margin-right: 100px;
}
#load_history_button {
padding: 9px 0 8px 0;
background-color: #dedede;
text-align: center;
display: none;
}
#loading_spinner {
padding: 9px 0 8px 0;
background-color: #dedede;
text-align: center;
display: none;
}
window.onerror = function (error, url, line) {
osxConnector.logJavascriptError_('Line ' + line + ': ' + error);
};
function addAnchor(anchorName) {
var newAnchor = document.createElement('a');
newAnchor.name = anchorName;
newAnchor.id = anchorName;
newAnchor.className = 'scrollAnchor';
var chatText = document.getElementById('chat_text');
chatText.insertBefore(newAnchor, chatText.firstChild);
}
function addChatDivider() {
removeChatDivider();
var newDiv = document.createElement('div');
newDiv.className = 'chatDivider';
document.getElementById('chat_text').appendChild(newDiv);
}
function addChatLine(blockId, className, body, messageId) {
var currentBlock = document.getElementById(blockId);
if (!currentBlock || typeof currentBlock == 'undefined') {
return;
}
var newLine = document.createElement('p');
newLine.id = messageId;
newLine.className = className;
newLine.innerHTML = body;
addLinkHandlers(newLine);
currentBlock.appendChild(newLine);
}
function addChatStateMessage(name) {
var stateMessage = document.getElementById('chat_state');
stateMessage.innerHTML = '<p>' + name + ' is typing...</p>';
stateMessage.style.display = 'block';
}
function addDateDivider(dateString, insertOnTop) {
var newDiv = document.createElement('div');
newDiv.className = 'dateDivider';
newDiv.innerHTML = '<span>'+dateString+'</span>';
chatText = document.getElementById('chat_text');
if (insertOnTop) {
newDiv.className += ' previousHistory';
newDiv.style.display = 'none';
chatText.insertBefore(newDiv, chatText.firstChild);
} else {
chatText.appendChild(newDiv);
}
}
function addLinkHandlers(node) {
var links = node.getElementsByTagName('A');
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (link.name == 'toggle_paste') {
// tweak: link.addEventListener('click', handleTogglePasteClick, false);
link.innerHTML = '';
}
}
}
function addPreviewData(messageId, html, className, displayName) {
if (typeof displayName == 'undefined') {
displayName = '&nbsp;';
}
var previewNode = document.createElement('div');
var messageNode = document.getElementById(messageId);
if (!messageNode || typeof messageNode == 'undefined') {
return;
}
previewNode.className = (className ? className + ' preview' : 'preview');
previewNode.innerHTML = '<table width="100%"><tr><td class="nameBlock"><p>'+displayName+'</p></td><td>'+html+'</td></tr></table>';
var links = previewNode.getElementsByTagName('A');
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (link.name == 'toggle_paste') {
link.addEventListener('click', handleTogglePasteClick, false);
}
}
var node = messageNode;
while (node != null) {
if (node.className.indexOf('chatBlock') >= 0) {
// Don't add the className to the chatBlock anymore
// since the preview block is a sibling instead of a child
// if (className) {
// node.className += ' ' + className;
// }
break;
}
node = node.parentNode;
}
node.parentNode.insertBefore(previewNode, node.nextSibling);
}
function clearChat() {
var chatText = document.getElementById('chat_text');
chatText.innerHTML = '';
}
function doScroll() {
window.scrollTo(0, document.body.scrollHeight);
}
function getMessageForBlock(blockId) {
var blockNode = document.getElementById(blockId);
if (!currentBlock) {
return '';
} else {
return currentBlock.lastChild.innerHTML;
}
}
function getSelectedHTML() {
var sel = window.getSelection();
if (sel.rangeCount) {
var container = document.createElement('div');
for (var i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
return container.innerHTML;
} else {
return '';
}
}
function handleBodyClick() {
var sel = getSelectedHTML();
window.osxConnector.chatBodyClicked_(sel);
}
function handleTogglePasteClick() {
var element = this.parentNode.parentNode.getElementsByTagName('div')[0];
if (element.className.indexOf('untruncated') < 0) {
element.className = element.className.replace('truncated', 'untruncated');
this.innerHTML = 'Show less';
} else {
element.className = element.className.replace('untruncated', 'truncated');
this.innerHTML = 'Show more';
}
}
function hideChatStateMessage() {
var stateMessage = document.getElementById('chat_state');
stateMessage.style.display = 'none';
}
function lastChatNodeContainsMessage(msg) {
var chatText = document.getElementById('chat_text');
if (chatText.childNodes.length > 0) {
var lastMessage = chatText.childNodes[chatText.childNodes.length - 1].childNodes[0].innerHTML;
return lastMessage.indexOf(msg) != -1;
}
return false;
}
function markMessageConfirmed(messageId) {
var messageNode = document.getElementById(messageId);
if (!messageNode || typeof messageNode == 'undefined') {
return;
}
messageNode.className = 'msgText messageWrapper';
}
function removeChatDivider() {
var dividerNodes = document.getElementsByClassName('chatDivider');
for (var i = 0; i < dividerNodes.length; i++) {
dividerNodes[i].parentNode.removeChild(dividerNodes[i]);
}
}
function removeLastPresence(bareJid) {
var presName = 'presence_' + bareJid;
var chatText = document.getElementById('chat_text');
for (var i = chatText.childNodes.length - 1; i > 0; i--) {
var node = chatText.childNodes[i];
if (node.nodeType != Node.ELEMENT_NODE) {
return false;
}
var name = node.getAttribute('name');
if (!(/presence_/.test(name))) {
return false;
}
if (name == presName) {
chatText.removeChild(chatText.childNodes[i]);
return true;
}
}
}
function replaceMessageById(messageId, html) {
var messageNode = document.getElementById(messageId);
if (!messageNode || typeof messageNode == 'undefined') {
return;
} else {
messageNode.innerHTML = html;
}
}
function scrollByPixels(numPixels) {
setTimeout(function () {
window.scrollTo(0, window.pageYOffset + numPixels);
}, 200);
}
function scrollAtBottom() {
return window.pageYOffset >= (document.body.scrollHeight - window.innerHeight - 200);
}
function scrollToBottom() {
setTimeout(function () {
doScroll();
}, 200);
}
function showHistory() {
var historyNodes = document.getElementsByClassName('previousHistory');
for (var i = 0; i < historyNodes.length; i++) {
historyNodes[i].style.display = 'block';
}
}
function showMentionTooltip(node) {
node.title = window.osxConnector.getNameForMention_(node.innerHTML);
}
function showTooltip(obj, html) {
var tt = document.getElementById('tooltip');
var curleft = curtop = 0;
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
tt.style.top = curtop - 25;
tt.style.left = curleft;
tt.style.display = 'block';
setTimeout(function () {
tt.style.display = 'none';
}, 4000);
tt.innerHTML = html
}
function toggleImage(link) {
var blockNode = (link.className == 'hide' ? link.parentNode : link.parentNode.parentNode.parentNode);
var image = blockNode.getElementsByClassName('thumbnail')[0];
var hiddenText = blockNode.getElementsByClassName('hiddenImage')[0];
var toggleImg = blockNode.getElementsByClassName('hide')[0].getElementsByTagName('img')[0];
image.style.display = (image.style.display == 'none' ? '' : 'none');
hiddenText.style.display = (image.style.display == 'none' ? '' : 'none');
toggleImg.src = (image.style.display == 'none' ?
imagePreviewClosed :
imagePreviewOpened);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment