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/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.0.3",
4
+ "version": "0.2.45",
5
5
  "author": "johnyma22 (John McLear) <john@mclear.co.uk>",
6
- "dependencies": {},
7
- "engines": { "node": ">= 0.4.1" },
8
- "repository" : { "type" : "git", "url" : "https://github.com/JohnMcLear/ep_file_menu_toolbar.git" }
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
  }
@@ -1,5 +1,58 @@
1
- exports.documentReady = function(){
2
- $.getScript("/static/plugins/ep_file_menu_toolbar/static/js/lib/jquery-css-dropdown-plugin-master/dropdown-menu.min.js", function(){
3
- $('.dropdown-menu').dropdown_menu();
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
- ;(function( $, window, document, undefined ) {
6
- $.fn.extend({
7
- dropdown_menu : function (options) {
8
- var _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 : function() {} // Callback function applied on init
24
- };
25
-
26
- // Test for IE <= 7
27
- version = parseFloat(navigator.appVersion.split("MSIE")[1]);
28
- var ie7 = (version < 8) && (document.body.filters);
29
-
30
- return this.each(function() {
31
- var menu = $(this);
32
- // Needs this single/double quote precedence for JSON data
33
- // <ul data-options='{"sub_indicators":"true"}'></ul>
34
- var metadata = menu.data('options');
35
- var o = $.extend({}, _defaults, options, metadata);
36
-
37
- // Arrow element
38
- var sub_indicator = $('<span class="' + o.sub_indicator_class + '">&#187;</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
- var 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(function() {
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 : function(e) {
78
- clearTimeout($(this).data('close_timer'));
79
- clearTimeout($(this).data('open_timer'));
80
-
81
- // If the submenu has already been opened
82
- if ($(this).hasClass(o.hover_class)) {
83
- return;
84
- }
85
-
86
- // $.proxy() keeps "this" context
87
- $(this).data('open_timer', setTimeout($.proxy(function() {
88
- $(this).addClass(o.hover_class);
89
-
90
- // For vertical menus
91
- if (o.vertical) {
92
- submenu.css({ 'top' : 0 , 'left' : $(this).width() });
93
- } else {
94
- submenu.css({ 'top' : '', 'left' : '' });
95
- }
96
-
97
- // So we can check the offset
98
- submenu.css({ 'visibility' : 'hidden', 'display' : 'block' });
99
-
100
- // Check if the submenu is overflowing off the page
101
- overflow_x = submenu.offset().left + submenu.width() > $(window).scrollLeft() + $(window).width();
102
- overflow_y = submenu.offset().top + submenu.height() > $(window).scrollTop() + $(window).height();
103
- overflow = overflow_x || overflow_y;
104
-
105
- if (overflow && o.viewport_overflow) {
106
- // Padding to accomodate for drop shadows, etc
107
- var padding = 10;
108
- if (o.viewport_overflow === 'auto') o.viewport_overflow = ie7 ? 'scroll' : 'move';
109
-
110
- switch (o.viewport_overflow) {
111
- case 'move' :
112
- var left = overflow_x ? ($(window).scrollLeft() + $(window).width()) - submenu.width() - padding : submenu.offset().left;
113
- var top = overflow_y ? ($(window).scrollTop() + $(window).height()) - submenu.height() - padding : submenu.offset().top;
114
- submenu.offset({ left : left , top : top });
115
- break;
116
- case 'scroll' :
117
- if (overflow_x) {
118
- var scrollLeft = submenu.offset().left - $(window).width() + submenu.width() + padding;
119
- $('html').animate({ scrollLeft : scrollLeft }, 'fast');
120
- //$(window).scrollLeft(scrollLeft);
121
- }
122
- if (overflow_y) {
123
- var scrollTop = submenu.offset().top - $(window).height() + submenu.height() + padding;
124
- $('html').animate({ scrollTop : scrollTop }, 'fast');
125
- //$(window).scrollTop(scrollTop);
126
- }
127
- break;
128
- }
129
- }
130
-
131
- // Restore display state
132
- submenu.hide().css({ 'visibility' : 'visible' });
133
-
134
- if (o.animation_open) {
135
- submenu.animate(o.animation_open, o.speed_open);
136
- } else {
137
- submenu.show();
138
- }
139
- }, this), o.open_delay));
140
- },
141
- mouseleave : function(e) {
142
- clearTimeout($(this).data('close_timer'));
143
- clearTimeout($(this).data('open_timer'));
144
-
145
- $(this).data('close_timer', setTimeout($.proxy(function() {
146
- $(this).removeClass(o.hover_class);
147
-
148
- if (o.animation_close) {
149
- submenu.animate(o.animation_close, o.speed_close, function() {
150
- submenu.css({ 'visibility' : 'hidden' });
151
- });
152
- } else {
153
- submenu.hide().css({ 'visibility' : 'hidden' });
154
- }
155
- }, this), o.close_delay));
156
- },
157
- // For touch devices, disable the link if its submenu is not showing yet
158
- touchstart : function(e) {
159
- $('>a:first-child', this).one('click', $.proxy(function(e) {
160
- if (!$(this).hasClass(o.hover_class)) {
161
- e.preventDefault();
162
- } else {
163
- return true;
164
- }
165
- }, this));
166
- }
167
- });
168
- });
169
-
170
- // Wrap in setTimeout() to ensure processes have completed
171
- setTimeout(function() {
172
- // Completely hide the submenus
173
- $('ul', menu).hide(1)
174
- .promise()
175
- .done(function() {
176
- // Apply the init callback
177
- o.init.call(menu[0]);
178
- });
179
- }, 0);
180
- });
181
- }
182
- });
183
- })( jQuery, window , document );
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}">&#187;</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:function(r){var 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:function(){}};version=parseFloat(navigator.appVersion.split("MSIE")[1]);var s=version<8&&n.body.filters;return this.each(function(){var n=e(this);var o=n.data("options");var u=e.extend({},i,r,o);var a=e('<span class="'+u.sub_indicator_class+'">&#187;</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())}var n=e(">ul",this).css({visibility:"hidden",display:"block"});if(u.drop_shadows){n.addClass(u.shadow_class)}if(s){setTimeout(function(){n.css({width:n.width()})},0)}e(this).on({mouseenter:function(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){var 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){var a=n.offset().left-e(t).width()+n.width()+r;e("html").animate({scrollLeft:a},"fast")}if(overflow_y){var 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:function(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,function(){n.css({visibility:"hidden"})})}else{n.hide().css({visibility:"hidden"})}},this),u.close_delay))},touchstart:function(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(function(){e("ul",n).hide(1).promise().done(function(){u.init.call(n[0])})},0)})}})})(jQuery,window,document)
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}">&#187;</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);