ep_file_menu_toolbar 0.0.3 → 0.2.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc.cjs +9 -0
- package/.github/dependabot.yml +11 -0
- package/.github/workflows/automerge.yml +30 -0
- package/.github/workflows/backend-tests.yml +71 -0
- package/.github/workflows/frontend-tests.yml +94 -0
- package/.github/workflows/npmpublish.yml +107 -0
- package/.github/workflows/test-and-release.yml +26 -0
- package/.travis.yml +69 -0
- package/CONTRIBUTING.md +133 -0
- package/LICENSE.md +14 -0
- package/README.md +7 -1
- package/demo.gif +0 -0
- package/demo.png +0 -0
- package/eejs.js +17 -10
- package/ep.json +4 -5
- package/package.json +21 -4
- package/static/js/index.js +57 -4
- package/static/js/lib/jquery-css-dropdown-plugin-master/dropdown-menu.css +3 -0
- package/static/js/lib/jquery-css-dropdown-plugin-master/dropdown-menu.js +186 -179
- package/static/js/lib/jquery-css-dropdown-plugin-master/dropdown-menu.min.js +1 -1
- package/static/js/lib/jquery-css-dropdown-plugin-master/lib/jquery-1.8.3.min.js +2 -2
- package/static/tests/frontend/specs/atest.js +74 -0
- package/templates/toolbar.ejs +60 -42
- package/.npmignore +0 -1
- package/index.js +0 -52
package/package.json
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ep_file_menu_toolbar",
|
|
3
3
|
"description": "File / Menu style toolbar",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.45",
|
|
5
5
|
"author": "johnyma22 (John McLear) <john@mclear.co.uk>",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18.0.0"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/ether/ep_file_menu_toolbar.git"
|
|
12
|
+
},
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "individual",
|
|
15
|
+
"url": "https://etherpad.org/"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"eslint": "^8.57.1",
|
|
19
|
+
"eslint-config-etherpad": "^4.0.5",
|
|
20
|
+
"typescript": "^6.0.3"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"lint": "eslint .",
|
|
24
|
+
"lint:fix": "eslint --fix ."
|
|
25
|
+
}
|
|
9
26
|
}
|
package/static/js/index.js
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.documentReady = () => {
|
|
4
|
+
/* eslint-disable-next-line max-len */
|
|
5
|
+
$.getScript('../static/plugins/ep_aa_file_menu_toolbar/static/js/lib/jquery-css-dropdown-plugin-master/dropdown-menu.js', () => {
|
|
6
|
+
$(() => {
|
|
7
|
+
$('.dropdown-menu').dropdown_menu({
|
|
8
|
+
open_delay: 50, // Delay on menu open
|
|
9
|
+
close_delay: 300, // Delay on menu close
|
|
10
|
+
});
|
|
11
|
+
});
|
|
4
12
|
});
|
|
5
|
-
}
|
|
13
|
+
$('#newPad').attr('href', `./${randomPadName()}`);
|
|
14
|
+
|
|
15
|
+
const exports = $('#exportColumn').children('a');
|
|
16
|
+
$.each(exports, (k, v) => {
|
|
17
|
+
const href = $(v).attr('href');
|
|
18
|
+
const txt = $(v).text();
|
|
19
|
+
const html = `<a class='exportlink' href='${href}'><div class='exportttype'>${txt}</div></a>`;
|
|
20
|
+
$('#file_menu_exports > .submenu').append(html);
|
|
21
|
+
});
|
|
22
|
+
$('#importexportlink').click(() => {
|
|
23
|
+
$('#importfileinput').click();
|
|
24
|
+
$('#import_export').addClass('popup-show');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
$('#filemenutoolbarsettings').click(() => {
|
|
28
|
+
$('#settings').addClass('popup-show');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
$('#filemenutoolbarembed').click(() => {
|
|
32
|
+
$('#embed').addClass('popup-show');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
$('body').on('click', ".dropdown-menu-sub-indicator *[data-key='undo']", () => {
|
|
36
|
+
$('#editbar').find("*[data-key='undo']").click();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
$('body').on('click', ".dropdown-menu-sub-indicator *[data-key='redo']", () => {
|
|
40
|
+
$('#editbar').find("*[data-key='red']").click();
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
window.printPad = () => {
|
|
45
|
+
const pad = $('iframe[name="ace_outer"]').contents().find('iframe[name="ace_inner"]')[0];
|
|
46
|
+
pad.contentWindow.print();
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const randomPadName = () => {
|
|
50
|
+
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
|
|
51
|
+
const string_length = 10;
|
|
52
|
+
let randomstring = '';
|
|
53
|
+
for (let i = 0; i < string_length; i++) {
|
|
54
|
+
const rnum = Math.floor(Math.random() * chars.length);
|
|
55
|
+
randomstring += chars.substring(rnum, rnum + 1);
|
|
56
|
+
}
|
|
57
|
+
return randomstring;
|
|
58
|
+
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* Root menu */
|
|
3
3
|
.dropdown-menu {
|
|
4
4
|
background: #FFF;
|
|
5
|
+
color:#393939;
|
|
5
6
|
}
|
|
6
7
|
/* Root links */
|
|
7
8
|
.dropdown-menu a,
|
|
@@ -10,6 +11,8 @@
|
|
|
10
11
|
text-decoration: none;
|
|
11
12
|
color: #393939;
|
|
12
13
|
padding: 5px 9px;
|
|
14
|
+
cursor:pointer;
|
|
15
|
+
cursor:hand;
|
|
13
16
|
}
|
|
14
17
|
/* Root link hover */
|
|
15
18
|
.dropdown-menu a:hover,
|
|
@@ -2,182 +2,189 @@
|
|
|
2
2
|
// http://danielupshaw.com/jquery-css-dropdown-plugin/readme.html
|
|
3
3
|
|
|
4
4
|
// Beginning semi-colon for concatenated scripts and any improperly closed plugins
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
5
|
+
(function ($, window, document, undefined) {
|
|
6
|
+
$.fn.extend({
|
|
7
|
+
dropdown_menu(options) {
|
|
8
|
+
const _defaults = {
|
|
9
|
+
sub_indicator_class: 'dropdown-menu-sub-indicator', // Class given to LI's with submenus
|
|
10
|
+
vertical_class: 'dropdown-menu-vertical', // Class for a vertical menu
|
|
11
|
+
shadow_class: 'dropdown-menu-shadow', // Class for drop shadow on submenus
|
|
12
|
+
hover_class: 'dropdown-menu-hover', // Class applied to hovered LI's
|
|
13
|
+
open_delay: 150, // Delay on menu open
|
|
14
|
+
close_delay: 300, // Delay on menu close
|
|
15
|
+
animation_open: {opacity: 'show'}, // Animation for menu open
|
|
16
|
+
speed_open: 'fast', // Animation speed for menu open
|
|
17
|
+
animation_close: {opacity: 'hide'}, // Animation for menu close
|
|
18
|
+
speed_close: 'fast', // Animation speed for menu close
|
|
19
|
+
sub_indicators: false, // Whether to show arrows for submenus
|
|
20
|
+
drop_shadows: false, // Whether to apply drop shadow class to submenus
|
|
21
|
+
vertical: false, // Whether the root menu is vertically aligned
|
|
22
|
+
viewport_overflow: 'auto', // Handle submenu opening offscreen: "auto", "move", "scroll", or false
|
|
23
|
+
init() {}, // Callback function applied on init
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Test for IE <= 7
|
|
27
|
+
version = parseFloat(navigator.appVersion.split('MSIE')[1]);
|
|
28
|
+
const ie7 = (version < 8) && (document.body.filters);
|
|
29
|
+
|
|
30
|
+
return this.each(function () {
|
|
31
|
+
const menu = $(this);
|
|
32
|
+
// Needs this single/double quote precedence for JSON data
|
|
33
|
+
// <ul data-options='{"sub_indicators":"true"}'></ul>
|
|
34
|
+
const metadata = menu.data('options');
|
|
35
|
+
const o = $.extend({}, _defaults, options, metadata);
|
|
36
|
+
|
|
37
|
+
// Arrow element
|
|
38
|
+
const sub_indicator = $(`<span class="${o.sub_indicator_class}">»</span>`);
|
|
39
|
+
|
|
40
|
+
// Add vertical menu class
|
|
41
|
+
if (o.vertical) {
|
|
42
|
+
menu.addClass(o.vertical_class);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Remove whitespace between inline-block elements
|
|
46
|
+
$('>li', menu).css({'font-size': menu.css('font-size')});
|
|
47
|
+
menu.css({'font-size': '0'});
|
|
48
|
+
|
|
49
|
+
menu.find('li:has(ul)').each(function () {
|
|
50
|
+
// Add a class to the LI to indicate that it has a submenu
|
|
51
|
+
$(this).addClass(o.sub_indicator_class);
|
|
52
|
+
|
|
53
|
+
// Add arrow/indicator element if enabled
|
|
54
|
+
if (o.sub_indicators) {
|
|
55
|
+
$('>a:first-child', this).append(sub_indicator.clone());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Get the submenu and hide it, but keep display:block so the width can be calculated
|
|
59
|
+
const submenu = $('>ul', this).css({visibility: 'hidden', display: 'block'});
|
|
60
|
+
|
|
61
|
+
// Add drop shadow class if enabled
|
|
62
|
+
if (o.drop_shadows) {
|
|
63
|
+
submenu.addClass(o.shadow_class);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// IE <= 7
|
|
67
|
+
if (ie7) {
|
|
68
|
+
// Wrap in setTimeout() else the arrow may not be included
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
// Lock submenu UL width in CSS so that the LI's can stretch
|
|
71
|
+
submenu.css({width: submenu.width()});
|
|
72
|
+
}, 0);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Handle hover states
|
|
76
|
+
$(this).on({
|
|
77
|
+
mouseenter(e) {
|
|
78
|
+
// For some reason Chrome has a horrible bug where it opens the File menu if this isn't included
|
|
79
|
+
const rootElement = $(e.fromElement).parent().parent().attr('class');
|
|
80
|
+
if (rootElement) {
|
|
81
|
+
if (rootElement.indexOf('toolbar') == -1) { // wut
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
clearTimeout($(this).data('close_timer'));
|
|
86
|
+
clearTimeout($(this).data('open_timer'));
|
|
87
|
+
|
|
88
|
+
// If the submenu has already been opened
|
|
89
|
+
if ($(this).hasClass(o.hover_class)) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// $.proxy() keeps "this" context
|
|
94
|
+
$(this).data('open_timer', setTimeout($.proxy(function () {
|
|
95
|
+
$(this).addClass(o.hover_class);
|
|
96
|
+
|
|
97
|
+
// For vertical menus
|
|
98
|
+
if (o.vertical) {
|
|
99
|
+
submenu.css({top: 0, left: $(this).width()});
|
|
100
|
+
} else {
|
|
101
|
+
submenu.css({top: '', left: ''});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// So we can check the offset
|
|
105
|
+
submenu.css({visibility: 'hidden', display: 'block'});
|
|
106
|
+
|
|
107
|
+
// Check if the submenu is overflowing off the page
|
|
108
|
+
overflow_x = submenu.offset().left + submenu.width() > $(window).scrollLeft() + $(window).width();
|
|
109
|
+
overflow_y = submenu.offset().top + submenu.height() > $(window).scrollTop() + $(window).height();
|
|
110
|
+
overflow = overflow_x || overflow_y;
|
|
111
|
+
|
|
112
|
+
if (overflow && o.viewport_overflow) {
|
|
113
|
+
// Padding to accomodate for drop shadows, etc
|
|
114
|
+
const padding = 10;
|
|
115
|
+
if (o.viewport_overflow === 'auto') o.viewport_overflow = ie7 ? 'scroll' : 'move';
|
|
116
|
+
|
|
117
|
+
switch (o.viewport_overflow) {
|
|
118
|
+
case 'move':
|
|
119
|
+
var left = overflow_x ? ($(window).scrollLeft() + $(window).width()) - submenu.width() - padding : submenu.offset().left;
|
|
120
|
+
var top = overflow_y ? ($(window).scrollTop() + $(window).height()) - submenu.height() - padding : submenu.offset().top;
|
|
121
|
+
submenu.offset({left, top});
|
|
122
|
+
break;
|
|
123
|
+
case 'scroll':
|
|
124
|
+
if (overflow_x) {
|
|
125
|
+
const scrollLeft = submenu.offset().left - $(window).width() + submenu.width() + padding;
|
|
126
|
+
$('html').animate({scrollLeft}, 'fast');
|
|
127
|
+
// $(window).scrollLeft(scrollLeft);
|
|
128
|
+
}
|
|
129
|
+
if (overflow_y) {
|
|
130
|
+
const scrollTop = submenu.offset().top - $(window).height() + submenu.height() + padding;
|
|
131
|
+
$('html').animate({scrollTop}, 'fast');
|
|
132
|
+
// $(window).scrollTop(scrollTop);
|
|
133
|
+
}
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Restore display state
|
|
139
|
+
submenu.hide().css({visibility: 'visible'});
|
|
140
|
+
|
|
141
|
+
if (o.animation_open) {
|
|
142
|
+
submenu.animate(o.animation_open, o.speed_open);
|
|
143
|
+
} else {
|
|
144
|
+
submenu.show();
|
|
145
|
+
}
|
|
146
|
+
}, this), o.open_delay));
|
|
147
|
+
},
|
|
148
|
+
mouseleave(e) {
|
|
149
|
+
clearTimeout($(this).data('close_timer'));
|
|
150
|
+
clearTimeout($(this).data('open_timer'));
|
|
151
|
+
|
|
152
|
+
$(this).data('close_timer', setTimeout($.proxy(function () {
|
|
153
|
+
$(this).removeClass(o.hover_class);
|
|
154
|
+
|
|
155
|
+
if (o.animation_close) {
|
|
156
|
+
submenu.animate(o.animation_close, o.speed_close, () => {
|
|
157
|
+
submenu.css({visibility: 'hidden'});
|
|
158
|
+
});
|
|
159
|
+
} else {
|
|
160
|
+
submenu.hide().css({visibility: 'hidden'});
|
|
161
|
+
}
|
|
162
|
+
}, this), o.close_delay));
|
|
163
|
+
},
|
|
164
|
+
// For touch devices, disable the link if its submenu is not showing yet
|
|
165
|
+
touchstart(e) {
|
|
166
|
+
$('>a:first-child', this).one('click', $.proxy(function (e) {
|
|
167
|
+
if (!$(this).hasClass(o.hover_class)) {
|
|
168
|
+
e.preventDefault();
|
|
169
|
+
} else {
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
}, this));
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Wrap in setTimeout() to ensure processes have completed
|
|
178
|
+
setTimeout(() => {
|
|
179
|
+
// Completely hide the submenus
|
|
180
|
+
$('ul', menu).hide(1)
|
|
181
|
+
.promise()
|
|
182
|
+
.done(() => {
|
|
183
|
+
// Apply the init callback
|
|
184
|
+
o.init.call(menu[0]);
|
|
185
|
+
});
|
|
186
|
+
}, 0);
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
})(jQuery, window, document);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// jQuery().dropdown_menu() by Daniel Upshaw 2012-2013
|
|
2
2
|
// http://danielupshaw.com/jquery-css-dropdown-plugin/readme.html
|
|
3
|
-
(function(e,t,n,r){e.fn.extend({dropdown_menu
|
|
3
|
+
(function (e, t, n, r) { e.fn.extend({dropdown_menu(r) { const i = {sub_indicator_class: 'dropdown-menu-sub-indicator', vertical_class: 'dropdown-menu-vertical', shadow_class: 'dropdown-menu-shadow', hover_class: 'dropdown-menu-hover', open_delay: 50, close_delay: 100, animation_open: {opacity: 'show'}, speed_open: 'fast', animation_close: {opacity: 'hide'}, speed_close: 'fast', sub_indicators: false, drop_shadows: false, vertical: false, viewport_overflow: 'auto', init() {}}; version = parseFloat(navigator.appVersion.split('MSIE')[1]); const s = version < 8 && n.body.filters; return this.each(function () { const n = e(this); const o = n.data('options'); const u = e.extend({}, i, r, o); const a = e(`<span class="${u.sub_indicator_class}">»</span>`); if (u.vertical) { n.addClass(u.vertical_class); }e('>li', n).css({'font-size': n.css('font-size')}); n.css({'font-size': '0'}); n.find('li:has(ul)').each(function () { e(this).addClass(u.sub_indicator_class); if (u.sub_indicators) { e('>a:first-child', this).append(a.clone()); } const n = e('>ul', this).css({visibility: 'hidden', display: 'block'}); if (u.drop_shadows) { n.addClass(u.shadow_class); } if (s) { setTimeout(() => { n.css({width: n.width()}); }, 0); }e(this).on({mouseenter(r) { clearTimeout(e(this).data('close_timer')); clearTimeout(e(this).data('open_timer')); if (e(this).hasClass(u.hover_class)) { return; }e(this).data('open_timer', setTimeout(e.proxy(function () { e(this).addClass(u.hover_class); if (u.vertical) { n.css({top: 0, left: e(this).width()}); } else { n.css({top: '', left: ''}); }n.css({visibility: 'hidden', display: 'block'}); overflow_x = n.offset().left + n.width() > e(t).scrollLeft() + e(t).width(); overflow_y = n.offset().top + n.height() > e(t).scrollTop() + e(t).height(); overflow = overflow_x || overflow_y; if (overflow && u.viewport_overflow) { const r = 10; if (u.viewport_overflow === 'auto')u.viewport_overflow = s ? 'scroll' : 'move'; switch (u.viewport_overflow) { case 'move': var i = overflow_x ? e(t).scrollLeft() + e(t).width() - n.width() - r : n.offset().left; var o = overflow_y ? e(t).scrollTop() + e(t).height() - n.height() - r : n.offset().top; n.offset({left: i, top: o}); break; case 'scroll': if (overflow_x) { const a = n.offset().left - e(t).width() + n.width() + r; e('html').animate({scrollLeft: a}, 'fast'); } if (overflow_y) { const f = n.offset().top - e(t).height() + n.height() + r; e('html').animate({scrollTop: f}, 'fast'); } break; } }n.hide().css({visibility: 'visible'}); if (u.animation_open) { n.animate(u.animation_open, u.speed_open); } else { n.show(); } }, this), u.open_delay)); }, mouseleave(t) { clearTimeout(e(this).data('close_timer')); clearTimeout(e(this).data('open_timer')); e(this).data('close_timer', setTimeout(e.proxy(function () { e(this).removeClass(u.hover_class); if (u.animation_close) { n.animate(u.animation_close, u.speed_close, () => { n.css({visibility: 'hidden'}); }); } else { n.hide().css({visibility: 'hidden'}); } }, this), u.close_delay)); }, touchstart(t) { e('>a:first-child', this).one('click', e.proxy(function (t) { if (!e(this).hasClass(u.hover_class)) { t.preventDefault(); } else { return true; } }, this)); }}); }); setTimeout(() => { e('ul', n).hide(1).promise().done(() => { u.init.call(n[0]); }); }, 0); }); }}); })(jQuery, window, document);
|