EE v.10

By Sjef Bosman Last update May 14, 2012 — Installed 4,641 times.

There are 27 previous versions of this script.

// ==UserScript==
// @name           EE v.10
// @namespace      EE
// @description    EE v.10 Expert interface: less white, less ugly, less images
// @include        http://www.experts-exchange.com/*
// @include        http://cms.l3.redsrci.com/*
// @require        http://github.com/sizzlemctwizzle/GM_config/raw/master/gm_config.js
// ==/UserScript==
// Copyright (c) 2012 Sjef Bosman
// Release 1.4.1

var release= "1.4";

GM_addStyle("#GM_config {width: 260px !important; height: 460px !important;z-index:9999!important}");

GM_registerMenuCommand( "EE v.10 Options", eev10Config, "o" );
GM_config.init("EE v.10 Options (V" + release + ")", "#GM_config .config_header {margin: -10px -8px 4px -8px; padding: 4px; font-size: 14px; background: #E0E0D0} .config_var input {float: right} #GM_config_field_DW,#GM_config_field_DB {width:50px} #GM_config textarea {font-size: 10px; width:100%; height:7em}",
	/* Fields object */
	{
		'DW':	{
			'label': 'Delta width', 'type': 'text', 'default': '250'
		},
		'Welcome':	{
			'label': 'Disable intro   ', 'type': 'checkbox', 'default': false
//		},
//		'EEple':	{
//			'label': 'Hide EEples', 'type': 'checkbox', 'default': true
		},
		'NW':	{
			'label': 'Alert when new version', 'type': 'checkbox', 'default': true
		},
		'Col2':	{
			'label': 'Hide right column', 'type': 'checkbox', 'default': false
		},
		'TE':	{
			'label': 'Hide Top Experts', 'type': 'checkbox', 'default': false
		},
		'Footer':	{
			'label': 'Hide footer', 'type': 'checkbox', 'default': false
		},
		'Reduce':	{
			'label': 'Allow negative delta\n(unsafe)', 'type': 'checkbox', 'default': false
		},
		'MenHor':	{
			'label': 'Horizontal menu', 'type': 'checkbox', 'default': false
		},
		'DB':	{
			'label': 'Delta menu button width', 'type': 'text', 'default': '-30'
		},
		'BL':	{
			'label': 'Askers tagged Black', 'type': 'textarea', 'default': ''
		},
		'GL':	{
			'label': 'Askers tagged Green', 'type': 'textarea', 'default': ''
		}
	}
);

GM_addStyle("body {font-family: verdana,univers,sans-serif !important}");
GM_addStyle(".ctCommentView .meta { margin-bottom: 2px;}");
GM_addStyle(".ctCommentView .comment-type { margin: 4px}");
GM_addStyle("div.content {padding-bottom: 2px !important}");
GM_addStyle(".ctContentView .body { background: white}");
//GM_addStyle(".questionCommentsView .solution .grade { top:0px!important}");
GM_addStyle("#col1 .component-alt-bg2 .body, #col1 .frcomponent-alt-bg2 .frsection { background: white !important}");

var reduce= GM_config.get("Reduce")==true;

var wdelta= (GM_config.get("DW")==""? 250: (+GM_config.get("DW")))-250;
var wdelta2= +wdelta+50;
var extra= 0;
if(GM_config.get("Col2")) {
	GM_addStyle("#col2Wrap {display:none!important}");
	extra= 300;
}
changeWidth('#bodyWrapper', wdelta);
changeWidth('#columnsWrapper', wdelta);

wdelta+= extra;
wdelta2+= extra;

var bdelta= GM_config.get("DB")==""? -30: (+GM_config.get("DB"));

//if(GM_config.get("EEple")!=false) {
//	GM_addStyle(".avatar, .eeple {display:none!important}");
//	changeWidth('.ctCommentView .comment-inner', wdelta2+50);
//} else
  changeWidth('.ctCommentView .comment-inner', wdelta);

if(GM_config.get("TE"))
	GM_addStyle("#topExperts {display:none!important}");
if(GM_config.get("Footer"))
	GM_addStyle("#footer {display: none}");

