9 DEFAULT_PERSPECTIVE = "#VisualPerspective";
13 var tabs = $('ol#tabs li');
16 CurrentDocument = new $.wikiapi.WikiDocument("document-meta");
17 $.blockUI.defaults.baseZ = 10000;
26 $('#tabs li').live('click', function(event, callback) {
27 event.preventDefault();
28 $.wiki.switchToTab(this);
31 $('#tabs li > .tabclose').live('click', function(event, callback) {
32 var $tab = $(this).parent();
34 if($tab.is('.active'))
35 $.wiki.switchToTab(DEFAULT_PERSPECTIVE);
37 var p = $.wiki.perspectiveForTab($tab);
42 $(window).resize(function(){
43 $('iframe').height($(window).height() - $('#tabs').outerHeight() - $('#source-editor .toolbar').outerHeight());
46 $(document).bind('wlapi_document_changed', function(event, doc) {
48 $('#document-revision').text(doc.revision);
50 console.log("Failed handler", e);
54 CurrentDocument.fetch({
56 console.log("Fetch success");
57 $('#loading-overlay').fadeOut();
58 var active_tab = document.location.hash || DEFAULT_PERSPECTIVE;
62 console.log("Initial tab is:", active_tab)
63 $.wiki.switchToTab(active_tab);
66 $('#loading-overlay').fadeOut();
70 }; /* end of initialize() */
72 /* Load configuration */
75 var initAll = function(a, f) {
76 if (a.length == 0) return f();
89 * Initialize all perspectives
91 initAll( $.makeArray($('ol#tabs li')), initialize);
92 console.log(location.hash);