Last active
December 22, 2017 07:05
-
-
Save phenax/94e12c3e56adc4b20ff7db0d3f21c0be to your computer and use it in GitHub Desktop.
Turn any page into a random chuck norris joke
This file contains hidden or 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
(() => { | |
const chuckFace = 'http://wallsdesk.com/wp-content/uploads/2016/11/Chuck-Norris-HD.jpg'; | |
const $body = document.body; | |
const $div = document.createElement('div'); | |
$body.innerHTML = ''; | |
$body.appendChild($div); | |
Object.assign($div.style, { width: '100%',fontSize: '1.5em', padding:'.5em', color: '#fff', textShadow: '1px 1px 1px #000', textAlign: 'center', backgroundColor: 'rgba(0,0,0,.4)' }); | |
Object.assign($body.style, { background: `url(${chuckFace}) no-repeat center`, backgroundSize: 'cover', display: 'flex', alignItems: 'center' }); | |
(async () => { | |
const joke = await (async () => await fetch('https://api.chucknorris.io/jokes/random').then(d => d.json()))(); | |
$div.textContent = joke.value; | |
})(); | |
})(); | |
// javascript:(()=>{const b=document.body,c=document.createElement('div');b.innerHTML='',b.appendChild(c),Object.assign(c.style,{width:'100%',fontSize:'1.5em',padding:'.5em',color:'#fff',textShadow:'1px 1px 1px #000',textAlign:'center',backgroundColor:'rgba(0,0,0,.4)'}),Object.assign(b.style,{background:`url(${'http://wallsdesk.com/wp-content/uploads/2016/11/Chuck-Norris-HD.jpg'}) no-repeat center`,backgroundSize:'cover',display:'flex',alignItems:'center'}),(async()=>{const e=await(async()=>await fetch('https://api.chucknorris.io/jokes/random').then(f=>f.json()))();c.textContent=e.value})()})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment