- // ==UserScript==
- // @name Atmosphir Forum Adjustments
- // @namespace scupizzaboy
- // @include http://beta.atmosphir.com/atmosphir/forum*
- // ==/UserScript==
- // VERSION 1.2
- function userDefined() {
- // TURN STUFF ON AND OFF HERE
- // Turn something off by putting // before it
- extraSpace(); // Moves Categories below friends, expands some avatars and post space
- allDiscussionsLink(); // Inserts All Discussions link into Categories;
- pmLink(); // Inserts PM link below avatars
- }
- // NO EDITING BEYOND THIS POINT
- function xpath(query) {
- return document.evaluate(query, document, null,
- XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
- }
- 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);
- }
- function buildLink(url, text) {
- var link;
- link = document.createElement('a');
- link.setAttribute('href', url);
- link.appendChild(document.createTextNode(text));
- return link;
- }
- function extraSpace() {
- var path, catDiv, friDiv, textDiv;
- catDiv = xpath("//div[@class='categories']").snapshotItem(0);
- friDiv = xpath("//div[@class='friends']").snapshotItem(0);
- if (catDiv && friDiv) {
- friDiv.parentNode.insertBefore(catDiv, friDiv.nextSibling);
- addGlobalStyle(" #contentArea #right-column .right .categories { margin: 10px 10px 0; color: black;} ");
- addGlobalStyle(" #contentArea #right-column .right .categories a { color: #1D83B4; font-weight: bold; } ");
- addGlobalStyle(" #contentArea #right-column .right .categories ul { list-style: none outside none; margin: 0; padding: 0; } ");
- addGlobalStyle(" #contentArea #right-column .right .categories ul li { margin: 0; padding: 0 0 3px; } ");
- addGlobalStyle(" #contentArea #left-column .left .forum-main .inner .main-content { width: 620px; } ");
- addGlobalStyle(" #contentArea #left-column .left .forum-main .inner .main-content .post .post-right { width: 546px; } ");
- addGlobalStyle(" #contentArea #left-column .left .forum-main .inner .main-content .post .post-left { width: 74px; } ");
- path = xpath("//div[@class='main-content']//img[contains(@alt,'avatar')]");
- for (var i = 0; i < path.snapshotLength; i++) {
- path.snapshotItem(i).setAttribute('style', 'width: 64px; height: 64px;');
- }
- textDiv = xpath("//textarea[@class='markItUpEditor']").snapshotItem(0);
- if (textDiv) textDiv.setAttribute('style', 'border: 1px solid rgb(204, 204, 204); height: 300px; width: 98%;');
- }
- }
- function allDiscussionsLink() {
- var catDiv, path, discList;
- catDiv = xpath("//div[@class='categories']").snapshotItem(0);
- if (catDiv) {
- path = catDiv.getElementsByTagName('ul');
- if (path) {
- path = path[0].getElementsByTagName('li');
- if (path) {
- discList = document.createElement('li');
- discList.appendChild(buildLink('http://beta.atmosphir.com/atmosphir/forum', 'All Discussions'));
- path[0].parentNode.insertBefore(discList, path[0]);
- }
- }
- }
- }
- function pmLink() {
- var path, profDiv, str;
- path = xpath("//div[@class='main-content']//div[@class='post-left']//a[contains(@href,'/atmosphir/profile/')]");
- for (var i = 0; i < path.snapshotLength; i++) {
- profDiv = path.snapshotItem(i);
- str = 'http://beta.atmosphir.com/atmosphir/me/mailbox/send?recipients=';
- str += profDiv.getAttribute('href').replace('/atmosphir/profile/', '');
- profDiv.parentNode.appendChild(buildLink(str, 'Send PM'));
- }
- }
- userDefined();
- // eof
