Department: __department__<br>
</div>
<div class="proto lectures_instructor" id=PROTO_lectures_instructor>
- Instructor: __name__ (__email__)<br>
+ Instructor: __name__ <span class="instructor_email">(__email__)</span><br>
</div>
<div class="proto lecture" id=PROTO_lecture>
<div class=name>
<div class=page id=pg_notes>
- <h1>Notepads </h1>
+ <div class="proto notes_head" id=PROTO_notes_head>
+ <h1>Note pads for Course __number__ : __name__</h1>
+ Subject: __subject__<br>
+ Department: __department__<br>
+ </div>
+ <div class="proto notes_instructor" id=PROTO_notes_instructor>
+ Instructor: __name__ <span class="instructor_email">(__email__)</span><br>
+ </div>
<div class="proto note" id=PROTO_note>
<div class=name>
- <a href="/note/___id__">__name__</a>
+ <a href="/note/___id__">__name__</a> Visits: __visits__
</div>
</div>
<div>
if (data.lectures) {
response.push({
id: 'lecture',
- data: data.lectures
+ data: data.lectures.map(function(lecture) {
+ var date = new Date(lecture.date);
+ lecture.date = date.toDateString();
+ return lecture;
+ })
})
}
+ cb('lectures', response);
+
+ if (!data.instructor.email) {
+ $('.instructor_email').hide();
+ } else {
+ $('.instructor_email').show();
+ }
if (data.course.authorized) {
$('#new_lecture').show();
});
}
- cb('lectures', response);
});
var response = [];
+ if (data.course) {
+ response.push({
+ id: 'notes_head',
+ data: data.course
+ })
+ }
+
+ if (data.instructor) {
+ response.push({
+ id: 'notes_instructor',
+ data: data.instructor
+ })
+ }
+
if (data.notes) {
response.push({
id: 'note',
})
}
+ cb("notes", response);
+
+ if (!data.instructor.email) {
+ $('.instructor_email').hide();
+ } else {
+ $('.instructor_email').show();
+ }
+
if (data.lecture.authorized) {
$('#new_note').show();
$('#new_note').click(function(e) {
})
});
}
- cb("notes", response);
});
*/
var topQueue = [0]
function goPage(path) {
- var y = 0 + window.pageYOffset
- topQueue.push(y)
- history.pushState({}, path, path);
- showPage(0);
+ if (history.pushState !== undefined) {
+ topQueue.push(window.pageYOffset)
+ history.pushState({}, path, path);
+ showPage(0);
+ } else {
+ document.location = path;
+ }
}
/* Simulates a "back" browser navigation. */
+var popped = false;
function goBack(event) {
- var y = topQueue.pop()
- showPage( y );
+ popped = true;
+ showPage( topQueue.pop() );
}
- window.onpopstate = goBack
+window.onpopstate = goBack
$(document).ready(function() {
})
// xxx older FF browsers don't fire a page load/reload - deal with it somehow.
- // showPage( 0 ); // needed for some older browsers, redundant for chrome
+ setTimeout(function() {
+ if (!popped) {
+ showPage( 0 ); // needed for some older browsers, redundant for chrome
+ }
+ }, 200)
})