CXM_jquery_tiptip.anubis
4.07 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
* Created by PyramIDE.
* User: Jeremy
* Date: 18/09/2012
* Time: 15:42
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
read calexium_lib/web/CXM_making_a_web_site.anubis
read calexium_lib/web/CXM_jquery.anubis
read tools/basis.anubis
read system/string.anubis
read system/convert.anubis
/* jQuery tipTip position type */
public type JQ_tiptip_position:
jq_tiptip_top,
jq_tiptip_left,
jq_tiptip_bottom, // is default
jq_tiptip_right
.
/* position to string */
public define String
jq_tiptip_position_to_string
(
JQ_tiptip_position p
)
=
if p is
{
jq_tiptip_top then "top",
jq_tiptip_left then "left",
jq_tiptip_bottom then "bottom",
jq_tiptip_right then "right"
}
.
/* position to string */
public define JQ_tiptip_position
string_to_jq_tiptip_position
(
String s
)
=
if s="top" then jq_tiptip_top
else if s="left" then jq_tiptip_left
else if s="bottom" then jq_tiptip_bottom
else if s="right" then jq_tiptip_right
else jq_tiptip_bottom //is default
.
/* Initialize jQuery tipTip */
public define List(HTML_Head_Tag)
jquery_tiptip_init
=
[
css(css_file("/js/jquery/tiptip/tiptip.css")),
js(js_file("/js/jquery/tiptip/tiptip.min.js"))
]
.
/* Create a tipTip tooltip with a HTML_Partial_Content and position */
public define HTML_Partial_Content
jquery_tiptip
(
String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!!
String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix
HTML_Partial_Content tooltip_partial_content,
JQ_tiptip_position position
)
=
if tooltip_partial_content is partial_content(head, body) then
partial_content(
[
js_inline(jquery_ready("
var tooltip_"+now+"=$('#"+tooltip_id+"-"+now+"').html();
$('#"+rollovered_id+"').tipTip({maxWidth: 'auto', edgeOffset: 10, defaultPosition: \""+jq_tiptip_position_to_string(position)+"\", content: tooltip_"+now+"});
"))
.
head
],
sequence([
literal("<div id=\""+tooltip_id+"-"+now+"\" style=\"display:none\">"),
body,
literal("</div>")
])
)
.
/* Create a tipTip tooltip with a HTML_Off_Form and position */
public define HTML_Partial_Content
jquery_tiptip
(
String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!!
String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix
HTML_Off_Form html_content,
JQ_tiptip_position position
)
=
jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content), position)
.
/* Create a tipTip tooltip with a HTML_Partial_Content */
public define HTML_Partial_Content
jquery_tiptip
(
String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!!
String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix
HTML_Partial_Content tooltip_partial_content
)
=
jquery_tiptip(rollovered_id, tooltip_id, tooltip_partial_content, jq_tiptip_bottom)
.
/* Create a tipTip tooltip with a HTML_Off_Form */
public define HTML_Partial_Content
jquery_tiptip
(
String rollovered_id, // id of the element on which toolip will be displayed => IT MUST BE UNIQUE !!!!
String tooltip_id, // id used to make a container around tooltip content => Uniqueness of the container's id is made with the addition of a timestamp as a suffix
HTML_Off_Form html_content
)
=
jquery_tiptip(rollovered_id, tooltip_id, partial_content([], html_content))
.