Add show code

This commit is contained in:
Jeremy Thomas
2017-10-09 12:27:08 +01:00
parent 927f7ebb38
commit 3ac5137192
4 changed files with 229 additions and 1 deletions

View File

@@ -111,6 +111,9 @@ document.addEventListener('DOMContentLoaded', function () {
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> Add show code
var $parent = $el.parentNode;
if ($parent && $parent.classList.contains('bd-is-more')) {
var showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>';
@@ -122,6 +125,7 @@ document.addEventListener('DOMContentLoaded', function () {
$el.insertAdjacentHTML('beforeend', expandEl);
}
<<<<<<< HEAD
=======
>>>>>>> Improve snippet
var $parent = $el.parentNode;
@@ -134,6 +138,14 @@ document.addEventListener('DOMContentLoaded', function () {
} else if ($el.firstElementChild.scrollHeight > 480 && $el.firstElementChild.clientHeight <= 480) {
$el.insertAdjacentHTML('beforeend', expandEl);
>>>>>>> Improve snippet
=======
var $parent = $el.parentNode;
if ($parent && $parent.className == 'bd-highlight-clipped') {
var showEl = '<button class="bd-show"><div><span class="icon"><i class="fa fa-code"></i></span> <strong>Show code</strong></div></button>';
$el.classList.add('bd-is-clipped');
$el.insertAdjacentHTML('beforeend', showEl);
>>>>>>> Add show code
>>>>>>> Add show code
}
itemsProcessed++;
@@ -164,6 +176,7 @@ document.addEventListener('DOMContentLoaded', function () {
});
});
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
var $highlightShows = getAll('.highlight .bd-show');
@@ -179,12 +192,24 @@ document.addEventListener('DOMContentLoaded', function () {
$el.parentNode.classList.remove('bd-is-clipped');
>>>>>>> Add show code
=======
=======
>>>>>>> Add show code
var $highlightShows = getAll('.highlight .bd-show');
$highlightShows.forEach(function ($el) {
$el.addEventListener('click', function () {
$el.parentNode.parentNode.classList.remove('bd-is-more-clipped');
<<<<<<< HEAD
>>>>>>> Improve snippet
=======
=======
var $highlightShows = getAll('.bd-highlight-clipped .bd-show');
$highlightShows.forEach(function ($el) {
$el.addEventListener('click', function () {
$el.parentNode.classList.remove('bd-is-clipped');
>>>>>>> Add show code
>>>>>>> Add show code
});
});
}