From c876432dc8223f852bea4a14bdb2321b7fc2efe9 Mon Sep 17 00:00:00 2001 From: Matt Basta Date: Sat, 7 Dec 2013 18:35:51 -0800 Subject: [PATCH] Refactor main.js.dist and index.html to remove unused stuff. --- src/index.html | 1 - src/media/js/main.js.dist | 47 +++++++++------------------------------ 2 files changed, 10 insertions(+), 38 deletions(-) diff --git a/src/index.html b/src/index.html index 578aa65..bc926c4 100644 --- a/src/index.html +++ b/src/index.html @@ -9,7 +9,6 @@ -
diff --git a/src/media/js/main.js.dist b/src/media/js/main.js.dist index 1097150..f4295dd 100644 --- a/src/media/js/main.js.dist +++ b/src/media/js/main.js.dist @@ -16,55 +16,32 @@ require.config({ define( 'main', [ - 'underscore', 'helpers', // Must come before mostly everything else. - 'capabilities', - 'forms', + 'forms', // Comment this if your app has no forms. 'l10n', 'log', - 'login', + 'login', // Comment this if your app does not have accounts. 'navigation', 'templates', - //'tracking', - 'user', - 'views', + 'user', // Comment this if your app does not have accounts. 'z' ], -function(_) { - var log = require('log'); - var console = log('main'); - console.log('Dependencies resolved, starting init'); - - var capabilities = require('capabilities'); - var nunjucks = require('templates'); +function() { + var console = require('log')('main'); var z = require('z'); - nunjucks.env.dev = true; + console.log('Dependencies resolved, starting init'); z.body.addClass('html-' + require('l10n').getDirection()); - z.page.one('loaded', function() { - console.log('Hiding splash screen'); - $('#splash-overlay').addClass('hide'); - }); - - // This lets you refresh within the app by holding down command + R. - if (capabilities.chromeless) { - window.addEventListener('keydown', function(e) { - if (e.keyCode == 82 && e.metaKey) { - window.location.reload(); - } - }); - } - // Do some last minute template compilation. z.page.on('reload_chrome', function() { console.log('Reloading chrome'); - var context = {z: z}; + var nunjucks = require('templates'); $('#site-header').html( - nunjucks.env.render('header.html', context)); + nunjucks.env.render('header.html')); $('#site-footer').html( - nunjucks.env.render('footer.html', context)); + nunjucks.env.render('footer.html')); z.body.toggleClass('logged-in', require('user').logged_in()); z.page.trigger('reloaded_chrome'); @@ -78,11 +55,7 @@ function(_) { // Perform initial navigation. console.log('Triggering initial navigation'); - if (!z.spaceheater) { - z.page.trigger('navigate', [window.location.pathname + window.location.search]); - } else { - z.page.trigger('loaded'); - } + z.page.trigger('navigate', [window.location.pathname + window.location.search]); // Debug page (function() {