client/js/save-once.js
changeset 320 154b121a43f1
parent 293 fba23fde14ba
child 357 70e577b0cdc6
equal deleted inserted replaced
319:91245f09c7a7 320:154b121a43f1
     1 /* Saves the Full JSON once */
     1 /* Saves the Full JSON once */
     2 
     2 
     3 Rkns.jsonIO = function(_renkan, _opts) {
     3 Rkns.jsonIOSaveOnClick = function(_renkan, _opts) {
     4     var _proj = _renkan.project,
     4     var _proj = _renkan.project,
     5         _saveWarn = false,
     5         _saveWarn = false,
     6         _onLeave = function() {
     6         _onLeave = function() {
     7             return "Project not saved";
     7             return "Project not saved";
     8         };
     8         };
    34             contentType: "application/json",
    34             contentType: "application/json",
    35             data: JSON.stringify(_data),
    35             data: JSON.stringify(_data),
    36             success: function(data, textStatus, jqXHR) {
    36             success: function(data, textStatus, jqXHR) {
    37                 $(window).off("beforeunload", _onLeave);
    37                 $(window).off("beforeunload", _onLeave);
    38                 _saveWarn = false;
    38                 _saveWarn = false;
    39                 document.location.hash = "#id=" + data.id;
    39                 //document.location.hash = "#id=" + data.id;
    40                 $(".Rk-Notifications").text("Saved as "+document.location.href).fadeIn().delay(2000).fadeOut();
    40                 //$(".Rk-Notifications").text("Saved as "+document.location.href).fadeIn().delay(2000).fadeOut();
    41             }
    41             }
    42         });
    42         });
    43     };
    43     };
    44     var _checkLeave = function() {
    44     var _checkLeave = function() {
    45         var title = _proj.get("title");
    45         var title = _proj.get("title");