summaryrefslogtreecommitdiff
path: root/js/tbc_external_review.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tbc_external_review.js')
-rw-r--r--js/tbc_external_review.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/js/tbc_external_review.js b/js/tbc_external_review.js
new file mode 100644
index 0000000..bfd1142
--- /dev/null
+++ b/js/tbc_external_review.js
@@ -0,0 +1,46 @@
+$(document).ready(function() {
+ $book = $("#edit-book");
+ $chapter = $("#edit-chapter");
+ $chapter_wrapper = $("#edit-chapter-wrapper");
+ $example = $("#edit-example");
+ $example_wrapper = $("#edit-example-wrapper");
+ $error_wrapper = $("#comment-error-wrapper");
+ $submit = $("#edit-submit");
+ $ajax_loader = $("#ajax-loader");
+
+ $book.change(function() {
+ var pid = $(this).val();
+ $.ajax({
+ url: "ajax/book/"+pid,
+ type: "GET",
+ success: function(data) {
+ $chapter.html(data);
+ $chapter_wrapper.show();
+ },
+ });
+ });
+
+ $chapter.change(function() {
+ var cid = $(this).val();
+ $.ajax({
+ url: "ajax/chapter/"+cid,
+ type: "GET",
+ success: function(data) {
+ $example.html(data);
+ $example_wrapper.show();
+ },
+ });
+ });
+
+ $example.change(function() {
+ $error_wrapper.show();
+ $submit.show();
+ });
+
+ $(document).ajaxStart(function() {
+ $ajax_loader.show();
+ });
+ $(document).ajaxStop(function() {
+ $ajax_loader.hide();
+ });
+});