Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/webroot/rsrc/js/phuix/PHUIXIconView.js
12241 views
1
/**
2
* @provides phuix-icon-view
3
* @requires javelin-install
4
* javelin-dom
5
*/
6
7
JX.install('PHUIXIconView', {
8
9
members: {
10
_node: null,
11
_icon: null,
12
_color: null,
13
14
setIcon: function(icon) {
15
var node = this.getNode();
16
if (this._icon) {
17
JX.DOM.alterClass(node, this._icon, false);
18
}
19
this._icon = icon;
20
JX.DOM.alterClass(node, this._icon, true);
21
return this;
22
},
23
24
setColor: function(color) {
25
var node = this.getNode();
26
if (this._color) {
27
JX.DOM.alterClass(node, this._color, false);
28
}
29
this._color = color;
30
JX.DOM.alterClass(node, this._color, true);
31
return this;
32
},
33
34
getNode: function() {
35
if (!this._node) {
36
var attrs = {
37
className: 'phui-icon-view phui-font-fa'
38
};
39
40
this._node = JX.$N('span', attrs);
41
}
42
43
return this._node;
44
}
45
}
46
47
});
48
49