if(GM_config.get("MenHor")) {
	GM_addStyle("body {position: relative}");
	GM_addStyle(".pageShareAndManage {left: 0!important;margin:0 auto!important;top:151px!important;width:100%;border:0;position:absolute!important}");
	var nbuttons= document.getElementsByClassName("monitorWrapper first").length? 9: 8;
	GM_addStyle(".pageShareAndManage .body {width:"+(nbuttons*(116+bdelta))+"px;margin:0 auto!important;border: 1px solid #E5E5E5;border-radius: 5px 5px 5px 5px;}");
	GM_addStyle(".share-list,.manage-list {display: inline-block!important;}");
	GM_addStyle("#___plusone_0, #___plusone_0 iframe {height: 20px!important;}");
	GM_addStyle(".pageShareAndManage .share-list li, .pageShareAndManage .manage-list li {display: inline-block!important;}");
	GM_addStyle("#bodyWrapper {margin-top:125px!important}");
	GM_addStyle(".monitorWrapper.first {display:inline-block!important}");
	changeWidth('.pageShareAndManage .share-list li, .pageShareAndManage .manage-list li', bdelta);
	var uc = document.getElementById('wrapper2');
	var psam = document.getElementById('pageShareAndManage');
	if(uc && psam)
		uc.appendChild(psam);
} //else
	//GM_addStyle('.pageShareAndManage { left:' + (489-wdelta/2) + "px !important}");

changeWidth('#col1Wrap', wdelta);
changeWidth("#col1 .component-alt-bg2, #col1 .frcomponent-alt-bg2", wdelta);
changeWidth("#col1 .component-alt-bg .body, #col1 .frcomponent-alt-bg .frbody", wdelta);
changeWidth("#col1 .component-alt-bg2 .body, #col1 .frcomponent-alt-bg2 .frsection", wdelta);
setRepeat("#col1 .component-alt-bg .body, #col1 .frcomponent-alt-bg .frbody", 'repeat-x');
changeWidth(".recentActivityUberFeed .section .content", wdelta2);
changeWidth(".questionCommentAdd", wdelta);
changeWidth(".formatted-textarea", wdelta);
changeWidth(".formatted-textarea textarea", wdelta);
changeWidth(".formatted-textarea .controls", wdelta);
changeWidth(".ctContentView .trailing-meta, #post-preview .trailing-meta", wdelta);
setRepeat(".ctContentView .trailing-meta, #post-preview .trailing-meta", 'repeat');
changeWidth(".ctContentView .trailing-meta dl, #post-preview .trailing-meta dl", wdelta2);
setRepeat(".ctContentView .trailing-meta dl, #post-preview .trailing-meta dl", 'repeat-x');
changeWidth("#uberContainer .featuredArticleTA", wdelta);
changeWidth("#featuredArticleTA .body", wdelta);
changeWidth("#featuredArticleTA .section-1", wdelta);
changeWidth("#featuredArticleTA .section", wdelta/2-5);
changeWidth(".taPopWrap .taPopArticles", wdelta/2);
changeWidth(".taPopWrap .taPopQuestions", wdelta/2);
changeWidth(".ctCommentView .attachment .snippet", wdelta);
changeWidth("#col1 .ctCommentView .attachment, #col1 .ctCommentView .attachments", wdelta);
changeWidth(".attachment, .attachments", wdelta);
changeWidth(".attachment .snippet", wdelta);
changeWidth(".questionView .auto-close .heading span", wdelta);
changeWidth(".questionView .auto-close .heading", wdelta);
changeWidth(".questionView .auto-close .content", wdelta);
changeWidth(".questionCommentAdd .auto-close .heading span", wdelta);
changeWidth(".questionCommentAdd .auto-close .heading", wdelta);
changeWidth(".questionCommentAdd .auto-close", wdelta);
changeWidth("#col1 #post-preview .attachment", wdelta);
changeWidth("#col1 .btf-content .attachment .buttons", wdelta);
//changeWidth("", wdelta);
//changeWidth("", wdelta);
//changeWidth("", wdelta);
//changeWidth("", wdelta);

/*
zReIndex();
*/
GM_addStyle(".pageShareAndManage .manage-list .monitor a {background-position: 4px -56px !important;}");
GM_addStyle(".pageShareAndManage .manage-list .monitor.monitoring span {text-indent: 0px;}");
GM_addStyle(".pageShareAndManage .monitor.monitoring { background: #E8FBC4 !important}");
GM_addStyle(".pageShareAndManage .monitor.not-monitoring { background: #ffc !important}");
GM_addStyle(".pageShareAndManage .share-list li, .responsive .pageShareAndManage .manage-list li {height:30px;}");
GM_addStyle(".pageShareAndManage li .the-widget {padding:6px 0 2px; text-indent:40px}");
GM_addStyle(".taggedbl {font-weight:bold; color: white!important; background:#444; padding:4px 8px}");
GM_addStyle(".taggedgl {font-weight:bold; color: white!important; background:#040; padding:4px 8px}");

tag();

if(!GM_config.get("Welcome"))
	alert("EE v.10 loaded\n\nTo configure this script, click Tools/Greasemonkey/User Script Commands\n\n\u00A9 2012, Sjef Bosman");
/*
try {
	var oldrelease= GM_config.get("Release");
} catch(e) {
	var oldrelease= "";
}
if(oldrelease!=release) {
	if(GM_config.get("NW"))
		alert("EE v.10: new features available!\n\nSee Tools/Greasemonkey/User Script Commands");
	GM_config.set("Release", release);
	GM_config.save();
}
*/

function eev10Config() {
	GM_config.open();
}

function changeWidth(id, n) {
	if(n<=0 && !reduce)
		return;
	var r= getAllRules(id,'width');
	deltaRuleValue(r, 'width', n)
}

function changeLeft(id, n) {
	var r= getAllRules(id,'left');
	deltaRuleValue(r, 'left', n)
}

function setDisplay(id, v) {
	var r= getAllRules(id);
	if(r.length)
	  r[r.length-1].display= v;
}

function setRepeat(id, v) {
	var r= getAllRules(id);
	if(r.length)
	  r[0].repeat= v;
}

function deltaRuleValue(rules, attrib, delta) {
	for(var ri in rules) {
		var w= rules[ri].style['width'];
		if(!w)
		  continue;
		if(w.match(/%$/))
		  continue;
		var v= parseInt(w);
		if(v!="NaN")
		  rules[ri].style['width']= (v+delta) + "px";
	}
}

function getAllRules(styleId, attrib) {
	var rulesFound= new Array();
	for(var sh in document.styleSheets) {
	  var sheet= document.styleSheets[sh];
	  for(var r in sheet.cssRules) {
	    var rule= sheet.cssRules[r];
	    if(rule.selectorText && rule.selectorText==styleId) //.indexOf(styleId)>=0)// && rule.style[attrib])
	      rulesFound.push(rule);
		}
	}
	return rulesFound;
}

function getAllRulesWith(attrib) {
	var rulesFound= new Array();
	for(var sh in document.styleSheets) {
	  var sheet= document.styleSheets[sh];
	  for(var r in sheet.cssRules) {
	    var rule= sheet.cssRules[r];
	    if(rule.cssText && rule.cssText.indexOf(attrib)>=0)
	      rulesFound.push(rule);
		}
	}
	return rulesFound;
}

function zReIndex() {
	var r= getAllRulesWith('z-index');
	var u= [];
	for(var ri in r) {
	  u.push(r[ri].style.zIndex);
	}
	for(var ri in r) {
	  r[ri].style.zIndex= u.indexOf(r[ri].style.zIndex)+100;
	}
}

function tag() {
	var anchors= document.getElementsByTagName("a");
	var users= GM_config.get("BL").split("\n");
	taggem(anchors, users, "taggedbl");
	var users= GM_config.get("GL").split("\n");
	taggem(anchors, users, "taggedgl");
}

function taggem(anchors, users, tag) {
  for(var j= 0; j<users.length; j++) {
    var user= users[j];
    if(user=="")
      continue;
		for(var i= 0; i<anchors.length; i++)
	  	if(anchors[i].innerHTML==user)
	    	anchors[i].className+= " " + tag;
	}
}