emojicons.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 26
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
cc 2
wmc 2
c 4
b 0
f 0
nc 3
mnd 2
bc 2
fnc 0
dl 0
loc 26
rs 10
bpm 0
cpm 0
noi 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