Merge branch 'cdn-scripts' into develop

This commit is contained in:
Tyler Renelle
2013-03-17 09:33:19 -04:00
2 changed files with 15 additions and 20 deletions
+4 -18
View File
@@ -10,41 +10,27 @@ restoreRefs = module.exports.restoreRefs = (model) ->
###
Loads JavaScript files from (1) public/js/* and (2) external sources
We use this file (instead of <Scripts:> or <Tail:> inside .html) so we can utilize require() to concatinate for
faster page load, and $.getScript for asyncronous external script loading
If a library is available in a CDN, we put it in <Scripts:> (index.html) for better caching. If not, we use
this function to utilize require() to concatinate for faster page load, and $.getScript for asyncronous external script loading
###
loadJavaScripts = (model) ->
require '../../public/vendor/jquery-ui/jquery-1.9.1'
unless model.get('_view.mobileDevice')
require '../../public/vendor/jquery-ui/ui/jquery.ui.core'
require '../../public/vendor/jquery-ui/ui/jquery.ui.widget'
require '../../public/vendor/jquery-ui/ui/jquery.ui.mouse'
require '../../public/vendor/jquery-ui/ui/jquery.ui.sortable'
# Bootstrap
require '../../public/vendor/bootstrap/docs/assets/js/bootstrap'
# require '../../public/vendor/bootstrap/js/bootstrap-tooltip'
# require '../../public/vendor/bootstrap/js/bootstrap-tab'
# require '../../public/vendor/bootstrap/js/bootstrap-popover'
# require '../../public/vendor/bootstrap/js/bootstrap-modal'
# require '../../public/vendor/bootstrap/js/bootstrap-dropdown'
require '../../public/vendor/jquery-cookie/jquery.cookie'
require '../../public/vendor/bootstrap-tour/bootstrap-tour'
require '../../public/vendor/bootstrap-datepicker/js/bootstrap-datepicker'
require '../../public/vendor/bootstrap-growl/jquery.bootstrap-growl.min'
# JS files not needed right away (google charts) or entirely optional (analytics)
# Each file getsload asyncronously via $.getScript, so it doesn't bog page-load
unless model.get('_view.mobileDevice')
$.getScript("https://s7.addthis.com/js/250/addthis_widget.js#pubid=lefnire");
$.getScript("//s7.addthis.com/js/250/addthis_widget.js#pubid=lefnire");
# Google Charts
$.getScript "https://www.google.com/jsapi", ->
$.getScript "//www.google.com/jsapi", ->
# Specifying callback in options param is vital! Otherwise you get blank screen, see http://stackoverflow.com/a/12200566/362790
google.load "visualization", "1", {packages:["corechart"], callback: ->}