Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I have just released the FastClick module, a Drupal library for fastclick.js. I know Writer theme makes use of it, and I think it would be nice if could be integrated with it.
A part of the common advantages of using the Libraries API, this would make the library optional for the theme, as the javascript code wouldn't be included unless the library is installed by the user:
if (($library = libraries_load('fastclick')) && !empty($library['loaded'])) {
drupal_add_js(drupal_get_path('theme', 'writer') . '/attach_fastclick.js');
}
(where attach_fastclick.js is where you create the event listener).
Comments
Comment #0.0
Pere OrgaMinor.
Comment #0.1
Pere OrgaMinor.
Comment #0.2
Pere OrgaFix code snippet.
Comment #1
bryanbraun CreditAttribution: bryanbraun commentedI've thought about this a bit. I agree, using Libraries is a good pattern, especially for large sites with a lot of complexity. However, this theme is designed for use on smaller blog sites, and I'd really like to keep writer as simple to set up as possible, which means leaving fastclick integrated. Maybe I'll reconsider at some point, but I feel pretty good about that for now.
Thanks for checking though, and thanks for your contributed modules.