Skip to content

Commit

Permalink
All smilie versions are getting loaded into SCEDitor #1
Browse files Browse the repository at this point in the history
Smilies can be clicked inside the "view more smilies" popup #2

Closes #1, Fixes #2
  • Loading branch information
cYbercOsmOnauT committed Jun 11, 2015
1 parent 9488a79 commit 66cdbdd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
3 changes: 1 addition & 2 deletions nassim/sceditor/event/sce.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public function initialize_sceditor () {

// We need to get all smilies with url and code
$sql = 'SELECT smiley_url, code
FROM ' . SMILIES_TABLE . '
GROUP BY smiley_url';
FROM ' . SMILIES_TABLE;
// Caching the smilies for 10 minutes should be okay
// they don't get changed so often
$result = $this->db->sql_query($sql, 600);
Expand Down
12 changes: 12 additions & 0 deletions nassim/sceditor/styles/all/template/event/simple_footer_after.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- IF S_SCEDITOR -->
<script type="text/javascript">
$(function () {
$('div.inner > a > img').each(function () {
$(this).click(function () {
opener.setSmilie($(this).attr('alt'));
return false;
});
});
});
</script>
<!-- ENDIF -->
14 changes: 10 additions & 4 deletions nassim/sceditor/styles/all/template/js/sce.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,20 @@ $.sceditor.command.set('size', {
}
});

var textarea;
// This is needed for the smilies popup
function setSmilie(tag) {
textarea.data('sceditor').insert(' ' + tag + ' ');
}

$(document).ready(function () {
$(function () {
// Don't need to select the node again and again
textarea = $('textarea');
// Hide the normal BBCode Buttons
$('#format-buttons').hide();
$('#smiley-box a img').each(function () {
$(this).css('cursor', 'pointer');

$(this).click(function () {
$('textarea').data('sceditor').insert(' ' + $(this).attr('alt') + ' ');
setSmilie($(this).attr('alt'));
return false;
});
});
Expand Down

0 comments on commit 66cdbdd

Please sign in to comment.