X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/d64a8451dafc98e8f71455a55d123d22f3368ef9..36f6233fd79390ad5af8a1532eac60a0ae57c825:/platforma/static/js/wiki/loader.js diff --git a/platforma/static/js/wiki/loader.js b/platforma/static/js/wiki/loader.js index 34305d71..a4414027 100644 --- a/platforma/static/js/wiki/loader.js +++ b/platforma/static/js/wiki/loader.js @@ -22,7 +22,7 @@ $(function() function initialize() { gallery = new $.wiki.ScanGalleryPerspective({ - doc: CurrentDocument + doc: CurrentDocument, id: "ScanGalleryPerspective" }); $(document).keydown(function(event) { @@ -65,6 +65,7 @@ $(function() $('.vsplitbar').toggle( function() { + $.wiki.state.perspectives.ScanGalleryPerspective.show = true; $('#side-gallery').show(); $('.vsplitbar').css('right', 480).addClass('.active'); $('#editor .editor').css('right', 510); @@ -72,6 +73,7 @@ $(function() gallery.onEnter(); }, function() { + $.wiki.state.perspectives.ScanGalleryPerspective.show = false; $('#side-gallery').hide(); $('.vsplitbar').css('right', 0).removeClass('active'); $('#editor .editor').css('right', 30); @@ -80,6 +82,9 @@ $(function() } ); + if($.wiki.state.perspectives.ScanGalleryPerspective.show) + $('.vsplitbar').trigger('click'); + window.onbeforeunload = function(e) { if($.wiki.isDirty()) { e.returnValue = "Na stronie mogą być nie zapisane zmiany."; @@ -102,17 +107,24 @@ $(function() console.log("Fetch success"); $('#loading-overlay').fadeOut(); var active_tab = document.location.hash || DEFAULT_PERSPECTIVE; - var $active = $("#tabs " + active_tab); - $active.trigger("click"); + if(active_tab == "#ScanGalleryPerspective") + active_tab = DEFAULT_PERSPECTIVE; + + console.log("Initial tab is:", active_tab) + $.wiki.switchToTab(active_tab); }, failure: function() { $('#loading-overlay').fadeOut(); alert("FAILURE"); } - }); + }); }; /* end of initialize() */ + + /* Load configuration */ + $.wiki.loadConfig(); + var initAll = function(a, f) { if (a.length == 0) return f(); @@ -125,6 +137,7 @@ $(function() }); }; + /* * Initialize all perspectives */