diff media/js/forums.js @ 123:3ae999b0c53b

Forums: added a jquery ui dialog of extra smileys.
author Brian Neal <bgneal@gmail.com>
date Sun, 08 Nov 2009 21:15:31 +0000
parents 07be3e39e639
children b0d62247c3e4
line wrap: on
line diff
--- a/media/js/forums.js	Tue Oct 27 02:56:16 2009 +0000
+++ b/media/js/forums.js	Sun Nov 08 21:15:31 2009 +0000
@@ -83,4 +83,31 @@
             'WARNING: all posts will be lost.');
    });
    $('#id_body').markItUp(mySettings);
+   $('#smileys_dialog').dialog({autoOpen:false});
+   var firstTime = true;
+   $('#more_smileys').click(function () {
+         $('#smileys_dialog').dialog('open');
+         var postBox = $('#id_body')[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;
+      });
 });