// 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')));
- }
-
- $('#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();
+ } 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>");
}
- },
- 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();
- });
+ $('#edit_note_tags').click(function(event) {
+ $('#note_tags_form').slideToggle();
+ });
- $('#save_note_tags').click(function(event) {
- $.ajax({
- url: edit_note_tags_url,
- dataType: 'json',
- data: $('#note_tags_input').val(),
- type: 'POST',
- success: function(data) {
- $('#note_tags_form').slideUp();
- $('.tags').empty();
- $.each(data.fields.tags, function(index, tag) {
- $('.tags').append($('<span>', { class: 'tag-span', text: tag }));
- });
- }
+ $('#save_note_tags').click(function(event) {
+ $.ajax({
+ url: edit_note_tags_url,
+ dataType: 'json',
+ data: $('#note_tags_input').val(),
+ type: 'POST',
+ success: function(data) {
+ $('#note_tags_form').slideUp();
+ $('.tags').empty();
+ $.each(data.fields.tags, function(index, tag) {
+ $('.tags').append($('<span>', { class: 'tag-span', text: tag }));
+ });
+ }
+ });
});
- });
+ }
});