Overview
Comment:Unification/simplification du Javascript
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9c55662f073fbd88be899940adae0b731a95439c
User & Date: bohwaz on 2015-02-04 06:28:24
Other Links: manifest | tags
Context
2015-02-04
06:29
Débuts upload fichier check-in: 00cedbfb6a user: bohwaz tags: trunk
06:28
Unification/simplification du Javascript check-in: 9c55662f07 user: bohwaz tags: trunk
02:48
possibilité d'indiquer si un fichier est une image, ça simplifiera les galeries dans le wiki check-in: 6ea3fe6cbb user: bohwaz tags: trunk
Changes

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

1






2
3
4
5
6
7
8
..
14
15
16
17
18
19
20














21
22
23
24
25
26
27
28
..
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
(function () {






	window.$ = function(selector) {
		if (!selector.match(/^[.#]?[a-z0-9_-]+$/i))
		{
			return document.querySelectorAll(selector);
		}
		else if (selector.substr(0, 1) == '.')
		{
................................................................................
		}
		else
		{
			return document.getElementsByTagName(selector);
		}
	};















    window.toggleElementVisibility = function(selector, visibility)
    {
    	if (!('classList' in document.documentElement))
    		return false;

    	if (selector instanceof Array)
    	{
    		for (var i = 0; i < selector.length; i++)
................................................................................
           	else
        		elements[i].classList.remove('hidden');
        }

        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);
	}

})();

>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|












|

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
..
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
..
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103


104





105
106
107
108
109
110
111




112

113


114
115
(function () {
    window.garradin = {
    	url: window.location.href.replace(/\/admin\/.*?$/, ''),
    	admin_url: window.location.href.replace(/\/admin\/.*?$/, '/admin/'),
    	static_url: window.location.href.replace(/\/admin\/.*?$/, '/admin/static/')
    };

	window.$ = function(selector) {
		if (!selector.match(/^[.#]?[a-z0-9_-]+$/i))
		{
			return document.querySelectorAll(selector);
		}
		else if (selector.substr(0, 1) == '.')
		{
................................................................................
		}
		else
		{
			return document.getElementsByTagName(selector);
		}
	};

	garradin.onload = function(callback, dom = true)
    {
    	var eventName = dom ? 'DOMContentLoaded' : 'load';

		if (document.addEventListener)
		{
			document.addEventListener(eventName, callback, false);
		}
		else
		{
			document.attachEvent('on' + eventName, callback);
		}
    };

    window.garradin.toggleElementVisibility = function(selector, visibility)
    {
    	if (!('classList' in document.documentElement))
    		return false;

    	if (selector instanceof Array)
    	{
    		for (var i = 0; i < selector.length; i++)
................................................................................
           	else
        		elements[i].classList.remove('hidden');
        }

        return true;
    };

    garradin.script = function (file) {
    	var script = document.createElement('script');
    	script.type = 'text/javascript';
    	script.src = this.static_url + file;
    	return document.head.appendChild(script);
    };

    garradin.style = function (file) {
    	var link = document.createElement('link');
    	link.rel = 'stylesheet';
    	link.type = 'text/css';
    	link.href = this.static_url + file;
    	return document.head.appendChild(link);
    };

    // From KD2fw/js/xhr.js
	garradin.load = function(b,d,f,e){var a=new XMLHttpRequest();if(!a||!b)return false;if(a.overrideMimeType)a.overrideMimeType('text/xml');b+=(b.indexOf('?')+1?'&':'?')+(+(new Date));a.onreadystatechange=function(){if(a.readyState!=4)return;if((s=a.status)==200){if(!d)return true;var c=a.responseText;if(f=='json'){return((j=window.JSON)&&j.parse)?j.parse(c):eval('('+c.replace(/[\n\r]/g,'')+')')}d(c)}else if(e){e(s)}};a.open('GET',b,true);a.send(null)};

	var dateInputFallback = function ()
	{
		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 === ':-)')
		{
			document.body.removeChild(input);

			if (document.querySelector && !document.querySelector('input[type=date]'))
				return false;








			garradin.script('scripts/datepickr.js');
			garradin.style('scripts/datepickr.css');
		}
		else
		{
			document.body.removeChild(input);
		}




	};




	garradin.onload(dateInputFallback);
})();