[TemporaryStorage] add files required for SDK build
[samples/web/TemporaryStorage.git] / tizen-web-ui-fw / latest / js / src / jquery.mobile.controlGroup.js
1 (function( $, undefined ) {
2
3 $.fn.controlgroup = function( options ) {
4         function flipClasses( els, flCorners  ) {
5                 els.removeClass( "ui-btn-corner-all ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-controlgroup-last ui-shadow" )
6                         .eq( 0 ).addClass( flCorners[ 0 ] )
7                         .end()
8                         .last().addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" );
9         }
10
11         return this.each(function() {
12                 var $el = $( this ),
13                         o = $.extend({
14                                                 direction:  $.mobile.getAttrFixed( $el[0], "data-"+ $.mobile.ns + "type" ) || "vertical",
15                                                 shadow: false,
16                                                 excludeInvisible: true,
17                                                 mini: $.mobile.getAttrFixed( $el[0], "data-"+ $.mobile.ns + "mini" )
18                                         }, options ),
19                         grouplegend = $el.children( "legend" ),
20                         groupheading = $el.children( ".ui-controlgroup-label" ),
21                         groupcontrols = $el.children( ".ui-controlgroup-controls" ),
22                         flCorners = o.direction === "horizontal" ? [ "ui-corner-left", "ui-corner-right" ] : [ "ui-corner-top", "ui-corner-bottom" ],
23                         type = $el.find( "input" ).first().attr( "type" );
24
25                 // First unwrap the controls if the controlgroup was already enhanced
26                 if ( groupcontrols.length ) {
27                         groupcontrols.contents().unwrap();
28                 }
29                 $el.wrapInner( "<div class='ui-controlgroup-controls'></div>" );
30
31                 if ( grouplegend.length ) {
32                         // Replace legend with more stylable replacement div
33                         $( "<div role='heading' class='ui-controlgroup-label'>" + grouplegend.html() + "</div>" ).insertBefore( $el.children( 0 ) );
34                         grouplegend.remove();
35                 } else if ( groupheading.length ) {
36                         // Just move the heading if the controlgroup was already enhanced
37                         $el.prepend( groupheading );
38                 }
39
40                 $el.addClass( "ui-corner-all ui-controlgroup ui-controlgroup-" + o.direction );
41
42                 flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ).not( '.ui-slider-handle' ), flCorners );
43                 flipClasses( $el.find( ".ui-btn-inner" ), flCorners );
44
45                 if ( o.shadow ) {
46                         $el.addClass( "ui-shadow" );
47                 }
48
49                 if ( o.mini ) {
50                         $el.addClass( "ui-mini" );
51                 }
52
53         });
54 };
55
56 // The pagecreate handler for controlgroup is in jquery.mobile.init because of the soft-dependency on the wrapped widgets
57
58 })(jQuery);