Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div id="homepage" class="middle">
	<div id="terminal">
		<div>
			<div id="controls" class="middle"><span></span><span></span><span></span><div class="taille"></div></div>
			<div>Terminal</div>
		</div>
		<div id="content">
		</div>
	</div><span class="taille"></span>
</div>
            
          
!
            
              @import('https://fonts.googleapis.com/icon?family=Fira+Mono');
body {
	background: url(https://images.unsplash.com/photo-1443926818681-717d074a57af?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&w=1920&fit=max&s=e435d3ac89330d57124fef0de2aceb35);
	/*
	https://unsplash.com/@marceloquinan?utm_medium=referral&amp;utm_campaign=photographer-credit&amp;utm_content=creditBadge
	Download free do whatever you want high-resolution photos from Marcelo Quinan
	*/
	background-position: center;
	background-size: cover;
	color: white;
}
#homepage {
	height: 100%;
	text-align: center;
	padding: 50px;
}
#terminal {
	min-height: 350px;
	width: 650px;
	max-width: 100%;
	max-height: 100%;
	background: rgba(29, 31, 32, 0.85);
	border-radius: .3rem;
box-shadow: 0 20px 60px 10px rgba(0, 0, 0, 0.5);
	position: relative;
}
#terminal div:first-child div {
	height: 30px;
	line-height: 30px;
}
#controls {
	position: absolute;
}
#controls span {
	width: .875rem;
	height: .875rem;
	background: #fdbc40;
	margin: 0 0 0 8px;
	border-radius: 50%;
}
#controls span:first-child {
	background: #fc615c;
}
#controls span:nth-child(3) {
	background: #33c748;
}
#content {
	font-family: 'Fira Mono', monospace;
	text-align: left;
	font-size: 0.8rem;
	position: absolute;
	top: 30px;
	left: 13px;
	right: 13px;
	bottom: 0;
	overflow: auto;
}
.green { color: #9ADF3A; }
.yellow { color: #FFDE38; }
.red { color: #FF575A; }
.blue { color: #98d7ff; }

#content > div:last-child {
	margin-bottom: 20px;
}
#content form { display: inline; }
#content input {
	text-transform: initial;
}
#content > div, #content p {
	margin: 10px 0;
}
#content b {
	opacity: .3;
}
            
          
!
            
              const commands = {
	presentation: {
		cmd: 'presentation',
		res: 'Yann Le Vaguerès<br>TheRolf<br>Développeur HTML - CSS - JS - jQuery - PHP<br>Designer Photoshop affirmé<br><br><b>Tapez \'help\' pour plus de détails sur les commandes</b>'},
	visitors: {
		cmd: 'visitors',
		res: '<span class="blue">2626</span> visites'
	},
	whoami: {
		cmd: 'whoami',
		res: 'utilisateur: anonyme<br>ip: 12.34.567.890<br>useragent: ' + navigator.userAgent
	},
	help: {
		cmd: 'help',
		res: ' Aide commandes disponibles<br><br> hello	- Dis bonjour<br> clear	- Efface le terminal<br> date	- Renvoie la date<br> help	- Liste des commandes disponibles<br> whoami	- Affiche les informations sur l\'utilisateur'
	},
	visitors : { cmd: 'visitors', res: '<span class="blue">2626</span> visites'},
	hello: { cmd: 'hello', res: 'Salut, mec !'},
	date: { cmd: 'date', res: 'ceci est la date'}
}

const prephrase = '<span class="green">website</span> <span class="yellow"> (therolf)</span> <span class="red">#</span> ';

var form = $('<div>' + prephrase + '<form id="form"><input type="text" class="nostyle" autofocus /></form>').appendTo('#content');

function launchCommand(command) {
	$('<div>' + prephrase + command.cmd + '<p>' + command.res + '</p></div>').insertBefore(form)
}

launchCommand(commands.presentation);
launchCommand(commands.visitors);

$('#content').niceScroll({
	cursorcolor: '#303030',
	cursorborder: '0px none',
	autohidemode: false,
	cursorwidth: "8px",
	cursorborderradius: "4px",
	railpadding: { top: 0, left: 0, right: 0, bottom: 10 }
});

$('form').on('submit', function(e) {
	e.preventDefault();
	try {
		if($('input').val().trim() !== '') {
			launchCommand(commands[$('input').val()]);
		}
	} catch(error) {
		launchCommand({
			cmd: $('input').val(),
			res: '<div><p>' + $('input').val() + ': command not found</p></div>'
		});
		if($('input').val() === 'clear') {
			$('#content > *').not(':last').remove();
		}
	}
	$('input').val('');$('#content').getNiceScroll(0).resize().doScrollTop($('#content')[0].scrollHeight, 0);
})
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console