9 DEFAULT_PERSPECTIVE = "#MotifsPerspective";
14 var tabs = $('ol#tabs li');
17 CurrentDocument = new $.wikiapi.WikiDocument("document-meta");
18 $.blockUI.defaults.baseZ = 10000;
27 $('#tabs li').live('click', function(event, callback) {
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());
47 $(document).bind('wlapi_document_changed', function(event, doc) {
49 $('#document-revision').text(doc.revision);
51 console.log("Failed handler", e);
55 CurrentDocument.fetch({
57 console.log("Fetch success");
58 $('#loading-overlay').fadeOut();
59 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);