Overview
Comment:Gestion des listes à cocher/décocher plus propre (et passage de l'indentation en tabs)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9e3b4eda6755f0f1f3f8b23dd936803a985a2253
User & Date: bohwaz on 2015-02-19 06:52:04
Other Links: manifest | tags
Context
2015-02-19
06:52
Mise en commun des éléments check-in: 0c1f27c28d user: bohwaz tags: trunk
06:52
Gestion des listes à cocher/décocher plus propre (et passage de l'indentation en tabs) check-in: 9e3b4eda67 user: bohwaz tags: trunk
2015-02-18
19:16
Fonctionnalité rapprochement bancaire check-in: 2fe1c3aa3e user: bohwaz tags: trunk
Changes

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

1
2
3
4
5
6
7
8
9
10
11
12
13
..
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
...
108
109
110
111
112
113
114












































115
(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))
		{
			return document.querySelectorAll(selector);
		}
		else if (selector.substr(0, 1) == '.')
................................................................................
		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';
................................................................................
		else
		{
			document.body.removeChild(input);
		}
	};

	g.onload(dateInputFallback);












































})();

|
|
|
|
|







 







|
|









|

|
|
|
|

|
|
|
|
|
|

|
|

|

|
|
|
|
|
|
|

|
|

|
|
|
|
|
|

|
|
|
|
|
|
|

|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

1
2
3
4
5
6
7
8
9
10
11
12
13
..
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
...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
(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))
		{
			return document.querySelectorAll(selector);
		}
		else if (selector.substr(0, 1) == '.')
................................................................................
		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)};

	g.checkUncheck = function()
	{
		var elements = this.form.getElementsByTagName('input');
		var el_length = elements.length;

		for (i = 0; i < el_length; i++)
		{
			var elm = elements[i];

			if (elm.type == 'checkbox' && elm.name)
			{
				elm.checked = this.checked;

				if (elm.onchange)
					elm.onchange({target: elm});
			}
		}

		return true;
	};

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

	g.onload(dateInputFallback);

	if (document.querySelectorAll)
	{
		g.onload(function () {
			var checkTables = document.querySelectorAll('table thead input[type=checkbox]');
			var l = checkTables.length;

			for (var i = 0; i < l; i++)
			{
				var masterCheck = checkTables[i];
				masterCheck.onchange = g.checkUncheck;

				var parent = masterCheck.parentNode;

				while (parent.nodeType != Node.ELEMENT_NODE || parent.tagName != 'TABLE')
				{
					parent = parent.parentNode;
				}

				var checkBoxes = parent.querySelectorAll('tbody input[type=checkbox]');
				var ll = checkBoxes.length;

				for (var j = 0; j < ll; j++)
				{
					checkBoxes[j].onchange = function (e) {
						var elm = e.target || this;

						var parent = elm.parentNode;

						while (parent.nodeType != Node.ELEMENT_NODE || parent.tagName != 'TR')
						{
							parent = parent.parentNode;
						}
						
						if (elm.checked)
							parent.className += ' checked';
						else
							parent.className = parent.className.replace(/ checked/, '');
					};
				}
			}
		});
	}

})();