You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
32 lines
1.0 KiB
$(document).ready(function() { |
|
/* code highlight */ |
|
$('pre code').each(function(i, block) { |
|
hljs.highlightBlock(block); |
|
}); |
|
|
|
/* zerobin / radio 'source' autoswitch */ |
|
$('#paste').on('change', function() { |
|
$('input[name=source]').val(['form']); |
|
}); |
|
$('#upload').on('change', function() { |
|
$('input[name=source]').val(['file']); |
|
}); |
|
|
|
/* comments */ |
|
$('#comments').load('/comments/get', function() { |
|
// handle 'add comment' button click |
|
$('a#cadd').click(function(e) { |
|
e.preventDefault(); |
|
$(this).remove(); |
|
$('div#cadd').load('/comments/new', function() { |
|
// form submit with ajax |
|
$('#comments form').submit(function(e) { |
|
e.preventDefault(); |
|
$.post('/comments/add', $(this).serialize()) |
|
.done(function(data) { location.reload(); }) |
|
.fail(function(data) { $('#comments #resp').html(data.responseText); }); |
|
}); // form submit |
|
}); // on form load |
|
}); // #cadd click |
|
}); // #comments load |
|
}); // document ready
|
|
|