upload tizen1.0 source
[framework/web/web-ui-fw.git] / libs / patch / 0005-JQM-Change-button-design-to-meet-TIZEN-UI.patch
1 From 01ba67004fdeaa1c205935ffb3e6739a9005cc21 Mon Sep 17 00:00:00 2001
2 From: Minkyu Kang <mk7.kang@samsung.com>
3 Date: Wed, 29 Feb 2012 11:28:03 +0900
4 Subject: [PATCH] JQM: Change button design to meet TIZEN UI
5
6 Signed-off-by: Lee Wongi <wongi11.lee@samsung.com>
7 Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
8 ---
9  .../js/jquery.mobile.buttonMarkup.js               |   61 +++++++++++++++++++-
10  1 files changed, 58 insertions(+), 3 deletions(-)
11
12 diff --git a/libs/js/jquery-mobile-1.0.1pre/js/jquery.mobile.buttonMarkup.js b/libs/js/jquery-mobile-1.0.1pre/js/jquery.mobile.buttonMarkup.js
13 index d192e37..93485f1 100644
14 --- a/libs/js/jquery-mobile-1.0.1pre/js/jquery.mobile.buttonMarkup.js
15 +++ b/libs/js/jquery-mobile-1.0.1pre/js/jquery.mobile.buttonMarkup.js
16 @@ -2,6 +2,21 @@
17  * "buttons" plugin - for making button-like links
18  */
19  
20 +/*
21 + * Button Markup modified for TIZEN style.
22 + *
23 + * HTML Attributes:
24 + *
25 + *             data-role: button
26 + *             data-style: circle, nobg, edit
27 + *
28 + * Examples:
29 + *
30 + *     <div data-role="button" data-inline="true" data-icon="send" data-style="circle"></div>
31 + *     <div data-role="button" data-inline="true" data-icon="favorite" data-style="nobg">
32 + *     <div data-role="button" data-inline="true" data-icon="editminus" data-style="edit"></div>
33 + */
34 +
35  ( function( $, undefined ) {
36  
37  $.fn.buttonMarkup = function( options ) {
38 @@ -73,8 +88,48 @@ $.fn.buttonMarkup = function( options ) {
39                         buttonClass += " ui-shadow";
40                 }
41  
42 -               e.setAttribute( "data-" + $.mobile.ns + "theme", o.theme );
43 -               el.addClass( buttonClass );
44 +               /* TIZEN style markup */
45 +               buttonStyle = el.jqmData("style");
46 +
47 +               if ( buttonStyle == "circle" ) {
48 +                       /* style : no text, Icon only */
49 +                       buttonClass += " ui-btn-corner-circle";
50 +                       buttonClass += " ui-btn-icon_only";
51 +               } else if ( buttonStyle == "nobg" ) {
52 +                       /* style : no text, Icon only, no bg */
53 +                       buttonClass += " ui-btn-icon-nobg";
54 +                       buttonClass += " ui-btn-icon_only";
55 +               } else if ( buttonStyle == "edit" ) {
56 +                       buttonClass += " ui-btn-edit";
57 +               }
58 +
59 +               if ( o.icon ) {
60 +                       if ( $(el).text().length > 0 ) {
61 +                               o.iconpos == "right" ?
62 +                                       textClass += " ui-btn-text-padding-right" :
63 +                                       textClass += " ui-btn-text-padding-left";
64 +
65 +                               innerClass += " ui-btn-hastxt";
66 +                       } else {
67 +                               if ( buttonStyle == "circle" ) {
68 +                                       /* style : no text, Icon only */
69 +                                       innerClass += " ui-btn-corner-circle";
70 +                               } else if ( buttonStyle == "nobg" ) {
71 +                                       /* style : no text, Icon only, no bg */
72 +                                       innerClass += " ui-btn-icon-nobg";
73 +                               }
74 +
75 +                               buttonClass += " ui-btn-icon_only";
76 +                               innerClass += " ui-btn-icon-only";
77 +                       }
78 +               } else {
79 +                       if ( $(el).text().length > 0 ) {
80 +                               innerClass += " ui-btn-hastxt";
81 +                       }
82 +               }
83 +
84 +               el.attr( "data-" + $.mobile.ns + "theme", o.theme )
85 +                       .addClass( buttonClass );
86  
87                 buttonInner.className = innerClass;
88                 buttonInner.setAttribute("aria-hidden", "true");
89 @@ -96,7 +151,7 @@ $.fn.buttonMarkup = function( options ) {
90                 // TODO obviously it would be nice to pull this element out instead of
91                 // retrieving it from the DOM again, but this change is much less obtrusive
92                 // and 1.0 draws nigh
93 -               $.data( e, 'textWrapper', $( buttonText ) );
94 +               el.data( 'textWrapper', $( buttonText ) );
95         }
96  
97         return this;
98 -- 
99 1.7.5.4
100