Sha256: 0bb34c90dbf1ab36cf77cd8c7fec963cbbb1e3b9154b7dd5441f28f62d2a3c8c

Contents?: true

Size: 1.5 KB

Versions: 9

Compression:

Stored size: 1.5 KB

Contents

document.addEventListener('graph:changed', function (e) {
  $("button[name=save]").prop("disabled",false);
}, false);
document.addEventListener('parameters:changed', function (e) {
  $("button[name=save]").prop("disabled",false);
}, false);
document.addEventListener('modifiers:changed', function (e) {
  $("button[name=save]").prop("disabled",false);
}, false);
document.addEventListener('model:loaded', function (e) {
  $("button[name=save]").prop("disabled",false);
}, false);

function leading_zeros(dt) {
  return (dt < 10 ? '0' : '') + dt;
}

$(document).ready(function() {
  $("button[name=save]").click(function(){
    var def = new $.Deferred();
    def.done(function(name,testset) {
      $.ajax({
        url: $('body').attr('current-save') + ($('body').attr('current-save-dir') ? ($('body').attr('current-save-dir') + '/').replace(/\/+/,'/') : '') + name + '.xml',
        type: 'PUT',
        contentType: 'application/xml',
        data: testset.serializePrettyXML(),
        headers: { 'Content-ID': 'content' },
        success: function() {
          $("button[name=save]").prop("disabled",true);
          $("#lastsavedline").removeClass('hidden');
          var dt = new Date();
          var time = leading_zeros(dt.getHours()) + ":" + leading_zeros(dt.getMinutes()) + ":" + leading_zeros(dt.getSeconds());
          $("#lastsaved").text(time);
        },
        error: function() {
          alert('File was moved or deleted. Save testset to disk.');
        }
      });
    });
    get_testset(def);
  });
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cpee-2.1.61 cockpit/js/edit.js
cpee-2.1.60 cockpit/js/edit.js
cpee-2.1.59 cockpit/js/edit.js
cpee-2.1.58 cockpit/js/edit.js
cpee-2.1.57 cockpit/js/edit.js
cpee-2.1.56 cockpit/js/edit.js
cpee-2.1.55 cockpit/js/edit.js
cpee-2.1.54 cockpit/js/edit.js
cpee-2.1.53 cockpit/js/edit.js