Commit fdb413fd56c5862d6a510e6bb4ae186dc5bc1f7f
Remove emoji-named-characters
Close %UvnFv14vZCp1pfYpBTEZu0n03WqSKEr46eIAuvTPwNU=.sha256cel committed on 5/12/2020, 12:07:50 AM
Parent: 475e344db407a8f7d1b682b4cc3866f09f5131e3
Files changed
index.js | changed |
lib/markdown.js | changed |
lib/util.js | changed |
package.json | changed |
static/styles.css | changed |
index.js | ||
---|---|---|
@@ -26,9 +26,8 @@ | ||
26 | 26 … | var moment = require('moment') |
27 | 27 … | var LRUCache = require('lrucache') |
28 | 28 … | |
29 | 29 … | var hlCssPath = path.resolve(require.resolve('highlight.js'), '../../styles') |
30 | -var emojiPath = path.resolve(require.resolve('emoji-named-characters'), '../pngs') | |
31 | 30 … | |
32 | 31 … | function ParamError(msg) { |
33 | 32 … | var err = Error.call(this, msg) |
34 | 33 … | err.name = ParamError.name |
@@ -288,10 +287,8 @@ | ||
288 | 287 … | else if (dir == 'static') |
289 | 288 … | return this.serveFile(req, dirs) |
290 | 289 … | else if (dir == 'highlight') |
291 | 290 … | return this.serveFile(req, [hlCssPath].concat(dirs.slice(1)), true) |
292 | - else if (dir == 'emoji') | |
293 | - return this.serveFile(req, [emojiPath].concat(dirs.slice(1)), true) | |
294 | 291 … | else |
295 | 292 … | return this.serve404(req) |
296 | 293 … | } |
297 | 294 … |
lib/markdown.js | ||
---|---|---|
@@ -2,9 +2,8 @@ | ||
2 | 2 … | var url = require('url') |
3 | 3 … | var marked = require('ssb-marked') |
4 | 4 … | var ref = require('ssb-ref') |
5 | 5 … | var u = require('./util') |
6 | -var emojiNamedCharacters = require('emoji-named-characters') | |
7 | 6 … | |
8 | 7 … | // render links to git objects and ssb objects |
9 | 8 … | var blockRenderer = new marked.Renderer() |
10 | 9 … | blockRenderer.urltransform = function (href) { |
@@ -48,17 +47,8 @@ | ||
48 | 47 … | (checked === undefined ? '' : '<i>' + (checked ? '☑' : '☐') + '</i> ') + |
49 | 48 … | text + '</li>\n' |
50 | 49 … | } |
51 | 50 … | |
52 | -function renderEmoji(emoji) { | |
53 | - return emoji in emojiNamedCharacters ? | |
54 | - '<img src="/emoji/' + encodeURI(emoji) + '.png"' | |
55 | - + ' alt=":' + escape(emoji) + ':"' | |
56 | - + ' title=":' + escape(emoji) + ':"' | |
57 | - + ' class="emoji" height="16" width="16">' | |
58 | - : ':' + emoji + ':' | |
59 | -} | |
60 | - | |
61 | 51 … | marked.setOptions({ |
62 | 52 … | gfm: true, |
63 | 53 … | mentions: true, |
64 | 54 … | tables: true, |
@@ -66,9 +56,8 @@ | ||
66 | 56 … | pedantic: false, |
67 | 57 … | sanitize: true, |
68 | 58 … | smartLists: true, |
69 | 59 … | smartypants: false, |
70 | - emoji: renderEmoji, | |
71 | 60 … | highlight: u.highlight, |
72 | 61 … | renderer: blockRenderer |
73 | 62 … | }) |
74 | 63 … |
lib/util.js | ||
---|---|---|
@@ -240,9 +240,9 @@ | ||
240 | 240 … | return u.escape(removeMd(title)) |
241 | 241 … | } |
242 | 242 … | |
243 | 243 … | u.privateIcon = function (req) { |
244 | - return `<img src="/emoji/lock.png" height="16" width="16" alt="${req._t('repo.Private')}" title="${req._t('repo.RepoIsPrivate')}">` | |
244 … | + return `<i title="${req._t('repo.RepoIsPrivate')}">🔒</i>` | |
245 | 245 … | } |
246 | 246 … | |
247 | 247 … | u.msgIdToDomId = function (id) { |
248 | 248 … | return 'msg-' + id.replace(/^%/, '') |
package.json | |||
---|---|---|---|
@@ -5,16 +5,14 @@ | |||
5 | 5 … | "bin": "server.js", | |
6 | 6 … | "pkg": { | |
7 | 7 … | "assets": [ | |
8 | 8 … | "static/*", | |
9 | - "locale/*.json", | ||
10 | - "node_modules/emoji-named-characters/pngs/*.png" | ||
9 … | + "locale/*.json" | ||
11 | 10 … | ] | |
12 | 11 … | }, | |
13 | 12 … | "dependencies": { | |
14 | 13 … | "asyncmemo": "^1.0.0", | |
15 | 14 … | "diff": "^3.0.1", | |
16 | - "emoji-named-characters": "^1.0.2", | ||
17 | 15 … | "highlight.js": "^9.8.0", | |
18 | 16 … | "lrucache": "^1.0.2", | |
19 | 17 … | "mime-types": "^2.1.12", | |
20 | 18 … | "moment": "^2.14.1", |
Built with git-ssb-web