Total Complexity | 2 |
Complexity/F | 0 |
Lines of Code | 26 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | var emojiStyle = [ |
||
2 | 'span.emoji, ', |
||
3 | 'i.emoji, ', |
||
4 | 'emoji { ', |
||
5 | ' vertical-align: middle; ', |
||
6 | ' width: 1.5em; ', |
||
7 | ' height: 1.5em; ', |
||
8 | ' line-height: 1.5em; ', |
||
9 | ' display: inline-block; ', |
||
10 | ' background: center center/contain no-repeat', |
||
11 | '} ' |
||
12 | ].join("\n"); |
||
13 | |||
14 | var styleNode = document.createElement("style"); |
||
15 | var emojiNode = document.createTextNode(emojiStyle); |
||
16 | styleNode.appendChild(emojiNode); |
||
17 | document.getElementsByTagName('head')[0].appendChild(styleNode); |
||
18 | |||
19 | var emoji = document.querySelectorAll('span.emoji, i.emoji, emoji'); |
||
20 | |||
21 | for (var i = 0, len = emoji.length; i < len; i++) { |
||
22 | if (emoji[i].innerHTML !== null){ |
||
23 | emoji[i].setAttribute("style", 'background-image: url(https://s3-us-west-2.amazonaws.com/emojicons/' + emoji[i].innerHTML + '.png)'); |
||
24 | emoji[i].innerHTML = ''; |
||
25 | } |
||
26 | } |
||
27 |