1 |
57088
|
stefania.m
|
// http://getuikit.com/docs/documentation_javascript.html#js-override
|
2 |
|
|
|
3 |
|
|
if (typeof UIkit !== 'undefined') {
|
4 |
|
|
|
5 |
|
|
var $body = $('body');
|
6 |
|
|
|
7 |
|
|
UIkit.on('beforeready.uk.dom', function () {
|
8 |
|
|
|
9 |
|
|
// accrodion
|
10 |
|
|
if (typeof UIkit.components.accordion !== "undefined") { // check if accordion component is defined
|
11 |
|
|
$.extend(UIkit.components.accordion.prototype.defaults, {
|
12 |
|
|
easing: $.bez([ 0.35,0,0.25,1 ]),
|
13 |
|
|
duration: 200
|
14 |
|
|
});
|
15 |
|
|
}
|
16 |
|
|
|
17 |
|
|
// dropdown
|
18 |
|
|
if (typeof UIkit.components.dropdown.prototype !== "undefined") { // check if dropdown component is defined
|
19 |
|
|
|
20 |
|
|
$.extend(UIkit.components.dropdown.prototype.defaults, {
|
21 |
|
|
remaintime: 150,
|
22 |
|
|
delay: 50
|
23 |
|
|
});
|
24 |
|
|
|
25 |
|
|
(function() {
|
26 |
|
|
var old_show_function = UIkit.components.dropdown.prototype.show;
|
27 |
|
|
|
28 |
|
|
UIkit.components.dropdown.prototype.show = function() {
|
29 |
|
|
|
30 |
|
|
this.dropdown
|
31 |
|
|
.css({
|
32 |
|
|
'min-width': this.dropdown.outerWidth()
|
33 |
|
|
})
|
34 |
|
|
.addClass('uk-dropdown-active uk-dropdown-shown');
|
35 |
|
|
|
36 |
|
|
return old_show_function.apply(this, arguments);
|
37 |
|
|
}
|
38 |
|
|
})();
|
39 |
|
|
|
40 |
|
|
(function() {
|
41 |
|
|
var old_hide_function = UIkit.components.dropdown.prototype.hide;
|
42 |
|
|
|
43 |
|
|
UIkit.components.dropdown.prototype.hide = function() {
|
44 |
|
|
|
45 |
|
|
var this_dropdown = this.dropdown;
|
46 |
|
|
|
47 |
|
|
this_dropdown.removeClass('uk-dropdown-shown');
|
48 |
|
|
|
49 |
|
|
var dropdown_timeout = setTimeout(function() {
|
50 |
|
|
this_dropdown.removeClass('uk-dropdown-active')
|
51 |
|
|
},280);
|
52 |
|
|
|
53 |
|
|
return old_hide_function.apply(this, arguments);
|
54 |
|
|
}
|
55 |
|
|
})();
|
56 |
|
|
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
// modal
|
60 |
|
|
if (typeof UIkit.components.modal !== "undefined") { // check if modal component is defined
|
61 |
|
|
$.extend(UIkit.components.modal.prototype.defaults, {
|
62 |
|
|
center: true
|
63 |
|
|
});
|
64 |
|
|
|
65 |
|
|
UIkit.modal.dialog.template = '<div class="uk-modal uk-modal-dialog-replace"><div class="uk-modal-dialog" style="min-height:0;"></div></div>';
|
66 |
|
|
$body
|
67 |
|
|
.on('show.uk.modal', '.uk-modal-dialog-replace', function () {
|
68 |
|
|
// customize uikit dialog
|
69 |
|
|
setTimeout(function () {
|
70 |
|
|
var dialogReplace = $('.uk-modal-dialog-replace');
|
71 |
|
|
if (dialogReplace.find('.uk-button-primary').length) {
|
72 |
|
|
var actionBtn = dialogReplace.find('.uk-button-primary').toggleClass('uk-button-primary md-btn-flat-primary');
|
73 |
|
|
if (actionBtn.next('button')) {
|
74 |
|
|
actionBtn.next('button').after(actionBtn);
|
75 |
|
|
}
|
76 |
|
|
}
|
77 |
|
|
if (dialogReplace.find('.uk-button').length) {
|
78 |
|
|
dialogReplace.find('.uk-button').toggleClass('uk-button md-btn md-btn-flat');
|
79 |
|
|
}
|
80 |
|
|
if (dialogReplace.find('.uk-margin-small-top').length) {
|
81 |
|
|
dialogReplace.find('.uk-margin-small-top').toggleClass('uk-margin-small-top uk-margin-top');
|
82 |
|
|
}
|
83 |
|
|
if (dialogReplace.find('input.uk-width-1-1').length) {
|
84 |
|
|
dialogReplace.find('input.uk-width-1-1').toggleClass('uk-width-1-1 md-input');
|
85 |
|
|
// reinitialize md inputs
|
86 |
|
|
altair_md.inputs();
|
87 |
|
|
}
|
88 |
|
|
if (dialogReplace.find('.uk-form').length) {
|
89 |
|
|
dialogReplace.find('.uk-form').removeClass('uk-form');
|
90 |
|
|
}
|
91 |
|
|
}, 50)
|
92 |
|
|
});
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
// tabs
|
96 |
|
|
if (typeof UIkit.components.tab !== "undefined") { // check if tab component is defined
|
97 |
|
|
$.extend(UIkit.components.tab.prototype.defaults, {
|
98 |
|
|
swiping: false
|
99 |
|
|
});
|
100 |
|
|
}
|
101 |
|
|
|
102 |
|
|
// tooltip
|
103 |
|
|
if (typeof UIkit.components.tooltip !== "undefined") { // check if tooltip component is defined
|
104 |
|
|
$.extend(UIkit.components.tooltip.prototype.defaults, {
|
105 |
|
|
animation: UIkit.support.touch ? false : 280,
|
106 |
|
|
offset: 8
|
107 |
|
|
});
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
// sortable
|
112 |
|
|
if (typeof UIkit.components.sortable !== "undefined") { // check if sortable component is defined
|
113 |
|
|
if(Modernizr.touch) {
|
114 |
|
|
$('[data-uk-sortable]').children().addClass('needsclick');
|
115 |
|
|
}
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
});
|
119 |
|
|
}
|