CXM_jq_checkbox.anubis
2.01 KB
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
/*
* Created by PyramIDE.
* User: フランスのトトロ
* Date: 28/06/2015
* Time: 02:22
* © Calexium
*/
transmit xlib/web/CXM_making_a_web_site.anubis
transmit xlib/web/CXM_jquery.anubis
transmit xlib/web/jQuery/CXM_jquery_button.anubis
transmit xlib/web/jQuery/CXM_jquery_icons.anubis
transmit xlib/web/js_tools.anubis
transmit tools/basis.anubis
transmit system/string.anubis
transmit tools/random.anubis
define String
checkbox_init_script
(
String checkbox_id,
Bool initial_state
) =
"var checkbox = $('#" + checkbox_id + "');" +
if initial_state then
"checkbox.addClass('checked');"
else
"checkbox.addClass('unchecked');".
define String
checkbox_onclick_script
(
String checkbox_id,
String on_script,
String off_script,
) =
"var checkbox = $('#" + checkbox_id + "');
checkbox.toggleClass('checked');
checkbox.toggleClass('unchecked');
if (checkbox.hasClass('checked')) {
" + on_script + "
} else {
" + off_script + "
}".
public define HTML_Partial_Content
jq_img_checkbox
(
String checkbox_id,
Bool initial_state,
String image_url,
String checkbox_label,
String on_script,
String off_script,
Icon_orientation orientation
) =
partial_content(
[
js_inline(jquery_ready(checkbox_init_script(checkbox_id, initial_state)))
],
jquery_button(jquery_img_button(image_url, checkbox_label, checkbox_id, jQuery_actioner(same, jqscript(checkbox_onclick_script(checkbox_id, on_script, off_script))), orientation))
).
public define HTML_Partial_Content
jq_img_checkbox
(
String checkbox_id,
Bool initial_state,
String image_url,
String checkbox_label,
String script,
Icon_orientation orientation
) =
jq_img_checkbox(checkbox_id, initial_state, image_url, checkbox_label, script, script, orientation).