From 670efd29543b7a8a702655372bc51f8109f03d8b Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 15 Nov 2014 16:44:43 +0100 Subject: [PATCH] add jquery_ready which is execute code when the document.ready() add jqscript in type JQuery_Actioner_type. add Jquery dialog --- .gitignore | 1 + web/CXM_jquery.anubis | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------ web/jQuery/CXM_jquery_button.anubis | 54 +++++++++++++++++++++++++++++++----------------------- web/jQuery/CXM_jquery_datatable.anubis | 12 +++--------- web/jQuery/CXM_jquery_dialog.anubis | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ web/jQuery/CXM_jquery_jqplot.anubis | 18 +++++++++++++----- web/jQuery/CXM_jquery_tabs.anubis | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------- web/jQuery/CXM_jquery_tiptip.anubis | 267 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------- 8 files changed, 446 insertions(+), 314 deletions(-) create mode 100644 .gitignore create mode 100644 web/jQuery/CXM_jquery_dialog.anubis diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca05aa2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.a2a diff --git a/web/CXM_jquery.anubis b/web/CXM_jquery.anubis index b058ba0..879a343 100644 --- a/web/CXM_jquery.anubis +++ b/web/CXM_jquery.anubis @@ -1,48 +1,56 @@ -/* - * Created by PyramIDE. - * User: Jeremy - * Date: 21/08/2012 - * Time: 16:52 - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -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 -. - -/* jQuery Actioner */ -public type JQuery_Actioner: - jQuery_actioner(Actioner_Target target, JQuery_Actioner_type type, String url_or_form_id) -. - - -/* jQuery default js files */ -define List(HTML_Head_Tag) - jquery_defaults - = - [ - js(js_file("/js/jquery/jquery-1.11.1.min.js")), - js(js_file("/js/jquery/jquery-ui-1.10.4.custom.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/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css") then - [ css(css_file("/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ] - else - println("Jquery Theme not found "+web_dir+"/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css"); - [ css(css_file("/css/jquery/redmond/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ] - . +/* + * Created by PyramIDE. + * User: Jeremy + * Date: 21/08/2012 + * Time: 16:52 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ + +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). + + +/* */ +public define Script + jquery_ready + ( + String code //javascript code to execute when the document is ready + )= + script("","$(document).ready(function(){"+code+"});"). + + +/* jQuery default js files */ +define List(HTML_Head_Tag) + jquery_defaults + = + [ + js(js_file("/js/jquery/jquery-1.11.1.min.js")), + js(js_file("/js/jquery/jquery-ui-1.10.4.custom.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/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css") then + [ css(css_file("/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ] + else + println("Jquery Theme not found "+web_dir+"/css/jquery/"+theme_name+"/jquery-ui-1.10.4.custom.min.css"); + [ css(css_file("/css/jquery/redmond/jquery-ui-1.10.4.custom.min.css")) . jquery_defaults ] + . diff --git a/web/jQuery/CXM_jquery_button.anubis b/web/jQuery/CXM_jquery_button.anubis index 32b88e9..3c9a2f5 100644 --- a/web/jQuery/CXM_jquery_button.anubis +++ b/web/jQuery/CXM_jquery_button.anubis @@ -95,20 +95,23 @@ define HTML_Head_Tag same then if act_type is { - jqform then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){$('#"+str+"').submit();});});")), - jqlink then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){document.location='/?a="+str+"';});});")), + jqform then js_inline(jquery_ready("$('#"+button_id+"').click(function(){$('#"+str+"').submit();});")), + jqlink then js_inline(jquery_ready("$('#"+button_id+"').click(function(){document.location='/?a="+str+"';});")), + jqscript then js_inline(jquery_ready("$('#"+button_id+"').click(function(){"+str+"});")) }, same(label) then if act_type is { - jqform then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){$('#"+str+"').submit();});});")), - jqlink then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){document.location='/?a="+str+"';});});")), + jqform then js_inline(jquery_ready("$('#"+button_id+"').click(function(){$('#"+str+"').submit();});")), + jqlink then js_inline(jquery_ready("$('#"+button_id+"').click(function(){document.location='/?a="+str+"';});")), + jqscript then js_inline(jquery_ready("$('#"+button_id+"').click(function(){"+str+"});")) }, other(window_name, window_options) then if act_type is { - jqform then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){$('#"+str+"').submit();});});")), //il s'agit d'une soumision d'un formulaire => cela se fait uniquement dans la même fenêtre ! - jqlink then js_inline(script("", "$(document).ready(function(){$('#"+button_id+"').click(function(){window.open('"+str+"', '"+window_name+"', '"+jquery_button_get_onclick_action_window_options(window_options, "")+"');});});")), + jqform then js_inline(jquery_ready("$('#"+button_id+"').click(function(){$('#"+str+"').submit();});")), //il s'agit d'une soumision d'un formulaire => cela se fait uniquement dans la même fenêtre ! + jqlink then js_inline(jquery_ready("$('#"+button_id+"').click(function(){window.open('"+str+"', '"+window_name+"', '"+jquery_button_get_onclick_action_window_options(window_options, "")+"');});")), + jqscript then js_inline(jquery_ready("$('#"+button_id+"').click(function(){"+str+"});")) } } . @@ -147,7 +150,7 @@ define HTML_Partial_Content _jquery_buttons( t, [ - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button();});")), + js_inline(jquery_ready("$('#"+id+"').button();")), onclick_action ] +html_tags, @@ -161,7 +164,7 @@ define HTML_Partial_Content _jquery_buttons( t, [ - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});});")), + js_inline(jquery_ready("$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});")), onclick_action ] +html_tags, @@ -176,7 +179,7 @@ define HTML_Partial_Content _jquery_buttons( t, [ - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});});")), + js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});")), onclick_action ] +html_tags, @@ -190,7 +193,7 @@ define HTML_Partial_Content _jquery_buttons( t, [ - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});});")), + js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});")), onclick_action ] +html_tags, @@ -212,7 +215,7 @@ public define HTML_Partial_Content = if _jquery_buttons(buttons, [], []) is partial_content(tags, html) then partial_content( - [ js_inline(script("", "$(document).ready(function(){$('#"+buttons_container_id+"').buttonset();});")) ] + tags, + [ js_inline(jquery_ready("$('#"+buttons_container_id+"').buttonset();")) ] + tags, sequence([ literal("
"), html, @@ -233,7 +236,7 @@ public define HTML_Partial_Content if jquery_icon_to_string(secondary) = "" then partial_content( [ - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button();});")), + js_inline(jquery_ready("$('#"+id+"').button();")), onclick_action ], literal("") @@ -241,7 +244,7 @@ public define HTML_Partial_Content else partial_content( [ - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});});")), + js_inline(jquery_ready("$('#"+id+"').button({icons:{secondary:'"+jquery_icon_to_string(secondary)+"'}});")), onclick_action ], literal("") @@ -250,7 +253,7 @@ public define HTML_Partial_Content if jquery_icon_to_string(secondary) = "" then partial_content( [ - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});});")), + js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"'}});")), onclick_action ], literal("") @@ -258,7 +261,7 @@ public define HTML_Partial_Content else partial_content( [ - js_inline(script("", "$(document).ready(function(){$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});});")), + js_inline(jquery_ready("$('#"+id+"').button({icons:{primary:'"+jquery_icon_to_string(primary)+"',secondary:'"+jquery_icon_to_string(secondary)+"'}});")), onclick_action ], literal("") @@ -272,7 +275,7 @@ public type Icon_orientation: right. public type JQuery_img_button: - jquery_img_button(String img_url, String label_text, JQuery_Actioner jq_action, Icon_orientation orientation). + jquery_img_button(String img_url, String label_text, String id, JQuery_Actioner jq_action, Icon_orientation orientation). public define HTML_Off_Form jquery_button_html @@ -280,7 +283,7 @@ public define HTML_Off_Form JQuery_img_button button, String button_id ) = - if button is jquery_img_button(img_url, label_text, actioner, orientation) then + if button is jquery_img_button(img_url, label_text, _, actioner, orientation) then div([id(button_id), class("jq_img_btn")], if orientation is { @@ -289,20 +292,25 @@ public define HTML_Off_Form left then table([class("jq_img_btn_table")],[ row( [cell(image(img_url)), cell(text(label_text)) ]) ]), right then table([class("jq_img_btn_table")],[ row( [cell(text(label_text)), cell(image(img_url)) ]) ]), }). - + + + public define HTML_Partial_Content jquery_button ( JQuery_img_button button )= - if button is jquery_img_button(_, _, actioner, _) then - with button_id = generate_random_string(10), + if button is jquery_img_button(_, _, button_id, actioner, _) then + with button_id_str = if length(button_id) = 0 then + generate_random_string(10) + else + button_id, partial_content( [ - jquery_button_get_onclick_action(button_id, actioner), + jquery_button_get_onclick_action(button_id_str, actioner), css(css_file("css/cxm_button.css")), - js_inline(script("","$(document).ready(function(){$('.jq_img_btn').button();});")) + js_inline(jquery_ready("$('.jq_img_btn').button();")) ], - jquery_button_html(button, button_id)) + jquery_button_html(button, button_id_str)) . diff --git a/web/jQuery/CXM_jquery_datatable.anubis b/web/jQuery/CXM_jquery_datatable.anubis index 60917b1..619a0b4 100644 --- a/web/jQuery/CXM_jquery_datatable.anubis +++ b/web/jQuery/CXM_jquery_datatable.anubis @@ -43,7 +43,7 @@ public define HTML_Partial_Content ) = partial_content( - [ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable();});")) ], + [ js_inline(jquery_ready("$('#"+table_id+"').dataTable();")) ], table ) . @@ -58,7 +58,7 @@ public define HTML_Partial_Content = if enable_jqueryui then partial_content( - [ js_inline(script("", "$(document).ready(function(){$('#"+table_id+"').dataTable({\"bJQueryUI\":true});});")) ], + [ js_inline(jquery_ready("$('#"+table_id+"').dataTable({\"bJQueryUI\":true});")) ], table ) else @@ -85,12 +85,7 @@ public define HTML_Partial_Content = partial_content( [ - js_inline( - script( - "", - " - $(document).ready(function() - { + js_inline(jquery_ready(" $('#"+table_id+"').dataTable( { \"bJQueryUI\":"+to_String(enable_jqueryui)+", @@ -108,7 +103,6 @@ public define HTML_Partial_Content get_datatable_translation(lang, web_dir)+ jquery_datatable_extra_to_string(extra)+ "}); - }); " ) ) diff --git a/web/jQuery/CXM_jquery_dialog.anubis b/web/jQuery/CXM_jquery_dialog.anubis new file mode 100644 index 0000000..efe3857 --- /dev/null +++ b/web/jQuery/CXM_jquery_dialog.anubis @@ -0,0 +1,115 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ & julien + * Date: 09/11/2014 + * Time: 15:51 + * © Calexium + */ + +read calexium_lib/web/CXM_making_a_web_site.anubis +read calexium_lib/web/CXM_jquery.anubis + +public type JQuery_dialog_id: + dialog_id(String id). + +public type JQuery_dialog: + p_content(HTML_Partial_Content content), + off_form(HTML_Off_Form o_form), + ajax(String url). + + +public define HTML_Partial_Content + jq_dialog_create + ( + JQuery_dialog_id dial_id, + JQuery_dialog content, + String extra_parm + )= + with dlg_id = id(dial_id), + js = js_inline(jquery_ready(" + $( \"#"+dlg_id+"\" ).dialog({ + autoOpen: false, + modal: true, + height: 'auto', + width: 'auto', + "+extra_parm+" + Cancel: function() { + $( this ).dialog( 'close' ); + } + }); + ")), + + if content is + { + p_content(pc) then + if pc is partial_content(tags, html) then + partial_content( [js . tags ], html), //html code of the dialog + off_form(html) then + partial_content( [js], html), //html code of the dialog + ajax(url) then + partial_content( [js], div_empty([id(dlg_id), attr("ajax_url",url)])) + }. + +public define HTML_Partial_Content + jq_dialog_create + ( + JQuery_dialog_id dial_id, + JQuery_dialog content + )= + jq_dialog_create(dial_id, content, ""). + +define String + _jq_dialog_open + ( + Maybe(String) mb_html, + JQuery_dialog_id dialog_id, + String params + )= + with js_function = "jquery_dialog_click('"+id(dialog_id)+"', "+(if length(params)=0 then "''" else params) +");", + if mb_html is + { + failure then js_function, + success(html) then ""+html+"" + }. + +public define String + jq_dialog_open + ( + String html, + JQuery_dialog_id dialog_id, + String params + )= + _jq_dialog_open(success(html), dialog_id, params). + +public define String + jq_dialog_open + ( + JQuery_dialog_id dialog_id + )= + _jq_dialog_open(failure, dialog_id, ""). + +public define List(HTML_Head_Tag) + jq_dialog_init + = + [ + js_inline(jquery_ready(" + jquery_dialog_click = function (dialog_id, url_args) { + var dialog_elem = $('#'+dialog_id); + if (dialog_elem.is('[ajax_url]')) { + $.ajax({ + url: $('#'+dialog_id).attr('ajax_url')+((url_args !== '')?'&':'')+url_args + }).done(function (data) { + var dialog_elem = $('#'+dialog_id); + + dialog_elem.html(data); + dialog_elem.dialog('open'); + }); + return; + } + + dialog_elem.dialog('open'); + }; + ")) + ]. + + diff --git a/web/jQuery/CXM_jquery_jqplot.anubis b/web/jQuery/CXM_jquery_jqplot.anubis index fe70ac9..0da0060 100644 --- a/web/jQuery/CXM_jquery_jqplot.anubis +++ b/web/jQuery/CXM_jquery_jqplot.anubis @@ -18,7 +18,7 @@ read tools/basis.anubis )= partial_content( [ - js_inline(script("","$(document).ready(function(){$('#jq_img_btn').button();});")) + js_inline(jquery_ready("$('#jq_img_btn').button();")) ], div([id("jq_img_btn")], table([ @@ -39,17 +39,25 @@ public define HTML_Head_Tag . /* jQuery default js files */ -define List(HTML_Head_Tag) - jqplot_defaults +public define List(HTML_Head_Tag) + jqplot_init = [ js(js_file("/js/jquery/jqplot/jquery.jqplot.min.js")), css(css_file("/js/jquery/jqplot/jquery.jqplot.min.css")), ]. - -/* Initialize jQuery in compatiblity mode with jQueryUI */ +/* jQuery default js files, non minified version */ public define List(HTML_Head_Tag) + jqplot_init_debug + = + [ + js(js_file("/js/jquery/jqplot/jquery.jqplot.js")), + css(css_file("/js/jquery/jqplot/jquery.jqplot.css")), + ]. + +/* Initialize jQuery in compatiblity mode with jQueryUI */ + public define List(HTML_Head_Tag) jqplot_init = jqplot_defaults. diff --git a/web/jQuery/CXM_jquery_tabs.anubis b/web/jQuery/CXM_jquery_tabs.anubis index d01ac23..7e98643 100644 --- a/web/jQuery/CXM_jquery_tabs.anubis +++ b/web/jQuery/CXM_jquery_tabs.anubis @@ -1,94 +1,95 @@ -/* - * Created by PyramIDE. - * User: Jeremy - * Date: 04/09/2012 - * Time: 16:19 - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -read calexium_lib/web/CXM_making_a_web_site.anubis -read tools/basis.anubis - -public type JQuery_tab: - jQuery_tab(String title, HTML_Partial_Content content) -. - - // Helper to be compatible with the first version of JQuery_tab which - // take HTML_Off_Form as second argument instead of HTML_Partial_Content. - -public define JQuery_tab - jQuery_tab - ( - String title, - HTML_Off_Form content - )= - jQuery_tab(title, partial_content([], content)). - - -define HTML_Partial_Content - _jquery_tabs - ( - String tabs_container_id, - List(JQuery_tab) tabs, - String tabs_titles, - List(HTML_Off_Form) tabs_contents, - List(HTML_Head_Tag) tabs_heads, - Int count - ) - = - if tabs is - { - [ ] then - partial_content( - reverse(tabs_heads), - sequence([ - literal(""), - sequence(reverse(tabs_contents)) - ]) - ), - [ h . t ] then - if h is jQuery_tab(title, p_content) then - if p_content is partial_content(tags, content) then - _jquery_tabs( - tabs_container_id, - t, - tabs_titles + "
  • "+title+"
  • ", - [ - sequence([ - literal("
    "), - content, - literal("
    ") - ]) - . - tabs_contents - ], - tags + tabs_heads, - count+1 - ) - } - . - - -public define HTML_Partial_Content - jquery_tabs - ( - String tabs_container_id, - List(JQuery_tab) tabs - ) - = - if _jquery_tabs(tabs_container_id, tabs, "", [], [], 0) is partial_content(tags, html) then - partial_content( - [ - js_inline(script("", "$(document).ready(function(){$('#"+tabs_container_id+"').tabs();});")) - . - tags - ], - sequence([ - literal("
    "), - html, - literal("
    ") - ]) - ) - . - +/* + * Created by PyramIDE. + * User: Jeremy + * Date: 04/09/2012 + * Time: 16:19 + * + * 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 + +public type JQuery_tab: + jQuery_tab(String title, HTML_Partial_Content content) +. + + // Helper to be compatible with the first version of JQuery_tab which + // take HTML_Off_Form as second argument instead of HTML_Partial_Content. + +public define JQuery_tab + jQuery_tab + ( + String title, + HTML_Off_Form content + )= + jQuery_tab(title, partial_content([], content)). + + +define HTML_Partial_Content + _jquery_tabs + ( + String tabs_container_id, + List(JQuery_tab) tabs, + String tabs_titles, + List(HTML_Off_Form) tabs_contents, + List(HTML_Head_Tag) tabs_heads, + Int count + ) + = + if tabs is + { + [ ] then + partial_content( + reverse(tabs_heads), + sequence([ + literal(""), + sequence(reverse(tabs_contents)) + ]) + ), + [ h . t ] then + if h is jQuery_tab(title, p_content) then + if p_content is partial_content(tags, content) then + _jquery_tabs( + tabs_container_id, + t, + tabs_titles + "
  • "+title+"
  • ", + [ + sequence([ + literal("
    "), + content, + literal("
    ") + ]) + . + tabs_contents + ], + tags + tabs_heads, + count+1 + ) + } + . + + +public define HTML_Partial_Content + jquery_tabs + ( + String tabs_container_id, + List(JQuery_tab) tabs + ) + = + if _jquery_tabs(tabs_container_id, tabs, "", [], [], 0) is partial_content(tags, html) then + partial_content( + [ + js_inline(jquery_ready("$('#"+tabs_container_id+"').tabs();")) + . + tags + ], + sequence([ + literal("
    "), + html, + literal("
    ") + ]) + ) + . + diff --git a/web/jQuery/CXM_jquery_tiptip.anubis b/web/jQuery/CXM_jquery_tiptip.anubis index c478f22..75058a8 100644 --- a/web/jQuery/CXM_jquery_tiptip.anubis +++ b/web/jQuery/CXM_jquery_tiptip.anubis @@ -1,135 +1,132 @@ -/* - * 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 - ( - String web_dir, - ) - = - [ - css(css_file("/css/jquery/tipTip.css")), - js(js_file("/js/jquery/jquery.tipTip.minified.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(script("", " - $(document).ready(function() - { - 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("
    "), - body, - literal("
    ") - ]) - ) - . - -/* 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)) - . - +/* + * 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 + ( + String web_dir, + ) + = + [ + css(css_file("/css/jquery/tipTip.css")), + js(js_file("/js/jquery/jquery.tipTip.minified.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("
    "), + body, + literal("
    ") + ]) + ) + . + +/* 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)) + . + -- libgit2 0.21.4