Refactor main.js.dist and index.html to remove unused stuff.

This commit is contained in:
Matt Basta 2013-12-07 18:35:51 -08:00
Родитель 5254d5e57a
Коммит c876432dc8
2 изменённых файлов: 10 добавлений и 38 удалений

Просмотреть файл

@ -9,7 +9,6 @@
<body class="home" data-media="">
<noscript><p>Sorry, you need JavaScript to use this site.</p></noscript>
<div id="splash-overlay"><div class="throbber"></div></div>
<header id="site-header" class="header site-header"></header>

Просмотреть файл

@ -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() {