$62 GRAYBYTE WORDPRESS FILE MANAGER $85

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.217.254 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail

/home/bravrvjk/dantho.rw/wp-content/plugins/extendify/src/Recommendations/

HOME
Current File : /home/bravrvjk/dantho.rw/wp-content/plugins/extendify/src/Recommendations//recommendations.js
import domReady from '@wordpress/dom-ready';
import { PluginSearchBanner } from '@recommendations/components/PluginSearchBanner';
import '@recommendations/recommendations.css';
import { render } from '@shared/lib/dom';

domReady(() => {
	// Check the current page to know what elements we need to insert.
	const currentUrl = new URL(window.location.href);
	const isPluginInstall = currentUrl.pathname.endsWith('plugin-install.php');
	const isNewPost =
		currentUrl.pathname.endsWith('post-new.php') &&
		currentUrl.searchParams.get('post_type') !== 'page';
	const isNewPage =
		currentUrl.pathname.endsWith('post-new.php') &&
		currentUrl.searchParams.get('post_type') === 'page';

	// Returns early if we are not in a page that shows recommendations.
	if (!isPluginInstall && !isNewPost && !isNewPage) {
		return;
	}

	if (isPluginInstall) {
		// The element `plugin-filter` wraps the search results,
		const pluginResults = document.getElementById('plugin-filter');

		if (pluginResults) {
			const pluginSearchContainerId = 'ext-recommendations-plugin-search';

			// If our component is already inserted, return early.
			if (document.getElementById(pluginSearchContainerId)) {
				return;
			}

			const pluginSearchContainer = Object.assign(
				document.createElement('div'),
				{
					id: pluginSearchContainerId,
					className: 'extendify-recommendations',
				},
			);

			// Inserts our component just before the plugin search results.
			pluginResults.parentNode.insertBefore(
				pluginSearchContainer,
				pluginResults,
			);

			return render(<PluginSearchBanner />, pluginSearchContainer);
		}
	}

	if (isNewPost) {
		// TODO: Implement injection of components in new post.
	}

	if (isNewPage) {
		// TODO: Implement injection of components in new page.
	}
});


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
components
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
selectors
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
state
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
utils
--
6 Nov 2025 10.43 AM
bravrvjk / bravrvjk
0755
recommendations.css
0.356 KB
27 Aug 2025 5.47 PM
bravrvjk / bravrvjk
0644
recommendations.js
1.738 KB
12 May 2025 4.42 PM
bravrvjk / bravrvjk
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF