Skip to content

Instantly share code, notes, and snippets.

@sweeneyapps
Last active October 16, 2018 02:59
Show Gist options
  • Save sweeneyapps/db0880b07b59adccc1f7903e35de09f2 to your computer and use it in GitHub Desktop.
Save sweeneyapps/db0880b07b59adccc1f7903e35de09f2 to your computer and use it in GitHub Desktop.
making your life easier (no scrolling) perfect for 2 monitors.
// ==UserScript==
// @name Rainforest UI fixes
// @namespace http://tampermonkey.net/
// @version 0.5
// @description Taking over the UI!
// @author Paul Sweeney Jr.
// @match https://tester.rainforestqa.com/tester/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function createOption(value, text) {
var option = document.createElement('option');
option.setAttribute('value', value);
option.innerHTML = text;
return option;
}
var body = document.body;
var optDropDown = document.createElement('select');
var normal = createOption('normal', 'Normal');
var topMin = createOption('top', 'Top');
var side = createOption('side', 'Side 80-20');
var sideFixed = createOption('beta400', 'Side Fixed Mobile');
var side50 = createOption('side50', 'Side 50-50');
optDropDown.appendChild(normal);
optDropDown.appendChild(topMin);
optDropDown.appendChild(side);
optDropDown.appendChild(sideFixed);
optDropDown.appendChild(side50);
var style = document.createElement('style'); // to break-word for url copy
style.innerHTML = "div[class*='instructions_main']{word-wrap: break-word;} span[class*='clickToCopy_holder']{word-wrap: break-word; width:100%}";
var hideSteps = document.createElement('button');
hideSteps.innerHTML = 'show/hide steps';
var toggleFontSize = document.createElement('button');
toggleFontSize.innerHTML = 'toggle FontSize';
body.insertBefore(optDropDown, body.firstChild);
body.insertBefore(hideSteps, body.firstChild);
body.insertBefore(toggleFontSize, body.firstChild);
body.insertBefore(style, body.firstChild);
toggleFontSize.onclick = function(event) {
var paper = document.querySelector('div[class*="instructions_paper"]');
paper.style.fontSize = paper.style.fontSize === '200%' ? '100%' : '200%';
};
hideSteps.onclick = function(event) {
var steps = document.querySelector('div[class*="steps_steps"]');
if (steps.style.display === 'none') {
steps.style.display = '';
} else {
steps.style.display = 'none';
}
};
optDropDown.onchange = function(event) {
var layout = event.target.value;
var jobIDBar = document.querySelector('#page > div > div:nth-child(2) > div:nth-child(1)');
var userBar = document.querySelector('div[class*="assignment_job"] > div:nth-child(1)');
var qa = document.querySelector('div[class*="assignment_job"]');
var mainTerminal = document.querySelector('div[class*="terminal_main"]');
var tracking = document.querySelector('#TrackingContainer'); // bugfix: layout fix
var instruction = document.querySelector('div[class*="instructions_main"]');
var steps = document.querySelector('div[class*="steps_steps"]');
if (layout === 'normal') {
jobIDBar.style.display = 'flex';
userBar.style.display = 'flex';
qa.style.width = '100%';
qa.style.float = 'left';
qa.style.position = "relative";
mainTerminal.style.top = '';
mainTerminal.style.width = '100%';
mainTerminal.style.marginLeft = "";
instruction.parentNode.insertBefore(steps, instruction);
instruction.style.marginTop = "";
} else {
jobIDBar.style.display = 'none';
userBar.style.display = 'none';
if (layout === 'top') {
qa.style.top = '-10px';
qa.style.width = '100%';
qa.style.float = '';
qa.style.position = "relative";
mainTerminal.style.width = '100%';
mainTerminal.style.top = '-40px';
mainTerminal.style.marginLeft = "";
instruction.parentNode.insertBefore(steps, instruction);
instruction.style.marginTop = "";
} else {
instruction.parentNode.insertBefore(instruction, steps);
instruction.style.marginTop = "60px";
qa.style.top = '-10px';
if(layout === 'side50') {
qa.style.width = '50%';
qa.style.position = "relative";
mainTerminal.style.width = '50%';
mainTerminal.style.marginLeft = "";
} else {
if (layout === 'beta400') {
qa.style.top = '20px';
qa.style.width = "400px";
qa.style.position = "fixed";
mainTerminal.style.marginLeft = "400px";
mainTerminal.style.width = '100%';
} else {
qa.style.position = "relative";
qa.style.width = '20%';
mainTerminal.style.width = '80%';
mainTerminal.style.marginLeft = "";
}
}
tracking.style.display = 'flex'; // bugfix: display inline-block messing w/ the layout
qa.style.float = 'left';
mainTerminal.style.top = '-10px';
}
}
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment