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 event.preventDefault();
29 $.wiki.switchToTab(this);
32 $('#tabs li > .tabclose').live('click', function(event, callback) {
33 var $tab = $(this).parent();
35 if($tab.is('.active'))
36 $.wiki.switchToTab(DEFAULT_PERSPECTIVE);
38 var p = $.wiki.perspectiveForTab($tab);
43 $(window).resize(function(){
44 $('iframe').height($(window).height() - $('#tabs').outerHeight() - $('#source-editor .toolbar').outerHeight());
48 $(document).bind('wlapi_document_changed', function(event, doc) {
50 $('#document-revision').text(doc.revision);
52 console.log("Failed handler", e);
56 CurrentDocument.fetch({
58 console.log("Fetch success");
59 $('#loading-overlay').fadeOut();
60 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);