mirror of
https://github.com/tabler/tabler.git
synced 2025-12-22 18:04:26 +04:00
48 lines
1.0 KiB
HTML
48 lines
1.0 KiB
HTML
<style>
|
|
.card-debug {
|
|
position: absolute;
|
|
right: 0;
|
|
top: 0;
|
|
line-height: 1;
|
|
font-size: 11px;
|
|
display: none;
|
|
}
|
|
|
|
.card-debug a {
|
|
display: inline-block;
|
|
padding: 2px;
|
|
}
|
|
|
|
.card-debug a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|
|
<script>
|
|
$(document).ready(function () {
|
|
$('.card').each(function () {
|
|
var $card = $(this),
|
|
htmlCode = $card[0].innerHTML.replace(/(^[ \t]*\n)/gm, '');
|
|
|
|
var $button = $('<div class="card-debug"><a href="#" class="text-muted-light" data-code>code</a></div>'),
|
|
$codeLink = $button.find('[data-code]');
|
|
|
|
$codeLink
|
|
// .data('htmlCode', htmlCode)
|
|
.on('click', function(e){
|
|
|
|
var $modal = $('<div class="modal hide"><div class="modal-dialog modal-lg"><div class="modal-content"><div class="modal-body"><pre class="m-0"></pre></div></div></div></div>');
|
|
$modal.find('pre').text(htmlCode);
|
|
$('body').append($modal);
|
|
console.log();
|
|
|
|
$modal.modal('show');
|
|
|
|
e.preventDefault();
|
|
return false;
|
|
});
|
|
|
|
$card.prepend($button);
|
|
});
|
|
});
|
|
</script>
|