|
@@ -29,6 +29,7 @@ var router = {
|
|
|
}
|
|
|
},
|
|
|
run: function(name, path) {
|
|
|
+ $('.nav').removeClass('active');
|
|
|
checkUser(function() {
|
|
|
if (router.routes[name].useAjax) {
|
|
|
$.get(path, {cache: false}, function(data) {
|
|
@@ -46,13 +47,13 @@ var router = {
|
|
|
|
|
|
function render(pageId, response) {
|
|
|
if (user.name) {
|
|
|
- $('.username').text(user.name);
|
|
|
+ $('.username').text("Hi, "+user.name+"!");
|
|
|
$("#login_status").show();
|
|
|
$('#login_link').text('Logout').attr('href', '/logout');
|
|
|
$('#register_link').hide();
|
|
|
$('#profile_link').show();
|
|
|
} else {
|
|
|
- $('.username').text('');
|
|
|
+ $('.username').text('Guest');
|
|
|
$("#login_status").hide();
|
|
|
$('#login_link').text('Login').attr('href', '/login');
|
|
|
$('#register_link').show();
|
|
@@ -99,6 +100,7 @@ router.add('404', false, function() {
|
|
|
|
|
|
router.add('home', false, function(cb) {
|
|
|
$('#learnsomething').unbind();
|
|
|
+ $('.nav').removeClass('active');
|
|
|
cb("home");
|
|
|
$('#learnsomething').click(function(e) {
|
|
|
$.get('/learn/random', function(data) {
|
|
@@ -108,7 +110,7 @@ router.add('home', false, function(cb) {
|
|
|
})
|
|
|
});
|
|
|
if ($('#vimeo-screencast').length === 0) {
|
|
|
- $('#screencast').html('<iframe id="vimeo-screencast" src="http://player.vimeo.com/video/30647271?title=0&byline=0&portrait=0" width="350" height="250" frameborder="0" webkitallowfullscreen="webkitAllowFullScreen" allowfullscreen="allowFullScreen"></iframe>');
|
|
|
+ $('.video-wrapper').html('<iframe id="vimeo-screencast" src="http://player.vimeo.com/video/30647271?title=0&byline=0&portrait=0&color=367da9" width="460" height="259" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>');
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -116,7 +118,7 @@ router.add('home', false, function(cb) {
|
|
|
|
|
|
// go to the page that lists the schools
|
|
|
router.add('schools', function(data, cb) {
|
|
|
-
|
|
|
+ $('#school_link').addClass('active');
|
|
|
var response = {
|
|
|
id: 'school',
|
|
|
data: data.schools
|
|
@@ -129,6 +131,7 @@ router.add('schools', function(data, cb) {
|
|
|
|
|
|
// go to the page that lists the courses for a specific school
|
|
|
router.add('school', function(data, cb) {
|
|
|
+ $('#school_link').addClass('active');
|
|
|
$('.sub_menu').hide();
|
|
|
$('#new_course').unbind();
|
|
|
$('#form_course').hide().unbind();
|
|
@@ -171,6 +174,7 @@ router.add('school', function(data, cb) {
|
|
|
|
|
|
// go to the page that lists the lectures for a specific course
|
|
|
router.add('course', function(data, cb) {
|
|
|
+ $('#school_link').addClass('active');
|
|
|
$('.sub_menu').hide();
|
|
|
$('#new_lecture').unbind();
|
|
|
$('#form_lecture').hide().unbind();;
|
|
@@ -240,6 +244,7 @@ router.add('course', function(data, cb) {
|
|
|
|
|
|
// go to the page that lists the note taking sessions for a specific lecture
|
|
|
router.add('lecture', function(data, cb) {
|
|
|
+ $('#school_link').addClass('active');
|
|
|
$('.sub_menu').hide();
|
|
|
$('#new_note').unbind();
|
|
|
$('#form_note').hide().unbind();;
|
|
@@ -304,6 +309,7 @@ router.add('lecture', function(data, cb) {
|
|
|
|
|
|
// go to the page that lists the archived subject names
|
|
|
router.add('archive', function(data, cb) {
|
|
|
+ $('#archive_link').addClass('active');
|
|
|
|
|
|
var response = {
|
|
|
id: 'archive_subject',
|
|
@@ -316,6 +322,8 @@ router.add('archive', function(data, cb) {
|
|
|
|
|
|
|
|
|
router.add('archivesubject', function(data, cb) {
|
|
|
+ $('.nav').removeClass('active');
|
|
|
+ $('#archive_link').addClass('active');
|
|
|
|
|
|
var response = {
|
|
|
id: 'archive_course',
|
|
@@ -328,6 +336,7 @@ router.add('archivesubject', function(data, cb) {
|
|
|
|
|
|
|
|
|
router.add('archivecourse', function(data, cb) {
|
|
|
+ $('#archive_link').addClass('active');
|
|
|
|
|
|
var response = {
|
|
|
id: 'archive_note',
|
|
@@ -340,6 +349,7 @@ router.add('archivecourse', function(data, cb) {
|
|
|
|
|
|
|
|
|
router.add('archivenote', function(data, cb) {
|
|
|
+ $('#archive_link').addClass('active');
|
|
|
|
|
|
var response = {
|
|
|
id: 'archive_note_display',
|
|
@@ -353,6 +363,7 @@ router.add('archivenote', function(data, cb) {
|
|
|
|
|
|
// go to the account registration page
|
|
|
router.add('register', false, function(cb) {
|
|
|
+ $('#register_link').addClass('active');
|
|
|
$('#form_register').submit(function(e) {
|
|
|
e.preventDefault();
|
|
|
|
|
@@ -377,6 +388,7 @@ router.add('activate', function(data, cb) {
|
|
|
});
|
|
|
|
|
|
router.add('profile', false, function(cb) {
|
|
|
+ $('#profile_link').addClass('active');
|
|
|
var form = $('#form_profile');
|
|
|
$('input[type=password]','#form_profile').val('');
|
|
|
$('#affiliation').attr('value', user.affil);
|
|
@@ -466,6 +478,7 @@ router.add('resetpw', false, function(cb) {
|
|
|
|
|
|
// go to the press articles page
|
|
|
router.add('press', false, function(cb) {
|
|
|
+ $('#press_link').addClass('active');
|
|
|
cb("press");
|
|
|
});
|
|
|
|
|
@@ -529,10 +542,12 @@ function goPage(path) {
|
|
|
var popped = false;
|
|
|
function goBack(event) {
|
|
|
popped = true;
|
|
|
+ console.timeEnd('pop')
|
|
|
showPage( topQueue.pop() );
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+console.time('pop')
|
|
|
+console.time('no-pop')
|
|
|
window.onpopstate = goBack
|
|
|
|
|
|
$(document).ready(function() {
|
|
@@ -554,6 +569,7 @@ $(document).ready(function() {
|
|
|
|
|
|
// xxx older FF browsers don't fire a page load/reload - deal with it somehow.
|
|
|
setTimeout(function() {
|
|
|
+ console.timeEnd('no-pop')
|
|
|
if (!popped) {
|
|
|
showPage( 0 ); // needed for some older browsers, redundant for chrome
|
|
|
}
|