Separate html and js example code
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var clipboard = new Clipboard('#copy-button');
|
var htmlClipboard = new Clipboard('#copy-html-button');
|
||||||
clipboard.on('success', function(e) {
|
htmlClipboard.on('success', function(e) {
|
||||||
|
e.clearSelection();
|
||||||
|
});
|
||||||
|
var jsClipboard = new Clipboard('#copy-js-button');
|
||||||
|
jsClipboard.on('success', function(e) {
|
||||||
e.clearSelection();
|
e.clearSelection();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -91,13 +91,13 @@ pre[class*="language-"] {
|
|||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
#source-controls {
|
.source-controls {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
right: 40px;
|
right: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#source-controls a {
|
.source-controls a {
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,8 +113,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div id="source-controls">
|
<div class="source-controls">
|
||||||
<a id="copy-button" data-clipboard-target="#example-source"><i class="fa fa-clipboard"></i> Copy</a>
|
|
||||||
<!-- <a id="codepen-button"><i class="fa fa-codepen"></i> Edit</a> -->
|
<!-- <a id="codepen-button"><i class="fa fa-codepen"></i> Edit</a> -->
|
||||||
</div>
|
</div>
|
||||||
<form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
|
<form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
|
||||||
@@ -125,7 +124,12 @@
|
|||||||
<textarea class="hidden" name="html">{{ contents }}</textarea>
|
<textarea class="hidden" name="html">{{ contents }}</textarea>
|
||||||
<input type="hidden" name="data">
|
<input type="hidden" name="data">
|
||||||
</form>
|
</form>
|
||||||
<pre><code id="example-source" class="language-markup"><!DOCTYPE html>
|
<hr>
|
||||||
|
<pre>index.html</pre>
|
||||||
|
<div class="source-controls">
|
||||||
|
<a id="copy-html-button" data-clipboard-target="#example-html-source"><i class="fa fa-clipboard"></i> Copy</a>
|
||||||
|
</div>
|
||||||
|
<pre><code id="example-html-source" class="language-markup"><!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
@@ -138,10 +142,15 @@
|
|||||||
{{ indent css.source spaces=6 }} </style>{{/if}}
|
{{ indent css.source spaces=6 }} </style>{{/if}}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{ indent contents spaces=4 }} <script>
|
{{ indent contents spaces=4 }} <script src="index.js"></script>
|
||||||
{{ indent js.source spaces=6 }} </script>
|
|
||||||
</body>
|
</body>
|
||||||
</html></code></pre>
|
</html></code></pre>
|
||||||
|
<br>
|
||||||
|
<pre>index.js</pre>
|
||||||
|
<div class="source-controls">
|
||||||
|
<a id="copy-js-button" data-clipboard-target="#example-js-source"><i class="fa fa-clipboard"></i> Copy</a>
|
||||||
|
</div>
|
||||||
|
<pre><code id="example-js-source" class="language-js">{{ js.source }}</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user