Commit 6372df7e authored by okhin's avatar okhin

Cleaner global variable in JS

parent 0c23b73f
Pipeline #804 passed with stage
in 1 second
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,6 @@
<script type="text/javascript"> <script type="text/javascript">
var call = JSON.parse('{{ @call | raw }}'); var call = JSON.parse('{{ @call | raw }}');
var call_url = call['data']['url']; var call_url = call['data']['url'];
var interval;
function normalize_phone(phone) { function normalize_phone(phone) {
if (phone.startsWith('+')) { if (phone.startsWith('+')) {
return phone.replace('+', '00'); return phone.replace('+', '00');
...@@ -146,7 +145,7 @@ ...@@ -146,7 +145,7 @@
$('#step5').removeClass('green').removeClass('outline_green').addClass('red'); $('#step5').removeClass('green').removeClass('outline_green').addClass('red');
$('#step6').removeClass('green').removeClass('outline_green').addClass('red'); $('#step6').removeClass('green').removeClass('outline_green').addClass('red');
$('#callee').removeClass('green').removeClass('outline_green').addClass('red'); $('#callee').removeClass('green').removeClass('outline_green').addClass('red');
clearInterval(interval); clearInterval(window.interval);
} }
console.log(call_state[0]); console.log(call_state[0]);
}; };
...@@ -162,6 +161,6 @@ ...@@ -162,6 +161,6 @@
}; };
$(document).ready(function() { $(document).ready(function() {
update_call(call); update_call(call);
interval = window.setInterval(fetch, 3000); var window.interval = window.setInterval(fetch, 3000);
}); });
</script> </script>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment