https://github.com/CU-CommunityApps/cwd_project/blob/main/js/project.js
Let's change how project.js is initialized -- follow-up to discussion on Slack.
Specifically:
- Use Drupal 8/9 best practices
- Er, well now it's Drupal 10!...
- (Probably?) Include
'use strict'; with whatever we come up with.
To do
Background
Drupal reference
Best practices laid out in Drupal JavaScript API documentation
What's in project.js now
(https://github.com/CU-CommunityApps/cwd_project/blob/main/js/project.js)
jQuery(document).ready(function($) {
// By default, site search uses this site.
$('input[type=radio][name=sitesearch]').on('change', function() {
switch ($(this).val()) {
// ...etc etc etc...
}
});
});
What's in some of our D8 sites' child theme JS files
(probably based on the old cwd_ssit theme?? -- but I haven't confirmed this speculation)
(function ($, Drupal) {
'use strict';
// By default, site search uses this site.
$('input[type=radio][name=sitesearch]').on('change', function() {
switch ($(this).val()) {
// ...etc etc etc...
}
});
})(jQuery, this);
https://github.com/CU-CommunityApps/cwd_project/blob/main/js/project.js
Let's change how
project.jsis initialized -- follow-up to discussion on Slack.Specifically:
'use strict';with whatever we come up with.To do
project.jsproject.jsBackground
Drupal reference
Best practices laid out in Drupal JavaScript API documentation
What's in project.js now
(https://github.com/CU-CommunityApps/cwd_project/blob/main/js/project.js)
What's in some of our D8 sites' child theme JS files
(probably based on the old cwd_ssit theme?? -- but I haven't confirmed this speculation)