Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions course/assets/js/hovercard-setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
document.addEventListener('DOMContentLoaded', () => {
Copy link
Copy Markdown
Contributor

@donnapep donnapep Oct 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we follow the same whitespace rules in this JS file as we do for Sensei?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yapp, good point. I've updated it here 07d099e

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, looks like the spaces get removed by this pre-commit hooks #3596

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, looks like the spaces get removed by this pre-commit hooks #3596

const hovercards = new Gravatar.Hovercards({});
const elements = document.getElementsByClassName('wp-block-comments');

if (elements.length > 0) {
hovercards.attach(elements[0]);
}
});
23 changes: 23 additions & 0 deletions course/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,29 @@ function course_scripts() {
wp_register_style( 'course-style', get_stylesheet_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
wp_enqueue_script( 'course-header', get_template_directory_uri() . '/assets/js/header.js', array(), wp_get_theme()->get( 'Version' ), true );
wp_enqueue_style( 'course-style' );

// Load gravatar-hovercard related styles and scripts.
wp_enqueue_style( 'gravatar-hovercard-style', 'https://unpkg.com/@gravatar-com/hovercards@0.5.8/dist/style.css', array(), 'unversioned' );
wp_register_script(
'gravatar-hovercard-js',
'https://unpkg.com/@gravatar-com/hovercards@0.5.8',
array(),
'unversioned',
array(
'in_footer' => false,
'strategy' => 'defer',
)
);
wp_enqueue_script(
'gravatar-hovercard-setup-js',
get_template_directory_uri() . '/assets/js/hovercard-setup.js',
array( 'gravatar-hovercard-js' ),
wp_get_theme()->get( 'Version' ),
array(
'in_footer' => true,
'strategy' => 'defer',
)
);
}

endif;
Expand Down
2 changes: 1 addition & 1 deletion course/readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=== Course ===
Contributors: Automattic
Requires at least: 6.2
Requires at least: 6.3
Tested up to: 6.4
Requires PHP: 7.4
License: GPLv2 or later
Expand Down