diff --git a/web/jQuery/CXM_jq_radio.anubis b/web/jQuery/CXM_jq_radio.anubis index 1215fda..95ab273 100644 --- a/web/jQuery/CXM_jq_radio.anubis +++ b/web/jQuery/CXM_jq_radio.anubis @@ -43,29 +43,42 @@ define String "radio.addClass('unchecked');". define String + multi_select_script + ( + Bool multi_select_with_shift, + String script + ) = + if multi_select_with_shift then + "if (!e.shiftKey) {" + script + "} else { window.getSelection().removeAllRanges(); radio.toggleClass('checked').toggleClass('unchecked'); }" + else + script. + +define String radio_onclick_script ( String radio_id, RadioGroup radio_group, + Bool multi_select_with_shift, String on_script ) = " var radio = $('#" + radio_id + "'); - if (radio.hasClass('checked')) return; " + + multi_select_script(multi_select_with_shift, + " if (radio.hasClass('checked')) return;" + - if radio_group is - { - group(name) then - with jq_selector = "$('.radio-group-" + name + ":not(#" + radio_id + ")')", - jq_selector + ".addClass('unchecked').removeClass('checked');", + if radio_group is + { + group(name) then + with jq_selector = "$('.radio-group-" + name + ":not(#" + radio_id + ")')", + jq_selector + ".addClass('unchecked').removeClass('checked');", - none then - "" - } + + none then + "" + } + - "radio.removeClass('unchecked'); - radio.addClass('checked');" + on_script. + "radio.removeClass('unchecked').addClass('checked');" + ) + on_script. public define HTML_Partial_Content jq_img_radio @@ -73,18 +86,31 @@ public define HTML_Partial_Content String radio_id, RadioGroup radio_group, Bool initial_state, -//Bool multi_select_with_shift, + Bool multi_select_with_shift, String image_url, String checkbox_label, String on_script, Icon_orientation orientation ) = - partial_content( - [ - js_inline(jquery_ready(radio_init_script(radio_id, radio_group, initial_state))) - ], - jquery_button(jquery_img_button(image_url, checkbox_label, radio_id, jQuery_actioner(same, jqscript, radio_onclick_script(radio_id, radio_group, on_script)), orientation)) - ). + partial_content( + [ + js_inline(jquery_ready(radio_init_script(radio_id, radio_group, initial_state))) + ], + jquery_button(jquery_img_button(image_url, checkbox_label, radio_id, jQuery_actioner(same, jqscript, radio_onclick_script(radio_id, radio_group, multi_select_with_shift, on_script)), orientation)) + ). + +public define HTML_Partial_Content + jq_img_radio + ( + String radio_id, + RadioGroup radio_group, + Bool initial_state, + String image_url, + String checkbox_label, + String script, + Icon_orientation orientation + ) = + jq_img_radio(radio_id, none, initial_state, false, image_url, checkbox_label, script, orientation). public define HTML_Partial_Content jq_img_radio @@ -96,4 +122,4 @@ public define HTML_Partial_Content String script, Icon_orientation orientation ) = - jq_img_radio(radio_id, none, initial_state, image_url, checkbox_label, script, orientation). + jq_img_radio(radio_id, none, initial_state, false, image_url, checkbox_label, script, orientation). -- libgit2 0.21.4