Skip to content

Instantly share code, notes, and snippets.

Created December 15, 2012 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4299061 to your computer and use it in GitHub Desktop.
Save anonymous/4299061 to your computer and use it in GitHub Desktop.
This makes chatrooms on MocoSpace actually usable.
// ==UserScript==
// @name MocoSpace Plus
// @namespace http://monokro.me/
// @version 0.1
// @description Makes mocospace not-so-lame.
// @match http://www.mocospace.com/html/chat/*
// @copyright 2012+, Brandon R. Stoner
// ==/UserScript==
(function(undefined) {
function boundWidths(min, max) {
return (function(element) {
element.style.minWidth = min;
element.style.maxWidth = max;
});
}
var elementActions = {
"actions": {
"hideElement": (function(element) {
element.style.display = "none";
}),
"fullHeight": (function(element) {
var tagNameIndex, tagNames = ['body', 'html'];
for (tagNameIndex in tagNames) {
console.log(tagNames[tagNameIndex]);
var elementIndex,
elements = document.getElementsByTagName(tagNames[tagNameIndex]);
for (elementIndex in elements) {
if (typeof elements[elementIndex] != 'undefined' && typeof elements[elementIndex].style != 'undefined') {
elements[elementIndex].style.height = '100%';
}
}
}
element.style.height = '100%';
})
},
"selectors": {
"#header": "hideElement",
".warningmsg": "hideElement",
"#footer": "hideElement",
"#wrapper": "fullHeight",
"#content": [
boundWidths('100px', '100%'),
"fullHeight"
],
"#conversations": "fullHeight"
},
"initialize": (function() {
var selector,
action, actionName,
elements,
elementIndex, element;
document.removeEventListener("load", elementActions.initialize);
for (selector in elementActions.selectors) {
actionName = elementActions.selectors[selector];
elements = document.querySelectorAll(selector);
for (elementIndex = 0; elementIndex < elements.length; ++elementIndex) {
element = elements.item(elementIndex);
elementActions.parseAction(actionName, element);
}
}
}),
"parseAction": (function(action, element) {
if (typeof action == 'string') {
action = elementActions.actions[action];
} else if (typeof action == 'object') {
var actionIndex;
for (actionIndex in action) {
elementActions.parseAction(action[actionIndex], element);
}
return;
}
action(element);
})
};
document.addEventListener("load",
elementActions.initialize,
false);
})();
@monokrome
Copy link

I made this, but - just like everything else that they've touched in the last year - GitHub has completely ruined the GIST portion of the site. When you go to gist, you don't get automatically logged in. Then you post something which is now owned by "anonymous", and there's a "sign in to comment button" which automatically logs me in. That's some horrible UX. Why did they get rid of the "Login to claim this gist" button? Oh well.

Now I have to fork it if changes ever occur. Fantastic.

@monokrome
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment