Closed (fixed)
Project:
Webfont Loader
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Apr 2012 at 13:36 UTC
Updated:
19 Apr 2012 at 07:31 UTC
Imagine I want to hook some js code to a specific event from the webfont loader like the 'active' event seen at https://developers.google.com/webfonts/docs/webfont_loader#Events
Is this currently possible using this module?
Comments
Comment #1
btmash commented@anthonyR, it isn't possible with this module at the moment...I'm trying to think of a way that is easy for a person to integrate the additional behaviors. The easiest solution (for me) would basically be run
drupal_alter()on the array before sending it off to get turned into a js setting. Then you have a hook you can work with in a module you may have. Would that work? Or would you prefer some other method of adding specific js code you have? You could quite possibly override the core js object I provide to webfont loader as well in your js file with something like:within your jquery sandwich (so long as the weight of your code is lower than the weight of the webfont loader - I'm going to see if I can alter the weight so it comes further down so it is easier to add in your js if necessary).
Comment #2
btmash commentedSorry, this was a post in the wrong issue...
Comment #3
anthonyR commentedHey @btmash,
after fiddling around with the weights and trying out some stuff I now have a working solution.
It's possible to just add this in your normal script (in your theme f.e.), which will come after the script provided by the module.
This way it gets added to the existing google_webfont_loader_api_setting object in Drupal.settings, but the code will get executed on the event of the webfont loader, because this stuff lives in the Drupal behaviors i guess.
Pretty easy solution after all : )