With drupal_add_js you can add inline javascript such as

<script type="text/javascript">Drupal.extend({ settings: { "thickbox": { "close": "Close", "next": "Next \x3e", "prev": "\x3c Prev", "esc_key": "or Esc Key", "next_close": "Next / Close on last", "image_count": "Image !current of !total" } } });</script>

It would be nice if we could get those aggregated, too.

Comments

derjochenmeyer’s picture

Hi FiReaNG3L, thanks or your idea! I thought about that, but i see some problems:

- the filename is generated by the set of .js files right now. we would have to figure out a way to include this information in the md5 value.
- the inline js code might be dynamic in some caes. if we dont take that into account we end up with problems, if we do we might have a new file created on every pageload which would make it a performance issue for the server maybe.

After all the main purpose is to redue the serverload and interaction. I think it makes no big difference if the code is inline or in a cached file. What would be the main benefit of caching inline js?

FiReaNGeL’s picture

Status: Active » Closed (works as designed)

I think you're right on both points, especially the dynamic JS one, which we have no easy way to detect. I can work around it by building a small JS file and drupal_add_js that instead, it will get aggregated just fine. Thanks for the awesome module!

redben’s picture

Or we can aggregate inline ! instead of having :

<script>
if (Drupal.jsEnabled) { .... }
</script>
<script>
if (Drupal.jsEnabled) { .... }
</script>
<script>
if (Drupal.jsEnabled) { .... }
</script>

we can have

<script>
...
</script>