summaryrefslogtreecommitdiffstats
path: root/js/custom.js
blob: 84936d370e8df6649d05d3a25d16cb6d04d1295f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var carousel = "";
$(document).ready(function() {;
  // Starting up carousel
  carousel = $('.carousel').carousel({
    interval: 9999999999999
  })

  // Rollover images
  $(function() {
    $('img[data-hover]').hover(function() {
      $(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp');
    }).each(function() {
      $('<img />').attr('src', $(this).attr('data-hover'));
    });;
  });

  // Slide selector
  $(".navbar .nav li a").click(function() {
    function clear_prods() {
      $(".navbar .nav li").each(function(){
        $(this).removeClass("active"); 
      });
    }
    carousel.unbind('slide');
    clear_prods();
    $(this).parent().addClass("active");
    carousel.carousel($(this).data()["slide"]);
    carousel.carousel('stop');
    carousel.bind('slide', function() {
      clear_prods();
      carousel.unbind('slide');
    });
  });

	if ($("#docs h2").length == 0){
		$("#docs-nav").remove();
	}else{
		$("<ul/>").insertAfter("#docs-nav");
		$("#docs h2").each(function(){
			$("<li><a href=\"#" + $(this).attr("id") + "\">" + $(this).text() + "</a></li>").appendTo("#docs-nav+ul");
		});
		if ($("#_rest_callbacks").length != 0){
			$('<ul id="_rest_callbacks_nav"/>').insertAfter('#docs-nav+ul a[href="#_rest_callbacks"]');
			$('#_rest_callbacks+div h3').each(function(){
				$("<li><a href=\"#" + $(this).attr("id") + "\">" + $(this).text() + "</a></li>").appendTo('#docs-nav+ul a[href="#_rest_callbacks"]+ul');
			});
		}
	}
});