git ssb

30+

cel / git-ssb-web



Commit fdb413fd56c5862d6a510e6bb4ae186dc5bc1f7f

Remove emoji-named-characters

Close %UvnFv14vZCp1pfYpBTEZu0n03WqSKEr46eIAuvTPwNU=.sha256
cel committed on 5/12/2020, 12:07:50 AM
Parent: 475e344db407a8f7d1b682b4cc3866f09f5131e3

Files changed

index.jschanged
lib/markdown.jschanged
lib/util.jschanged
package.jsonchanged
static/styles.csschanged
index.jsView
@@ -26,9 +26,8 @@
2626 var moment = require('moment')
2727 var LRUCache = require('lrucache')
2828
2929 var hlCssPath = path.resolve(require.resolve('highlight.js'), '../../styles')
30-var emojiPath = path.resolve(require.resolve('emoji-named-characters'), '../pngs')
3130
3231 function ParamError(msg) {
3332 var err = Error.call(this, msg)
3433 err.name = ParamError.name
@@ -288,10 +287,8 @@
288287 else if (dir == 'static')
289288 return this.serveFile(req, dirs)
290289 else if (dir == 'highlight')
291290 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)
294291 else
295292 return this.serve404(req)
296293 }
297294
lib/markdown.jsView
@@ -2,9 +2,8 @@
22 var url = require('url')
33 var marked = require('ssb-marked')
44 var ref = require('ssb-ref')
55 var u = require('./util')
6-var emojiNamedCharacters = require('emoji-named-characters')
76
87 // render links to git objects and ssb objects
98 var blockRenderer = new marked.Renderer()
109 blockRenderer.urltransform = function (href) {
@@ -48,17 +47,8 @@
4847 (checked === undefined ? '' : '<i>' + (checked ? '☑' : '☐') + '</i> ') +
4948 text + '</li>\n'
5049 }
5150
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-
6151 marked.setOptions({
6252 gfm: true,
6353 mentions: true,
6454 tables: true,
@@ -66,9 +56,8 @@
6656 pedantic: false,
6757 sanitize: true,
6858 smartLists: true,
6959 smartypants: false,
70- emoji: renderEmoji,
7160 highlight: u.highlight,
7261 renderer: blockRenderer
7362 })
7463
lib/util.jsView
@@ -240,9 +240,9 @@
240240 return u.escape(removeMd(title))
241241 }
242242
243243 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>`
245245 }
246246
247247 u.msgIdToDomId = function (id) {
248248 return 'msg-' + id.replace(/^%/, '')
package.jsonView
@@ -5,16 +5,14 @@
55 "bin": "server.js",
66 "pkg": {
77 "assets": [
88 "static/*",
9- "locale/*.json",
10- "node_modules/emoji-named-characters/pngs/*.png"
9 + "locale/*.json"
1110 ]
1211 },
1312 "dependencies": {
1413 "asyncmemo": "^1.0.0",
1514 "diff": "^3.0.1",
16- "emoji-named-characters": "^1.0.2",
1715 "highlight.js": "^9.8.0",
1816 "lrucache": "^1.0.2",
1917 "mime-types": "^2.1.12",
2018 "moment": "^2.14.1",
static/styles.cssView
@@ -192,14 +192,8 @@
192192 section img {
193193 max-width: 100%;
194194 }
195195
196-.emoji {
197- width: 1em;
198- height: 1em;
199- vertical-align: middle;
200-}
201-
202196 /* repo page */
203197
204198 .repo-title {
205199 height: 2em;

Built with git-ssb-web