1 From 412619cb65dfa87ee6485afa6bbe810a2705dd67 Mon Sep 17 00:00:00 2001
2 From: Minkyu Kang <mk7.kang@samsung.com>
3 Date: Wed, 29 Feb 2012 16:46:14 +0900
4 Subject: [PATCH] JQM: checkbox pressed, no-lable support
6 Signed-off-by: Koeun Choi <koeun.choi@samsung.com>
8 .../js/jquery.mobile.forms.checkboxradio.js | 57 ++++++++++++++++++-
9 1 files changed, 54 insertions(+), 3 deletions(-)
11 diff --git a/libs/js/jquery-mobile-1.0.1pre/js/jquery.mobile.forms.checkboxradio.js b/libs/js/jquery-mobile-1.0.1pre/js/jquery.mobile.forms.checkboxradio.js
12 index d09a422..9243f2e 100644
13 --- a/libs/js/jquery-mobile-1.0.1pre/js/jquery.mobile.forms.checkboxradio.js
14 +++ b/libs/js/jquery-mobile-1.0.1pre/js/jquery.mobile.forms.checkboxradio.js
15 @@ -25,10 +25,23 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
16 checkedicon = "ui-icon-" + checkedState,
17 uncheckedicon = "ui-icon-" + uncheckedState;
19 + var checkedpressedicon = checkedicon + "-press",
20 + uncheckedpressedicon = uncheckedicon + "-press";
22 if ( inputtype !== "checkbox" && inputtype !== "radio" ) {
26 + // Support fake label
27 + if ( label.length == 0 ) {
28 + label = $( "<label for='" + input[ 0 ].id +
29 + "' style='display:block;width:1px;height:1px;'></label>" );
32 + // Wrap the input + label in a div
34 + .wrapAll( "<div class='ui-" + inputtype + "'></div>" );
36 // Expose for other methods
39 @@ -36,6 +49,8 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
40 checkedClass: checkedClass,
41 uncheckedClass: uncheckedClass,
42 checkedicon: checkedicon,
43 + checkedpressedicon: checkedpressedicon,
44 + uncheckedpressedicon: uncheckedpressedicon,
45 uncheckedicon: uncheckedicon
48 @@ -50,11 +65,19 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
52 - // Wrap the input + label in a div
54 - .wrapAll( "<div class='ui-" + inputtype + "'></div>" );
55 + if ( input.hasClass( "favorite" ) ) {
56 + input.parent().addClass( "favorite" ).end();
60 + vmousedown: function() {
63 + vmouseup: function() {
68 vmouseover: function( event ) {
69 if ( $( this ).parent().is( ".ui-disabled" ) ) {
70 event.stopPropagation();
71 @@ -154,6 +177,34 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
72 .checkboxradio( "refresh" );
76 + var input = this.element,
78 + icon = label.find( ".ui-icon" );
80 + if ( !$( input[ 0 ] ).is( ":disabled" ) ) {
81 + if ( $( input[ 0 ] ).prop( "checked" ) ) {
82 + icon.addClass( this.uncheckedpressedicon ).removeClass( this.checkedicon );
84 + icon.removeClass( this.uncheckedicon ).addClass( this.checkedpressedicon );
89 + unpress: function() {
90 + var input = this.element,
92 + icon = label.find( ".ui-icon" );
94 + if ( !$( input[ 0 ] ).is( ":disabled" ) ) {
95 + if ( $( input[ 0 ] ).prop( "checked" ) ) {
96 + icon.removeClass( this.uncheckedpressedicon ).addClass( this.uncheckedicon );
98 + icon.addClass( this.checkedicon ).removeClass( this.checkedpressedicon );
103 refresh: function() {
104 var input = this.element,