blob: 237a990f7c6dd8040f0072b186b4d2f39d31a97e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
function main(){
var socket = io('http://localhost:3000');
socket.on('alert', function (data) {
console.log(data);
socket.emit('my other event', { my: 'data' });
});
socket.on('new_solution', function (data) {
console.log("new solution: ");
console.log(data);
var $notification_menu = $(".notification-dropdown-menu");
//$notification_menu.remove($('li a.generic-notification'));
var $li = $('<li>');
var $a = $('<a>').text(data.author + " has added a solution to an exam.");
$li.append($a);
$notification_menu.append($li);
socket.emit('add_notification', data);
// emit back to the server to save it as a notification in the database
// update badge
});
// --- nav scripts ---
$("input").keyup( function(event) {
if(event.keyCode == 13){
$(".go-button").click();
}
});
$(".dropdown").hover(function(){
//$(".dropdown-toggle", this).trigger("click");
});
$(".dropdown-toggle").click(function() {
$(this).next(".dropdown-menu").fadeToggle(200);
});
// For the Second level Dropdown menu, highlight the parent
$( ".dropdown-menu" )
.mouseenter(function() {
$(this).parent('li').addClass('active');
})
.mouseleave(function() {
$(this).parent('li').removeClass('active');
});
$('.table-row').trigger('create');
}
$(document).ready(main);
|