Overview
Comment:détection de fallback plus simple et rapide et fonctionnant avec chrome, pour input type="date"
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8e270b999e783da9afaf30a07e39d4ea680fa794
User & Date: bohwaz on 2014-02-06 17:38:24
Other Links: manifest | tags
Context
2014-02-06
17:39
Création des écritures comptables liées à l'enregistrement d'un paiement check-in: 2dfd20ead7 user: bohwaz tags: trunk
17:38
détection de fallback plus simple et rapide et fonctionnant avec chrome, pour input type="date" check-in: 8e270b999e user: bohwaz tags: trunk
17:25
Déplacement de la vérification du moyen de paiement check-in: 6c590e5bb9 user: bohwaz tags: trunk
Changes

Modified src/www/admin/static/datepickr.js from [83895353f1] to [3ca93c8113].

407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
	{
		var inputs = document.getElementsByTagName('input');
		var length = inputs.length;
		var enabled = false;

		for (i = 0; i < inputs.length; i++)
		{
			if (inputs[i].getAttribute('type') == 'date' && (inputs[i].type == 'text' || window.webkitConvertPointFromNodeToPage))
			{
				inputs[i].setAttribute('type', 'text');
				inputs[i].className += ' date';
				inputs[i].size = 10;
				inputs[i].maxlength = 10;
				inputs[i].setAttribute('pattern', '[0-9]{4}-[0-9]{2}-[0-9]{2}');
				new datepickr(inputs[i], config_fr);
			}
		}
	}

	dateInputFallback();
} () );







|













407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
	{
		var inputs = document.getElementsByTagName('input');
		var length = inputs.length;
		var enabled = false;

		for (i = 0; i < inputs.length; i++)
		{
			if (inputs[i].getAttribute('type') == 'date')
			{
				inputs[i].setAttribute('type', 'text');
				inputs[i].className += ' date';
				inputs[i].size = 10;
				inputs[i].maxlength = 10;
				inputs[i].setAttribute('pattern', '[0-9]{4}-[0-9]{2}-[0-9]{2}');
				new datepickr(inputs[i], config_fr);
			}
		}
	}

	dateInputFallback();
} () );

Modified src/www/admin/static/global.js from [f20f9c86c7] to [f4ee6dbd13].

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
        }

        return true;
    };

	function dateInputFallback()
	{
		var inputs = document.getElementsByTagName('input');
		var length = inputs.length;
		var enabled = false;

		for (i = 0; i < inputs.length; i++)

		{
			if (inputs[i].getAttribute('type') == 'date' && (inputs[i].type == 'text' || window.webkitConvertPointFromNodeToPage))
			{
				enabled = true;
			}
		}


		if (enabled)
		{
			var www_url = document.body.getAttribute('data-url') + 'static/';

			var script = document.createElement('script');
			script.type = "text/javascript";
			script.src = www_url + 'datepickr.js';
			document.head.appendChild(script);
			
			var link = document.createElement('link');
			link.type = 'text/css';
			link.rel = 'stylesheet';
			link.href = www_url + 'datepickr.css';
			document.head.appendChild(link);
		}


	}

	if (document.addEventListener)
	{
		document.addEventListener("DOMContentLoaded", dateInputFallback, false);
	}
	else
	{
		document.attachEvent("onDOMContentLoaded", dateInputFallback);
	}
})();







|
|
|
|
|
>
|
<
<
<
<
<
|
>
|














>
>











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
        }

        return true;
    };

	function dateInputFallback()
	{
		var input = document.createElement('input');
		input.setAttribute('type', 'date');
		input.value = ':-)';
		input.style.position = 'absolute';
		input.style.visibility = 'hidden';
		document.body.appendChild(input);






		// If input type changed or value hasn't been sanitized then
		// the input type date element is not supported
		if (input.type === 'text' || input.value === ':-)')
		{
			var www_url = document.body.getAttribute('data-url') + 'static/';

			var script = document.createElement('script');
			script.type = "text/javascript";
			script.src = www_url + 'datepickr.js';
			document.head.appendChild(script);
			
			var link = document.createElement('link');
			link.type = 'text/css';
			link.rel = 'stylesheet';
			link.href = www_url + 'datepickr.css';
			document.head.appendChild(link);
		}

		document.body.removeChild(input);
	}

	if (document.addEventListener)
	{
		document.addEventListener("DOMContentLoaded", dateInputFallback, false);
	}
	else
	{
		document.attachEvent("onDOMContentLoaded", dateInputFallback);
	}
})();