Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Emoji Search for Synology Chat
// ==UserScript==
// @name Emoji Search for Synology Chat
// @namespace https://chat.synology.com/
// @version 0.2
// @description Add search function for emoji list in Synology Chat
// @author Howar31
// @match https://chat.synology.com/*
// @run-at document-idle
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// jshint multistr: true
// ==/UserScript==
GM_addStyle("\
#emoji-search { \
width: calc(100% - 10px); \
box-sizing: border-box; \
padding: 3px 8px; \
margin: 5px 5px; \
z-index: 100; \
} \
.syno-chat .emoji-menu .sticker-ct.emoji-tab-body .emoji-list, \
.syno-chat.syno-chat-integration .msg-input-reaction .sticker-ct.emoji-tab-body .emoji-list { \
padding: 5px 12px 0px 16px; \
} \
");
(function() {
'use strict';
var emoji_block_padding_top = '';
var emoji_block_padding_bottom = '';
waitForKeyElements('.emoji-menu > ul.x-menu-list > .x-tab-panel > .x-tab-panel-bwrap', function() {
$('.emoji-menu > ul.x-menu-list > .x-tab-panel > .x-tab-panel-bwrap').prepend("<input type='text' id='emoji-search' placeholder='Search Emoji'>");
});
waitForKeyElements('input#emoji-search', function() {
$('button#ext-gen160').click(function() {
showForSearch();
setTimeout(function() {$('input#emoji-search').focus();}, 1000);
});
$('input#emoji-search').keyup(function(e) {
var search_key = $(this).val();
if (search_key) {
if (13 == e.which) {
$('.sticker-wrap:visible').first().trigger('click');
return false;
}
hideForSearch();
$('.sticker-wrap').each(function() {
var sticker_name = String($(this).data('sticker-name'));
if (sticker_name.includes(search_key)) {
$(this).show();
}
});
} else {
showForSearch();
}
});
});
function hideForSearch() {
$('#ext-comp-1218').hide();
$('.emoji-category-header:visible').hide();
emoji_block_padding_top = $('.emoji-category-block').css('padding-top');
emoji_block_padding_bottom = $('.emoji-category-block').css('padding-bottom');
$('.emoji-category-block').css('padding-top', 0);
$('.emoji-category-block').css('padding-bottom', 0);
$('.sticker-wrap:visible').hide();
}
function showForSearch() {
$('#ext-comp-1218').show();
$('.emoji-category-header:hidden').show();
$('.emoji-category-block').css('padding-top', emoji_block_padding_top);
$('.emoji-category-block').css('padding-bottom', emoji_block_padding_bottom);
$('.sticker-wrap:hidden').show();
$('input#emoji-search').val('');
}
})();
@tomgood

This comment has been minimized.

Copy link

@tomgood tomgood commented Jun 20, 2018

Hi! Do you know, is it possible to change the default Emoji in Synology Chat? Want to add new.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment