-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathInputfieldFontIconPicker.js
90 lines (76 loc) · 2.96 KB
/
InputfieldFontIconPicker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Altivebir
var Altivebir = Altivebir || {};
// Altivebir.ScriptLoader
Altivebir.ScriptLoader = Altivebir.ScriptLoader || {};
// Altivebir.ScriptLoader
Altivebir.ScriptLoader = {
Items: {},
Add: function (name, value) {
if (name !== "undefined" && name !== undefined && value !== "undefined" && value !== undefined) {
this.Items[name] = value;
}
},
Remove: function (name) {
if (name !== "undefined" && name !== undefined && this.Items[name] !== "undefined" && this.Items[name] !== undefined) {
delete this.Items[name];
}
},
Render: function () {
for (var name in this.Items) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = this.Items[name];
$("head").append(script);
}
}
};
function AvbFontIconPickerInit() {
var AvbFontIconPicker = $(".AvbIconPicker"),
AvbFontIconPickerLoadedClass = 'AvbIconPickerLoaded';
AvbFontIconPicker.each(function() {
var $this = $(this);
if(!$this.hasClass(AvbFontIconPickerLoadedClass)) {
var useAttribute = $this.attr('use-attribute'),
attributeName = $this.attr('attribute-name');
var options = {
theme: $this.attr('theme'),
emptyIcon: $this.attr('empty-icon'),
emptyIconValue: $this.attr('empty-icon-value'),
iconsPerPage: $this.attr('icons-per-page'),
hasSearch: $this.attr('has-search'),
convertToHex : $this.attr('convert-to-hex'),
allCategoryText : $this.attr('all-category-text'),
unCategorizedText : $this.attr('un-categorized-text')
};
if(useAttribute && useAttribute !== "false" && attributeName) {
options.iconGenerator = function( icon ) {
return '<span ' + attributeName + '="' + icon + '"></span>';
};
}
$this.fontIconPicker(options);
// Remove position: relative style from icons-selector class
$this.parent().children(".icons-selector").css("position", "");
if($this.parents('.InputfieldContent').length) {
$this.parents('.InputfieldContent').css(
'z-index', 2
);
}
$this.addClass(AvbFontIconPickerLoadedClass);
}
});
}
$(document).ready(function() {
var PwContentElement = $('#content');
AvbFontIconPickerInit();
$(document)
// .on('openReady', '.InputfieldRepeaterItem', AvbFontIconPickerInit);
.on('reloaded', '.InputfieldRepeater', AvbFontIconPickerInit)
.on('opened', '.InputfieldRepeaterItem', AvbFontIconPickerInit);
if(PwContentElement.length) {
PwContentElement.css(
'z-index', 2
);
}
// Altivebir.ScriptLoader
Altivebir.ScriptLoader.Render();
});