Created
July 22, 2009 04:15
-
-
Save zed9h/151796 to your computer and use it in GitHub Desktop.
greasemonkey script to invert colors of cruise control builds view every 7 seconds
This file contains hidden or 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 cruisecontrol-flipcolors | |
// @namespace cruisecontrol-flipcolors | |
// @description invert colors of cruise control builds view every 7 seconds | |
// @include http://*cruisecontrol*/dashboard/tab/builds | |
// ==/UserScript== | |
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); | |
return style; | |
} | |
function changeCssByTag(tagName, cssKey, cssValue) { | |
var list = document.getElementsByTagName(tagName) | |
for(i in list) { obj = list[i] | |
obj.style[cssKey]=cssValue | |
} | |
} | |
window.addEventListener('load', | |
function() { | |
document.getElementById('header').style.display='none'; | |
document.getElementById('project_summary_panel').style.display='none'; | |
document.getElementsByTagName('body')[0].style.overflow = 'hidden'; | |
changeCssByTag('img', 'display', 'none'); | |
addGlobalStyle('.no_decoration ' + | |
'{ color: inherit ! important; }'); | |
addGlobalStyle('.passed, .failed ' + | |
'{ background-image: url() ! important; }'); | |
// .inactive, .discontinued, .unknown #666666 #CCCCCC | |
// .passed #003300 #B6FFB1 | |
// .failed #330000 #FFC2C9 | |
passed_inverse = | |
'.passed, .passed a.clickable_target ' + | |
'{ color: #FFCCFF ! important; background-color: #49004E ! important; }' | |
failed_inverse = | |
'.failed, .failed a.clickable_target ' + | |
'{ color: #CCFFFF ! important; background-color: #003D36 ! important; }' | |
inactive_inverse = | |
'.inactive, .discontinued, .unknown, ' + | |
'.inactive a.clickable_target, ' + | |
'.discontinued a.clickable_target, ' + | |
'.unknown a.clickable_target ' + | |
'{ color: #999999 ! important; background-color: #333333 ! important; }' | |
body_inverse = 'body, .tabContent { background-color: #000000 ! important }' | |
passed = addGlobalStyle(passed_inverse) | |
failed = addGlobalStyle(failed_inverse) | |
inactive = addGlobalStyle(inactive_inverse) | |
body = addGlobalStyle(body_inverse) | |
setInterval(function () { | |
passed.innerHTML = passed.innerHTML ? '' : passed_inverse; | |
failed.innerHTML = failed.innerHTML ? '' : failed_inverse; | |
inactive.innerHTML = inactive.innerHTML ? '' : inactive_inverse; | |
body.innerHTML = body.innerHTML ? '' : body_inverse; | |
changeCssByTag('img', 'display', 'none'); | |
}, 7000) | |
}, | |
true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment