Ticket 867: 'cancel' button in editor.
[redakcja.git] / redakcja / static / js / wiki / view_editor_wysiwyg.js
index 87d7707..dc24aea 100644 (file)
         if ($origin.is(".annotation-inline-box")) {
             w = Math.max(w, 400);
             h = Math.max(h, 60);
-            if($('.htmlview div').offset().left + $('.htmlview div').width() > ($('.vsplitbar').offset().left - 450)){
-                x = 0;    
+            if($('.htmlview div').offset().left + $('.htmlview div').width() > ($('.vsplitbar').offset().left - 480)){
+                x = -(Math.max($origin.offset().left, $origin.width())); 
             } else {
                 x = 100;
             }
-            alert('Origin left: ' + ($('.htmlview div').offset().left + $('.htmlview div').width()) + ', Belka-odstep: ' + ($('.vsplitbar').offset().left - 450));
         }
 
         // start edition on this node
             });
         }
         else {
-            $('.delete-button', $overlay).hide();
+            $('.delete-button', $overlay).html("Anuluj");
+            $('.delete-button', $overlay).click(function(){
+                if (window.confirm("Czy jesteś pewien, że chcesz anulować zmiany?")) {
+                    $overlay.remove();
+                    $(document).unbind('click.blur-overlay');
+                    return false;
+                };
+            });
         }
 
 
                             alert('Błąd! ' + text);
                         }
                     })
+                    
+                    var msg = $("<div class='saveNotify'><p>Twoje zmiany zostały naniesione na tekst źródłowy. Pamiętaj, że aby zmiany zostały utrwalone <span>należy je zapisać</span>!</p><p class='notifyTip'>Ta wiadomość zostanie automatycznie zamknięta za 6 sekund.</p></div>");
+                    $("#base").prepend(msg);
+                    $("#save-button").css({border: '5px solid red'});
+                    $('#base .saveNotify').fadeOut(7000, function(){
+                        $(this).remove(); 
+                        $("#save-button").css({border: '1px solid black'});
+                    });
                 }
 
                 $('.accept-button', $overlay).click(function(){
                         return;
                     }
                     save();
-
                     $(document).unbind('click.blur-overlay');
                 });