// Embed the converted markdown if it is on the page, else default to the iframe
if ($('#note-markdown').length > 0) {
$('#note-markdown').html(marked($('#note-markdown').data('markdown')));
- } else {
- $.ajax(note_contents_url, {
- type: 'GET',
- xhrFields: {
- onprogress: function (progress) {
- var percentage = Math.floor((progress.loaded / progress.total) * 100);
- writeNoteFrame("<h3 style='text-align: center'>" + percentage + "%</h3>");
- }
- },
- success: function(data, textStatus, jqXHR) {
- writeNoteFrame(data);
- autoResize('noteframe');
- if (pdfControls == true) {
- setupPdfViewer();
- }
- },
- error: function(data, textStatus, jqXHR) {
- writeNoteFrame("<h3 style='text-align: center'>Sorry, your note could not be retrieved.</h3>");
- }
- });
}
+ $('#note-iframe-toggle').click(function(){
+ $('#noteframe').slideToggle();
+ autoResize('noteframe');
+ });
+
+ $.ajax(note_contents_url, {
+ type: 'GET',
+ xhrFields: {
+ onprogress: function (progress) {
+ var percentage = Math.floor((progress.loaded / progress.total) * 100);
+ writeNoteFrame("<h3 style='text-align: center'>" + percentage + "%</h3>");
+ }
+ },
+ success: function(data, textStatus, jqXHR) {
+ writeNoteFrame(data);
+ autoResize('noteframe');
+ if (pdfControls == true) {
+ setupPdfViewer();
+ }
+ },
+ error: function(data, textStatus, jqXHR) {
+ writeNoteFrame("<h3 style='text-align: center'>Sorry, your note could not be retrieved.</h3>");
+ }
+ });
+
$('#edit_note_tags').click(function(event) {
$('#note_tags_form').slideToggle();
});
<div class="note-text">
{% if note.has_markdown %}
<span id="note-markdown" data-markdown="{{note.notemarkdown.markdown}}"></span>
- {% else %}
- <iframe style="border:none; width:100%; min-height: 1000px;"
- id="noteframe"> </iframe>
+ <a id="note-iframe-toggle">Show original document</a>
{% endif %}
+ <iframe style="border:none; width:100%; min-height: 1000px;"
+ class="{% if note.has_markdown %}hide{% endif %}"
+ id="noteframe"> </iframe>
<noscript>
{{ note.text }}
</noscript>