UNPKG

3.08 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const path_1 = require("path");
4const nconf = require.main.require('nconf');
5const url = nconf.get('url');
6function images(pack) {
7 return `.emoji-${pack.id} {` +
8 'display: inline-block;' +
9 'height: 23px;' +
10 'margin-top: -1px;' +
11 'margin-bottom: -1px;' +
12 '}';
13}
14exports.images = images;
15function sprite(pack) {
16 const classes = Object.keys(pack.dictionary).map((name) => {
17 return `.emoji-${pack.id}.emoji--${name} {` +
18 `background-position: ${pack.dictionary[name].backgroundPosition};` +
19 '}';
20 });
21 const route = `${url}/plugins/nodebb-plugin-emoji/emoji/${pack.id}`;
22 return `.emoji-${pack.id} {` +
23 `background-image: url(${route}/${path_1.basename(pack.sprite.file)});` +
24 `background-size: ${pack.sprite.backgroundSize};` +
25 'background-repeat: no-repeat;' +
26 'display: inline-block;' +
27 'height: 23px;' +
28 'width: 23px;' +
29 'overflow: hidden;' +
30 'font-size: 23px;' +
31 'line-height: 23px;' +
32 'text-align: center;' +
33 'vertical-align: bottom;' +
34 'color: transparent;' +
35 'margin-top: -1px;' +
36 'margin-bottom: -1px;' +
37 '}' +
38 `.emoji-link .emoji-${pack.id} {` +
39 'transform: scale(1.304347826086957);' +
40 'position: relative;' +
41 'bottom: -3.5px;' +
42 'height: 23px;' +
43 'width: 23px;' +
44 'font-size: 23px;' +
45 'line-height: 23px;' +
46 '}' + classes.join('');
47}
48exports.sprite = sprite;
49function font(pack) {
50 const route = `${url}/plugins/nodebb-plugin-emoji/emoji/${pack.id}`;
51 return '@font-face {' +
52 `font-family: '${pack.font.family}';` +
53 (pack.font.eot ? `src: url(${route}/${path_1.basename(pack.font.eot)});` : '') +
54 'src: ' + [
55 pack.font.eot &&
56 `url(${route}/${path_1.basename(pack.font.eot)}?#iefix) format('embedded-opentype')`,
57 pack.font.woff2 &&
58 `url(${route}/${path_1.basename(pack.font.woff2)}) format('woff2')`,
59 pack.font.woff &&
60 `url(${route}/${path_1.basename(pack.font.woff)}) format('woff')`,
61 pack.font.ttf &&
62 `url(${route}/${path_1.basename(pack.font.ttf)}) format('truetype')`,
63 pack.font.svg &&
64 `url(${route}/${path_1.basename(pack.font.svg)}) format('svg')`,
65 ].filter(Boolean).join(', ') + ';' +
66 '}' +
67 `.emoji-${pack.id} {` +
68 `font-family: '${pack.font.family}';` +
69 'font-style: normal;' +
70 'display: inline-block;' +
71 'height: 23px;' +
72 'width: 23px;' +
73 'overflow: hidden;' +
74 'font-size: 23px;' +
75 'line-height: 23px;' +
76 'text-align: center;' +
77 'vertical-align: bottom;' +
78 'margin-top: -1px;' +
79 'margin-bottom: -1px;' +
80 '}';
81}
82exports.font = font;
83//# sourceMappingURL=css-builders.js.map
\No newline at end of file