diff --git a/web/jQuery/CXM_jq_checkbox.anubis b/web/jQuery/CXM_jq_checkbox.anubis new file mode 100644 index 0000000..68a746e --- /dev/null +++ b/web/jQuery/CXM_jq_checkbox.anubis @@ -0,0 +1,74 @@ +/* + * Created by PyramIDE. + * User: フランスのトトロ + * Date: 28/06/2015 + * Time: 02:22 + * © Calexium + */ + +transmit calexium_lib/web/CXM_making_a_web_site.anubis +transmit calexium_lib/web/CXM_jquery.anubis +transmit calexium_lib/web/jQuery/CXM_jquery_button.anubis +transmit calexium_lib/web/jQuery/CXM_jquery_icons.anubis +transmit calexium_lib/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). -- libgit2 0.21.4