From: Jacob Hilker Date: Tue, 11 Mar 2014 20:19:45 +0000 (-0400) Subject: remove iframe and noscript if markdown exists X-Git-Tag: release-20150131~148^2~1^2~3 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3caf97a4ffa3e895678e87ead70bbbbfbb376cfe;p=oweals%2Fkarmaworld.git remove iframe and noscript if markdown exists --- diff --git a/karmaworld/assets/js/note-detail.js b/karmaworld/assets/js/note-detail.js index 772419b..b4b3b6a 100644 --- a/karmaworld/assets/js/note-detail.js +++ b/karmaworld/assets/js/note-detail.js @@ -133,50 +133,45 @@ $(function() { // 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("

" + percentage + "%

"); - } - }, - 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("

" + percentage + "%

"); + } + }, + success: function(data, textStatus, jqXHR) { + writeNoteFrame(data); + autoResize('noteframe'); + if (pdfControls == true) { + setupPdfViewer(); + } + }, + error: function(data, textStatus, jqXHR) { + writeNoteFrame("

Sorry, your note could not be retrieved.

"); } - }, - error: function(data, textStatus, jqXHR) { - writeNoteFrame("

Sorry, your note could not be retrieved.

"); - } - }); + }); - $('#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($('', { 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($('', { class: 'tag-span', text: tag })); + }); + } + }); }); - }); + } }); diff --git a/karmaworld/templates/notes/note_detail.html b/karmaworld/templates/notes/note_detail.html index 415576e..030af9d 100644 --- a/karmaworld/templates/notes/note_detail.html +++ b/karmaworld/templates/notes/note_detail.html @@ -193,14 +193,14 @@
{% if note.has_markdown %} - Show original document - {% endif %} - - + id="noteframe"> + + {% endif %}
{% else %} {# note.static_html #}