JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
#app-wall(
v-bind:class="{'full': isFull}"
v-bind:style="{backgroundColor: actualSkin.wall}"
)
div#app
header
| just-a-file.md
.buttons
.editor
textarea.code(
v-model="code"
v-bind:style="{color: actualSkin.color}"
)
.result(v-html="compiledOutput")
.settings(v-bind:class="{'active': isSettings}")
h2 Settings
i.fa.fa-window-close-o(
@click="isSettings = false"
)
h3 Editor Theme
.skin(
v-for="skin in skins"
v-bind:class="{'active': skin.isActive}"
v-bind:style="{background:skin.color}"
@click="setSkin(skin)"
)
h3 Screen
span.toggleView(
v-show="!isFull" @click="isFull = true"
)
i.fa.fa-window-maximize
| Full Screen
span.toggleView(
v-show="isFull" @click="isFull = false"
)
i.fa.fa-window-restore
| Compact
h3 Update
span.search(
@click="updateMe"
)
i.fa.fa-refresh
| Search for updates
.alert(v-bind:class="{'updating': isUpdating}")
.text Hehehe, serious?? You know it's not gonna happen, right?
footer(v-bind:style="{background:actualSkin.background}")
| {{ appTitle }}
i.fa.fa-cog(
v-bind:class="{'lookme': isSeen}"
@click="showSettings"
)
// FONTS
@import url('https://fonts.googleapis.com/css?family=Noto+Sans:400,700|Source+Code+Pro');
$primary-font: 'Noto Sans', sans-serif;
$code-font: 'Source Code Pro', monospace;
// COLORS
$white: #fff;
$light-gray: lightgray;
$black: #000;
$red: rgba(#c00, .6);
$orange: rgba(#f90, .5);
$green: rgba(#0c0, .4);
// SETTINGS
$foot-height: 20px;
// GENERAL
*, *::before, *::after{
box-sizing: border-box;
}
body{
font-family: $primary-font;
font-size: 16px;
}
h1,h2,h3,h4,h5,h6{
margin-top: 0;
}
// EDITOR STYLES
#app-wall{
min-height: 100vh;
padding: 5rem 0;
transition: background .4s;
&.full{
padding: 0;
#app{
width: 100%;
height: calc(100vh - 40px);
padding: 0;
font-size: 100%;
}
}
}
#app{
width: 40rem;
max-width: 100%;
height: 400px;
margin: 0 auto;
padding: 0 1rem;
font-size: 70%;
transition: all .4s;
}
header{
position: relative;
height: $foot-height;
line-height: $foot-height;
text-align: center;
font-size: .75em;
color: rgba($black, .8);
background: $light-gray;
border-radius: 5px 5px 0 0;
.buttons{
position: absolute;
top: 6px;
left: 22px;
width: 8px;
height: 8px;
background: $orange;
border-radius: 50%;
box-shadow: -12px 0 0 $red,
12px 0 0 $green;
}
}
.editor{
position: relative;
min-height: 100%;
background: rgba($black, .2);
display: flex;
overflow: hidden;
.code,
.result,
.settings{
width: 50%;
padding: 1rem;
}
.code{
resize: none;
border: none;
font-family: $code-font;
background: rgba($black, .8);
outline: none;
transition: color .4s;
}
.result{
background: $white;
hr{
border: none;
border-bottom: 1px solid rgba($black, .2);
}
img{
max-width: 100%;
height: auto;
}
ul, ol{
margin-left: 0;
padding-left: 20px;
li{
margin-left: 0;
}
}
}
.settings{
position: absolute;
top: 0;
right: 0;
width: 51%;
height: 100%;
color: $white;
background: #000;
transform: translateX(101%);
transition: transform .4s;
&.active{
transform: translateX(0);
}
h2{
position: relative;
.fa{
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
transition: transform .3s;
font-size: .85em;
cursor: pointer;
&:hover{
transform: translateY(-50%) rotate(-180deg);
}
}
}
h3{
margin-top: 2rem;
padding: .25rem .2rem .2rem;
font-weight: normal;
background: rgba($white, .2);
}
.skin{
display: inline-block;
width: 14px;
height: 14px;
margin-right: 0.5rem;
border-radius: 50%;
cursor: pointer;
vertical-align: middle;
opacity: .5;
transition: opacity .4s;
&:hover,
&.active{
opacity: 1;
}
}
.search,
.toggleView{
cursor: pointer;
font-size: .85em;
.fa{
margin-right: .5rem;
}
}
.toggleView{
&:hover{
.fa-window-maximize{
animation: pulse 1s linear infinite;
}
.fa-window-restore{
animation: pulse 1s linear infinite reverse;
}
}
}
.search{
&:hover{
.fa{
animation: rotation 1s linear infinite;
}
}
}
.alert{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background-color: rgba($white, .85);
transform: translateY(-100%);
transition: transform .4s;
&.updating{
transform: translateY(0);
}
.text{
padding: 1rem 1rem 1.1rem;
text-align: center;
background: $black;
line-height: 1.4;
}
}
}
}
footer{
position: relative;
height: $foot-height;
line-height: $foot-height;
text-align: center;
text-transform: uppercase;
font-size: .75em;
font-weight: bold;
color: rgba($black, .4);
border-radius: 0 0 5px 5px;
box-shadow: 0 12px 15px -8px rgba($black, .9);
transition: background .4s;
.fa{
position: absolute;
right: 10px;
top: 3px;
font-size: 14px;
cursor: pointer;
border-radius: 50%;
transition: color .4s;
&:hover{
color: rgba($black, .8);
}
&.lookme{
animation: blink 1s linear infinite alternate;
}
}
}
// ANIMATIONS
@keyframes blink{
from{
color: rgba($black, .4);
box-shadow: 0 0 10px 7px rgba(yellow, .2);
}
to{
color: rgba($black, .8);
box-shadow: 0 0 10px 7px rgba(yellow, .8);
}
}
@keyframes rotation{
from{
transform: rotate(0);
}
to{
transform: rotate(360deg);
}
}
@keyframes pulse{
from{
transform: scale(0);
}
to{
transform: scale(1.1);
}
}
/**
* ROOT COMPONENT
*/
var app = new Vue({
el: '#app-wall',
data: {
appTitle: 'VueDown Editor',
code: '# Hello dev \n\n---\n\nType **here** some markdown! ',
isSeen: true,
isSettings: false,
isFull: false,
isUpdating: false,
actualSkin: {
color: '#0cc',
background: 'rgba(0, 204, 204, .4)',
wall: 'rgba(0, 204, 204, .15)'
},
skins: [
{
color: '#0cc',
background: 'rgba(0, 204, 204, .4)',
wall: 'rgba(0, 204, 204, .15',
isActive: true
},
{
color: '#0c0',
background: 'rgba(0, 204, 0, .4)',
wall: 'rgba(0, 204, 0, .15',
isActive: false
},
{
color: '#f60',
background: 'rgba(255, 102, 0, .4)',
wall: 'rgba(255, 102, 0, .15)',
isActive: false
},
{
color: '#f0f',
background: 'rgba(255, 0, 255, .4)',
wall: 'rgba(255, 0, 255, .15)',
isActive: false
},
{
color: '#e00',
background: 'rgba(204, 0, 0, .2)',
wall: 'rgba(204, 0, 0, .15)'
}
]
},
computed: {
compiledOutput(){
return marked(this.code, {sanitize: true});
}
},
methods: {
showSettings(){
this.isSettings = ! this.isSettings;
this.isSeen = false;
},
setSkin(skin){
this.actualSkin.color = skin.color;
this.actualSkin.background = skin.background;
this.actualSkin.wall = skin.wall;
// Toggle the actual active skin
this.skins.map(function(obj){
if(obj === skin){
obj.isActive = true;
}
else{
obj.isActive = false;
}
})
},
updateMe(){
var ctx = this;
ctx.isUpdating = true;
setTimeout(function(){
ctx.isUpdating = false;
}, 4000);
}
}
});
Also see: Tab Triggers