diff options
author | Unknwon <u@gogs.io> | 2015-09-05 14:11:05 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-05 14:11:05 -0400 |
commit | 3b0c2cb480de28c97fced6857f9c0e006ac2a943 (patch) | |
tree | 81218bc8940ac9d1aba61270dc6b318b72f9c7f0 /public/js/gogs.js | |
parent | d464d3b0c38dae7048b368ef33ac34981393f115 (diff) | |
download | gitea-3b0c2cb480de28c97fced6857f9c0e006ac2a943.tar.gz gitea-3b0c2cb480de28c97fced6857f9c0e006ac2a943.zip |
#633 Add Emoji support
Diffstat (limited to 'public/js/gogs.js')
-rw-r--r-- | public/js/gogs.js | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js index 89e5ef89d7..cf9dade5fb 100644 --- a/public/js/gogs.js +++ b/public/js/gogs.js @@ -14,7 +14,9 @@ function initCommentPreviewTab($form) { "text": $form.find('.tab.segment[data-tab="' + $tab_menu.data('write') + '"] textarea').val() }, function (data) { - $form.find('.tab.segment[data-tab="' + $tab_menu.data('preview') + '"]').html(data); + var $preview_tab = $form.find('.tab.segment[data-tab="' + $tab_menu.data('preview') + '"]'); + $preview_tab.html(data); + emojify.run($preview_tab[0]); } ); }); @@ -43,14 +45,14 @@ function initCommentForm() { $label_menu.find('.item:not(.no-select)').click(function () { if ($(this).hasClass('checked')) { - $(this).removeClass('checked') - $(this).find('.octicon').removeClass('octicon-check') + $(this).removeClass('checked'); + $(this).find('.octicon').removeClass('octicon-check'); if (has_label_update_action) { updateIssueMeta($label_menu.data('update-url'), "detach", $(this).data('id')); } } else { - $(this).addClass('checked') - $(this).find('.octicon').addClass('octicon-check') + $(this).addClass('checked'); + $(this).find('.octicon').addClass('octicon-check'); if (has_label_update_action) { updateIssueMeta($label_menu.data('update-url'), "attach", $(this).data('id')); } @@ -92,7 +94,7 @@ function initCommentForm() { function selectItem(select_id, input_id) { var $menu = $(select_id + ' .menu'); - var $list = $('.ui' + select_id + '.list') + var $list = $('.ui' + select_id + '.list'); var has_update_action = $menu.data('action') == 'update'; $menu.find('.item:not(.no-select)').click(function () { @@ -175,7 +177,7 @@ function initInstall() { $('#disable-gravatar').checkbox('check'); } }); -}; +} function initRepository() { if ($('.repository').length == 0) { @@ -209,7 +211,7 @@ function initRepository() { $(this).minicolors(); }); $('.precolors .color').click(function () { - var color_hex = $(this).data('color-hex') + var color_hex = $(this).data('color-hex'); $('.color-picker').val(color_hex); $('.minicolors-swatch-color').css("background-color", color_hex); }); @@ -231,7 +233,7 @@ function initRepository() { } if ($('.repository.new.milestone').length > 0) { - var $datepicker = $('.milestone.datepicker') + var $datepicker = $('.milestone.datepicker'); $datepicker.datetimepicker({ lang: $datepicker.data('lang'), inline: true, @@ -260,7 +262,7 @@ function initRepository() { $('.in-edit').toggle(); $edit_input.focus(); return false; - } + }; $('#edit-title').click(editTitleToggle); $('#cancel-edit-title').click(editTitleToggle); $('#save-edit-title').click(editTitleToggle). @@ -374,7 +376,7 @@ function initRepository() { // Pull request if ($('.repository.compare.pull').length > 0) { - var $branch_dropdown = $('.choose.branch .dropdown') + var $branch_dropdown = $('.choose.branch .dropdown'); $branch_dropdown.dropdown({ fullTextSearch: true, onChange: function (text, value, $choice) { @@ -383,7 +385,7 @@ function initRepository() { message: {noResults: $branch_dropdown.data('no-results')} }); } -}; +} function initWebhook() { if ($('.new.webhook').length == 0) { @@ -470,7 +472,7 @@ $(document).ready(function () { this.on("success", function (file, data) { filenameDict[file.name] = data.uuid; $('.attachments').append('<input id="' + data.uuid + '" name="attachments" type="hidden" value="' + data.uuid + '">'); - }) + }); this.on("removedfile", function (file) { if (file.name in filenameDict) { $('#' + filenameDict[file.name]).remove(); @@ -480,6 +482,14 @@ $(document).ready(function () { }); } + // Emojify + emojify.setConfig({ + img_dir:'/img/emoji' + }); + $('.markdown').each(function(){ + emojify.run($(this)[0]); + }); + // Helpers. $('.delete-button').click(function () { var $this = $(this); |