Source fixes: avoid race and wait a minute after uploading to prevent unnecessary...
[redakcja.git] / src / redakcja / static / js / wiki / loader_readonly.js
index a859ec6..2d31123 100644 (file)
@@ -23,12 +23,12 @@ $(function()
                /*
                 * TABS
                 */
-        $('#tabs li').live('click', function(event, callback) {
+            $(document).on('click', '#tabs li', function(event, callback) {
             event.preventDefault();
                        $.wiki.switchToTab(this);
         });
 
-               $('#tabs li > .tabclose').live('click', function(event, callback) {
+           $(document).on('click', '#tabs li > .tabclose', function(event, callback) {
                        var $tab = $(this).parent();
 
                        if($tab.is('.active'))
@@ -72,22 +72,8 @@ $(function()
        /* Load configuration */
        $.wiki.loadConfig();
 
-       var initAll = function(a, f) {
-               if (a.length == 0) return f();
-
-               $.wiki.initTab({
-                       tab: a.pop(),
-                       doc: CurrentDocument,
-                       callback: function(){
-                               initAll(a, f);
-                       }
-               });
-       };
-
-
-       /*
-        * Initialize all perspectives
-        */
-       initAll( $.makeArray($('ol#tabs li')), initialize);
-       console.log(location.hash);
-});
\ No newline at end of file
+    $('.tabs li').each((i, e) => {
+        $.wiki.initTab({tab: e, doc: CurrentDocument});
+    });
+    initialize();
+});