From 2f78005613b149d7eccb16d1f3bb55f2b20a2db9 Mon Sep 17 00:00:00 2001 From: Jayaram R Pai Date: Tue, 9 Sep 2014 13:24:00 +0530 Subject: added bode plot to regex, ajax loader to selects --- static/website/css/main.css | 10 ++++++++++ static/website/images/ajax-loader.gif | Bin 723 -> 723 bytes static/website/js/cloud.js | 33 +++++++++++++++++++++++++-------- static/website/templates/index.html | 2 +- website/helpers.py | 2 +- 5 files changed, 37 insertions(+), 10 deletions(-) diff --git a/static/website/css/main.css b/static/website/css/main.css index d476b7b..d4938fe 100644 --- a/static/website/css/main.css +++ b/static/website/css/main.css @@ -142,3 +142,13 @@ a.extra-link { float: right; color: #aaaaaa; } +.ajax-loader { + position: relative; + display: inline-block; + top: 1px; + left: 5px; + width: 16px; + height: 11px; + background: url("../images/ajax-loader.gif"); + background-size: cover; +} diff --git a/static/website/images/ajax-loader.gif b/static/website/images/ajax-loader.gif index 6bdc3b5..8b71ca9 100644 Binary files a/static/website/images/ajax-loader.gif and b/static/website/images/ajax-loader.gif differ diff --git a/static/website/js/cloud.js b/static/website/js/cloud.js index 764a8ae..50b9a07 100644 --- a/static/website/js/cloud.js +++ b/static/website/js/cloud.js @@ -71,23 +71,37 @@ $(document).ready(function() { $("#books-wrapper").html(""); $("#chapters-wrapper").html(""); $("#examples-wrapper").html(""); - Dajaxice.website.books(Dajax.process, {category_id: $(this).val()}); + ajax_loader(this); + Dajaxice.website.books(function(data) { + Dajax.process(data); + ajax_loader("clear"); + }, {category_id: $(this).val()}); }); $(document).on("change", "#books", function() { $("#chapters-wrapper").html(""); $("#examples-wrapper").html(""); - Dajaxice.website.chapters(Dajax.process, {book_id: $(this).val()}); + ajax_loader(this); + Dajaxice.website.chapters(function(data) { + Dajax.process(data); + ajax_loader("clear"); + }, {book_id: $(this).val()}); }); $(document).on("change", "#chapters", function() { $("#examples-wrapper").html(""); - Dajaxice.website.examples(Dajax.process, {chapter_id: $(this).val()}); + ajax_loader(this); + Dajaxice.website.examples(function(data) { + Dajax.process(data); + ajax_loader("clear"); + }, {chapter_id: $(this).val()}); }); $(document).on("change", "#examples", function() { + ajax_loader(this); Dajaxice.website.code(function(data) { editor.setValue(data.code); + ajax_loader("clear"); }, {example_id: $(this).val()}); }); @@ -95,9 +109,9 @@ $(document).ready(function() { $lightbox_wrapper = $("#lightbox-me-wrapper"); $lightbox = $("#lightbox-me"); $(document).on("click", "#execute", function() { - $("body").css("cursor", "wait"); + $("#execute-inner").html("Executing..."); Dajaxice.website.execute(function(data) { - $("body").css("cursor", "auto"); + $("#execute-inner").html("Execute"); result.setValue(data.output); if(data.plot_path) { $plot = $(""); @@ -134,8 +148,11 @@ $(document).ready(function() { }); /* Ajax loader */ - function ajax_loader(ele) { - + function ajax_loader(key) { + if(key == "clear") { + $(".ajax-loader").remove(); + } else { + $(key).after(""); + } } - ajax_loader("#categories"); }); diff --git a/static/website/templates/index.html b/static/website/templates/index.html index a3a6f8a..31d028c 100644 --- a/static/website/templates/index.html +++ b/static/website/templates/index.html @@ -74,7 +74,7 @@ - Execute + Execute