Last active
May 10, 2016 17:21
-
-
Save ruzz311/f7fcc0a5ef6c5f35cd12e875b4f38c88 to your computer and use it in GitHub Desktop.
tampermonkey script for hipchat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hipchat Themes | |
// @namespace http://madsendev.com/ | |
// @version 0.2 | |
// @description Style hipchat web app. | |
// @author russell@madsendev.com | |
// @match *.hipchat.com/chat/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Exposed API | |
window.Tampermonkey = window.Tampermonkey || {}; | |
window.Tampermonkey.Hipchat = { | |
SetTheme: SetTheme, | |
ListThemes: ListThemes | |
}; | |
var themes = [ | |
{ | |
name: 'russell does not remember what this theme is', | |
css: [ | |
'.prettyprint{background:#2f3640;font-family:Menlo,Bitstream Vera Sans Mono,DejaVu Sans Mono,Monaco,Consolas,monospace;border:0!important}.pln{color:#e6e9ed}ol.linenums{margin-top:0;margin-bottom:0;color:#656d78}', | |
'li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9{padding-left:1em;background-color:#2f3640;list-style-type:decimal}@media screen{.str{color:#ffce54}.kwd{color:#4fc1e9}.com{color:#656d78}.typ{color:#4fc1e9}', | |
'.lit{color:#ac92ec}.pun{color:#e6e9ed}.opn{color:#e6e9ed}.clo{color:#e6e9ed}.tag{color:#ed5565}.atn{color:#a0d468}.atv{color:#ffce54}.dec{color:#ac92ec}.var{color:#e6e9ed}.fun{color:#e6e9ed}}' | |
].join('') | |
}, { | |
name: 'tomorrow night', | |
css: ['/*! Color themes for Google Code Prettify | MIT License | github.com/jmblog/color-themes-for-google-code-prettify */', | |
'.prettyprint{background:#1d1f21;font-family:Menlo,Bitstream Vera Sans Mono,DejaVu Sans Mono,Monaco,Consolas,monospace;border:0!important}.pln{color:#c5c8c6}ol.linenums{margin-top:0;margin-bottom:0;color:#969896}li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9{padding-left:1em;background-color:#1d1f21;list-style-type:decimal}@media screen{.str{color:#b5bd68}.kwd{color:#b294bb}.com{color:#969896}.typ{color:#81a2be}.lit{color:#de935f}.pun{color:#c5c8c6}.opn{color:#c5c8c6}.clo{color:#c5c8c6}.tag{color:#c66}.atn{color:#de935f}.atv{color:#8abeb7}.dec{color:#de935f}.var{color:#c66}.fun{color:#81a2be}}' | |
].join('') | |
}, { | |
name: 'tomorrow night eighties', | |
css: ['/*! Color themes for Google Code Prettify | MIT License | github.com/jmblog/color-themes-for-google-code-prettify */', | |
'.prettyprint{background:#2d2d2d;font-family:Menlo,Bitstream Vera Sans Mono,DejaVu Sans Mono,Monaco,Consolas,monospace;border:0!important}.pln{color:#ccc}ol.linenums{margin-top:0;margin-bottom:0;color:#999}li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9{padding-left:1em;background-color:#2d2d2d;list-style-type:decimal}@media screen{.str{color:#9c9}.kwd{color:#c9c}.com{color:#999}.typ{color:#69c}.lit{color:#f99157}.pun{color:#ccc}.opn{color:#ccc}.clo{color:#ccc}.tag{color:#f2777a}.atn{color:#f99157}.atv{color:#6cc}.dec{color:#f99157}.var{color:#f2777a}.fun{color:#69c}}' | |
].join('') | |
}, { | |
name: 'tomrrow ngith blue', | |
css: ['/*! Color themes for Google Code Prettify | MIT License | github.com/jmblog/color-themes-for-google-code-prettify */', | |
'.prettyprint{background:#002451;font-family:Menlo,Bitstream Vera Sans Mono,DejaVu Sans Mono,Monaco,Consolas,monospace;border:0!important}.pln{color:#fff}ol.linenums{margin-top:0;margin-bottom:0;color:#7285b7}li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9{padding-left:1em;background-color:#002451;list-style-type:decimal}@media screen{.str{color:#d1f1a9}.kwd{color:#ebbbff}.com{color:#7285b7}.typ{color:#bbdaff}.lit{color:#ffc58f}.pun{color:#fff}.opn{color:#fff}.clo{color:#fff}.tag{color:#ff9da4}.atn{color:#ffc58f}.atv{color:#9ff}.dec{color:#ffc58f}.var{color:#ff9da4}.fun{color:#bbdaff}}' | |
].join('') | |
}, { | |
name: 'tranquil heart', | |
css: ['/*! Color themes for Google Code Prettify | MIT License | github.com/jmblog/color-themes-for-google-code-prettify */', | |
'.prettyprint{background:#2f3640;font-family:Menlo,Bitstream Vera Sans Mono,DejaVu Sans Mono,Monaco,Consolas,monospace;border:0!important}.pln{color:#e6e9ed}ol.linenums{margin-top:0;margin-bottom:0;color:#656d78}li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9{padding-left:1em;background-color:#2f3640;list-style-type:decimal}@media screen{.str{color:#ffce54}.kwd{color:#4fc1e9}.com{color:#656d78}.typ{color:#4fc1e9}.lit{color:#ac92ec}.pun{color:#e6e9ed}.opn{color:#e6e9ed}.clo{color:#e6e9ed}.tag{color:#ed5565}.atn{color:#a0d468}.atv{color:#ffce54}.dec{color:#ac92ec}.var{color:#e6e9ed}.fun{color:#e6e9ed}}' | |
].join('') | |
}, { | |
name: 'russell - tranquil :heart: remix', | |
css: ['/*! Color themes for Google Code Prettify | MIT License | github.com/jmblog/color-themes-for-google-code-prettify */', | |
'.prettyprint{background:#2f3640;font-family:Menlo,Bitstream Vera Sans Mono,DejaVu Sans Mono,Monaco,Consolas,monospace;border:0!important}.pln{color:#e6e9ed}ol.linenums{margin-top:0;margin-bottom:0;color:#656d78}li.L0,li.L1,li.L2,li.L3,li.L4,li.L5,li.L6,li.L7,li.L8,li.L9{padding-left:1em;background-color:#2f3640;list-style-type:decimal}@media screen{.str{color:#ffce54}.kwd{color:#4fc1e9}.com{color:#656d78}.typ{color:#4fc1e9}.lit{color:#ac92ec}.pun{color:#e6e9ed}.opn{color:#e6e9ed}.clo{color:#e6e9ed}.tag{color:#ed5565}.atn{color:#a0d468}.atv{color:#ffce54}.dec{color:#ac92ec}.var{color:#e6e9ed}.fun{color:#e6e9ed}}' | |
].concat( | |
//custom additions to tranquil. | |
/* codeblock styling */ | |
'.hc-chat-msg .msg-status .msg-line div.pre-wrap{-webkit-transition: border-color 0.8s; -ms-transition: border-color 0.8s; transition: border-color 0.8s;}' | |
'.hc-chat-msg .msg-status .msg-line.truncatable.expanded .pre-wrap{border-color: rgba(255,255,255,0);}' | |
'.hc-chat-msg .msg-status .msg-line.truncatable.tipruncated .pre-wrap{border-color: #ccc;}' | |
'ol.linenums{background:transparent;}' | |
/* Application title bar */ | |
'body.dark .aui-header {background: rgba(14,15,15, 1);}' | |
/* "New Chat" button*/ | |
'body.dark .aui-header .aui-button {background: #3C4444;}' | |
/* chat panel */ | |
'body.dark #hipchat .hc-chat-panel {/*border-color: #1D242A;*/}' | |
]).join('') | |
} | |
]; | |
var currentTheme = SetTheme('russell - tranquil :heart: remix'); | |
function ListThemes() { | |
return themes; | |
} | |
function SetTheme(name) { | |
var theme; | |
for(var i in themes){ | |
if (themes[i].name != name){ | |
continue; | |
} | |
theme = themes[i]; | |
addGlobalStyle(theme.css); | |
console.log('Hipchat theme "'+theme.name+'" set via Tampermonkey.'); | |
} | |
return theme; | |
} | |
// Your code here... | |
function addGlobalStyle(css) { | |
var head, style; | |
head = document.getElementsByTagName('head')[0]; | |
if (!head) { return; } | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = css; | |
head.appendChild(style); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment