Sha256: a1961b390c744962684ffd36ab69ee79191d2097136e5f9b9150c85ca2b431a2

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

var startRefresh = function() {
  window.worker = setTimeout(function() {
    location.reload();
  }, 3000);
}

window.worker = null;

$('#refreshButton').on('click', function() {
  if (window.localStorage.refresh == undefined) {
    window.localStorage.refresh = 'true'
  }
  else{
    delete window.localStorage.refresh
  }
  console.log(window.localStorage.refresh)

  if (window.localStorage.refresh == 'true') {
    startRefresh()
    $('#refreshButton').html('AUTO RELOAD ON')
    $(this).addClass("btn-info")
    $(this).removeClass("btn-warning")
  } else {
    clearTimeout(window.worker)
    $('#refreshButton').html('AUTO RELOAD OFF')
    $(this).addClass("btn-warning")
    $(this).removeClass("btn-info")
  }

})

if (window.localStorage.refresh == 'true') {
  $('#refreshButton').html('AUTO RELOAD ON')
  $('#refreshButton').addClass("btn-info")
  $('#refreshButton').removeClass("btn-warning")
  startRefresh()
}


$("#start_script").click(function(){
  $.ajax({url: "/start", success: function(result){
  }});
});

$("#stop_script").click(function(){
  $.ajax({url: "/stop", success: function(result){
  }});
});


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adminix-0.2 app/assets/javascripts/application.js