9 DEFAULT_PERSPECTIVE = "#MotifsPerspective";
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 $.wiki.switchToTab(this);
30 $('#tabs li > .tabclose').live('click', function(event, callback) {
31 var $tab = $(this).parent();
33 if($tab.is('.active'))
34 $.wiki.switchToTab(DEFAULT_PERSPECTIVE);
36 var p = $.wiki.perspectiveForTab($tab);
41 $(window).resize(function(){
42 $('iframe').height($(window).height() - $('#tabs').outerHeight() - $('#source-editor .toolbar').outerHeight());
45 $(document).bind('wlapi_document_changed', function(event, doc) {
47 $('#document-revision').text(doc.revision);
49 console.log("Failed handler", e);
53 CurrentDocument.fetch({
55 console.log("Fetch success");
56 $('#loading-overlay').fadeOut();
57 var active_tab = document.location.hash || DEFAULT_PERSPECTIVE;
61 console.log("Initial tab is:", active_tab)
62 $.wiki.switchToTab(active_tab);
65 $('#loading-overlay').fadeOut();
69 }; /* end of initialize() */
71 /* Load configuration */
74 var initAll = function(a, f) {
75 if (a.length == 0) return f();
88 * Initialize all perspectives
90 initAll( $.makeArray($('ol#tabs li')), initialize);
91 console.log(location.hash);