Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ <h2>Have a play.</h2>
<div id="editor" class="bypass" style="width: 49%;"></div>

<div class="controls" style="width: 49%;">

<p id="charCount">Characters: <span>0</span></p>

<div class="pull-right">
<!--<a href="#" class="btn btn-primary">Download Your Code</a>-->
<a href="#" class="btn btn-primary download-pdf">Download PDF</a>
Expand Down Expand Up @@ -102,5 +105,22 @@ <h2>Have a play.</h2>
<!-- Scripts in development mode -->
<script type="text/javascript" src="./examples/js/pdfobject.min.js"></script>
<script type="text/javascript" src="./examples/js/editor.js"></script>

<!-- Character Count -->
<script>
$(document).ready(function() {
var editor = ace.edit("editor");

function countCharacters() {
var text = editor.getValue();
var textWithoutNewlines = text.replace(/(\r\n|\n|\r)/g, '');
var count = textWithoutNewlines.length;
$('#charCount span').text(count);
}

editor.getSession().on('change', countCharacters);
countCharacters();
});
</script>
</body>
</html>
Loading