You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pp...@apache.org on 2013/09/10 20:04:24 UTC
[19/51] [partial] [cordova-tizen] Tizen SDK 2.2 support mores samples
http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/4ebce38e/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/fixedToolbar.js
----------------------------------------------------------------------
diff --git a/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/fixedToolbar.js b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/fixedToolbar.js
new file mode 100644
index 0000000..880d451
--- /dev/null
+++ b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/fixedToolbar.js
@@ -0,0 +1,280 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Behavior for "fixed" headers and footers
+//>>label: Toolbars: Fixed
+//>>group: Widgets
+//>>css.structure: ../css/structure/jquery.mobile.fixedToolbar.css
+//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
+
+define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jquery.mobile.navigation", "./page", "./page.sections", "../jquery.mobile.zoom" ], function( jQuery ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+
+
+ $.widget( "mobile.fixedtoolbar", $.mobile.widget, {
+ options: {
+ visibleOnPageShow: true,
+ disablePageZoom: true,
+ transition: "slide", //can be none, fade, slide (slide maps to slideup or slidedown)
+ fullscreen: false,
+ tapToggle: true,
+ tapToggleBlacklist: "a, button, input, select, textarea, .ui-header-fixed, .ui-footer-fixed, .ui-popup",
+ hideDuringFocus: "input, textarea, select",
+ updatePagePadding: true,
+ trackPersistentToolbars: true,
+
+ // Browser detection! Weeee, here we go...
+ // Unfortunately, position:fixed is costly, not to mention probably impossible, to feature-detect accurately.
+ // Some tests exist, but they currently return false results in critical devices and browsers, which could lead to a broken experience.
+ // Testing fixed positioning is also pretty obtrusive to page load, requiring injected elements and scrolling the window
+ // The following function serves to rule out some popular browsers with known fixed-positioning issues
+ // This is a plugin option like any other, so feel free to improve or overwrite it
+ supportBlacklist: function() {
+ var w = window,
+ ua = navigator.userAgent,
+ platform = navigator.platform,
+ // Rendering engine is Webkit, and capture major version
+ wkmatch = ua.match( /AppleWebKit\/([0-9]+)/ ),
+ wkversion = !!wkmatch && wkmatch[ 1 ],
+ ffmatch = ua.match( /Fennec\/([0-9]+)/ ),
+ ffversion = !!ffmatch && ffmatch[ 1 ],
+ operammobilematch = ua.match( /Opera Mobi\/([0-9]+)/ ),
+ omversion = !!operammobilematch && operammobilematch[ 1 ];
+
+ if(
+ // iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
+ ( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 ) ||
+ // Opera Mini
+ ( w.operamini && ({}).toString.call( w.operamini ) === "[object OperaMini]" ) ||
+ ( operammobilematch && omversion < 7458 ) ||
+ //Android lte 2.1: Platform is Android and Webkit version is less than 533 (Android 2.2)
+ ( ua.indexOf( "Android" ) > -1 && wkversion && wkversion < 533 ) ||
+ // Firefox Mobile before 6.0 -
+ ( ffversion && ffversion < 6 ) ||
+ // WebOS less than 3
+ ( "palmGetResource" in window && wkversion && wkversion < 534 ) ||
+ // MeeGo
+ ( ua.indexOf( "MeeGo" ) > -1 && ua.indexOf( "NokiaBrowser/8.5.0" ) > -1 ) ) {
+ return true;
+ }
+
+ return false;
+ },
+ initSelector: ":jqmData(position='dummy')"
+ },
+
+ _create: function() {
+
+ var self = this,
+ o = self.options,
+ $el = self.element,
+ tbtype = $el.is( ":jqmData(role='header')" ) ? "header" : "footer",
+ $page = $el.closest( ".ui-page" );
+
+ // Feature detecting support for
+ if ( o.supportBlacklist() ) {
+ self.destroy();
+ return;
+ }
+
+ $el.addClass( "ui-"+ tbtype +"-fixed" );
+
+ // "fullscreen" overlay positioning
+ if ( o.fullscreen ) {
+ $el.addClass( "ui-"+ tbtype +"-fullscreen" );
+ $page.addClass( "ui-page-" + tbtype + "-fullscreen" );
+ }
+ // If not fullscreen, add class to page to set top or bottom padding
+ else{
+ $page.addClass( "ui-page-" + tbtype + "-fixed" );
+ }
+
+ self._addTransitionClass();
+ self._bindPageEvents();
+ self._bindToggleHandlers();
+ },
+
+ _addTransitionClass: function() {
+ var tclass = this.options.transition;
+
+ if ( tclass && tclass !== "none" ) {
+ // use appropriate slide for header or footer
+ if ( tclass === "slide" ) {
+ tclass = this.element.is( ".ui-header" ) ? "slidedown" : "slideup";
+ }
+
+ this.element.addClass( tclass );
+ }
+ },
+
+ _bindPageEvents: function() {
+ var self = this,
+ o = self.options,
+ $el = self.element;
+
+ //page event bindings
+ // Fixed toolbars require page zoom to be disabled, otherwise usability issues crop up
+ // This method is meant to disable zoom while a fixed-positioned toolbar page is visible
+ $el.closest( ".ui-page" )
+ .bind( "pagebeforeshow", function() {
+ if ( o.disablePageZoom ) {
+ $.mobile.zoom.disable( true );
+ }
+ if ( !o.visibleOnPageShow ) {
+ self.hide( true );
+ }
+ } )
+ .bind( "webkitAnimationStart animationstart updatelayout", function() {
+ var thisPage = this;
+ if ( o.updatePagePadding ) {
+ self.updatePagePadding( thisPage );
+ }
+ })
+ .bind( "pageshow", function() {
+ var thisPage = this;
+ self.updatePagePadding( thisPage );
+ if ( o.updatePagePadding ) {
+ $.mobile.$window.bind( "throttledresize." + self.widgetName, function() {
+ self.updatePagePadding( thisPage );
+ });
+ }
+ })
+ .bind( "pagebeforehide", function( e, ui ) {
+ if ( o.disablePageZoom ) {
+ $.mobile.zoom.enable( true );
+ }
+ if ( o.updatePagePadding ) {
+ $.mobile.$window.unbind( "throttledresize." + self.widgetName );
+ }
+
+ if ( o.trackPersistentToolbars ) {
+ var thisFooter = $( ".ui-footer-fixed:jqmData(id)", this ),
+ thisHeader = $( ".ui-header-fixed:jqmData(id)", this ),
+ nextFooter = thisFooter.length && ui.nextPage && $( ".ui-footer-fixed:jqmData(id='" + thisFooter.jqmData( "id" ) + "')", ui.nextPage ) || $(),
+ nextHeader = thisHeader.length && ui.nextPage && $( ".ui-header-fixed:jqmData(id='" + thisHeader.jqmData( "id" ) + "')", ui.nextPage ) || $();
+
+ if ( nextFooter.length || nextHeader.length ) {
+
+ nextFooter.add( nextHeader ).appendTo( $.mobile.pageContainer );
+
+ ui.nextPage.one( "pageshow", function() {
+ nextFooter.add( nextHeader ).appendTo( this );
+ });
+ }
+ }
+ });
+ },
+
+ _visible: true,
+
+ // This will set the content element's top or bottom padding equal to the toolbar's height
+ updatePagePadding: function( tbPage ) {
+ var $el = this.element,
+ header = $el.is( ".ui-header" );
+
+ // This behavior only applies to "fixed", not "fullscreen"
+ if ( this.options.fullscreen ) { return; }
+
+ tbPage = tbPage || $el.closest( ".ui-page" );
+ $( tbPage ).css( "padding-" + ( header ? "top" : "bottom" ), $el.outerHeight() );
+ },
+
+ _useTransition: function( notransition ) {
+ var $win = $.mobile.$window,
+ $el = this.element,
+ scroll = $win.scrollTop(),
+ elHeight = $el.height(),
+ pHeight = $el.closest( ".ui-page" ).height(),
+ viewportHeight = $.mobile.getScreenHeight(),
+ tbtype = $el.is( ":jqmData(role='header')" ) ? "header" : "footer";
+
+ return !notransition &&
+ ( this.options.transition && this.options.transition !== "none" &&
+ (
+ ( tbtype === "header" && !this.options.fullscreen && scroll > elHeight ) ||
+ ( tbtype === "footer" && !this.options.fullscreen && scroll + viewportHeight < pHeight - elHeight )
+ ) || this.options.fullscreen
+ );
+ },
+
+ show: function( notransition ) {
+ var hideClass = "ui-fixed-hidden",
+ $el = this.element;
+
+ if ( this._useTransition( notransition ) ) {
+ $el
+ .removeClass( "out " + hideClass )
+ .addClass( "in" );
+ }
+ else {
+ $el.removeClass( hideClass );
+ }
+ this._visible = true;
+ },
+
+ hide: function( notransition ) {
+ var hideClass = "ui-fixed-hidden",
+ $el = this.element,
+ // if it's a slide transition, our new transitions need the reverse class as well to slide outward
+ outclass = "out" + ( this.options.transition === "slide" ? " reverse" : "" );
+
+ if( this._useTransition( notransition ) ) {
+ $el
+ .addClass( outclass )
+ .removeClass( "in" )
+ .animationComplete(function() {
+ $el.addClass( hideClass ).removeClass( outclass );
+ });
+ }
+ else {
+ $el.addClass( hideClass ).removeClass( outclass );
+ }
+ this._visible = false;
+ },
+
+ toggle: function() {
+ this[ this._visible ? "hide" : "show" ]();
+ },
+
+ _bindToggleHandlers: function() {
+ var self = this,
+ o = self.options,
+ $el = self.element;
+
+ // tap toggle
+ $el.closest( ".ui-page" )
+ .bind( "vclick", function( e ) {
+ if ( o.tapToggle && !$( e.target ).closest( o.tapToggleBlacklist ).length ) {
+ self.toggle();
+ }
+ })
+ .bind( "focusin focusout", function( e ) {
+ if ( screen.width < 500 && $( e.target ).is( o.hideDuringFocus ) && !$( e.target ).closest( ".ui-header-fixed, .ui-footer-fixed" ).length ) {
+ self[ ( e.type === "focusin" && self._visible ) ? "hide" : "show" ]();
+ }
+ });
+ },
+
+ destroy: function() {
+ this.element.removeClass( "ui-header-fixed ui-footer-fixed ui-header-fullscreen ui-footer-fullscreen in out fade slidedown slideup ui-fixed-hidden" );
+ this.element.closest( ".ui-page" ).removeClass( "ui-page-header-fixed ui-page-footer-fixed ui-page-header-fullscreen ui-page-footer-fullscreen" );
+ }
+
+ });
+
+ //auto self-init widgets
+ $.mobile.$document
+ .bind( "pagecreate create", function( e ) {
+
+ // DEPRECATED in 1.1: support for data-fullscreen=true|false on the page element.
+ // This line ensures it still works, but we recommend moving the attribute to the toolbars themselves.
+ if ( $( e.target ).jqmData( "fullscreen" ) ) {
+ $( $.mobile.fixedtoolbar.prototype.options.initSelector, e.target ).not( ":jqmData(fullscreen)" ).jqmData( "fullscreen", true );
+ }
+
+ $.mobile.fixedtoolbar.prototype.enhanceWithin( e.target );
+ });
+
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");
http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/4ebce38e/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/button.js
----------------------------------------------------------------------
diff --git a/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/button.js b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/button.js
new file mode 100644
index 0000000..d390071
--- /dev/null
+++ b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/button.js
@@ -0,0 +1,156 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Custom-styled native input/buttons
+//>>label: Buttons: Input or button-based
+//>>group: Forms
+//>>css.structure: ../css/structure/jquery.mobile.button.css
+//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
+
+define( [ "jquery", "../../jquery.mobile.widget", "../../jquery.mobile.buttonMarkup" ], function( jQuery ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+
+$.widget( "mobile.button", $.mobile.widget, {
+ options: {
+ theme: null,
+ icon: null,
+ iconpos: null,
+ corners: true,
+ shadow: true,
+ iconshadow: true,
+ initSelector: "button, [type='button'], [type='submit'], [type='reset']"
+ },
+ _create: function() {
+ var $el = this.element,
+ $button,
+ o = this.options,
+ type,
+ name,
+ inline = o.inline || $.mobile.getAttrFixed( $el[0], "data-" + $.mobile.ns + "inline" ),
+ mini = o.mini || $.mobile.getAttrFixed( $el[0], "data-" + $.mobile.ns + "mini" ),
+ classes = "",
+ $buttonPlaceholder;
+
+ // if this is a link, check if it's been enhanced and, if not, use the right function
+ if ( $el[ 0 ].tagName === "A" ) {
+ if ( !$el.hasClass( "ui-btn" ) ) {
+ $el.buttonMarkup();
+ }
+
+ return;
+ }
+
+ // get the inherited theme
+ // TODO centralize for all widgets
+ if ( !this.options.theme ) {
+ this.options.theme = $.mobile.getInheritedTheme( this.element, "c" );
+ }
+
+ // TODO: Post 1.1--once we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577
+ /* if ( $el[0].className.length ) {
+ classes = $el[0].className;
+ } */
+ if ( !!~$el[0].className.indexOf( "ui-btn-left" ) ) {
+ classes = "ui-btn-left";
+ }
+
+ if ( !!~$el[0].className.indexOf( "ui-btn-right" ) ) {
+ classes = "ui-btn-right";
+ }
+
+ if ( $el.attr( "type" ) === "submit" || $el.attr( "type" ) === "reset" ) {
+ classes ? classes += " ui-submit" : classes = "ui-submit";
+ }
+ $( "label[for='" + $el.attr( "id" ) + "']" ).addClass( "ui-submit" );
+
+ // Add ARIA role
+ this.button = $( "<div></div>" )
+ [ $el.html() ? "html" : "text" ]( $el.html() || $el.val() )
+ .insertBefore( $el )
+ .buttonMarkup({
+ theme: o.theme,
+ icon: o.icon,
+ iconpos: o.iconpos,
+ inline: inline,
+ corners: o.corners,
+ shadow: o.shadow,
+ iconshadow: o.iconshadow,
+ mini: mini
+ })
+ .addClass( classes )
+ .append( $el.addClass( "ui-btn-hidden" ) );
+
+ $button = this.button;
+ type = $el.attr( "type" );
+ name = $el.attr( "name" );
+
+ // Add hidden input during submit if input type="submit" has a name.
+ if ( type !== "button" && type !== "reset" && name ) {
+ $el.bind( "vclick", function() {
+ // Add hidden input if it doesn't already exist.
+ if ( $buttonPlaceholder === undefined ) {
+ $buttonPlaceholder = $( "<input>", {
+ type: "hidden",
+ name: $el.attr( "name" ),
+ value: $el.attr( "value" )
+ }).insertBefore( $el );
+
+ // Bind to doc to remove after submit handling
+ $.mobile.$document.one( "submit", function() {
+ $buttonPlaceholder.remove();
+
+ // reset the local var so that the hidden input
+ // will be re-added on subsequent clicks
+ $buttonPlaceholder = undefined;
+ });
+ }
+ });
+ }
+
+ $el.bind({
+ focus: function() {
+ $button.addClass( $.mobile.focusClass );
+ },
+
+ blur: function() {
+ $button.removeClass( $.mobile.focusClass );
+ }
+ });
+
+ this.refresh();
+ },
+
+ enable: function() {
+ this.element.attr( "disabled", false );
+ this.button.removeClass( "ui-disabled" ).attr( "aria-disabled", false );
+ return this._setOption( "disabled", false );
+ },
+
+ disable: function() {
+ this.element.attr( "disabled", true );
+ this.button.addClass( "ui-disabled" ).attr( "aria-disabled", true );
+ return this._setOption( "disabled", true );
+ },
+
+ refresh: function() {
+ var $el = this.element;
+
+ if ( $el.prop("disabled") ) {
+ this.disable();
+ } else {
+ this.enable();
+ }
+
+ // Grab the button's text element from its implementation-independent data item
+ $( this.button.data( 'buttonElements' ).text )[ $el.html() ? "html" : "text" ]( $el.html() || $el.val() );
+ }
+});
+
+//auto self-init widgets
+$.mobile.$document.bind( "pagecreate create", function( e ) {
+ $.mobile.button.prototype.enhanceWithin( e.target, true );
+});
+
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");
http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/4ebce38e/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/checkboxradio.js
----------------------------------------------------------------------
diff --git a/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/checkboxradio.js b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/checkboxradio.js
new file mode 100644
index 0000000..a8f0082
--- /dev/null
+++ b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/checkboxradio.js
@@ -0,0 +1,229 @@
+/*
+* "checkboxradio" plugin
+*/
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Consistent styling for checkboxes/radio buttons.
+//>>label: Checkboxes & Radio Buttons
+//>>group: Forms
+//>>css.structure: ../css/structure/jquery.mobile.forms.checkboxradio.css
+//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
+
+define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", "../../jquery.mobile.buttonMarkup" ], function( jQuery ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+
+$.widget( "mobile.checkboxradio", $.mobile.widget, {
+ options: {
+ theme: null,
+ initSelector: "input[type='checkbox'],input[type='radio']"
+ },
+ _create: function() {
+ var self = this,
+ input = this.element,
+ inheritAttr = function( input, dataAttr ) {
+ return input.jqmData( dataAttr ) || input.closest( "form, fieldset" ).jqmData( dataAttr );
+ },
+ // NOTE: Windows Phone could not find the label through a selector
+ // filter works though.
+ parentLabel = $( input ).closest( "label" ),
+ label = parentLabel.length ? parentLabel : ( input[0].id ? $( input ).closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" ).find( "label" ).filter( "[for='" + input[0].id + "']" ) : [ ] ),
+ inputtype = input[0].type,
+ mini = inheritAttr( input, "mini" ),
+ checkedState = inputtype + "-on",
+ uncheckedState = inputtype + "-off",
+ icon = input.parents( ":jqmData(type='horizontal')" ).length ? undefined : uncheckedState,
+ iconpos = inheritAttr( input, "iconpos" ),
+ activeBtn = icon ? "" : " " + $.mobile.activeBtnClass,
+ checkedClass = "ui-" + checkedState + activeBtn,
+ uncheckedClass = "ui-" + uncheckedState,
+ checkedicon = "ui-icon-" + checkedState,
+ uncheckedicon = "ui-icon-" + uncheckedState,
+ ariaCheckedAttr = "";
+
+ if ( inputtype !== "checkbox" && inputtype !== "radio" ) {
+ return;
+ }
+
+ ariaCheckedAttr = ( inputtype === "checkbox" ) ? "aria-checked" : "aria-selected";
+
+ // Support fake label
+ if ( label.length == 0 ) {
+ label = $( "<label for='" + input[ 0 ].id +
+ "'></label>" );
+ }
+
+ // Expose for other methods
+ $.extend( this, {
+ label: label,
+ inputtype: inputtype,
+ checkedClass: checkedClass,
+ uncheckedClass: uncheckedClass,
+ checkedicon: checkedicon,
+ uncheckedicon: uncheckedicon,
+ ariaCheckedAttr : ariaCheckedAttr
+ });
+
+ // If there's no selected theme check the data attr
+ if ( !this.options.theme ) {
+ this.options.theme = $.mobile.getInheritedTheme( this.element, "c" );
+ }
+
+ label.buttonMarkup({
+ theme: this.options.theme,
+ icon: icon,
+ shadow: false,
+ mini: mini,
+ iconpos: iconpos
+ });
+
+ // Wrap the input + label in a div
+ var wrapper = document.createElement('div');
+ wrapper.className = 'ui-' + inputtype;
+ wrapper.setAttribute( "role", inputtype );
+
+ if ( input.hasClass( "favorite" ) ) {
+ wrapper.className += ' favorite';
+ }
+
+ input.add( label ).wrapAll( wrapper );
+
+ label.bind({
+ vmouseover: function( event ) {
+ if ( $( this ).parent().is( ".ui-disabled" ) ) {
+ event.stopPropagation();
+ }
+ },
+
+ vclick: function( event ) {
+ if ( input.is( ":disabled" ) ) {
+ event.preventDefault();
+ return;
+ }
+
+ self._cacheVals();
+
+ input.prop( "checked", inputtype === "radio" && true || !input.prop( "checked" ) );
+
+ // trigger click handler's bound directly to the input as a substitute for
+ // how label clicks behave normally in the browsers
+ // TODO: it would be nice to let the browser's handle the clicks and pass them
+ // through to the associate input. we can swallow that click at the parent
+ // wrapper element level
+ input.triggerHandler( 'click' );
+
+ // Input set for common radio buttons will contain all the radio
+ // buttons, but will not for checkboxes. clearing the checked status
+ // of other radios ensures the active button state is applied properly
+ self._getInputSet().not( input ).prop( "checked", false );
+
+ self._updateAll();
+ return false;
+ }
+ });
+
+ input
+ .bind({
+ vmousedown: function() {
+ self._cacheVals();
+ },
+
+ vclick: function() {
+ var $this = $( this );
+
+ // Adds checked attribute to checked input when keyboard is used
+ if ( $this.is( ":checked" ) ) {
+
+ $this.prop( "checked", true);
+ self._getInputSet().not( $this ).prop( "checked", false );
+ } else {
+
+ $this.prop( "checked", false );
+ }
+
+ self._updateAll();
+ },
+
+ focus: function() {
+ label.addClass( $.mobile.focusClass );
+ },
+
+ blur: function() {
+ label.removeClass( $.mobile.focusClass );
+ }
+ });
+
+ this.refresh();
+ },
+
+ _cacheVals: function() {
+ this._getInputSet().each(function() {
+ $( this ).jqmData( "cacheVal", this.checked );
+ });
+ },
+
+ //returns either a set of radios with the same name attribute, or a single checkbox
+ _getInputSet: function() {
+ if ( this.inputtype === "checkbox" ) {
+ return this.element;
+ }
+
+ return this.element.closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" )
+ .find( "input[name='" + this.element[0].name + "'][type='" + this.inputtype + "']" );
+ },
+
+ _updateAll: function() {
+ var self = this;
+
+ this._getInputSet().each(function() {
+ var $this = $( this );
+
+ if ( this.checked || self.inputtype === "checkbox" ) {
+ $this.trigger( "change" );
+ }
+ $this.focus();
+ })
+ .checkboxradio( "refresh" );
+ },
+
+ refresh: function() {
+ var input = this.element[0],
+ label = this.label,
+ wrapper = input.parentNode,
+ icon = label.find( ".ui-icon" );
+
+ if ( input.checked ) {
+ label.addClass( this.checkedClass ).removeClass( this.uncheckedClass );
+ icon.addClass( this.checkedicon ).removeClass( this.uncheckedicon );
+ wrapper.setAttribute( this.ariaCheckedAttr, true );
+ } else {
+ label.removeClass( this.checkedClass ).addClass( this.uncheckedClass );
+ icon.removeClass( this.checkedicon ).addClass( this.uncheckedicon );
+ wrapper.setAttribute( this.ariaCheckedAttr, false );
+ }
+
+ if ( input.disabled ) {
+ this.disable();
+ } else {
+ this.enable();
+ }
+ },
+
+ disable: function() {
+ this.element.prop( "disabled", true ).parent().addClass( "ui-disabled" );
+ },
+
+ enable: function() {
+ this.element.prop( "disabled", false ).parent().removeClass( "ui-disabled" );
+ }
+});
+
+//auto self-init widgets
+$.mobile.$document.bind( "pagecreate create", function( e ) {
+ $.mobile.checkboxradio.prototype.enhanceWithin( e.target, true );
+});
+
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");
http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/4ebce38e/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/select.custom.js
----------------------------------------------------------------------
diff --git a/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/select.custom.js b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/select.custom.js
new file mode 100644
index 0000000..02ae263
--- /dev/null
+++ b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/select.custom.js
@@ -0,0 +1,524 @@
+/*
+* custom "selectmenu" plugin
+*/
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Extension to select menus to support menu styling, placeholder options, and multi-select features.
+//>>label: Selects: Custom menus
+//>>group: Forms
+//>>css.structure: ../css/structure/jquery.mobile.forms.select.css
+//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
+
+define( [
+ "jquery",
+ "../../jquery.mobile.buttonMarkup",
+ "../../jquery.mobile.core",
+ "../dialog",
+ "./select",
+ "../listview",
+ "../page",
+ "../popup",
+ // NOTE expects ui content in the defined page, see selector for menuPageContent definition
+ "../page.sections" ], function( jQuery ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+ var extendSelect = function( widget ) {
+
+ var select = widget.select,
+ selectID = widget.selectID,
+ label = widget.label,
+ thisPage = widget.select.closest( ".ui-page" ),
+ selectOptions = widget._selectOptions(),
+ isMultiple = widget.isMultiple = widget.select[ 0 ].multiple,
+ buttonId = selectID + "-button",
+ menuId = selectID + "-menu",
+ menuPage = $( "<div data-" + $.mobile.ns + "role='dialog' data-" +$.mobile.ns + "theme='"+ widget.options.theme +"' data-" +$.mobile.ns + "overlay-theme='"+ widget.options.overlayTheme +"'>" +
+ "<div data-" + $.mobile.ns + "role='header'>" +
+ "<div class='ui-title'>" + label.getEncodedText() + "</div>"+
+ "</div>"+
+ "<div data-" + $.mobile.ns + "role='content'></div>"+
+ "</div>" ),
+
+ listbox = $( "<div>", { "class": "ui-selectmenu" } ).insertAfter( widget.select ).popup( { theme: "a" } ),
+
+ list = $( "<ul>", {
+ "class": "ui-selectmenu-list",
+ "id": menuId,
+ "role": "listbox",
+ "aria-labelledby": buttonId
+ }).attr( "data-" + $.mobile.ns + "theme", widget.options.theme ).appendTo( listbox ),
+
+ header = $( "<div>", {
+ "class": "ui-header ui-bar-" + widget.options.theme
+ }).prependTo( listbox ),
+
+ headerTitle = $( "<h1>", {
+ "class": "ui-title"
+ }).appendTo( header ),
+
+ menuPageContent,
+ menuPageClose,
+ headerClose;
+
+ if ( widget.isMultiple ) {
+ headerClose = $( "<a>", {
+ "text": widget.options.closeText,
+ "href": "#",
+ "class": "ui-btn-left"
+ }).attr( "data-" + $.mobile.ns + "iconpos", "notext" ).attr( "data-" + $.mobile.ns + "icon", "delete" ).appendTo( header ).buttonMarkup();
+ }
+
+ $.extend( widget, {
+ select: widget.select,
+ selectID: selectID,
+ buttonId: buttonId,
+ menuId: menuId,
+ thisPage: thisPage,
+ menuPage: menuPage,
+ label: label,
+ selectOptions: selectOptions,
+ isMultiple: isMultiple,
+ theme: widget.options.theme,
+ listbox: listbox,
+ list: list,
+ header: header,
+ headerTitle: headerTitle,
+ headerClose: headerClose,
+ menuPageContent: menuPageContent,
+ menuPageClose: menuPageClose,
+ placeholder: "",
+
+ build: function() {
+ var self = this;
+
+ // Create list from select, update state
+ self.refresh();
+
+ self.select.attr( "tabindex", "-1" ).focus(function() {
+ $( this ).blur();
+ self.button.focus();
+ });
+
+ // Button events
+ self.button.bind( "vclick keydown" , function( event ) {
+ if (event.type === "vclick" ||
+ event.keyCode && (event.keyCode === $.mobile.keyCode.ENTER ||
+ event.keyCode === $.mobile.keyCode.SPACE)) {
+
+ self.open();
+ event.preventDefault();
+ }
+ });
+
+ // Events for list items
+ self.list.attr( "role", "listbox" )
+ .bind( "focusin", function( e ) {
+ $( e.target )
+ .attr( "tabindex", "0" )
+ .trigger( "vmouseover" );
+
+ })
+ .bind( "focusout", function( e ) {
+ $( e.target )
+ .attr( "tabindex", "-1" )
+ .trigger( "vmouseout" );
+ })
+ .delegate( "li:not(.ui-disabled, .ui-li-divider)", "click", function( event ) {
+
+ // index of option tag to be selected
+ var oldIndex = self.select[ 0 ].selectedIndex,
+ newIndex = self.list.find( "li:not(.ui-li-divider)" ).index( this ),
+ option = self._selectOptions().eq( newIndex )[ 0 ];
+
+ // toggle selected status on the tag for multi selects
+ option.selected = self.isMultiple ? !option.selected : true;
+
+ // toggle checkbox class for multiple selects
+ if ( self.isMultiple ) {
+ $( this ).find( ".ui-icon" )
+ .toggleClass( "ui-icon-checkbox-on", option.selected )
+ .toggleClass( "ui-icon-checkbox-off", !option.selected );
+ }
+
+ // trigger change if value changed
+ if ( self.isMultiple || oldIndex !== newIndex ) {
+ self.select.trigger( "change" );
+ }
+
+ // hide custom select for single selects only - otherwise focus clicked item
+ // We need to grab the clicked item the hard way, because the list may have been rebuilt
+ if ( self.isMultiple ) {
+ self.list.find( "li:not(.ui-li-divider)" ).eq( newIndex )
+ .addClass( "ui-btn-down-" + widget.options.theme ).find( "a" ).first().focus();
+ }
+ else {
+ self.close();
+ }
+
+ event.preventDefault();
+ })
+ .keydown(function( event ) { //keyboard events for menu items
+ var target = $( event.target ),
+ li = target.closest( "li" ),
+ prev, next;
+
+ // switch logic based on which key was pressed
+ switch ( event.keyCode ) {
+ // up or left arrow keys
+ case 38:
+ prev = li.prev().not( ".ui-selectmenu-placeholder" );
+
+ if ( prev.is( ".ui-li-divider" ) ) {
+ prev = prev.prev();
+ }
+
+ // if there's a previous option, focus it
+ if ( prev.length ) {
+ target
+ .blur()
+ .attr( "tabindex", "-1" );
+
+ prev.addClass( "ui-btn-down-" + widget.options.theme ).find( "a" ).first().focus();
+ }
+
+ return false;
+ // down or right arrow keys
+ case 40:
+ next = li.next();
+
+ if ( next.is( ".ui-li-divider" ) ) {
+ next = next.next();
+ }
+
+ // if there's a next option, focus it
+ if ( next.length ) {
+ target
+ .blur()
+ .attr( "tabindex", "-1" );
+
+ next.addClass( "ui-btn-down-" + widget.options.theme ).find( "a" ).first().focus();
+ }
+
+ return false;
+ // If enter or space is pressed, trigger click
+ case 13:
+ case 32:
+ target.trigger( "click" );
+
+ return false;
+ }
+ });
+
+ // button refocus ensures proper height calculation
+ // by removing the inline style and ensuring page inclusion
+ self.menuPage.bind( "pagehide", function() {
+ self.list.appendTo( self.listbox );
+ self._focusButton();
+
+ // TODO centralize page removal binding / handling in the page plugin.
+ // Suggestion from @jblas to do refcounting
+ //
+ // TODO extremely confusing dependency on the open method where the pagehide.remove
+ // bindings are stripped to prevent the parent page from disappearing. The way
+ // we're keeping pages in the DOM right now sucks
+ //
+ // rebind the page remove that was unbound in the open function
+ // to allow for the parent page removal from actions other than the use
+ // of a dialog sized custom select
+ //
+ // doing this here provides for the back button on the custom select dialog
+ $.mobile._bindPageRemove.call( self.thisPage );
+ });
+
+ // Events on the popup
+ self.listbox.bind( "popupafterclose", function( event ) {
+ self.close();
+ });
+
+ // Close button on small overlays
+ if ( self.isMultiple ) {
+ self.headerClose.click(function() {
+ if ( self.menuType === "overlay" ) {
+ self.close();
+ return false;
+ }
+ });
+ }
+
+ // track this dependency so that when the parent page
+ // is removed on pagehide it will also remove the menupage
+ self.thisPage.addDependents( this.menuPage );
+ },
+
+ _isRebuildRequired: function() {
+ var list = this.list.find( "li" ),
+ options = this._selectOptions();
+
+ // TODO exceedingly naive method to determine difference
+ // ignores value changes etc in favor of a forcedRebuild
+ // from the user in the refresh method
+ return options.text() !== list.text();
+ },
+
+ selected: function() {
+ return this._selectOptions().filter( ":selected:not( :jqmData(placeholder='true') )" );
+ },
+
+ refresh: function( forceRebuild , foo ) {
+ var self = this,
+ select = this.element,
+ isMultiple = this.isMultiple,
+ indicies;
+
+ if ( forceRebuild || this._isRebuildRequired() ) {
+ self._buildList();
+ }
+
+ indicies = this.selectedIndices();
+
+ self.setButtonText();
+ self.setButtonCount();
+
+ self.list.find( "li:not(.ui-li-divider)" )
+ .removeClass( $.mobile.activeBtnClass )
+ .attr( "aria-selected", false )
+ .each(function( i ) {
+
+ if ( $.inArray( i, indicies ) > -1 ) {
+ var item = $( this );
+
+ // Aria selected attr
+ item.attr( "aria-selected", true );
+
+ // Multiple selects: add the "on" checkbox state to the icon
+ if ( self.isMultiple ) {
+ item.find( ".ui-icon" ).removeClass( "ui-icon-checkbox-off" ).addClass( "ui-icon-checkbox-on" );
+ } else {
+ if ( item.is( ".ui-selectmenu-placeholder" ) ) {
+ item.next().addClass( $.mobile.activeBtnClass );
+ } else {
+ item.addClass( $.mobile.activeBtnClass );
+ }
+ }
+ }
+ });
+ },
+
+ close: function() {
+ if ( this.options.disabled || !this.isOpen ) {
+ return;
+ }
+
+ var self = this;
+
+ if ( self.menuType === "page" ) {
+ // doesn't solve the possible issue with calling change page
+ // where the objects don't define data urls which prevents dialog key
+ // stripping - changePage has incoming refactor
+ $.mobile.back();
+ } else {
+ self.listbox.popup( "close" );
+ self.list.appendTo( self.listbox );
+ self._focusButton();
+ }
+
+ // allow the dialog to be closed again
+ self.isOpen = false;
+ },
+
+ open: function() {
+ if ( this.options.disabled ) {
+ return;
+ }
+
+ var self = this,
+ $window = $.mobile.$window,
+ selfListParent = self.list.parent(),
+ menuHeight = selfListParent.outerHeight(),
+ menuWidth = selfListParent.outerWidth(),
+ activePage = $( "." + $.mobile.activePageClass ),
+ scrollTop = $window.scrollTop(),
+ btnOffset = self.button.offset().top,
+ screenHeight = $window.height(),
+ screenWidth = $window.width();
+
+ //add active class to button
+ self.button.addClass( $.mobile.activeBtnClass );
+
+ //remove after delay
+ setTimeout( function() {
+ self.button.removeClass( $.mobile.activeBtnClass );
+ }, 300);
+
+ function focusMenuItem() {
+ var selector = self.list.find( "." + $.mobile.activeBtnClass + " a" );
+ if ( selector.length === 0 ) {
+ selector = self.list.find( "li.ui-btn:not( :jqmData(placeholder='true') ) a" );
+ }
+ selector.first().focus().closest( "li" ).addClass( "ui-btn-down-" + widget.options.theme );
+ }
+
+ if ( menuHeight > screenHeight - 80 || !$.support.scrollTop ) {
+
+ self.menuPage.appendTo( $.mobile.pageContainer ).page();
+ self.menuPageContent = menuPage.find( ".ui-content" );
+ self.menuPageClose = menuPage.find( ".ui-header a" );
+
+ // prevent the parent page from being removed from the DOM,
+ // otherwise the results of selecting a list item in the dialog
+ // fall into a black hole
+ self.thisPage.unbind( "pagehide.remove" );
+
+ //for WebOS/Opera Mini (set lastscroll using button offset)
+ if ( scrollTop === 0 && btnOffset > screenHeight ) {
+ self.thisPage.one( "pagehide", function() {
+ $( this ).jqmData( "lastScroll", btnOffset );
+ });
+ }
+
+ self.menuPage.one( "pageshow", function() {
+ focusMenuItem();
+ self.isOpen = true;
+ });
+
+ self.menuType = "page";
+ self.menuPageContent.append( self.list );
+ self.menuPage.find("div .ui-title").text(self.label.text());
+ $.mobile.changePage( self.menuPage, {
+ transition: $.mobile.defaultDialogTransition
+ });
+ } else {
+ self.menuType = "overlay";
+
+ self.listbox
+ .one( "popupafteropen", focusMenuItem )
+ .popup( "open", {
+ x: self.button.offset().left + self.button.outerWidth() / 2,
+ y: self.button.offset().top + self.button.outerHeight() / 2
+ });
+
+ // duplicate with value set in page show for dialog sized selects
+ self.isOpen = true;
+ }
+ },
+
+ _buildList: function() {
+ var self = this,
+ o = this.options,
+ placeholder = this.placeholder,
+ needPlaceholder = true,
+ optgroups = [],
+ lis = [],
+ dataIcon = self.isMultiple ? "checkbox-off" : "false";
+
+ self.list.empty().filter( ".ui-listview" ).listview( "destroy" );
+
+ var $options = self.select.find( "option" ),
+ numOptions = $options.length,
+ select = this.select[ 0 ],
+ dataPrefix = 'data-' + $.mobile.ns,
+ dataIndexAttr = dataPrefix + 'option-index',
+ dataIconAttr = dataPrefix + 'icon',
+ dataRoleAttr = dataPrefix + 'role',
+ dataPlaceholderAttr = dataPrefix + 'placeholder',
+ fragment = document.createDocumentFragment(),
+ isPlaceholderItem = false,
+ optGroup;
+
+ for (var i = 0; i < numOptions;i++, isPlaceholderItem = false) {
+ var option = $options[i],
+ $option = $( option ),
+ parent = option.parentNode,
+ text = $option.text(),
+ anchor = document.createElement( 'a' ),
+ classes = [];
+
+ anchor.setAttribute( 'href', '#' );
+ anchor.appendChild( document.createTextNode( text ) );
+
+ // Are we inside an optgroup?
+ if ( parent !== select && parent.nodeName.toLowerCase() === "optgroup" ) {
+ var optLabel = parent.getAttribute( 'label' );
+ if ( optLabel !== optGroup ) {
+ var divider = document.createElement( 'li' );
+ divider.setAttribute( dataRoleAttr, 'list-divider' );
+ divider.setAttribute( 'role', 'option' );
+ divider.setAttribute( 'tabindex', '-1' );
+ divider.appendChild( document.createTextNode( optLabel ) );
+ fragment.appendChild( divider );
+ optGroup = optLabel;
+ }
+ }
+
+ if ( needPlaceholder && ( !option.getAttribute( "value" ) || text.length === 0 || $option.jqmData( "placeholder" ) ) ) {
+ needPlaceholder = false;
+ isPlaceholderItem = true;
+
+ // If we have identified a placeholder, mark it retroactively in the select as well
+ option.setAttribute( dataPlaceholderAttr, true );
+ if ( o.hidePlaceholderMenuItems ) {
+ classes.push( "ui-selectmenu-placeholder" );
+ }
+ if (!placeholder) {
+ placeholder = self.placeholder = text;
+ }
+ }
+
+ var item = document.createElement('li');
+ if ( option.disabled ) {
+ classes.push( "ui-disabled" );
+ item.setAttribute('aria-disabled',true);
+ }
+ item.setAttribute( dataIndexAttr,i );
+ item.setAttribute( dataIconAttr, dataIcon );
+ if ( isPlaceholderItem ) {
+ item.setAttribute( dataPlaceholderAttr, true );
+ }
+ item.className = classes.join( " " );
+ item.setAttribute( 'role', 'option' );
+ anchor.setAttribute( 'tabindex', '-1' );
+ item.appendChild( anchor );
+ fragment.appendChild( item );
+ }
+
+ self.list[0].appendChild( fragment );
+
+ // Hide header if it's not a multiselect and there's no placeholder
+ if ( !this.isMultiple && !placeholder.length ) {
+ this.header.hide();
+ } else {
+ this.headerTitle.text( this.placeholder );
+ }
+
+ // Now populated, create listview
+ self.list.listview();
+ },
+
+ _button: function() {
+ return $( "<a>", {
+ "href": "#",
+ "role": "button",
+ // TODO value is undefined at creation
+ "id": this.buttonId,
+ "aria-haspopup": "true",
+
+ // TODO value is undefined at creation
+ "aria-owns": this.menuId
+ });
+ }
+ });
+ };
+
+ // issue #3894 - core doesn't trigger events on disabled delegates
+ $.mobile.$document.bind( "selectmenubeforecreate", function( event ) {
+ var selectmenuWidget = $( event.target ).data( "selectmenu" );
+
+ if ( !selectmenuWidget.options.nativeMenu &&
+ selectmenuWidget.element.parents( ":jqmData(role='popup')" ).length === 0 ) {
+ extendSelect( selectmenuWidget );
+ }
+ });
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");
http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/4ebce38e/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/select.js
----------------------------------------------------------------------
diff --git a/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/select.js b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/select.js
new file mode 100644
index 0000000..fb462c9
--- /dev/null
+++ b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/select.js
@@ -0,0 +1,265 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Consistent styling for native select menus. Tapping opens a native select menu.
+//>>label: Selects
+//>>group: Forms
+//>>css.structure: ../css/structure/jquery.mobile.forms.select.css
+//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
+
+define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", "../../jquery.mobile.buttonMarkup", "../../jquery.mobile.zoom" ], function( jQuery ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+
+$.widget( "mobile.selectmenu", $.mobile.widget, {
+ options: {
+ theme: null,
+ disabled: false,
+ icon: "arrow-d",
+ iconpos: "right",
+ inline: false,
+ corners: true,
+ shadow: true,
+ iconshadow: true,
+ overlayTheme: "a",
+ hidePlaceholderMenuItems: true,
+ closeText: "Close",
+ nativeMenu: true,
+ // This option defaults to true on iOS devices.
+ preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1,
+ initSelector: "select:not( :jqmData(role='slider') )",
+ mini: false
+ },
+
+ _button: function() {
+ return $( "<div/>" );
+ },
+
+ _setDisabled: function( value ) {
+ this.element.attr( "disabled", value );
+ this.button.attr( "aria-disabled", value );
+ return this._setOption( "disabled", value );
+ },
+
+ _focusButton : function() {
+ var self = this;
+
+ setTimeout( function() {
+ self.button.focus();
+ }, 40);
+ },
+
+ _selectOptions: function() {
+ return this.select.find( "option" );
+ },
+
+ // setup items that are generally necessary for select menu extension
+ _preExtension: function() {
+ var classes = "";
+ // TODO: Post 1.1--once we have time to test thoroughly--any classes manually applied to the original element should be carried over to the enhanced element, with an `-enhanced` suffix. See https://github.com/jquery/jquery-mobile/issues/3577
+ /* if ( $el[0].className.length ) {
+ classes = $el[0].className;
+ } */
+ if ( !!~this.element[0].className.indexOf( "ui-btn-left" ) ) {
+ classes = " ui-btn-left";
+ }
+
+ if ( !!~this.element[0].className.indexOf( "ui-btn-right" ) ) {
+ classes = " ui-btn-right";
+ }
+
+ this.select = this.element.wrap( "<div class='ui-select" + classes + "'>" );
+ this.selectID = this.select.attr( "id" );
+ this.label = $( "label[for='"+ this.selectID +"']" ).addClass( "ui-select" );
+ this.isMultiple = this.select[ 0 ].multiple;
+ if ( !this.options.theme ) {
+ this.options.theme = $.mobile.getInheritedTheme( this.select, "c" );
+ }
+ },
+
+ _create: function() {
+ this._preExtension();
+
+ // Allows for extension of the native select for custom selects and other plugins
+ // see select.custom for example extension
+ // TODO explore plugin registration
+ this._trigger( "beforeCreate" );
+
+ this.button = this._button();
+
+ var self = this,
+
+ options = this.options,
+
+ inline = options.inline || $.mobile.getAttrFixed( this.select[0], "data-" + $.mobile.ns + "inline" ),
+ mini = options.mini || $.mobile.getAttrFixed( this.select[0], "data-" + $.mobile.ns + "mini" ),
+ iconpos = options.icon ? ( options.iconpos || $.mobile.getAttrFixed( this.select[0], "data-" + $.mobile.ns + "iconpos" ) ) : false,
+
+ // IE throws an exception at options.item() function when
+ // there is no selected item
+ // select first in this case
+ selectedIndex = this.select[ 0 ].selectedIndex === -1 ? 0 : this.select[ 0 ].selectedIndex,
+
+ // TODO values buttonId and menuId are undefined here
+ button = this.button
+ .insertBefore( this.select )
+ .buttonMarkup( {
+ theme: options.theme,
+ icon: options.icon,
+ iconpos: iconpos,
+ inline: inline,
+ corners: options.corners,
+ shadow: options.shadow,
+ iconshadow: options.iconshadow,
+ mini: mini
+ });
+
+ this.setButtonText();
+
+ // TIZEN fix: The TIZEN buttonMarkup patch adds 'ui-btn-icon-only' class to the ui-btn-inner.
+ // It makes the text not to be shown, so the class must be removed. (Like JQM)
+ button.children('.ui-btn-inner').removeClass('ui-btn-icon-only');
+
+ // Opera does not properly support opacity on select elements
+ // In Mini, it hides the element, but not its text
+ // On the desktop,it seems to do the opposite
+ // for these reasons, using the nativeMenu option results in a full native select in Opera
+ if ( options.nativeMenu && window.opera && window.opera.version ) {
+ button.addClass( "ui-select-nativeonly" );
+ }
+
+ // Add counter for multi selects
+ if ( this.isMultiple ) {
+ this.buttonCount = $( "<span>" )
+ .addClass( "ui-li-count ui-btn-up-c ui-btn-corner-all" )
+ .hide()
+ .appendTo( button.addClass('ui-li-has-count') );
+ }
+
+ // Disable if specified
+ if ( options.disabled || this.element.attr('disabled')) {
+ this.disable();
+ }
+
+ // Events on native select
+ this.select.change(function() {
+ self.refresh();
+ });
+
+ this.build();
+ },
+
+ build: function() {
+ var self = this;
+
+ this.select
+ .appendTo( self.button )
+ .bind( "vmousedown", function() {
+ // Add active class to button
+ self.button.addClass( $.mobile.activeBtnClass );
+ })
+ .bind( "focus", function() {
+ self.button.addClass( $.mobile.focusClass );
+ })
+ .bind( "blur", function() {
+ self.button.removeClass( $.mobile.focusClass );
+ })
+ .bind( "focus vmouseover", function() {
+ self.button.trigger( "vmouseover" );
+ })
+ .bind( "vmousemove", function() {
+ // Remove active class on scroll/touchmove
+ self.button.removeClass( $.mobile.activeBtnClass );
+ })
+ .bind( "change blur vmouseout", function() {
+ self.button.trigger( "vmouseout" )
+ .removeClass( $.mobile.activeBtnClass );
+ })
+ .bind( "change blur", function() {
+ self.button.removeClass( "ui-btn-down-" + self.options.theme );
+ });
+
+ // In many situations, iOS will zoom into the select upon tap, this prevents that from happening
+ self.button.bind( "vmousedown", function() {
+ if ( self.options.preventFocusZoom ) {
+ $.mobile.zoom.disable( true );
+ }
+ }).bind( "mouseup", function() {
+ if ( self.options.preventFocusZoom ) {
+ setTimeout(function() {
+ $.mobile.zoom.enable( true );
+ }, 0);
+ }
+ });
+ },
+
+ selected: function() {
+ return this._selectOptions().filter( ":selected" );
+ },
+
+ selectedIndices: function() {
+ var self = this;
+
+ return this.selected().map(function() {
+ return self._selectOptions().index( this );
+ }).get();
+ },
+
+ setButtonText: function() {
+ var self = this,
+ selected = this.selected(),
+ text = this.placeholder,
+ span = $( document.createElement( "span" ) );
+
+ this.button.find( ".ui-btn-text" ).html(function() {
+ if ( selected.length ) {
+ text = selected.map(function() {
+ return $( this ).text();
+ }).get().join( ", " );
+ } else {
+ text = self.placeholder;
+ }
+
+ // TODO possibly aggregate multiple select option classes
+ return span.text( text )
+ .addClass( self.select.attr( "class" ) )
+ .addClass( selected.attr( "class" ) );
+ });
+ },
+
+ setButtonCount: function() {
+ var selected = this.selected();
+
+ // multiple count inside button
+ if ( this.isMultiple ) {
+ this.buttonCount[ selected.length > 1 ? "show" : "hide" ]().text( selected.length );
+ }
+ },
+
+ refresh: function() {
+ this.setButtonText();
+ this.setButtonCount();
+ },
+
+ // open and close preserved in native selects
+ // to simplify users code when looping over selects
+ open: $.noop,
+ close: $.noop,
+
+ disable: function() {
+ this._setDisabled( true );
+ this.button.addClass( "ui-disabled" );
+ },
+
+ enable: function() {
+ this._setDisabled( false );
+ this.button.removeClass( "ui-disabled" );
+ }
+});
+
+//auto self-init widgets
+$.mobile.$document.bind( "pagecreate create", function( e ) {
+ $.mobile.selectmenu.prototype.enhanceWithin( e.target, true );
+});
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");
http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/4ebce38e/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/slider.js
----------------------------------------------------------------------
diff --git a/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/slider.js b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/slider.js
new file mode 100644
index 0000000..4c14574
--- /dev/null
+++ b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/slider.js
@@ -0,0 +1,472 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Slider form widget
+//>>label: Slider
+//>>group: Forms
+//>>css.structure: ../css/structure/jquery.mobile.forms.slider.css
+//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
+
+define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", "./textinput", "../../jquery.mobile.buttonMarkup" ], function( jQuery ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+
+$.widget( "mobile.slider", $.mobile.widget, {
+ widgetEventPrefix: "slide",
+
+ options: {
+ theme: null,
+ trackTheme: null,
+ disabled: false,
+ initSelector: "input[type='range'], :jqmData(type='range'), :jqmData(role='slider')",
+ mini: false
+ },
+
+ _create: function() {
+
+ // TODO: Each of these should have comments explain what they're for
+ var self = this,
+
+ control = this.element,
+
+ parentTheme = $.mobile.getInheritedTheme( control, "c" ),
+
+ theme = this.options.theme || parentTheme,
+
+ trackTheme = this.options.trackTheme || parentTheme,
+
+ cType = control[ 0 ].nodeName.toLowerCase(),
+
+ selectClass = ( cType === "select" ) ? "ui-slider-switch" : "",
+
+ controlID = control.attr( "id" ),
+
+ $label = $( "[for='" + controlID + "']" ),
+
+ labelID = $label.attr( "id" ) || controlID + "-label",
+
+ label = $label.attr( "id", labelID ),
+
+ val = function() {
+ return cType === "input" ? parseFloat( control.val() ) : control[0].selectedIndex;
+ },
+
+ min = cType === "input" ? parseFloat( control.attr( "min" ) ) : 0,
+
+ max = cType === "input" ? parseFloat( control.attr( "max" ) ) : control.find( "option" ).length-1,
+
+ step = window.parseFloat( control.attr( "step" ) || 1 ),
+
+ inlineClass = ( this.options.inline || $.mobile.getAttrFixed( control[0], "data-" + $.mobile.ns + "inline" ) === true ) ? " ui-slider-inline" : "",
+
+ miniClass = ( this.options.mini || $.mobile.getAttrFixed( control[0], "data-" + $.mobile.ns + "min" ) ) ? " ui-slider-mini" : "",
+
+
+ domHandle = document.createElement( 'a' ),
+ handle = $( domHandle ),
+ domSlider = document.createElement( 'div' ),
+ slider = $( domSlider ),
+
+ valuebg = $.mobile.getAttrFixed( control[0], "data-" + $.mobile.ns + "highlight" ) !== false && cType !== "select" ? (function() {
+ var bg = document.createElement('div');
+ bg.className = 'ui-slider-bg ' + $.mobile.activeBtnClass + ' ui-btn-corner-all';
+ return $( bg ).prependTo( slider );
+ })() : false,
+
+ options;
+
+ this._type = cType;
+
+ domHandle.setAttribute( 'href', "#" );
+ domSlider.setAttribute('role','application');
+ domSlider.className = ['ui-slider ',selectClass," ui-btn-down-",trackTheme,' ui-btn-corner-all', inlineClass, miniClass].join( "" );
+ domHandle.className = 'ui-slider-handle';
+ domSlider.appendChild( domHandle );
+ if ( $( control ).find( "option" ).length && $( control ).find( "option" ).text() === "" ) {
+ $( domSlider ).addClass( "ui-toggle-switch" );
+ }
+ if( val() === "1" ) {
+ $( domHandle ).addClass( "ui-toggle-on" );
+ } else {
+ $( domHandle ).addClass( "ui-toggle-off" );
+ }
+ handle.buttonMarkup({ corners: true, theme: theme, shadow: true })
+ .attr({
+ "role": "slider",
+ "aria-valuemin": min,
+ "aria-valuemax": max,
+ "aria-valuenow": val(),
+ "aria-valuetext": val(),
+ "title": val(),
+ "aria-labelledby": labelID
+ });
+
+ $.extend( this, {
+ slider: slider,
+ handle: handle,
+ valuebg: valuebg,
+ dragging: false,
+ beforeStart: null,
+ userModified: false,
+ mouseMoved: false
+ });
+
+ if ( cType === "select" ) {
+ var wrapper = document.createElement('div');
+ wrapper.className = 'ui-slider-inneroffset';
+
+ for ( var j = 0,length = domSlider.childNodes.length;j < length;j++ ) {
+ wrapper.appendChild( domSlider.childNodes[j] );
+ }
+
+ domSlider.appendChild( wrapper );
+
+ // slider.wrapInner( "<div class='ui-slider-inneroffset'></div>" );
+
+ // make the handle move with a smooth transition
+ handle.addClass( "ui-slider-handle-snapping" );
+
+ options = control.find( "option" );
+
+ for ( var i = 0, optionsCount = options.length; i < optionsCount; i++ ) {
+ var side = !i ? "b" : "a",
+ sliderTheme = !i ? " ui-btn-down-" + trackTheme : ( " " + $.mobile.activeBtnClass ),
+ sliderLabel = document.createElement( 'div' ),
+ sliderImg = document.createElement( 'span' );
+
+ sliderImg.className = ['ui-slider-label ui-slider-label-',side,sliderTheme," ui-btn-corner-all"].join( "" );
+ sliderImg.setAttribute('role','img');
+ sliderImg.appendChild( document.createTextNode( options[i].innerHTML ) );
+ $( sliderImg ).html() ? $( sliderImg ).html( $( sliderImg ).text() ) : $( sliderImg ).html();
+ $(sliderImg).prependTo( slider );
+ }
+
+ self._labels = $( ".ui-slider-label", slider );
+
+ }
+
+ label.addClass( "ui-slider" );
+
+ // monitor the input for updated values
+ control.addClass( cType === "input" ? "ui-slider-input" : "ui-slider-switch" )
+ .change(function() {
+ // if the user dragged the handle, the "change" event was triggered from inside refresh(); don't call refresh() again
+ if ( !self.mouseMoved ) {
+ self.refresh( val(), true );
+ }
+ })
+ .keyup(function() { // necessary?
+ self.refresh( val(), true, true );
+ })
+ .blur(function() {
+ self.refresh( val(), true );
+ });
+
+ this._preventDocumentDrag = function( event ) {
+ // NOTE: we don't do this in refresh because we still want to
+ // support programmatic alteration of disabled inputs
+ var et = $(event.target);
+ if ( self.dragging && !self.options.disabled && ( ( et.parents( ".ui-slider" ).is( ".ui-toggle-switch" ) && et.parents( ".ui-slider-handle" ).is( ".ui-btn-hover-s" ) ) || ( !$( self.element ).siblings( ".ui-slider" ).is( ".ui-toggle-switch"))) ) {
+
+ // self.mouseMoved must be updated before refresh() because it will be used in the control "change" event
+ self.mouseMoved = true;
+
+ if ( cType === "select" ) {
+ // make the handle move in sync with the mouse
+ handle.removeClass( "ui-slider-handle-snapping" );
+ }
+
+ self.refresh( event );
+
+ // only after refresh() you can calculate self.userModified
+ self.userModified = self.beforeStart !== control[0].selectedIndex;
+ return false;
+ }
+ }
+
+ this._on( $.mobile.$document, { "vmousemove": this._preventDocumentDrag });
+
+ // it appears the clicking the up and down buttons in chrome on
+ // range/number inputs doesn't trigger a change until the field is
+ // blurred. Here we check thif the value has changed and refresh
+ control.bind( "vmouseup", $.proxy( self._checkedRefresh, self));
+
+ slider.bind( "vmousedown", function( event ) {
+ // NOTE: we don't do this in refresh because we still want to
+ // support programmatic alteration of disabled inputs
+ if ( self.options.disabled ) {
+ return false;
+ }
+
+ self.dragging = true;
+ self.userModified = false;
+ self.mouseMoved = false;
+
+ if ( cType === "select" ) {
+ self.beforeStart = control[0].selectedIndex;
+ }
+
+ self.refresh( event );
+ self._trigger( "start" );
+ return false;
+ })
+ .bind( "vclick", false );
+
+ this._sliderMouseUp = function() {
+ if ( self.dragging ) {
+ self.dragging = false;
+
+ if ( cType === "select") {
+ // make the handle move with a smooth transition
+ handle.addClass( "ui-slider-handle-snapping" );
+
+ if ( self.mouseMoved ) {
+ // this is a drag, change the value only if user dragged enough
+ if ( self.userModified ) {
+ self.refresh( self.beforeStart === 0 ? 1 : 0 );
+ }
+ else {
+ self.refresh( self.beforeStart );
+ }
+ }
+ else {
+ // this is just a click, change the value
+ self.refresh( self.beforeStart === 0 ? 1 : 0 );
+ }
+ }
+
+ self.mouseMoved = false;
+ self._trigger( "stop" );
+ return false;
+ }
+ };
+
+ this._on( slider.add( document ), { "vmouseup": this._sliderMouseUp });
+ slider.insertAfter( control );
+
+ // Only add focus class to toggle switch, sliders get it automatically from ui-btn
+ if ( cType === 'select' ) {
+ this.handle.bind({
+ focus: function() {
+ slider.addClass( $.mobile.focusClass );
+ },
+
+ blur: function() {
+ slider.removeClass( $.mobile.focusClass );
+ }
+ });
+ }
+
+ this.handle.bind({
+ // NOTE force focus on handle
+ vmousedown: function() {
+ $( this ).focus();
+ },
+
+ vclick: false,
+
+ keydown: function( event ) {
+ var index = val();
+
+ if ( self.options.disabled ) {
+ return;
+ }
+
+ // In all cases prevent the default and mark the handle as active
+ switch ( event.keyCode ) {
+ case $.mobile.keyCode.HOME:
+ case $.mobile.keyCode.END:
+ case $.mobile.keyCode.PAGE_UP:
+ case $.mobile.keyCode.PAGE_DOWN:
+ case $.mobile.keyCode.UP:
+ case $.mobile.keyCode.RIGHT:
+ case $.mobile.keyCode.DOWN:
+ case $.mobile.keyCode.LEFT:
+ event.preventDefault();
+
+ if ( !self._keySliding ) {
+ self._keySliding = true;
+ $( this ).addClass( "ui-state-active" );
+ }
+ break;
+ }
+
+ // move the slider according to the keypress
+ switch ( event.keyCode ) {
+ case $.mobile.keyCode.HOME:
+ self.refresh( min );
+ break;
+ case $.mobile.keyCode.END:
+ self.refresh( max );
+ break;
+ case $.mobile.keyCode.PAGE_UP:
+ case $.mobile.keyCode.UP:
+ case $.mobile.keyCode.RIGHT:
+ self.refresh( index + step );
+ break;
+ case $.mobile.keyCode.PAGE_DOWN:
+ case $.mobile.keyCode.DOWN:
+ case $.mobile.keyCode.LEFT:
+ self.refresh( index - step );
+ break;
+ }
+ }, // remove active mark
+
+ keyup: function( event ) {
+ if ( self._keySliding ) {
+ self._keySliding = false;
+ $( this ).removeClass( "ui-state-active" );
+ }
+ }
+ });
+
+ this.refresh( undefined, undefined, true );
+ },
+
+ _checkedRefresh: function() {
+ if( this.value != this._value() ){
+ this.refresh( this._value() );
+ }
+ },
+
+ _value: function() {
+ return this._type === "input" ?
+ parseFloat( this.element.val() ) : this.element[0].selectedIndex;
+ },
+
+ refresh: function( val, isfromControl, preventInputUpdate ) {
+
+ // NOTE: we don't return here because we want to support programmatic
+ // alteration of the input value, which should still update the slider
+ if ( this.options.disabled || this.element.attr('disabled')) {
+ this.disable();
+ }
+
+ // set the stored value for comparison later
+ this.value = this._value();
+
+ var control = this.element, percent,
+ cType = control[0].nodeName.toLowerCase(),
+ min = cType === "input" ? parseFloat( control.attr( "min" ) ) : 0,
+ max = cType === "input" ? parseFloat( control.attr( "max" ) ) : control.find( "option" ).length - 1,
+ step = ( cType === "input" && parseFloat( control.attr( "step" ) ) > 0 ) ? parseFloat( control.attr( "step" ) ) : 1;
+
+ if ( typeof val === "object" ) {
+ var data = val,
+ // a slight tolerance helped get to the ends of the slider
+ tol = 8;
+ if ( !this.dragging ||
+ data.pageX < this.slider.offset().left - tol ||
+ data.pageX > this.slider.offset().left + this.slider.width() + tol ) {
+ return;
+ }
+ percent = Math.round( ( ( data.pageX - this.slider.offset().left ) / this.slider.width() ) * 100 );
+ } else {
+ if ( val == null ) {
+ val = cType === "input" ? parseFloat( control.val() || 0 ) : control[0].selectedIndex;
+ }
+ percent = ( parseFloat( val ) - min ) / ( max - min ) * 100;
+ }
+
+ if ( isNaN( percent ) ) {
+ return;
+ }
+
+ if ( percent < 0 ) {
+ percent = 0;
+ }
+
+ if ( percent > 100 ) {
+ percent = 100;
+ }
+
+ var newval = ( percent / 100 ) * ( max - min ) + min;
+
+ //from jQuery UI slider, the following source will round to the nearest step
+ var valModStep = ( newval - min ) % step;
+ var alignValue = newval - valModStep;
+
+ if ( Math.abs( valModStep ) * 2 >= step ) {
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
+ }
+ // Since JavaScript has problems with large floats, round
+ // the final value to 5 digits after the decimal point (see jQueryUI: #4124)
+ newval = parseFloat( alignValue.toFixed(5) );
+
+ if ( newval < min ) {
+ newval = min;
+ }
+
+ if ( newval > max ) {
+ newval = max;
+ }
+
+ this.handle.css( "left", percent + "%" );
+ this.handle.attr( {
+ "aria-valuenow": cType === "input" ? newval : control.find( "option" ).eq( newval ).attr( "value" ),
+ "aria-valuetext": cType === "input" ? newval : control.find( "option" ).eq( newval ).getEncodedText(),
+ title: cType === "input" ? newval : control.find( "option" ).eq( newval ).getEncodedText()
+ });
+
+ if( percent === 100 && this.handle.hasClass( "ui-slider-handle-snapping" ) ) {
+ this.handle.removeClass( "ui-toggle-off" );
+ this.handle.addClass( "ui-toggle-on" );
+ } else if ( percent === 0 && this.handle.hasClass( "ui-slider-handle-snapping" ) ) {
+ this.handle.removeClass( "ui-toggle-on" );
+ this.handle.addClass( "ui-toggle-off" );
+ }
+
+ if ( this.valuebg ) {
+ this.valuebg.css( "width", percent + "%" );
+ }
+
+ // drag the label widths
+ if ( this._labels ) {
+ var handlePercent = this.handle.width() / this.slider.width() * 100,
+ aPercent = percent && handlePercent + ( 100 - handlePercent ) * percent / 100,
+ bPercent = percent === 100 ? 0 : Math.min( handlePercent + 100 - aPercent, 100 );
+
+ this._labels.each(function() {
+ var ab = $( this ).is( ".ui-slider-label-a" );
+ $( this ).width( ( ab ? aPercent : bPercent ) + "%" );
+ });
+ }
+
+ if ( !preventInputUpdate ) {
+ var valueChanged = false;
+
+ // update control"s value
+ if ( cType === "input" ) {
+ valueChanged = control.val() !== newval;
+ control.val( newval );
+ } else {
+ valueChanged = control[ 0 ].selectedIndex !== newval;
+ control[ 0 ].selectedIndex = newval;
+ }
+ if ( !isfromControl && valueChanged ) {
+ control.trigger( "change" );
+ }
+ }
+ },
+
+ enable: function() {
+ this.element.attr( "disabled", false );
+ this.slider.removeClass( "ui-disabled" ).attr( "aria-disabled", false );
+ return this._setOption( "disabled", false );
+ },
+
+ disable: function() {
+ this.element.attr( "disabled", true );
+ this.slider.addClass( "ui-disabled" ).attr( "aria-disabled", true );
+ return this._setOption( "disabled", true );
+ }
+
+});
+
+//auto self-init widgets
+$.mobile.$document.bind( "pagecreate create", function( e ) {
+ $.mobile.slider.prototype.enhanceWithin( e.target, true );
+});
+
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");
http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/4ebce38e/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/textinput.js
----------------------------------------------------------------------
diff --git a/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/textinput.js b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/textinput.js
new file mode 100644
index 0000000..db404b8
--- /dev/null
+++ b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/forms/textinput.js
@@ -0,0 +1,158 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Enhances and consistently styles text inputs.
+//>>label: Text Inputs & Textareas
+//>>group: Forms
+//>>css.structure: ../css/structure/jquery.mobile.forms.textinput.css
+//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
+
+define( [ "jquery", "../../jquery.mobile.core", "../../jquery.mobile.widget", "../../jquery.mobile.degradeInputs", "../../jquery.mobile.buttonMarkup", "../../jquery.mobile.zoom" ], function( jQuery ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+
+$.widget( "mobile.textinput", $.mobile.widget, {
+ options: {
+ theme: null,
+ // This option defaults to true on iOS devices.
+ preventFocusZoom: /iPhone|iPad|iPod/.test( navigator.platform ) && navigator.userAgent.indexOf( "AppleWebKit" ) > -1,
+ initSelector: "input[type='text'], input[type='number'], :jqmData(type='number'), input[type='password'], input[type='email'], input[type='url'], input[type='tel'], textarea, input[type='time'], input[type='date'], input[type='month'], input[type='week'], input[type='datetime'], input[type='datetime-local'], input[type='color'], input:not([type])",
+ disabled: false
+ },
+
+ _create: function() {
+
+ var self = this,
+ input = this.element,
+ o = this.options,
+ theme = o.theme || $.mobile.getInheritedTheme( this.element, "c" ),
+ themeclass = " ui-body-" + theme,
+ mini = $.mobile.getAttrFixed( input[0], "data-" + $.mobile.ns + "mini" ) === true,
+ miniclass = mini ? " ui-mini" : "",
+ focusedEl, clearbtn;
+
+ function toggleClear() {
+ setTimeout( function() {
+ clearbtn.toggleClass( "ui-input-clear-hidden", !input.val() );
+ }, 0 );
+ }
+
+ $( "label[for='" + input.attr( "id" ) + "']" ).addClass( "ui-input-text" );
+
+ focusedEl = input.addClass("ui-input-text ui-body-"+ theme );
+
+ switch ( input.attr( "type" ) ) {
+ case "text":
+ case "password":
+ case "number":
+ case "email":
+ case "url":
+ case "tel":
+ input.attr( { "role" : "textbox", "aria-label" : "Keyboard opened" } );
+ break;
+ default:
+ if ( input.prop( "tagName" ).toLowerCase() === "textarea" ) {
+ input.attr( { "role" : "textbox", "aria-label" : "Keyboard opened" } );
+ }
+ }
+
+ // XXX: Temporary workaround for issue 785 (Apple bug 8910589).
+ // Turn off autocorrect and autocomplete on non-iOS 5 devices
+ // since the popup they use can't be dismissed by the user. Note
+ // that we test for the presence of the feature by looking for
+ // the autocorrect property on the input element. We currently
+ // have no test for iOS 5 or newer so we're temporarily using
+ // the touchOverflow support flag for jQM 1.0. Yes, I feel dirty. - jblas
+ if ( typeof input[0].autocorrect !== "undefined" && !$.support.touchOverflow ) {
+ // Set the attribute instead of the property just in case there
+ // is code that attempts to make modifications via HTML.
+ input[0].setAttribute( "autocorrect", "off" );
+ input[0].setAttribute( "autocomplete", "off" );
+ }
+
+ input.focus(function() {
+ focusedEl.addClass( $.mobile.focusClass );
+ })
+ .blur(function() {
+ focusedEl.removeClass( $.mobile.focusClass );
+ })
+ // In many situations, iOS will zoom into the select upon tap, this prevents that from happening
+ .bind( "focus", function() {
+ if ( o.preventFocusZoom ) {
+ $.mobile.zoom.disable( true );
+ }
+ })
+ .bind( "blur", function() {
+ if ( o.preventFocusZoom ) {
+ $.mobile.zoom.enable( true );
+ }
+ });
+
+ // Autogrow
+ if ( input.is( "textarea" ) ) {
+ var extraLineHeight = 15,
+ keyupTimeoutBuffer = 100,
+ keyupTimeout;
+
+ this._keyup = function() {
+ var scrollHeight = input[ 0 ].scrollHeight,
+ clientHeight = input[ 0 ].clientHeight;
+
+ if ( clientHeight < scrollHeight && window.innerHeight / 2 > scrollHeight ) {
+ input.height(scrollHeight + extraLineHeight);
+ }
+ };
+
+ input.keyup(function() {
+ clearTimeout( keyupTimeout );
+ keyupTimeout = setTimeout( self._keyup, keyupTimeoutBuffer );
+ });
+
+ // binding to pagechange here ensures that for pages loaded via
+ // ajax the height is recalculated without user input
+ this._on( $.mobile.$document, {"pagechange": "_keyup" });
+
+ // Issue 509: the browser is not providing scrollHeight properly until the styles load
+ if ( $.trim( input.val() ) ) {
+ // bind to the window load to make sure the height is calculated based on BOTH
+ // the DOM and CSS
+ this._on( $.mobile.$window, {"load": "_keyup"});
+ }
+ }
+ if ( input.attr( "disabled" ) ) {
+ this.disable();
+ }
+ },
+
+ disable: function() {
+ var $el;
+ if ( this.element.attr( "disabled", true ) ) {
+ $el = this.element;
+ } else {
+ return;
+ }
+ $el.addClass( "ui-disabled" );
+ return this._setOption( "disabled", true );
+ },
+
+ enable: function() {
+ var $el;
+
+ // TODO using more than one line of code is acceptable ;)
+ if ( this.element.attr( "disabled", false ) ) {
+ $el = this.element;
+ } else {
+ return;
+ }
+ $el.removeClass( "ui-disabled" );
+ return this._setOption( "disabled", false );
+ }
+});
+
+//auto self-init widgets
+$.mobile.$document.bind( "pagecreate create", function( e ) {
+ $.mobile.textinput.prototype.enhanceWithin( e.target, true );
+});
+
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");
http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/4ebce38e/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/listview.autodividers.js
----------------------------------------------------------------------
diff --git a/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/listview.autodividers.js b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/listview.autodividers.js
new file mode 100644
index 0000000..474945a
--- /dev/null
+++ b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/listview.autodividers.js
@@ -0,0 +1,67 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Generates dividers for listview items
+//>>label: Listview Autodividers
+//>>group: Widgets
+define( [ "jquery", "./listview" ], function( jQuery ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+
+$.mobile.listview.prototype.options.autodividers = false;
+$.mobile.listview.prototype.options.autodividersSelector = function( elt ) {
+ // look for the text in the given element
+ var text = elt.text() || null;
+
+ if ( !text ) {
+ return null;
+ }
+
+ // create the text for the divider (first uppercased letter)
+ text = text.trim().slice( 0, 1 ).toUpperCase();
+
+ return text;
+};
+
+$.mobile.$document.delegate( "ul,ol", "listviewcreate", function() {
+
+ var list = $( this ),
+ listview = list.data( "listview" );
+
+ if ( !listview || !listview.options.autodividers ) {
+ return;
+ }
+
+ var replaceDividers = function () {
+ list.find( "li:jqmData(role='list-divider')" ).remove();
+
+ var lis = list.find( 'li' ),
+ lastDividerText = null, li, dividerText;
+
+ for ( var i = 0; i < lis.length ; i++ ) {
+ li = lis[i];
+ dividerText = listview.options.autodividersSelector( $( li ) );
+
+ if ( dividerText && lastDividerText !== dividerText ) {
+ var divider = document.createElement( 'li' );
+ divider.appendChild( document.createTextNode( dividerText ) );
+ divider.setAttribute( 'data-' + $.mobile.ns + 'role', 'list-divider' );
+ li.parentNode.insertBefore( divider, li );
+ }
+
+ lastDividerText = dividerText;
+ }
+ };
+
+ var afterListviewRefresh = function () {
+ list.unbind( 'listviewafterrefresh', afterListviewRefresh );
+ replaceDividers();
+ listview.refresh();
+ list.bind( 'listviewafterrefresh', afterListviewRefresh );
+ };
+
+ afterListviewRefresh();
+});
+
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");
http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/4ebce38e/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/listview.filter.js
----------------------------------------------------------------------
diff --git a/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/listview.filter.js b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/listview.filter.js
new file mode 100644
index 0000000..1e0cd73
--- /dev/null
+++ b/samples/TizenWebUI-sample-v1/tizen-web-ui-fw/latest/js/modules/jqm/widgets/listview.filter.js
@@ -0,0 +1,126 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Extends the listview to add a search box to filter lists
+//>>label: Listview: Filter
+//>>group: Widgets
+
+
+define( [ "jquery", "./listview", "./forms/textinput" ], function( jQuery ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+
+$.mobile.listview.prototype.options.filter = false;
+$.mobile.listview.prototype.options.filterPlaceholder = "";
+$.mobile.listview.prototype.options.filterTheme = "c";
+// TODO rename callback/deprecate and default to the item itself as the first argument
+var defaultFilterCallback = function( text, searchValue, item ) {
+ return text.toString().toLowerCase().indexOf( searchValue ) === -1;
+ };
+
+$.mobile.listview.prototype.options.filterCallback = defaultFilterCallback;
+
+$.mobile.$document.delegate( ":jqmData(role='listview')", "listviewcreate", function() {
+
+ var list = $( this ),
+ listview = list.data( "listview" );
+
+ if ( !listview.options.filter ) {
+ return;
+ }
+
+ var wrapper = $( "<form>", {
+ "class": "ui-listview-filter ui-bar-" + listview.options.filterTheme,
+ "role": "search"
+ }),
+ search = $( "<input>", {
+ placeholder: listview.options.filterPlaceholder
+ })
+ .attr( "data-" + $.mobile.ns + "type", "search" )
+ .jqmData( "lastval", "" )
+ .bind( "keyup change", function() {
+
+ var $this = $( this ),
+ val = this.value.toLowerCase(),
+ listItems = null,
+ lastval = $this.jqmData( "lastval" ) + "",
+ childItems = false,
+ itemtext = "",
+ item,
+ // Check if a custom filter callback applies
+ isCustomFilterCallback = listview.options.filterCallback !== defaultFilterCallback;
+
+ listview._trigger( "beforefilter", "beforefilter", { input: this } );
+
+ // Change val as lastval for next execution
+ $this.jqmData( "lastval" , val );
+ if ( isCustomFilterCallback || val.length < lastval.length || val.indexOf( lastval ) !== 0 ) {
+
+ // Custom filter callback applies or removed chars or pasted something totally different, check all items
+ listItems = list.children();
+ } else {
+
+ // Only chars added, not removed, only use visible subset
+ listItems = list.children( ":not(.ui-screen-hidden)" );
+ }
+
+ if ( val ) {
+
+ // This handles hiding regular rows without the text we search for
+ // and any list dividers without regular rows shown under it
+
+ for ( var i = listItems.length - 1; i >= 0; i-- ) {
+ item = $( listItems[ i ] );
+ itemtext = $.mobile.getAttrFixed( item[0], "data-" + $.mobile.ns + "filtertext" ) || item.text();
+
+ if ( item.is( "li:jqmData(role=list-divider)" ) ) {
+
+ item.toggleClass( "ui-filter-hidequeue" , !childItems );
+
+ // New bucket!
+ childItems = false;
+
+ } else if ( listview.options.filterCallback( itemtext, val, item ) ) {
+
+ //mark to be hidden
+ item.toggleClass( "ui-filter-hidequeue" , true );
+ } else {
+
+ // There's a shown item in the bucket
+ childItems = true;
+ }
+ }
+
+ // Show items, not marked to be hidden
+ listItems
+ .filter( ":not(.ui-filter-hidequeue)" )
+ .toggleClass( "ui-screen-hidden", false );
+
+ // Hide items, marked to be hidden
+ listItems
+ .filter( ".ui-filter-hidequeue" )
+ .toggleClass( "ui-screen-hidden", true )
+ .toggleClass( "ui-filter-hidequeue", false );
+
+ } else {
+
+ //filtervalue is empty => show all
+ listItems.toggleClass( "ui-screen-hidden", false );
+ }
+ listview._refreshCorners();
+ })
+ .appendTo( wrapper )
+ .textinput();
+
+ if ( listview.options.inset ) {
+ wrapper.addClass( "ui-listview-filter-inset" );
+ }
+
+ wrapper.bind( "submit", function() {
+ return false;
+ })
+ .insertBefore( list );
+});
+
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");