Overview
Comment:Notation raccourcie
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 564e72ba27aaeecef29f2b602ab994f2a7c7dcd7
User & Date: bohwaz on 2015-02-17 17:46:50
Other Links: manifest | tags
Context
2015-02-17
17:47
Formatage des liens correct check-in: c5737366bf user: bohwaz tags: trunk
17:46
Notation raccourcie check-in: 564e72ba27 user: bohwaz tags: trunk
17:15
Montrer quand le mot de passe est trop court check-in: e9e8918053 user: bohwaz tags: trunk
Changes

Modified src/www/admin/static/scripts/global.js from [53a31a615b] to [8d68b55191].

1
2
3
4
5
6
7
8
9
(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))

|







1
2
3
4
5
6
7
8
9
(function () {
    window.g = 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))
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
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
		}
		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++)
    		{
    			toggleElementVisibility(selector[i], visibility);
    		}

    		return true;
    	}

        var elements = $(selector);

        for (var i = 0; i < elements.length; i++)
        {
        	if (!visibility)
        		elements[i].classList.add('hidden');
           	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);
})();







|













|








|


















|






|








|



















|
|







|

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
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
		}
		else
		{
			return document.getElementsByTagName(selector);
		}
	};

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

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

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

    	if (selector instanceof Array)
    	{
    		for (var i = 0; i < selector.length; i++)
    		{
    			g.toggle(selector[i], visibility);
    		}

    		return true;
    	}

        var elements = $(selector);

        for (var i = 0; i < elements.length; i++)
        {
        	if (!visibility)
        		elements[i].classList.add('hidden');
           	else
        		elements[i].classList.remove('hidden');
        }

        return true;
    };

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

    g.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
	g.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;

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

	g.onload(dateInputFallback);
})();