mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 17:38:19 +08:00
22 lines
566 B
JavaScript
22 lines
566 B
JavaScript
import emojify from 'emojify.js';
|
|
|
|
import { AutoloadPage } from 'vj/misc/Page';
|
|
|
|
function runEmojify($container) {
|
|
if ($container.is('[data-emoji-enabled]')) {
|
|
emojify.run($container[0]);
|
|
return;
|
|
}
|
|
$container.find('[data-emoji-enabled]').get().forEach((element) => emojify.run(element));
|
|
}
|
|
|
|
const emojifyPage = new AutoloadPage('emojifyPage', () => {
|
|
emojify.setConfig({
|
|
img_dir: `${UiContext.cdn_prefix}img/emoji`,
|
|
});
|
|
runEmojify($('body'));
|
|
$(document).on('vjContentNew', (e) => runEmojify($(e.target)));
|
|
});
|
|
|
|
export default emojifyPage;
|