|
// ==UserScript== |
|
// @name Dim.Twit |
|
// @namespace Sketch2 |
|
// @description Dims your Twitter feed. |
|
// @include https://twitter.* |
|
// @version 1.5 |
|
// @grant GM_info |
|
// @grant GM_getValue |
|
// @grant GM_setValue |
|
// @grant GM_xmlhttpRequest |
|
// @grant GM_registerMenuCommand |
|
// @updateURL https://git.io/vX2DV |
|
// @require https://git.io/vXaG2 |
|
// @require https://code.jquery.com/jquery-3.1.1.slim.min.js |
|
// @license GNU GPLv3 - https://www.gnu.org/licenses/gpl-3.0.html |
|
// ==/UserScript== |
|
//================================================================= |
|
|
|
// set your color variables to whatever you like. |
|
// standard websafe color codes |
|
// #RRGGBB or #RGB |
|
|
|
var Background, BG = '#224' |
|
var Twits = '#88a' |
|
|
|
var Text1 = '#fff' |
|
var Text2 = '#999' |
|
|
|
// #000000 or #000 = black |
|
// #FF0000 or #F00 = red |
|
// #00FF00 or #0F0 = green |
|
// #0000FF or #00F = blue |
|
// #FFFFFF or #FFF = white |
|
|
|
// <--- dimmer brighter ---> |
|
// 0 1 2 3 4 5 6 7 8 9 a b c d e f |
|
// '0' is off full on is 'f' |
|
|
|
//================================================================= |
|
// Don't edit below this line, unless you know jQuery / Javascript |
|
|
|
|
|
//dim outer background |
|
$('body') .css('background', BG); |
|
|
|
//dim background on your own userpage |
|
$('div#page-container') .css('background', BG); |
|
|
|
|
|
//wait a moment for page to load |
|
window .addEventListener('load', function() { |
|
|
|
//brighten background of messages again |
|
$('div.TwitterCard') .css('background', Twits); |
|
// they normally have a transparent background, |
|
// and dark text doesn't show up on a dark backdrop. |
|
|
|
}, false); |
|
|
|
|
|
//brighten text in the sidebar |
|
waitForKeyElements (".ProfileHeaderCard-name", sidebar); |
|
|
|
function sidebar (jNode) { |
|
jNode .css('color', Text1); |
|
$('.ProfileSidebar') .css('color', Text1); |
|
$('.ProfileHeaderCard-locationText') .css('color', Text2); |
|
$('.ProfileHeaderCard-joinDateText') .css('color', Text2); |
|
}; |
|
|
|
|
|
//full names take longer to show up on certain pages, |
|
//so we must wait longer for them to appear |
|
waitForKeyElements ("b.fullname", brightText); |
|
|
|
function brightText (jNode) { |
|
jNode .css('color', Text2); |
|
}; |