diff options
Diffstat (limited to 'website/static')
-rw-r--r-- | website/static/website/js/cloud.js | 19 | ||||
-rw-r--r-- | website/static/website/templates/index.html | 3 |
2 files changed, 22 insertions, 0 deletions
diff --git a/website/static/website/js/cloud.js b/website/static/website/js/cloud.js index a34f359..43f035f 100644 --- a/website/static/website/js/cloud.js +++ b/website/static/website/js/cloud.js @@ -1,3 +1,7 @@ +window.setInterval(function(){ + checkserver(); +}, 5000); + /* Ajax loader */ function ajax_loader(key) { if (key == "clear") { @@ -38,6 +42,8 @@ function checkInput(){ /**************************** math captcha function end *******************/ $(document.body).ready(function() { + checkserver(); + var editor = CodeMirror.fromTextArea(document.getElementById( "code"), { lineNumbers: true, @@ -651,6 +657,7 @@ $(document.body).ready(function() { $plotbox = $("#plotbox"); $(document).on("click", "#execute", function() { + checkserver(); if(editor.getValue() != ""){ ajax_loader(this); $("#execute-inner").html("Executing..."); @@ -1060,3 +1067,15 @@ function doSubmit(){ } } +function checkserver(){ + + $.ajax({url: api_url, + dataType: "jsonp", + statusCode: { + 404: function (response) { + alert("Oops! R cloud server is not available, please try after some time"); + } + } + }); +} + diff --git a/website/static/website/templates/index.html b/website/static/website/templates/index.html index fe31f5b..18dd01b 100644 --- a/website/static/website/templates/index.html +++ b/website/static/website/templates/index.html @@ -624,6 +624,9 @@ <script src="{% static 'website/js/javascript.js'%}"></script> <script src="{% static 'website/js/fullscreen.js'%}"></script> <script src="{% static 'website/js/placeholder.js'%}"></script> + <script> + var api_url = "{{ api_url }}"; + </script> <script src="{% static 'website/js/cloud.js' %}"></script> <script src="{% static 'website/js/jsdiff.js'%}"></script> {% csrf_token %} |