summaryrefslogtreecommitdiff
path: root/engines/kokompe/temp/jquery.ui/datepicker/compatibility/ui.datepicker.demo-3.2.js
blob: e718b95da30bc411f6c3f8c57f447191bc3e5e66 (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
// Initialise the date picker demonstrations
$(document).ready(function () {
	// initialize tab interface
	tabs.init();
	// reset defaults to English
	$.datepicker.setDefaults($.datepicker.regional['']);
	// replace script tags with HTML code
	$(".demojs").each(function () {
		$(this).before( '<pre style="padding-top:0 !important"><code class="javascript">' + $(this).html() + "</code></pre>" );
		eval( $(this).html() );
	});
	// Localization
	if ($.browser.safari) {
		$('.languageSelect,.l10nDatepicker,#frFullFormat').attr({ disabled: 'disabled' });
	} else {
		$('.languageSelect').change(localise);
	}
	// Stylesheets
	$('#altStyle').datepicker({buttonImage: 'img/calendar2.gif',
		prevText: '<img src="img/prev.gif" style="vertical-align: middle;"/> Prev',
		nextText: 'Next <img src="img/next.gif" style="vertical-align: middle;"/>'});
	$('#button3').click(function() { 
		$.datepicker.dialogDatepicker($('#altDialog').val(),
		setAltDateFromDialog, {prompt: 'Choose a date', speed: '',
		prevText: '<img src="img/prev.gif" style="vertical-align: middle;"/> Prev',
		nextText: 'Next <img src="img/next.gif" style="vertical-align: middle;"/>'});
	});
});

// Load and apply a localisation package for the date picker
function localise() {
	var input = $('input', this.parentNode.parentNode);
	var date = $.datepicker.getDateFor(input);
	var language = $(this).val();
	$.localise('../i18n/ui.datepicker', {language: language});
	$.datepicker.reconfigureFor(input, $.datepicker.regional[language]).
		setDefaults($.datepicker.regional['']); // Reset for general usage
	if (date) {
		$.datepicker.setDateFor(input, date);
		input.val($.datepicker.formatDate(
			$.datepicker.regional[language].dateFormat, date));
	}
}

// Demonstrate a callback from inline configuration
function showDay(input) {
	var date = $.datepicker.getDateFor(input);
	$('#inlineDay').html(date ? $.datepicker.formatDate('DD', date) : 'blank');
}

// Display a date selected in a "dialog"
function setAltDateFromDialog(date) {
	$('#altDialog').val(date);
}

// Custom Tabs written by Marc Grabanski
var tabs = 
{
	init : function () 
	{
		// Setup tabs
		$("div[@class^=tab_group]").hide();
		$("div[@class^=tab_group]:first").show().id;
		$("ul[@id^=tab_menu] a:eq(0)").addClass('over');

		// Slide visible up and clicked one down
		$("ul[@id^=tab_menu] a").each(function(i){
			$(this).click(function () {
				$("ul[@id^=tab_menu] a.over").removeClass('over');
				$(this).addClass('over');
				$("div[@class^=tab_group]:visible").hide();
				$( $(this).attr("href") ).fadeIn();
				tabs.stylesheet = $(this).attr("href") == "#styles" ? 'alt' : 'default';
				$('link').each(function() {
					this.disabled = (this.title != '' && this.title != tabs.stylesheet);
				});
				return false;
			});
		});
	}
}