summaryrefslogtreecommitdiff
blob: 1fc7af1b04f10aa2720be9d67ccd15a895d94c0e (plain)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
jQuery(document).ready(function($) {
	$('.tab_content, #toc_advanced_usage, #sitemap_advanced_usage, #toc_for_developers, div.more_toc_options.disabled, tr.disabled').hide();
	$('ul#tabbed-nav li:first').addClass('active').show(); // show first tab
	$('.tab_content:first').show(); // show first tab content

	$('ul#tabbed-nav li').click(function(event) {
		if ( !$(this).hasClass('url') ) {
			event.preventDefault();
			$('ul#tabbed-nav li').removeClass('active');
			$(this).addClass('active');
			$('.tab_content').hide();

			var activeTab = $(this).find('a').attr('href');
			$(activeTab).fadeIn();
		}
	});
	
	$('h3 span.show_hide a').click(function(event) {
		event.preventDefault();
		$( $(this).attr('href') ).toggle('fast');
		if ( $(this).text() == 'show' )
			$(this).text('hide');
		else
			$(this).text('show');
	});
	
	$('input#show_heading_text, input#visibility').click(function() {
		$(this).siblings('div.more_toc_options').toggle('fast');
	});
	
	$('input#smooth_scroll').click(function() {
		$('#smooth_scroll_offset_tr').toggle('fast');
	});
	
	$('input[name="theme"]').click(function() {
		// check custom theme selection
		if ( $(this).val() == 100 ) {
			$(this).parent().siblings('div.more_toc_options').show('fast');
		}
		else
			$(this).parent().siblings('div.more_toc_options').hide('fast');
	});
	
	/* width drop down */
	$('select#width').change(function() {
		if ( $(this).find('option:selected').val() == 'User defined' ) {
			$(this).siblings('div.more_toc_options').show('fast');
			$('input#width_custom').focus();
		}
		else
			$(this).siblings('div.more_toc_options').hide('fast');
	});
	$('input#width_custom, input#font_size, input#smooth_scroll_offset').keyup(function() {
		var value = $(this).val();
		$(this).val( value.replace(/[^0-9\.]/, '') );
	});
	$('input#fragment_prefix').keyup(function() {
		var fragment = $(this).val();
		$(this).val( fragment.replace(/[^a-zA-Z0-9_\-]/g, '') );
	});
	
	if ( $.farbtastic ) {
		var f = $.farbtastic('#farbtastic_colour_wheel');
		var selected;
		$('#farbtastic_colour_wheel').css('opacity', 0.5).hide();
		$('input.custom_colour_option')
			.each(function() { f.linkTo(this); $(this).css('opacity', 0.5); })
			.keyup(function() {
				var hex = $(this).val();
				hex = hex.replace(/[^a-fA-F0-9]/g, '');
				if ( hex.length > 6 ) hex = hex.substr(0, 6);
				$(this).val( '#' + hex );
			})
			.focus(function() {
				if (selected) {
					$(selected).css('opacity', 0.5);
					$(selected).siblings('img').css('opacity', 0.4);
				}
				f.linkTo(this);
				$('#farbtastic_colour_wheel').css('opacity', 1).show('fast');
				$(this).siblings('img').css('opacity', 1);
				$(selected = this).css('opacity', 1);
			});
		$('table#theme_custom img').click(function() {
			$(this).siblings('input.custom_colour_option').focus();
		});
	}
});