Mercurial > public > sg101
diff media/js/comments.js @ 127:2d299909e074
Adding markdown help to comments and forums. Still need to add it to a few other places that use the markItUp editor.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 16 Nov 2009 01:00:28 +0000 |
parents | b0d62247c3e4 |
children | b8474ffe76d9 |
line wrap: on
line diff
--- a/media/js/comments.js Sat Nov 14 20:30:31 2009 +0000 +++ b/media/js/comments.js Mon Nov 16 01:00:28 2009 +0000 @@ -62,4 +62,54 @@ return false; }); postText.markItUp(mySettings); + + $('#smileys_dialog').dialog({autoOpen:false}); + var firstTime = true; + $('#more_smileys').click(function () { + $('#smileys_dialog').dialog('open'); + var postBox = $('#id_comment')[0]; + if (firstTime) { + $.ajax({ + url: '/smiley/farm/extra/', + type: 'GET', + dataType: 'html', + success: function(data, textStatus) { + var img = $('#smiley_busy'); + img.hide(); + img.after(data); + $('#smileys_dialog .smiley_farm img').click(function() { + postBox.value += ' ' + this.alt + ' '; + postBox.focus(); + }); + firstTime = false; + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); + } + }); + } + return false; + }); + $('#markdown_help_dialog').dialog({autoOpen: false, width: 720, height: 600}); + var firstTimeMd = true; + $('#markdown_help').click(function () { + $('#markdown_help_dialog').dialog('open'); + if (firstTimeMd) { + $.ajax({ + url: '/core/markdown_help/', + type: 'GET', + dataType: 'html', + success: function(data, textStatus) { + var img = $('#markdown_busy'); + img.hide(); + img.after(data); + firstTimeMd = false; + }, + error: function (xhr, textStatus, ex) { + alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); + } + }); + } + return false; + }); });