Mercurial > public > sg101
comparison media/js/markitup/sets/markdown/set.js @ 131:5b69d6e01fd4
Creating a common way to display the smiley and markdown help dialogs for a markItUp textarea input form. Converted gcalendar over to it as a trial.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 26 Nov 2009 22:47:17 +0000 |
parents | dbd703f7d63a |
children | 0231aad9e211 |
comparison
equal
deleted
inserted
replaced
130:a4635c094f24 | 131:5b69d6e01fd4 |
---|---|
76 heading += char; | 76 heading += char; |
77 } | 77 } |
78 return '\n'+heading; | 78 return '\n'+heading; |
79 } | 79 } |
80 } | 80 } |
81 | |
82 $(document).ready(function() { | |
83 $('.markItUp').markItUp(mySettings); | |
84 | |
85 $('#smileys_dialog_popup').dialog({autoOpen:false}); | |
86 var firstTimeSmiley = true; | |
87 $('#more_smileys_link').click(function () { | |
88 $('#smileys_dialog_popup').dialog('open'); | |
89 var smileyTarget = $('.smileyTarget')[0]; | |
90 if (firstTimeSmiley) { | |
91 $.ajax({ | |
92 url: '/smiley/farm/extra/', | |
93 type: 'GET', | |
94 dataType: 'html', | |
95 success: function(data, textStatus) { | |
96 var img = $('#smiley_busy'); | |
97 img.hide(); | |
98 img.after(data); | |
99 $('#smileys_dialog_popup .smiley_farm img').click(function() { | |
100 smileyTarget.value += ' ' + this.alt + ' '; | |
101 smileyTarget.focus(); | |
102 }); | |
103 firstTimeSmiley = false; | |
104 }, | |
105 error: function (xhr, textStatus, ex) { | |
106 alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); | |
107 } | |
108 }); | |
109 } | |
110 return false; | |
111 }); | |
112 $('#markdown_help_dialog_popup').dialog({autoOpen: false, width: 720, height: 600}); | |
113 var firstTimeMdHelp = true; | |
114 $('#markdown_help_link').click(function () { | |
115 $('#markdown_help_dialog_popup').dialog('open'); | |
116 if (firstTimeMdHelp) { | |
117 $.ajax({ | |
118 url: '/core/markdown_help/', | |
119 type: 'GET', | |
120 dataType: 'html', | |
121 success: function(data, textStatus) { | |
122 var img = $('#markdown_busy'); | |
123 img.hide(); | |
124 img.after(data); | |
125 firstTimeMdHelp = false; | |
126 }, | |
127 error: function (xhr, textStatus, ex) { | |
128 alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText); | |
129 } | |
130 }); | |
131 } | |
132 return false; | |
133 }); | |
134 }); |