Skip to content

Instantly share code, notes, and snippets.

@digitaljhelms
Created February 9, 2011 18:36
Show Gist options
  • Save digitaljhelms/818985 to your computer and use it in GitHub Desktop.
Save digitaljhelms/818985 to your computer and use it in GitHub Desktop.
Campfire UI Cleanup
// ==UserScript==
// @name Campfire UI Cleanup
// @namespace https://gist.github.com/818985
// @description Some crap is just unnecessary
// @author Jeremy Helms
// @include *.campfirenow.com/room*
// ==/UserScript==
try {
var css = "#conference {display:none;}\n#corner_logo {display:none;}\nul.participant-list {height:auto;}\n";
if (typeof GM_addStyle != "undefined") { // Greasemonkey
GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") { // IEScripts
PRO_addStyle(css);
} else if (typeof addStyle != "undefined") { // IE
addStyle(css);
} else { // DOM
var heads = document.getElementsByTagName("head");
if (heads.length > 0) {
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
heads[0].appendChild(node);
}
}
function toggle(e) {
if(e.style.display == 'block' || !e.style.display)
e.style.display = 'none';
else
e.style.display = 'block';
}
function notifyError(e) {
new Insertion.Bottom('chat', "<tr class='topic_change_message message'><td colspan='2' style='color:#DA4632'><div>An error occurred: " + e + "</td></tr>");
}
// #Sidebar #Title h1 click:hides/shows #Sidebar #Title h2
document.getElementById('Title').getElementsByTagName('h1')[0].style.cursor = 'pointer';
document.getElementById('Title').getElementsByTagName('h1')[0].addEventListener('click', function(event) {
try { toggle(document.getElementById('Title').getElementsByTagName('h2')[0]); } catch(e) { notifyError(e); }
});
// #Sidebar .participants h3 click:hides/shows #Sidebar .participants #participants
document.getElementById('room_locking').getElementsByTagName('h3')[0].style.cursor = 'pointer';
document.getElementById('room_locking').getElementsByTagName('h3')[0].addEventListener('click', function(event) {
try { toggle(document.getElementById('participants')); } catch(e) { notifyError(e); }
});
// #Sidebar #files h3 click:hides/shows #Sidebar #files #file_list
document.getElementById('files').getElementsByTagName('h3')[0].style.cursor = 'pointer';
document.getElementById('files').getElementsByTagName('h3')[0].addEventListener('click', function(event) {
try { toggle(document.getElementById('file_list')); } catch(e) { notifyError(e); }
});
} catch(e) { notifyError(e); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment