From a18fea067a82b460be3fbf89e0cd0ecdd38d76be Mon Sep 17 00:00:00 2001 From: Tekin Birduezen Date: Thu, 11 Jun 2015 16:59:13 +0200 Subject: [PATCH] All smilie versions are getting loaded into SCEDitor #1 Smilies can be clicked inside the "view more smilies" popup #2 Closes #1, Fixes #2 --- nassim/sceditor/event/sce.php | 3 +-- .../all/template/event/simple_footer_after.html | 12 ++++++++++++ nassim/sceditor/styles/all/template/js/sce.js | 14 ++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 nassim/sceditor/styles/all/template/event/simple_footer_after.html diff --git a/nassim/sceditor/event/sce.php b/nassim/sceditor/event/sce.php index e951b64..863d9e6 100644 --- a/nassim/sceditor/event/sce.php +++ b/nassim/sceditor/event/sce.php @@ -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); diff --git a/nassim/sceditor/styles/all/template/event/simple_footer_after.html b/nassim/sceditor/styles/all/template/event/simple_footer_after.html new file mode 100644 index 0000000..5f4597d --- /dev/null +++ b/nassim/sceditor/styles/all/template/event/simple_footer_after.html @@ -0,0 +1,12 @@ + + + \ No newline at end of file diff --git a/nassim/sceditor/styles/all/template/js/sce.js b/nassim/sceditor/styles/all/template/js/sce.js index b31b3f3..ea10299 100644 --- a/nassim/sceditor/styles/all/template/js/sce.js +++ b/nassim/sceditor/styles/all/template/js/sce.js @@ -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; }); });