X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/039112897b09b05153d79ca9a2d9ed114827d294..2c85a46e149380dccf5a69694402bd2519e80203:/redakcja/static/js/catalogue/catalogue.js?ds=sidebyside diff --git a/redakcja/static/js/catalogue/catalogue.js b/redakcja/static/js/catalogue/catalogue.js index cb96d113..fa3f5f2b 100755 --- a/redakcja/static/js/catalogue/catalogue.js +++ b/redakcja/static/js/catalogue/catalogue.js @@ -63,10 +63,15 @@ 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'; @@ -86,7 +91,12 @@ 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() { @@ -112,12 +122,11 @@ } $('#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); });