/*! * jquery.toc.js - A jQuery plugin that will automatically generate a table of contents. * v0.1.1 * https://github.com/jgallen23/toc * copyright JGA 2012 * MIT License */ !function (e) { e.fn.toc = function (t) { var n = this, r = e.extend({}, jQuery.fn.toc.defaults, t), i = e(r.container), s = e(r.selectors, i), o = [], u = r.prefix + "-active", a = function (t) { for (var n = 0, r = arguments.length; n < r; n++) { var i = arguments[n], s = e(i); if (s.scrollTop() > 0) return s; s.scrollTop(1); var o = s.scrollTop() > 0; s.scrollTop(0); if (o) return s } return [] }, f = a(r.container, "body", "html"), l = function (t) { if (r.smoothScrolling) { t.preventDefault(); var i = e(t.target).attr("href"), s = e(i); f.animate({scrollTop: s.offset().top}, 400, "swing", function () { location.hash = i }) } e("li", n).removeClass(u), e(t.target).parent().addClass(u) }, c, h = function (t) { c && clearTimeout(c), c = setTimeout(function () { var t = e(window).scrollTop(), i; for (var s = 0, a = o.length; s < a; s++) if (o[s] >= t) { e("li", n).removeClass(u), i = e("li:eq(" + (s - 1) + ")", n).addClass(u), r.onHighlight(i); break } }, 50) }; return r.highlightOnScroll && (e(window).bind("scroll", h), h()), this.each(function () { var t = e(this), n = e("
Join us, fork Codeception and submit your pull requests!
'); } }); $('#scroll-to-top').click(function () { $('html, body').animate({scrollTop: 0}, 400); return false; }); $(window).scroll(function () { var threshold = 300; if ($(window).scrollTop() > threshold) { $('#scroll-to-top').fadeIn('slow'); } else { $('#scroll-to-top').fadeOut('slow'); } }); }); // js $(document).ready(function () { function randomCarousel(id) { var num = $(id + ' .item').length; var slide = Math.floor((Math.random() * num)); $(id + ' .item').each(function (index) { if (index == slide) { $(this).addClass('active'); } else { $(this).removeClass('active'); } }); } randomCarousel('#carousel-tweets'); randomCarousel('#carousel-companies'); var toc = $('#toc'); if (toc.length) { toc.toc({ 'selectors': 'h2', 'prefix': 'toc', 'container': '#page', 'anchorName': function (i, heading, prefix) { //custom function for anchor name return $(heading).text().replace(/\s/g, '-').replace(/[^\w-]/g, ''); }, }); } var page = $('#page table'); var tocNext = $('#toc'); var tocNextUl = $('#toc > ul'); var tocNextUlLi = $('#toc ul.list li a'); if (page.length) { page.addClass('table table-striped table-bordered'); } if (tocNext.length) { tocNext.toc({ 'selectors': 'h2,h3,h4', 'prefix': 'toc', 'container': '#page', //custom function for anchor name 'anchorName': function (i, heading, prefix) { return $(heading).text().replace(/\s/g, '-').replace(/[^\w-]/g, ''); }, }); } // List.js if (tocNextUl.length) { tocNextUl.addClass('list'); } if (tocNextUlLi.length) { tocNextUlLi.addClass('searchitem'); } var options = { valueNames: ['searchitem'] }; var userList = new List('searchable', options); // end List.js // docrdy // Adding this layout functionality for mobile views with the homepage hero var navbarToggle = $('.navbar-toggle') if (navbarToggle.length) { navbarToggle.click(function () { $('.row.home').toggleClass('no-padding-top'); }); } function randomCarousel(id) { var num = $(id + ' .item').length; var slide = Math.floor((Math.random() * num)); $(id + ' .item').each(function (index) { if (index == slide) { $(this).addClass('active'); } else { $(this).removeClass('active'); } }); } randomCarousel('#carousel-tweets'); randomCarousel('#carousel-companies'); var toc = $('#toc'); if (toc.length) { toc.toc({ 'selectors': 'h2', 'prefix': 'toc', 'container': '#page', 'anchorName': function (i, heading, prefix) { //custom function for anchor name return $(heading).text().replace(/\s/g, '-').replace(/[^\w-]/g, ''); }, }); } var cpContainer = $(".cp:contains('')"); var page = $('#page table'); var tocNext = $('#toc'); var tocNextUl = $('#toc > ul'); var tocNextUlLi = $('#toc ul.list li a'); if (cpContainer.length) { cpContainer.css({visibility: 'hidden'}); } if (cpContains.length) { cpContains.css({visibility: 'hidden'}); } if (page.length) { page.addClass('table table-striped table-bordered'); } if (tocNext.length) { tocNext.toc({ 'selectors': 'h2,h3,h4', 'prefix': 'toc', 'container': '#page', //custom function for anchor name 'anchorName': function (i, heading, prefix) { return $(heading).text().replace(/\s/g, '-').replace(/[^\w-]/g, ''); }, }); } // List.js if (tocNextUl.length) { tocNextUl.addClass('list'); } if (tocNextUlLi.length) { tocNextUlLi.addClass('searchitem'); } var options = { valueNames: ['searchitem'] }; var userList = new List('searchable', options); // end List.js // docrdy // Adding this layout functionality for mobile views with the homepage hero var navbarToggle = $('.navbar-toggle') if (navbarToggle.length) { navbarToggle.click(function () { $('.row.home').toggleClass('no-padding-top'); }); } }); var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1899308-9']); _gaq.push(['_trackPageview']); (function () { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();