CXM_jquery.anubis
2.37 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
75
76
77
78
79
80
81
82
83
84
85
86
/*
* Created by PyramIDE.
* User: Jeremy
* Date: 21/08/2012
* Time: 16:52
*
*/
read calexium_lib/web/CXM_making_a_web_site.anubis
read tools/printable_tree.anubis
read tools/basis.anubis
/* jQuery Actioner type */
public type JQuery_Actioner_type:
jqform,
jqlink,
jqscript.
/* jQuery Actioner */
public type JQuery_Actioner:
jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type, String url_or_form_id_or_script).
/* jQuery Selector - http://api.jquery.com/category/selectors/ */
public type JQuerySelector:
element(HtmlId id),
element_class(String name),
childs(HtmlId id).
public define String
format_jquery_selector
(
JQuerySelector selector
) =
if selector is
{
element(html_id) then
if html_id is htmlId(id) then "'#" + id + "'",
element_class(name) then
"'." + name + "'",
childs(html_id) then
if html_id is htmlId(id) then "'#" + id + " > *'"
}.
/* */
public define Script
jquery_ready
(
String code //javascript code to execute when the document is ready
)=
script("text/javascript","$(document).ready(function(){"+code+"});").
public define String
jquery_ready
(
String code //javascript code to execute when the document is ready
)=
"$(document).ready(function(){"+code+"});".
/* jQuery default js files */
define List(HTML_Head_Tag)
jquery_defaults
=
[
js(js_file("/js/jquery/jquery-1.11.3.js")),
js(js_file("/js/jquery/jquery-ui-1.11.4/jquery-ui.min.js")),
].
/* Initialize jQuery in compatiblity mode with jQueryUI */
public define List(HTML_Head_Tag)
jquery_init
(
String web_dir,
String theme_name
)
=
if file_exists(web_dir+"/public/js/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.min.css") then
[ css(css_file("/js/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.min.css")),
css(css_file("/js/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.structure.min.css")),
css(css_file("/js/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.theme.min.css")) . jquery_defaults ]
else
println("Jquery Theme not found "+web_dir+"/public/js/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.min.css");
//TODO change to real default jquery ui css
[ css(css_file("/js/jquery/jquery-ui-1.11.4/theme/"+theme_name+"/jquery-ui.min.css")) . jquery_defaults ]
.