PageSourceSearch

https://themerouter.com/wp-content/plugins/aculect-docs/assets/js/feedback.js?ver=0.1.0

js themerouter.com collected 2026-10-10 00:36:03 UTC 1,859 bytes, 68 lines download raw bytes

1( function () {
2	'use strict';
3
4	const config = window.aculectDocsFeedback || {};
5	const widgets = document.querySelectorAll( '[data-aculect-docs-feedback]' );
6
7	if ( ! widgets.length || ! config.endpoint || ! config.nonce ) {
8		return;
9	}
10
11	const setMessage = ( widget, message ) => {
12		const target = widget.querySelector( '[data-aculect-docs-feedback-message]' );
13
14		if ( target ) {
15			target.textContent = message;
16		}
17	};
18
19	const setDisabled = ( widget, disabled ) => {
20		widget.querySelectorAll( '[data-aculect-docs-feedback-rating]' ).forEach( ( button ) => {
21			button.disabled = disabled;
22		} );
23	};
24
25	widgets.forEach( ( widget ) => {
26		const postId = parseInt( widget.getAttribute( 'data-post-id' ), 10 );
27
28		if ( ! postId ) {
29			return;
30		}
31
32		widget.querySelectorAll( '[data-aculect-docs-feedback-rating]' ).forEach( ( button ) => {
33			button.addEventListener( 'click', () => {
34				const rating = button.getAttribute( 'data-aculect-docs-feedback-rating' );
35
36				setDisabled( widget, true );
37				setMessage( widget, config.sendingText || 'Sending feedback...' );
38
39				window.fetch( config.endpoint, {
40					method: 'POST',
41					credentials: 'same-origin',
42					headers: {
43						'Content-Type': 'application/json',
44						'X-WP-Nonce': config.nonce,
45					},
46					body: JSON.stringify( {
47						post_id: postId,
48						rating,
49					} ),
50				} )
51					.then( ( response ) => response.json() )
52					.then( ( payload ) => {
53						if ( payload.success ) {
54							setMessage( widget, config.successText || 'Thanks for the feedback.' );
55							return;
56						}
57
58						setDisabled( widget, false );
59						setMessage( widget, config.errorText || 'Feedback could not be saved.' );
60					} )
61					.catch( () => {
62						setDisabled( widget, false );
63						setMessage( widget, config.errorText || 'Feedback could not be saved.' );
64					} );
65			} );
66		} );
67	} );
68}() );

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.