PageSourceSearch

https://www.fastmarkets.com/content/mu-plugins/vendor/editor-block-outline/mouse-events.js?ver=1726577274

js fastmarkets.com collected 2026-10-09 21:57:39 UTC 2,329 bytes, 78 lines download raw bytes

1(function ($) {
2	$(document).ready(() => {
3		// Create floating element and append it to body
4		const floatingEl = jQuery("<div class='outline-floating-block-data'></div>");
5		jQuery('body').append(floatingEl);
6
7		let isFloating = false;
8
9		// Handle mouse events for enter, out and over for each block
10		jQuery('body')
11			.on(
12				'mouseover',
13				'.block-editor-block-list__layout .wp-block:not(.block-list-appender):not(.block-editor-default-block-appender)',
14				function (event) {
15					event.stopPropagation();
16
17					const el = jQuery(this);
18					el.addClass('outline-block-hovered');
19
20					// Get block data
21					const title = el.attr('data-title');
22					const type = el.attr('data-type');
23					const classes = el.attr('class').split(' ');
24
25					const classesWrappers = classes.map((className) => `<li>${className}</li>`).join(' ');
26
27					// Get plugin settings
28					const body = jQuery('body');
29					const showTitle = body.attr('show-block-name');
30					const showClasses = body.attr('show-class-name');
31					const dataPosition = body.attr('block-data-position');
32
33					// Don't show if position is not floating
34					if (dataPosition !== 'floating') {
35						isFloating = false;
36						return;
37					}
38
39					isFloating = true;
40
41					// Don't show the box if showTitle and showClasses are false
42					if (showTitle !== 'true' && showClasses !== 'true') {
43						return;
44					}
45
46					// Show title if user enabled it
47					if (showTitle === 'true') {
48						floatingEl.append(`<div class='floating-row-title'>${title}</div>`);
49						floatingEl.append(`<div class='floating-row'>Type: ${type}</div>`);
50					}
51
52					// show classes list if user enabled it
53					if (showClasses === 'true') {
54						floatingEl.append(`<div class='floating-row'>Classes: <ul>${classesWrappers}</ul></div>`);
55					}
56
57					floatingEl.css({ opacity: 1 });
58				}
59			)
60			.on('mouseout', '.block-editor-block-list__layout .wp-block', function (event) {
61				floatingEl.css({ opacity: 0 }).html('');
62
63				const el = jQuery(this);
64				el.removeClass('outline-block-hovered');
65			})
66			.on('mousemove', '.block-editor-block-list__layout .wp-block', (event) => {
67				// Change position only for floating setting
68				if (isFloating === false) {
69					return;
70				}
71
72				floatingEl.css({
73					left: event.pageX,
74					top: event.pageY,
75				});
76			});
77	});
78})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.