elkarte/Elkarte — pull request #1164 by Spuds (2013-12-14 17:27:50+00:00)
Title: [Feedback] Continued Script tunning

I'm going through the code and moving additional external scripts back to sources so that loadJavascriptFile and the site combiner can do their thing (and save a request).

I'm also looking for a few things that we can defer on the page load via addInlineJavascript using the defer option, it just moves some inline script from the header to the end where that is appropriate

Now the item that may, or may not, cause some to grumble ... I used addInlineJavascript in the tempates (but I was not the first :dancers: ) for a few reasons.
- One it places all of the cdata script stuff with that function so I don't have to see, or remember to do that in the template (plus we may decide we don't need that at some point, so removal will be easier).
- Two it consolidates the script output so we don't have 20 script open/close tags in the output
- Three it allows us to defer it to the end, and since a lot of the inline stuff is simply initializing some class/function in an external script, many are candidates for this.

All addInlineJavascript does is add a string to ```$context['javascript']['standard | defered][]``` for use in the JavaScript output template. So does anyone feel this is a bad practice, i.e. to call this function from the template? Yes many of those areas could be pulled back in the the sources, but TBH its kind of ugly to look at in the sources plus it not as easy to fix / work on "views" IMO

So a couple of examples: https://github.com/Spuds/Elkarte/commit/adbcb3d46511271dc95d94456a27dcec2611d16d or
parts of https://github.com/Spuds/Elkarte/commit/a75b072c3852e2311427c1aa50abd71c57ebfbc1