upload tizen1.0 source
[framework/web/web-ui-fw.git] / libs / patch / 0008-JQM-checkbox-pressed-no-lable-support.patch
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
5
6 Signed-off-by: Koeun Choi <koeun.choi@samsung.com>
7 ---
8  .../js/jquery.mobile.forms.checkboxradio.js        |   57 ++++++++++++++++++-
9  1 files changed, 54 insertions(+), 3 deletions(-)
10
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;
18  
19 +               var checkedpressedicon = checkedicon + "-press",
20 +                       uncheckedpressedicon = uncheckedicon + "-press";
21 +
22                 if ( inputtype !== "checkbox" && inputtype !== "radio" ) {
23                         return;
24                 }
25  
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>" );
30 +               }
31 +
32 +               // Wrap the input + label in a div
33 +               input.add( label )
34 +                       .wrapAll( "<div class='ui-" + inputtype + "'></div>" );
35 +
36                 // Expose for other methods
37                 $.extend( this, {
38                         label: label,
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
46                 });
47  
48 @@ -50,11 +65,19 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
49                         shadow: false
50                 });
51  
52 -               // Wrap the input + label in a div
53 -               input.add( label )
54 -                       .wrapAll( "<div class='ui-" + inputtype + "'></div>" );
55 +               if ( input.hasClass( "favorite" ) ) {
56 +                       input.parent().addClass( "favorite" ).end();
57 +               }
58  
59                 label.bind({
60 +                       vmousedown: function() {
61 +                               self.press();
62 +                       },
63 +                       vmouseup: function() {
64 +                               self.unpress();
65 +                       },
66 +
67 +
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" );
73         },
74  
75 +       press: function() {
76 +               var input = this.element,
77 +                       label = this.label,
78 +                       icon = label.find( ".ui-icon" );
79 +
80 +               if ( !$( input[ 0 ] ).is( ":disabled" ) ) {
81 +                       if ( $( input[ 0 ] ).prop( "checked" ) ) {
82 +                               icon.addClass( this.uncheckedpressedicon ).removeClass( this.checkedicon );
83 +                       } else {
84 +                               icon.removeClass( this.uncheckedicon ).addClass( this.checkedpressedicon );
85 +                       }
86 +               }
87 +       },
88 +
89 +       unpress: function() {
90 +               var input = this.element,
91 +                       label = this.label,
92 +                       icon = label.find( ".ui-icon" );
93 +
94 +               if ( !$( input[ 0 ] ).is( ":disabled" ) ) {
95 +                       if ( $( input[ 0 ] ).prop( "checked" ) ) {
96 +                               icon.removeClass( this.uncheckedpressedicon ).addClass( this.uncheckedicon );
97 +                       } else {
98 +                               icon.addClass( this.checkedicon ).removeClass( this.checkedpressedicon );
99 +                       }
100 +               }
101 +       },
102 +
103         refresh: function() {
104                 var input = this.element,
105                         label = this.label,
106 -- 
107 1.7.5.4
108