Created
February 23, 2017 13:45
-
-
Save timkindberg/1d064c773c3cbdd59cac058919fe974c to your computer and use it in GitHub Desktop.
Minimal JSBin TamperMonkey Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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'; | |
})(); |
Author
timkindberg
commented
Feb 23, 2017
- Download TamperMonkey: https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
- Create a new script
- Paste this script into the file (overwrite any existing contents)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment