Skip to content

Commit

Permalink
use poops
Browse files Browse the repository at this point in the history
  • Loading branch information
stamat committed Jul 21, 2023
1 parent a21878b commit 5efa834
Show file tree
Hide file tree
Showing 15 changed files with 3,592 additions and 1,796 deletions.
34 changes: 34 additions & 0 deletions _markup/_layouts/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>shortcodes.js - JavaScript Front-end Shortcode Engine</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="icon" type="image/png" href="">

<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700|IBM+Plex+Mono:400,600&display=swap" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/themes/prism-tomorrow.min.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick-theme.css"/>

<link rel="stylesheet" type="text/css" href="styles.css">

<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!--
========================================================================
INITIALIZE SHORTCODES
========================================================================
-->
<script type="text/javascript" src="shortcodes.js"></script>
<script type="text/javascript">
var shortcodes = new Shortcodes();
</script>
</head>
<body class="editor-active">
{% block content %} {% endblock %}
</body>
</html>
104 changes: 104 additions & 0 deletions _markup/_templates/foot.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.min.js"></script>
<!-- initialize Quill WYSIWYG editor -->
<script src="https://cdn.quilljs.com/1.3.6/quill.min.js"></script>
<script type="text/javascript">
var toolbarOptions = [
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'link', 'image'],
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
[{'align': []}],
['code-block'],
['clean'] // remove formatting button
];
var options = {
bounds: '#editor .editor',
modules: {
toolbar: toolbarOptions
},
theme: 'snow'
};
var editor = new Quill('#editor .editor', options);

editor.on('text-change', function(delta, oldDelta, source) {
$('.code-button.active').parent().find('.code').stop(true).fadeOut();
$('.code-button.active').removeClass('active');

shortcodes.reinit($('#editor .ql-editor').clone(), function(){
// https://www.youtube.com/watch?v=qetW6R9Jxs4
});
});
</script>

<!-- initialize other demo-only actions -->
<script type="text/javascript">
$(document).ready(function() {
function codeButton(elem) {
$('.code-button.active').not(elem).parent().find('.code').stop(true).fadeOut();
$('.code-button.active').not(elem).removeClass('active');

var $code = $(elem).parent().find('.code');
var $root = $(elem).closest('.shortcode-js');

if ($(elem).hasClass('active')) {
$(elem).removeClass('active');
$code.stop(true).fadeOut();
} else {
$(elem).addClass('active');
$code.css('max-height', $root.height() - 118);
$code.css('height', 'calc(100vh - 118px)');
$code.stop(true).fadeIn();
}
}
$('body').on('click', '.code-button', function(e) {
e.preventDefault();
codeButton(this);
});

$('.sidebar .carret a, .toggle-editor').on('click', function(e) {
e.preventDefault();
$('body').toggleClass('editor-active');

setTimeout(function(){
$(window).trigger('resize');
}, 250);
});

if (window.innerWidth < 960) {
$('body').removeClass('editor-active');
}

$('body').on('click', 'a[target="_action"]', function(e) {
e.preventDefault();

if ($(this).attr('href') === '#view-code') {
codeButton($(this).closest('.shortcode-js').find('.code-button'));
} else if ($(this).attr('href') === '#toggle-editor') {
$('.sidebar .carret a').trigger('click');
}
});
});
</script>

<!--
========================================================================
EXECUTE SHORTCODES
========================================================================
-->
<script type="text/javascript">
$(document).ready(function(){
shortcodes.execute($('#editor .ql-editor').clone(), function() {
// https://www.youtube.com/watch?v=qetW6R9Jxs4
console.log(arguments);
});
});
</script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.19.0/prism.min.js"></script>


<script>document.write('<script src="http://'
+ (location.host || 'localhost').split(':')[0]
+ ':35729/livereload.js?snipver=1"></'
+ 'script>')</script>
Loading

0 comments on commit 5efa834

Please sign in to comment.