rewizja -> wersja
[redakcja.git] / redakcja / static / js / catalogue / catalogue.js
index cb96d11..fa3f5f2 100755 (executable)
             start = null;
             var all_tutorial = $('[data-toggle="tutorial"]');
 
+            function sortKey(a) {
+                return parseInt($(a).attr('data-tutorial'));
+            }
             tutorial = $.makeArray(all_tutorial.sort(
-                function(a, b) {return $(a).attr('data-tutorial') < $(b).attr('data-tutorial') ? -1 : 1}
+                function(a, b) {return sortKey(a) < sortKey(b) ? -1 : 1}
             ));
 
+            console.log($(tutorial[0]).data('popover'));
+            console.log($(tutorial[16]).data('popover'));
             if (first_reset) {
                 $.each(tutorial, function(i, e) {
                     var but = (i < tutorial.length - 1) ? '>>' : 'OK';
         function tuton() {
             sessionStorage.setItem("tutorial", "on");
             tutreset();
-            $('#tutModal').modal('show');
+            var $tutModal = $('#tutModal');
+            if($tutModal.length === 0) {
+                tut();
+            } else {
+                $tutModal.modal('show');
+            }
             return false;
         }
         function tutoff() {
         }
         $('#tutModal').on('hidden.bs.modal', tut);
 
-        var $tuton = $("#tuton");
-        if (sessionStorage.getItem("tutorial") == "on" && $tuton.length == 0) {
+        if (sessionStorage.getItem("tutorial") == "on" && $('#tuton').length == 0) {
             tutreset();
             tut();
         }
-        $tuton.on('click', tuton);
+        $(document).on('click', '#tuton', tuton);
         $(document).on('click', '.tutorial-off', tutoff);
         $(document).on('click', '.tutorial-next', tut);
     });