Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@timkindberg
Created February 23, 2017 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timkindberg/1d064c773c3cbdd59cac058919fe974c to your computer and use it in GitHub Desktop.
Save timkindberg/1d064c773c3cbdd59cac058919fe974c to your computer and use it in GitHub Desktop.
Minimal JSBin TamperMonkey Script
// ==UserScript==
// @name Minimal JSBin
// @namespace http://egghead.io/
// @version 0.1
// @description Hide distractions in jsbin to help learners focus on taught content
// @author Tim Kindberg
// @include https://jsbin.com*
// @grant none
// ==/UserScript==
if (window.self != window.top) { return; }
function ce(n) { return document.createElement(n); } // end of function
function addStyle(css) {
var head = document.head || document.getElementsByTagName('head')[0];
if (head) {
var style = ce("style");
style.type = "text/css";
style.appendChild(document.createTextNode(css));
head.appendChild(style);
}
}
function hideElements(els) {
addStyle(els.map(function(el) { return el + ' { display: none !important; }'; }).join(' '));
}
(function() {
'use strict';
hideElements([
'.buttons > .menu:nth-child(2)',
'#sharemenu',
'.help',
'#infocard',
'.stretch.live.panel > .label > .name',
'.stretch.live.panel > .label > .size',
'#jsbinurl'
]);
addStyle('main { height: 100% !important; }');
document.getElementById('runwithalerts').textContent = 'Run';
console.log(document.querySelector('.options'));
document.getElementById('live').querySelector('.options').querySelector('label').childNodes[0].nodeValue = 'Autorun';
})();
@timkindberg
Copy link
Author

  1. Download TamperMonkey: https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
  2. Create a new script
  3. Paste this script into the file (overwrite any existing contents)

@timkindberg
Copy link
Author

It turns this:

screen shot 2017-02-23 at 8 48 45 am

Into this:

screen shot 2017-02-23 at 8 48 25 am

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