diff options
author | Jayaram R Pai | 2014-09-09 13:24:00 +0530 |
---|---|---|
committer | Jayaram R Pai | 2014-09-09 13:24:00 +0530 |
commit | 2f78005613b149d7eccb16d1f3bb55f2b20a2db9 (patch) | |
tree | b0890c9e910ab4df83dcedf7d56b9b62c8fac73a | |
parent | af7aba032a7ec5fa5da9cc06760d2e67d3c928be (diff) | |
download | scilab-on-cloud-2f78005613b149d7eccb16d1f3bb55f2b20a2db9.tar.gz scilab-on-cloud-2f78005613b149d7eccb16d1f3bb55f2b20a2db9.tar.bz2 scilab-on-cloud-2f78005613b149d7eccb16d1f3bb55f2b20a2db9.zip |
added bode plot to regex, ajax loader to selects
-rw-r--r-- | static/website/css/main.css | 10 | ||||
-rw-r--r-- | static/website/images/ajax-loader.gif | bin | 723 -> 723 bytes | |||
-rw-r--r-- | static/website/js/cloud.js | 33 | ||||
-rw-r--r-- | static/website/templates/index.html | 2 | ||||
-rw-r--r-- | 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 Binary files differindex 6bdc3b5..8b71ca9 100644 --- a/static/website/images/ajax-loader.gif +++ b/static/website/images/ajax-loader.gif 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 = $("<img>"); @@ -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("<span class='ajax-loader'></span>"); + } } - 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 @@ <textarea id="code" placeholder="Write a new code or select existing from above category..."></textarea> </form> </div><!-- /#input --> - <a id="execute" class="button">Execute</a> + <a id="execute" class="button"><span id="execute-inner">Execute</span></a> <div id="output"> <label> diff --git a/website/helpers.py b/website/helpers.py index 7659d43..20ef288 100644 --- a/website/helpers.py +++ b/website/helpers.py @@ -17,7 +17,7 @@ def scilab_run(code, token, book_id, dependency_exists): plot_exists = False #Finding the plot and appending xs2jpg function - p = re.compile(r'.*plot.*\(.*,.*,*\).*\n') + p = re.compile(r'.*plot.*\(.*,.*,*\).*\n|bode\(.*,.*\)') plot_path = '' if p.search(code): |