fixes
[redakcja.git] / src / redakcja / static / js / wiki / base.js
index e69e3e1..b4fee85 100644 (file)
                return this.perspectives[ $(tab).attr('id')];
        }
 
+    $.wiki.exitTab = function(tab){
+       var self = this;
+       var $tab = $(tab);
+        if (!('.active', $tab)) return;
+       $('.active', $tab).removeClass('active');
+       self.perspectives[$tab.attr('id')].onExit();
+       $('#' + $tab.attr('data-ui-related')).hide();
+    }
+    
     $.wiki.switchToTab = function(tab){
        var self = this;
        var $tab = $(tab);
                        $.blockUI({
                                message: this.$elem,
                                css: {
-                                       'top': '25%',
-                                       'left': '25%',
-                                       'width': '50%'
+                                    'top': '25%',
+                                    'left': '25%',
+                                    'width': '50%',
+                                    'max-height': '75%',
+                                    'overflow-y': 'scroll'
                                }
                        });
                },
                }
        };
 
+
+    window.addEventListener("message", (event) => {
+        event.source.close()
+
+        $.ajax("/editor/editor-user-area/", {
+            success: function(d) {
+                $("#user-area")[0].innerHTML = d;
+            }
+        });
+    }, false);
+    
+    $("#login").click(function (e) {
+        e.preventDefault();
+        let h = 600;
+        let w = 500;
+        let x = window.screenX + (window.innerWidth - w) / 2;
+        let y = window.screenY + (window.innerHeight - h) / 2;
+        window.open(
+            "/accounts/login/?next=/editor/back",
+            "login-window",
+            "width=" + w + " height=" + h + " top=" + y + " left=" + x
+        );
+    });
+    
 })(jQuery);