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/08/26 17:33:54 UTC

[20/52] [abbrv] [cordova-tizen] tizen SDK 2.2 support

http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/widgets/popup.js.orig
----------------------------------------------------------------------
diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/widgets/popup.js.orig b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/widgets/popup.js.orig
new file mode 100644
index 0000000..8faa909
--- /dev/null
+++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/widgets/popup.js.orig
@@ -0,0 +1,963 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Popup windows
+//>>label: Popups
+//>>group: Widgets
+//>>css.theme: ../css/themes/default/jquery.mobile.theme.css
+//>>css.structure: ../css/structure/jquery.mobile.popup.css,../css/structure/jquery.mobile.transition.css,../css/structure/jquery.mobile.transition.fade.css
+
+define( [ "jquery",
+	"../jquery.mobile.widget",
+	"../jquery.mobile.support",
+	"../jquery.mobile.navigation",
+	"depend!../jquery.hashchange[jquery]" ], function( $ ) {
+//>>excludeEnd("jqmBuildExclude");
+(function( $, undefined ) {
+
+	function fitSegmentInsideSegment( winSize, segSize, offset, desired ) {
+		var ret = desired;
+
+		if ( winSize < segSize ) {
+			// Center segment if it's bigger than the window
+			ret = offset + ( winSize - segSize ) / 2;
+		} else {
+			// Otherwise center it at the desired coordinate while keeping it completely inside the window
+			ret = Math.min( Math.max( offset, desired - segSize / 2 ), offset + winSize - segSize );
+		}
+
+		return ret;
+	}
+
+	function windowCoords() {
+		var $win = $.mobile.$window;
+
+		return {
+			x: $win.scrollLeft(),
+			y: $win.scrollTop(),
+			cx: ( window.innerWidth || $win.width() ),
+			cy: ( window.innerHeight || $win.height() )
+		};
+	}
+
+	$.widget( "mobile.popup", $.mobile.widget, {
+		options: {
+			theme: null,
+			overlayTheme: null,
+			shadow: true,
+			corners: true,
+			transition: "pop",
+			positionTo: "origin",
+			tolerance: null,
+			initSelector: ":jqmData(role='popup')",
+			closeLinkSelector: "a:jqmData(rel='back')",
+			closeLinkEvents: "click.popup",
+			navigateEvents: "navigate.popup",
+			closeEvents: "navigate.popup pagebeforechange.popup",
+
+			// NOTE Windows Phone 7 has a scroll position caching issue that
+			//      requires us to disable popup history management by default
+			//      https://github.com/jquery/jquery-mobile/issues/4784
+			//
+			// NOTE this option is modified in _create!
+			history: false
+		},
+
+		_eatEventAndClose: function( e ) {
+			e.preventDefault();
+			e.stopImmediatePropagation();
+			this.close();
+			return false;
+		},
+
+		// Make sure the screen size is increased beyond the page height if the popup's causes the document to increase in height
+		_resizeScreen: function() {
+			var popupHeight = this._ui.container.outerHeight( true );
+
+			this._ui.screen.removeAttr( "style" );
+			if ( popupHeight > this._ui.screen.height() ) {
+				this._ui.screen.height( popupHeight );
+			}
+		},
+
+		_handleWindowKeyUp: function( e ) {
+			if ( this._isOpen && e.keyCode === $.mobile.keyCode.ESCAPE ) {
+				return this._eatEventAndClose( e );
+			}
+		},
+
+		_maybeRefreshTimeout: function() {
+			var winCoords = windowCoords();
+
+			if ( this._resizeData ) {
+				if ( winCoords.x === this._resizeData.winCoords.x &&
+					winCoords.y === this._resizeData.winCoords.y &&
+					winCoords.cx === this._resizeData.winCoords.cx &&
+					winCoords.cy === this._resizeData.winCoords.cy ) {
+					// timeout not refreshed
+					return false;
+				} else {
+					// clear existing timeout - it will be refreshed below
+					clearTimeout( this._resizeData.timeoutId );
+				}
+			}
+
+			this._resizeData = {
+				timeoutId: setTimeout( $.proxy( this, "_resizeTimeout" ), 200 ),
+				winCoords: winCoords
+			};
+
+			return true;
+		},
+
+		_resizeTimeout: function() {
+			if ( !this._maybeRefreshTimeout() && this.positionTo === "window" ) {
+				// effectively rapid-open the popup while leaving the screen intact
+				this._trigger( "beforeposition" );
+				this._ui.container
+					.removeClass( "ui-selectmenu-hidden" )
+					.offset( this._placementCoords( this._desiredCoords( undefined, undefined, "window" ) ) );
+
+				this._resizeScreen();
+				this._resizeData = null;
+				this._orientationchangeInProgress = false;
+			}
+		},
+
+		_handleWindowResize: function( e ) {
+			if ( this._isOpen ) {
+				// Context popup close when Window resize event
+				if( this.positionTo !== "window" ) {
+					this.close();
+					return false;
+				}
+				this._maybeRefreshTimeout();
+			}
+		},
+
+		_handleWindowOrientationchange: function( e ) {
+
+			if ( !this._orientationchangeInProgress ) {
+				// effectively rapid-close the popup while leaving the screen intact
+				this._ui.container
+					.addClass( "ui-selectmenu-hidden" )
+					.removeAttr( "style" );
+
+				this._orientationchangeInProgress = true;
+			}
+		},
+
+		_create: function() {
+			var ui = {
+					screen: $( "<div class='ui-screen-hidden ui-popup-screen'></div>" ),
+					placeholder: $( "<div style='display: none;'><!-- placeholder --></div>" ),
+					container: $( "<div class='ui-popup-container ui-selectmenu-hidden'></div>" ),
+					arrow : $("<div class='ui-arrow'></div>")
+				},
+				thisPage = this.element.closest( ".ui-page" ),
+				myId = this.element.attr( "id" ),
+				self = this;
+
+			// We need to adjust the history option to be false if there's no AJAX nav.
+			// We can't do it in the option declarations because those are run before
+			// it is determined whether there shall be AJAX nav.
+			this.options.history = this.options.history && $.mobile.ajaxEnabled && $.mobile.hashListeningEnabled;
+
+			if ( thisPage.length === 0 ) {
+				thisPage = $( "body" );
+			}
+
+			// define the container for navigation event bindings
+			// TODO this would be nice at the the mobile widget level
+			this.options.container = this.options.container || $.mobile.pageContainer;
+
+			// Apply the proto
+			thisPage.append( ui.screen );
+			ui.container.insertAfter( ui.screen );
+			// Leave a placeholder where the element used to be
+			ui.placeholder.insertAfter( this.element );
+			if ( myId ) {
+				ui.screen.attr( "id", myId + "-screen" );
+				ui.container.attr( "id", myId + "-popup" );
+				ui.placeholder.html( "<!-- placeholder for " + myId + " -->" );
+			}
+			ui.container.append( this.element );
+			ui.container.append( ui.arrow );
+			// Add class to popup element
+			this.element.addClass( "ui-popup" );
+
+			// Define instance variables
+			$.extend( this, {
+				_page: thisPage,
+				_ui: ui,
+				_fallbackTransition: "",
+				_currentTransition: false,
+				_prereqs: null,
+				_isOpen: false,
+				_tolerance: null,
+				_resizeData: null,
+				_orientationchangeInProgress: false,
+				_globalHandlers: [
+					{
+						src: $.mobile.$window,
+						handler: {
+							orientationchange: $.proxy( this, "_handleWindowOrientationchange" ),
+							resize: $.proxy( this, "_handleWindowResize" ),
+							keyup: $.proxy( this, "_handleWindowKeyUp" )
+						}
+					}
+				]
+			});
+
+			$.each( this.options, function( key, value ) {
+				// Cause initial options to be applied by their handler by temporarily setting the option to undefined
+				// - the handler then sets it to the initial value
+				self.options[ key ] = undefined;
+				self._setOption( key, value, true );
+			});
+
+			ui.screen.bind( "vclick", $.proxy( this, "_eatEventAndClose" ) );
+
+			$.each( this._globalHandlers, function( idx, value ) {
+				value.src.bind( value.handler );
+			});
+		},
+
+		_applyTheme: function( dst, theme, prefix ) {
+			var classes = ( dst.attr( "class" ) || "").split( " " ),
+				alreadyAdded = true,
+				currentTheme = null,
+				matches,
+				themeStr = String( theme );
+
+			while ( classes.length > 0 ) {
+				currentTheme = classes.pop();
+				matches = ( new RegExp( "^ui-" + prefix + "-([a-z])$" ) ).exec( currentTheme );
+				if ( matches && matches.length > 1 ) {
+					currentTheme = matches[ 1 ];
+					break;
+				} else {
+					currentTheme = null;
+				}
+			}
+
+			if ( theme !== currentTheme ) {
+				dst.removeClass( "ui-" + prefix + "-" + currentTheme );
+				if ( ! ( theme === null || theme === "none" ) ) {
+					dst.addClass( "ui-" + prefix + "-" + themeStr );
+				}
+			}
+		},
+
+		_setTheme: function( value ) {
+			this._applyTheme( this.element, value, "body" );
+		},
+
+		_setOverlayTheme: function( value ) {
+			this._applyTheme( this._ui.screen, value, "overlay" );
+
+			if ( this._isOpen ) {
+				this._ui.screen.addClass( "in" );
+			}
+		},
+
+		_setShadow: function( value ) {
+			this.element.toggleClass( "ui-overlay-shadow", value );
+		},
+
+		_setCorners: function( value ) {
+			this.element.toggleClass( "ui-corner-all", value );
+		},
+
+		_applyTransition: function( value ) {
+			this._ui.container.removeClass( this._fallbackTransition );
+			if ( value && value !== "none" ) {
+				this._fallbackTransition = $.mobile._maybeDegradeTransition( value );
+				this._ui.container.addClass( this._fallbackTransition );
+			}
+		},
+
+		_setTransition: function( value ) {
+			if ( !this._currentTransition ) {
+				this._applyTransition( value );
+			}
+		},
+
+		_setTolerance: function( value ) {
+			var tol = { t: 5, r: 5, b: 5, l: 5 };
+
+			if ( value ) {
+				var ar = String( value ).split( "," );
+
+				$.each( ar, function( idx, val ) { ar[ idx ] = parseInt( val, 10 ); } );
+
+				switch( ar.length ) {
+					// All values are to be the same
+					case 1:
+						if ( !isNaN( ar[ 0 ] ) ) {
+							tol.t = tol.r = tol.b = tol.l = ar[ 0 ];
+						}
+						break;
+
+					// The first value denotes top/bottom tolerance, and the second value denotes left/right tolerance
+					case 2:
+						if ( !isNaN( ar[ 0 ] ) ) {
+							tol.t = tol.b = ar[ 0 ];
+						}
+						if ( !isNaN( ar[ 1 ] ) ) {
+							tol.l = tol.r = ar[ 1 ];
+						}
+						break;
+
+					// The array contains values in the order top, right, bottom, left
+					case 4:
+						if ( !isNaN( ar[ 0 ] ) ) {
+							tol.t = ar[ 0 ];
+						}
+						if ( !isNaN( ar[ 1 ] ) ) {
+							tol.r = ar[ 1 ];
+						}
+						if ( !isNaN( ar[ 2 ] ) ) {
+							tol.b = ar[ 2 ];
+						}
+						if ( !isNaN( ar[ 3 ] ) ) {
+							tol.l = ar[ 3 ];
+						}
+						break;
+
+					default:
+						break;
+				}
+			}
+
+			this._tolerance = tol;
+		},
+
+		_setOption: function( key, value ) {
+			var exclusions, setter = "_set" + key.charAt( 0 ).toUpperCase() + key.slice( 1 );
+
+			if ( this[ setter ] !== undefined ) {
+				this[ setter ]( value );
+			}
+
+			// TODO REMOVE FOR 1.2.1 by moving them out to a default options object
+			exclusions = [
+				"initSelector",
+				"closeLinkSelector",
+				"closeLinkEvents",
+				"navigateEvents",
+				"closeEvents",
+				"history",
+				"container"
+			];
+
+			$.mobile.widget.prototype._setOption.apply( this, arguments );
+			if ( $.inArray( key, exclusions ) === -1 ) {
+				// Record the option change in the options and in the DOM data-* attributes
+				this.element.attr( "data-" + ( $.mobile.ns || "" ) + ( key.replace( /([A-Z])/, "-$1" ).toLowerCase() ), value );
+			}
+		},
+
+		// Try and center the overlay over the given coordinates
+		_placementCoords: function( desired ) {
+			// rectangle within which the popup must fit
+			var
+				winCoords = windowCoords(),
+				rc = {
+					x: this._tolerance.l,
+					y: winCoords.y + this._tolerance.t,
+					cx: winCoords.cx - this._tolerance.l - this._tolerance.r,
+					cy: winCoords.cy - this._tolerance.t - this._tolerance.b
+				},
+				menuSize, ret,
+				linkOffset = $(this.link).offset(),
+				positionOffsets = [],
+				correctionValue = [0,0],
+				arrayIdx;
+
+			// Clamp the width of the menu before grabbing its size
+			this._ui.container.css( "max-width", rc.cx );
+			menuSize = {
+				cx: this._ui.container.outerWidth( true ),
+				cy: this._ui.container.outerHeight( true )
+			};
+
+			// Center the menu over the desired coordinates, while not going outside
+			// the window tolerances. This will center wrt. the window if the popup is too large.
+			ret = {
+				x: fitSegmentInsideSegment( rc.cx, menuSize.cx, rc.x, desired.x ),
+				y: fitSegmentInsideSegment( rc.cy, menuSize.cy, rc.y, desired.y )
+			};
+
+			// Make sure the top of the menu is visible
+			ret.y = Math.max( 0, ret.y );
+
+			// If the height of the menu is smaller than the height of the document
+			// align the bottom with the bottom of the document
+
+			// fix for $( document ).height() bug in core 1.7.2.
+			var docEl = document.documentElement, docBody = document.body,
+				docHeight = Math.max( docEl.clientHeight, docBody.scrollHeight, docBody.offsetHeight, docEl.scrollHeight, docEl.offsetHeight );
+
+			ret.y -= Math.min( ret.y, Math.max( 0, ret.y + menuSize.cy - docHeight ) );
+
+			if ( this.positionTo !== "origin" )
+			{
+				return { left: ret.x, top: ret.y , arrowleft: 0 , arrowtop: 0};
+			}
+
+			positionOffsets = [ linkOffset.left,
+								linkOffset.top,
+								docEl.clientHeight - ( linkOffset.top + $(this.link).height() ),
+								docEl.clientWidth - ( linkOffset.left + $(this.link).width() )];
+			arrayIdx = positionOffsets.indexOf(Math.max.apply(window,positionOffsets));
+
+			switch( arrayIdx )
+			{
+				case 0:
+					correctionValue = [ -$(this.link).width() , 0];
+					arrowtop = ( linkOffset.top - ret.y  ) + ( $(this.link).height() / 2 ) - parseInt( $(this._ui.arrow).css("border-width") ) ;
+					arrowleft = menuSize.cx;
+					$(this._ui.arrow).attr( "class", "" )
+									.addClass( "ui-arrow left" )
+					break;
+				case 1:
+					correctionValue = [ 0 , -(ret.y + menuSize.cy - linkOffset.top)];
+					arrowtop = menuSize.cy - 2;
+					arrowleft = (linkOffset.left - ret.x + correctionValue[0]) + ( $(this.link).width() / 2 ) - parseInt( $(this._ui.arrow).css("border-width") ) / 2;
+					$(this._ui.arrow).attr( "class", "" )
+									.addClass( "ui-arrow bottom" );
+					break;
+				case 2:
+					correctionValue = [ 0 , ( linkOffset.top + $(this.link).height() - ret.y ) ];
+					arrowtop = - parseInt( $(this._ui.arrow).css("border-width") ) * 2 + 1;
+					arrowleft = (linkOffset.left - ret.x + correctionValue[0]) + ( $(this.link).width() / 2 ) - parseInt( $(this._ui.arrow).css("border-width") ) / 2;
+					$(this._ui.arrow).attr( "class", "" )
+									.addClass("ui-arrow top");
+					break;
+				case 3:
+					correctionValue = [ ( menuSize.cx < $(this.link).width() ) ? ( $(this.link).width() / 2 ) + ( menuSize.cx / 2) : $(this.link).width() , 0];
+					arrowtop = ( linkOffset.top - ret.y  ) + ( $(this.link).height() / 2 ) - parseInt( $(this._ui.arrow).css("border-width") ) ;
+					arrowleft = - parseInt( $(this._ui.arrow).css("border-width") ) * 2;
+					$(this._ui.arrow).attr( "class", "" )
+									.addClass("ui-arrow right");
+					break;
+			}
+
+			return { left: ret.x + correctionValue[0], top: ret.y + correctionValue[1] , arrowleft: arrowleft , arrowtop: arrowtop };
+		},
+
+		_createPrereqs: function( screenPrereq, containerPrereq, whenDone ) {
+			var self = this, prereqs;
+
+			// It is important to maintain both the local variable prereqs and self._prereqs. The local variable remains in
+			// the closure of the functions which call the callbacks passed in. The comparison between the local variable and
+			// self._prereqs is necessary, because once a function has been passed to .animationComplete() it will be called
+			// next time an animation completes, even if that's not the animation whose end the function was supposed to catch
+			// (for example, if an abort happens during the opening animation, the .animationComplete handler is not called for
+			// that animation anymore, but the handler remains attached, so it is called the next time the popup is opened
+			// - making it stale. Comparing the local variable prereqs to the widget-level variable self._prereqs ensures that
+			// callbacks triggered by a stale .animationComplete will be ignored.
+
+			prereqs = {
+				screen: $.Deferred(),
+				container: $.Deferred()
+			};
+
+			prereqs.screen.then( function() {
+				if ( prereqs === self._prereqs ) {
+					screenPrereq();
+				}
+			});
+
+			prereqs.container.then( function() {
+				if ( prereqs === self._prereqs ) {
+					containerPrereq();
+				}
+			});
+
+			$.when( prereqs.screen, prereqs.container ).done( function() {
+				if ( prereqs === self._prereqs ) {
+					self._prereqs = null;
+					whenDone();
+				}
+			});
+
+			self._prereqs = prereqs;
+		},
+
+		_animate: function( args ) {
+			// NOTE before removing the default animation of the screen
+			//      this had an animate callback that would relove the deferred
+			//      now the deferred is resolved immediately
+			// TODO remove the dependency on the screen deferred
+			this._ui.screen
+				.removeClass( args.classToRemove )
+				.addClass( args.screenClassToAdd );
+
+			args.prereqs.screen.resolve();
+
+			if ( args.transition && args.transition !== "none" ) {
+				if ( args.applyTransition ) {
+					this._applyTransition( args.transition );
+				}
+				this._ui.container
+					.animationComplete( $.proxy( args.prereqs.container, "resolve" ) )
+					.addClass( args.containerClassToAdd )
+					.removeClass( args.classToRemove );
+			} else {
+				this._ui.container.removeClass( args.classToRemove );
+				args.prereqs.container.resolve();
+			}
+		},
+
+		// The desired coordinates passed in will be returned untouched if no reference element can be identified via
+		// desiredPosition.positionTo. Nevertheless, this function ensures that its return value always contains valid
+		// x and y coordinates by specifying the center middle of the window if the coordinates are absent.
+		_desiredCoords: function( x, y, positionTo ) {
+			var dst = null, offset, winCoords = windowCoords();
+
+			self.positionTo = positionTo;
+
+			// Establish which element will serve as the reference
+			if ( positionTo && positionTo !== "origin" ) {
+				if ( positionTo === "window" ) {
+					x = winCoords.cx / 2 + winCoords.x;
+					y = winCoords.cy / 2 + winCoords.y;
+				} else {
+					try {
+						dst = $( positionTo );
+					} catch( e ) {
+						dst = null;
+					}
+					if ( dst ) {
+						dst.filter( ":visible" );
+						if ( dst.length === 0 ) {
+							dst = null;
+						}
+					}
+				}
+			}
+
+			// If an element was found, center over it
+			if ( dst ) {
+				offset = dst.offset();
+				x = offset.left + dst.outerWidth() / 2;
+				y = offset.top + dst.outerHeight() / 2;
+			}
+
+			// Make sure x and y are valid numbers - center over the window
+			if ( $.type( x ) !== "number" || isNaN( x ) ) {
+				x = winCoords.cx / 2 + winCoords.x;
+			}
+			if ( $.type( y ) !== "number" || isNaN( y ) ) {
+				y = winCoords.cy / 2 + winCoords.y;
+			}
+
+			return { x: x, y: y };
+		},
+
+		_reposition: function() {
+			var self = this,
+					coords;
+
+			if( self._isOpen
+				&& self.link
+				&& self.positionTo !== "window") {
+					coords = self._placementCoords( self._desiredCoords( $(self.link).offset().left + $(self.link).outerWidth() /2 , $(self.link).offset().top + $(self.link).outerHeight() /2 , self.positionTo || self.options.positionTo || "origin" ) );
+					self._ui.container
+						.offset( { top : coords.top } );
+			}
+		},
+
+		_openPrereqsComplete: function() {
+			var self = this;
+
+			self._ui.container.addClass( "ui-popup-active" );
+			self._isOpen = true;
+			self._resizeScreen();
+
+			// Android appears to trigger the animation complete before the popup
+			// is visible. Allowing the stack to unwind before applying focus prevents
+			// the "blue flash" of element focus in android 4.0
+			setTimeout(function(){
+				self._ui.container.attr( "tabindex", "0" ).focus();
+				self._trigger( "afteropen" );
+				self._reposition();
+			});
+		},
+
+		_open: function( options ) {
+			var coords, transition,
+				androidBlacklist = ( function() {
+					var w = window,
+						ua = navigator.userAgent,
+						// Rendering engine is Webkit, and capture major version
+						wkmatch = ua.match( /AppleWebKit\/([0-9\.]+)/ ),
+						wkversion = !!wkmatch && wkmatch[ 1 ],
+						androidmatch = ua.match( /Android (\d+(?:\.\d+))/ ),
+						andversion = !!androidmatch && androidmatch[ 1 ],
+						chromematch = ua.indexOf( "Chrome" ) > -1;
+
+					// Platform is Android, WebKit version is greater than 534.13 ( Android 3.2.1 ) and not Chrome.
+					if( androidmatch !== null && andversion === "4.0" && wkversion && wkversion > 534.13 && !chromematch ) {
+						return true;
+					}
+					return false;
+				}());
+
+			// Make sure options is defined
+			options = ( options || {} );
+
+			// Copy out the transition, because we may be overwriting it later and we don't want to pass that change back to the caller
+			transition = options.transition || this.options.transition;
+
+			// Give applications a chance to modify the contents of the container before it appears
+			this._trigger( "beforeposition" );
+
+			coords = this._placementCoords( this._desiredCoords( options.x, options.y, options.positionTo || this.options.positionTo || "origin" ) );
+
+			// Count down to triggering "popupafteropen" - we have two prerequisites:
+			// 1. The popup window animation completes (container())
+			// 2. The screen opacity animation completes (screen())
+			this._createPrereqs(
+				$.noop,
+				$.noop,
+				$.proxy( this, "_openPrereqsComplete" ) );
+
+			if ( transition ) {
+				this._currentTransition = transition;
+				this._applyTransition( transition );
+			} else {
+				transition = this.options.transition;
+			}
+
+			if ( !this.options.theme ) {
+				this._setTheme( this._page.jqmData( "theme" ) || $.mobile.getInheritedTheme( this._page, "c" ) );
+			}
+
+			this._ui.screen.removeClass( "ui-screen-hidden" );
+
+			this._ui.container
+				.removeClass( "ui-selectmenu-hidden" )
+				.offset( coords );
+			this._ui.arrow.css( { top : coords.arrowtop, left : coords.arrowleft } );
+			if ( this.options.overlayTheme && androidBlacklist ) {
+				/* TODO:
+				The native browser on Android 4.0.X ("Ice Cream Sandwich") suffers from an issue where the popup overlay appears to be z-indexed
+				above the popup itself when certain other styles exist on the same page -- namely, any element set to `position: fixed` and certain
+				types of input. These issues are reminiscent of previously uncovered bugs in older versions of Android's native browser:
+				https://github.com/scottjehl/Device-Bugs/issues/3
+
+				This fix closes the following bugs ( I use "closes" with reluctance, and stress that this issue should be revisited as soon as possible ):
+
+				https://github.com/jquery/jquery-mobile/issues/4816
+				https://github.com/jquery/jquery-mobile/issues/4844
+				https://github.com/jquery/jquery-mobile/issues/4874
+				*/
+
+				// TODO sort out why this._page isn't working
+				this.element.closest( ".ui-page" ).addClass( "ui-popup-open" );
+			}
+			this._animate({
+				additionalCondition: true,
+				transition: transition,
+				classToRemove: "",
+				screenClassToAdd: "in",
+				containerClassToAdd: "in",
+				applyTransition: false,
+				prereqs: this._prereqs
+			});
+		},
+
+		_closePrereqScreen: function() {
+			this._ui.screen
+				.removeClass( "out" )
+				.addClass( "ui-screen-hidden" );
+		},
+
+		_closePrereqContainer: function() {
+			this._ui.container
+				.removeClass( "reverse out" )
+				.addClass( "ui-selectmenu-hidden" )
+				.removeAttr( "style" );
+		},
+
+		_closePrereqsDone: function() {
+			var self = this, opts = self.options;
+
+			self._ui.container.removeAttr( "tabindex" );
+
+			// remove nav bindings if they are still present
+			opts.container.unbind( opts.closeEvents );
+
+			// unbind click handlers added when history is disabled
+			self.element.undelegate( opts.closeLinkSelector, opts.closeLinkEvents );
+
+			// remove the global mutex for popups
+			$.mobile.popup.active = undefined;
+
+			// alert users that the popup is closed
+			self._trigger( "afterclose" );
+		},
+
+		_close: function( immediate ) {
+			this._ui.container.removeClass( "ui-popup-active" );
+			this._page.removeClass( "ui-popup-open" );
+
+			this._isOpen = false;
+
+			// IME hide when popup is closed
+			this.element.find("input").blur();
+
+			// Count down to triggering "popupafterclose" - we have two prerequisites:
+			// 1. The popup window reverse animation completes (container())
+			// 2. The screen opacity animation completes (screen())
+			this._createPrereqs(
+				$.proxy( this, "_closePrereqScreen" ),
+				$.proxy( this, "_closePrereqContainer" ),
+				$.proxy( this, "_closePrereqsDone" ) );
+
+			this._animate( {
+				additionalCondition: this._ui.screen.hasClass( "in" ),
+				transition: ( immediate ? "none" : ( this._currentTransition || this.options.transition ) ),
+				classToRemove: "in",
+				screenClassToAdd: "out",
+				containerClassToAdd: "reverse out",
+				applyTransition: true,
+				prereqs: this._prereqs
+			});
+		},
+
+		_destroy: function() {
+			var self = this;
+
+			// hide and remove bindings
+			self._close();
+
+			// Put the element back to where the placeholder was and remove the "ui-popup" class
+			self._setTheme( "none" );
+			self.element
+				.insertAfter( self._ui.placeholder )
+				.removeClass( "ui-popup ui-overlay-shadow ui-corner-all" );
+			self._ui.screen.remove();
+			self._ui.container.remove();
+			self._ui.placeholder.remove();
+
+			// Unbind handlers that were bound to elements outside self.element (the window, in self case)
+			$.each( self._globalHandlers, function( idx, oneSrc ) {
+				$.each( oneSrc.handler, function( eventType, handler ) {
+					oneSrc.src.unbind( eventType, handler );
+				});
+			});
+		},
+
+		_closePopup: function( e, data ) {
+			var parsedDst, toUrl;
+
+			if ( e.type === "pagebeforechange" && data ) {
+				if ( typeof data.toPage === "string" ) {
+					parsedDst = data.toPage;
+				} else {
+				parsedDst = data.toPage.jqmData( "url" );
+				}
+				parsedDst = $.mobile.path.parseUrl( parsedDst );
+				toUrl = parsedDst.pathname + parsedDst.search + parsedDst.hash;
+
+				if ( this._myUrl !== toUrl ) {
+					this.options.container.unbind( this.options.closeEvents );
+					this._close( true );
+				} else {
+					this._close();
+				}
+				return;	// skip normal close
+			}
+
+			this._close();
+		},
+
+		// any navigation event after a popup is opened should close the popup
+		// NOTE the pagebeforechange is bound to catch navigation events that don't
+		//      alter the url (eg, dialogs from popups)
+		_bindContainerClose: function() {
+			var self = this;
+
+			self.options.container
+				.one( self.options.closeEvents, $.proxy( self, "_closePopup" ) );
+		},
+
+		// TODO no clear deliniation of what should be here and
+		// what should be in _open. Seems to be "visual" vs "history" for now
+		open: function( options ) {
+			var self = this, opts = this.options, url, hashkey, activePage, currentIsDialog, hasHash, urlHistory;
+			// self.link = ( $(event.target).attr('data-role') === 'button') ? event.target : $(event.target).closest('[data-role="button"]')[0];
+			// make sure open is idempotent
+			if( $.mobile.popup.active ) {
+				return;
+			}
+			// set the global popup mutex
+			$.mobile.popup.active = this;
+			if( !options ) {
+				options = [];
+			}
+
+			if ( !options.link ) {
+				if ( !event ) {
+					self.positionTo = "window";
+				} else {
+					self.link = ( $(event.target).closest('a')[0] || $(event.target).closest('div')[0] );
+				}
+			} else {
+				self.link = options.link;
+			}
+			if ( event ) {
+				self.positionTo = ( options != null && options.positionTo != null ) ? options.positionTo : "origin";
+			}
+
+			if ( $(self.link).jqmData("position-to") !== "window"
+					&& self.positionTo !== "window" ) {
+
+				$(self.element).addClass("ui-ctxpopup");
+				$(self._ui.container).removeClass("ui-popup-container")
+					.addClass("ui-ctxpopup-container");
+
+				if( self.positionTo !== "origin" ) {
+					$(self._ui.arrow).hide();
+				} else {
+					$(self._ui.arrow).show();
+				}
+			} else {
+				$(self._ui.arrow).hide();
+				// apply opacity back screen
+				this._setOverlayTheme( "dim" );
+			}
+			if( !options.x
+				&& self.positionTo === "origin" ) {
+				options.x = $(self.link).offset().left + $(self.link).outerWidth() / 2;
+			}
+			if( !options.y
+				&& self.positionTo === "origin" ) {
+				options.y = $(self.link).offset().top + $(self.link).outerHeight() / 2;
+			}
+			// if history alteration is disabled close on navigate events
+			// and leave the url as is
+			if( !( opts.history ) ) {
+				self._open( options );
+				self._bindContainerClose();
+
+				// When histoy is disabled we have to grab the data-rel
+				// back link clicks so we can close the popup instead of
+				// relying on history to do it for us
+				self.element
+					.delegate( opts.closeLinkSelector, opts.closeLinkEvents, function( e ) {
+						self._close();
+
+						// NOTE prevent the browser and navigation handlers from
+						// working with the link's rel=back. This may cause
+						// issues for developers expecting the event to bubble
+						return false;
+					});
+
+				return;
+			}
+
+			// cache some values for min/readability
+			hashkey = $.mobile.dialogHashKey;
+			activePage = $.mobile.activePage;
+			currentIsDialog = activePage.is( ".ui-dialog" );
+			// Set active page url
+			this._myUrl = url = urlHistory.getActive().url;
+			//
+			url = $.mobile.urlHistory.getActive().url;
+			hasHash = ( url.indexOf( hashkey ) > -1 ) && !currentIsDialog;
+			urlHistory = $.mobile.urlHistory;
+
+			if ( hasHash ) {
+				self._open( options );
+				self._bindContainerClose();
+				return;
+			}
+
+			// if the current url has no dialog hash key proceed as normal
+			// otherwise, if the page is a dialog simply tack on the hash key
+			if ( url.indexOf( hashkey ) === -1 && !currentIsDialog ){
+				url = url + hashkey;
+			} else {
+				url = $.mobile.path.parseLocation().hash + hashkey;
+			}
+
+			// Tack on an extra hashkey if this is the first page and we've just reconstructed the initial hash
+			if ( urlHistory.activeIndex === 0 && url === urlHistory.initialDst ) {
+				url += hashkey;
+			}
+
+			// swallow the the initial navigation event, and bind for the next
+			opts.container.one( opts.navigateEvents, function( e ) {
+				e.preventDefault();
+				self._open( options );
+				self._bindContainerClose();
+			});
+
+			urlHistory.ignoreNextHashChange = currentIsDialog;
+
+			// Gotta love methods with 1mm args :(
+			urlHistory.addNew( url, undefined, undefined, undefined, "dialog" );
+
+			// set the new url with (or without) the new dialog hash key
+			$.mobile.path.set( url );
+		},
+
+		close: function() {
+			// make sure close is idempotent
+			if( !$.mobile.popup.active ){
+				return;
+			}
+
+			if( this.options.history ) {
+				$.mobile.back();
+			} else {
+				this._close();
+			}
+		}
+	});
+
+
+	// TODO this can be moved inside the widget
+	$.mobile.popup.handleLink = function( $link ) {
+		var closestPage = $link.closest( ":jqmData(role='page')" ),
+			scope = ( ( closestPage.length === 0 ) ? $( "body" ) : closestPage ),
+			// NOTE make sure to get only the hash, ie7 (wp7) return the absolute href
+			//      in this case ruining the element selection
+			popup = $( $.mobile.path.parseUrl($link.attr( "href" )).hash, scope[0] ),
+			offset;
+
+		if ( popup.data( "popup" ) ) {
+			offset = $link.offset();
+			popup.popup( "open", {
+				x: offset.left + $link.outerWidth() / 2,
+				y: offset.top + $link.outerHeight() / 2,
+				transition: $.mobile.getAttrFixed( $link[0], "data-" + $.mobile.ns + "transition" ),
+				positionTo: $.mobile.getAttrFixed( $link[0], "data-" + $.mobile.ns + "position-to" ),
+				link: $link
+			});
+		}
+
+		//remove after delay
+		setTimeout( function() {
+			$link.removeClass( $.mobile.activeBtnClass );
+		}, 300 );
+	};
+
+	// TODO move inside _create
+	$.mobile.$document.bind( "pagebeforechange", function( e, data ) {
+		if ( data.options.role === "popup" ) {
+			$.mobile.popup.handleLink( data.options.link );
+			e.preventDefault();
+		}
+	});
+
+	//delegate self-init widgets
+	$.delegateSelfInitWithSingleSelector( $.mobile.popup, true );
+
+})( jQuery );
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+});
+//>>excludeEnd("jqmBuildExclude");

http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.clrlib.js
----------------------------------------------------------------------
diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.clrlib.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.clrlib.js
new file mode 100644
index 0000000..057fb0f
--- /dev/null
+++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.clrlib.js
@@ -0,0 +1,230 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Color code converter
+//>>label: Color library
+//>>group: Tizen:Core
+
+define( [ 
+	'jquery',
+	'./util/ensurens',
+	'jqm/jquery.mobile.core',
+	'./jquery.mobile.tizen.core'
+	], function ( jQuery ) {
+
+//>>excludeEnd("jqmBuildExclude");
+
+ensureNS("jQuery.mobile.tizen.clrlib");
+
+jQuery.extend( jQuery.mobile.tizen.clrlib, 
+{
+    nearestInt: function(val) { 
+        var theFloor = Math.floor(val);
+
+        return (((val - theFloor) > 0.5) ? (theFloor + 1) : theFloor);
+    },
+
+    /*
+     * Converts html color string to rgb array.
+     *
+     * Input: string clr_str, where
+     * clr_str is of the form "#aabbcc"
+     *
+     * Returns: [ r, g, b ], where
+     * r is in [0, 1]
+     * g is in [0, 1]
+     * b is in [0, 1]
+     */
+    HTMLToRGB: function(clr_str) {
+        clr_str = (('#' == clr_str.charAt(0)) ? clr_str.substring(1) : clr_str);
+
+        return ([
+            clr_str.substring(0, 2),
+            clr_str.substring(2, 4),
+            clr_str.substring(4, 6)
+            ].map(function(val) {
+                return parseInt(val, 16) / 255.0;
+            }));
+    },
+
+    /*
+     * Converts rgb array to html color string.
+     *
+     * Input: [ r, g, b ], where
+     * r is in [0, 1]
+     * g is in [0, 1]
+     * b is in [0, 1]
+     *
+     * Returns: string of the form "#aabbcc"
+     */
+    RGBToHTML: function(rgb) {
+        return ("#" + 
+            rgb.map(function(val) {
+                      var ret = val * 255,
+                          theFloor = Math.floor(ret);
+
+                      ret = ((ret - theFloor > 0.5) ? (theFloor + 1) : theFloor);
+                      ret = (((ret < 16) ? "0" : "") + (ret & 0xff).toString(16));
+                      return ret;
+                  })
+               .join(""));
+    },
+
+    /*
+     * Converts hsl to rgb.
+     *
+     * From http://130.113.54.154/~monger/hsl-rgb.html
+     *
+     * Input: [ h, s, l ], where
+     * h is in [0, 360]
+     * s is in [0,   1]
+     * l is in [0,   1]
+     *
+     * Returns: [ r, g, b ], where
+     * r is in [0, 1]
+     * g is in [0, 1]
+     * b is in [0, 1]
+     */
+    HSLToRGB: function(hsl) {
+        var h = hsl[0] / 360.0, s = hsl[1], l = hsl[2];
+
+        if (0 === s)
+            return [ l, l, l ];
+
+        var temp2 = ((l < 0.5)
+                ? l * (1.0 + s)
+                : l + s - l * s),
+            temp1 = 2.0 * l - temp2,
+            temp3 = {
+                r: h + 1.0 / 3.0,
+                g: h,
+                b: h - 1.0 / 3.0
+            };
+
+        temp3.r = ((temp3.r < 0) ? (temp3.r + 1.0) : ((temp3.r > 1) ? (temp3.r - 1.0) : temp3.r));
+        temp3.g = ((temp3.g < 0) ? (temp3.g + 1.0) : ((temp3.g > 1) ? (temp3.g - 1.0) : temp3.g));
+        temp3.b = ((temp3.b < 0) ? (temp3.b + 1.0) : ((temp3.b > 1) ? (temp3.b - 1.0) : temp3.b));
+
+        ret = [
+            (((6.0 * temp3.r) < 1) ? (temp1 + (temp2 - temp1) * 6.0 * temp3.r) :
+            (((2.0 * temp3.r) < 1) ? temp2 :
+            (((3.0 * temp3.r) < 2) ? (temp1 + (temp2 - temp1) * ((2.0 / 3.0) - temp3.r) * 6.0) :
+             temp1))),
+            (((6.0 * temp3.g) < 1) ? (temp1 + (temp2 - temp1) * 6.0 * temp3.g) :
+            (((2.0 * temp3.g) < 1) ? temp2 :
+            (((3.0 * temp3.g) < 2) ? (temp1 + (temp2 - temp1) * ((2.0 / 3.0) - temp3.g) * 6.0) :
+             temp1))),
+            (((6.0 * temp3.b) < 1) ? (temp1 + (temp2 - temp1) * 6.0 * temp3.b) :
+            (((2.0 * temp3.b) < 1) ? temp2 :
+            (((3.0 * temp3.b) < 2) ? (temp1 + (temp2 - temp1) * ((2.0 / 3.0) - temp3.b) * 6.0) :
+             temp1)))]; 
+
+        return ret;
+    },
+
+    /*
+     * Converts hsv to rgb.
+     *
+     * Input: [ h, s, v ], where
+     * h is in [0, 360]
+     * s is in [0,   1]
+     * v is in [0,   1]
+     *
+     * Returns: [ r, g, b ], where
+     * r is in [0, 1]
+     * g is in [0, 1]
+     * b is in [0, 1]
+     */
+    HSVToRGB: function(hsv) {
+        return $.mobile.tizen.clrlib.HSLToRGB($.mobile.tizen.clrlib.HSVToHSL(hsv));
+    },
+
+    /*
+     * Converts rgb to hsv.
+     *
+     * from http://coecsl.ece.illinois.edu/ge423/spring05/group8/FinalProject/HSV_writeup.pdf
+     *
+     * Input: [ r, g, b ], where
+     * r is in [0,   1]
+     * g is in [0,   1]
+     * b is in [0,   1]
+     *
+     * Returns: [ h, s, v ], where
+     * h is in [0, 360]
+     * s is in [0,   1]
+     * v is in [0,   1]
+     */
+    RGBToHSV: function(rgb) {
+        var min, max, delta, h, s, v, r = rgb[0], g = rgb[1], b = rgb[2];
+
+        min = Math.min(r, Math.min(g, b));
+        max = Math.max(r, Math.max(g, b));
+        delta = max - min;
+
+        h = 0;
+        s = 0;
+        v = max;
+
+        if (delta > 0.00001) {
+            s = delta / max;
+
+            if (r === max)
+                h = (g - b) / delta ;
+            else
+            if (g === max)
+                h = 2 + (b - r) / delta ;
+            else
+                h = 4 + (r - g) / delta ;
+
+            h *= 60 ;
+
+            if (h < 0)
+                h += 360 ;
+        }
+
+        return [h, s, v];
+    },
+
+    /*
+     * Converts hsv to hsl.
+     *
+     * Input: [ h, s, v ], where
+     * h is in [0, 360]
+     * s is in [0,   1]
+     * v is in [0,   1]
+     *
+     * Returns: [ h, s, l ], where
+     * h is in [0, 360]
+     * s is in [0,   1]
+     * l is in [0,   1]
+     */
+    HSVToHSL: function(hsv) {
+        var max = hsv[2],
+            delta = hsv[1] * max,
+            min = max - delta,
+            sum = max + min,
+            half_sum = sum / 2,
+            s_divisor = ((half_sum < 0.5) ? sum : (2 - max - min));
+
+        return [ hsv[0], ((0 == s_divisor) ? 0 : (delta / s_divisor)), half_sum ];
+    },
+
+    /*
+     * Converts rgb to hsl
+     *
+     * Input: [ r, g, b ], where
+     * r is in [0,   1]
+     * g is in [0,   1]
+     * b is in [0,   1]
+     *
+     * Returns: [ h, s, l ], where
+     * h is in [0, 360]
+     * s is in [0,   1]
+     * l is in [0,   1]
+     */
+    RGBToHSL: function(rgb) {
+        return $.mobile.tizen.clrlib.HSVToHSL($.mobile.tizen.clrlib.RGBToHSV(rgb));
+    }
+});
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");

http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.configure.js
----------------------------------------------------------------------
diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.configure.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.configure.js
new file mode 100644
index 0000000..d61f28c
--- /dev/null
+++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.configure.js
@@ -0,0 +1,39 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: jQuery Mobile configuration for Tizen widgets
+//>>label: Configuration
+//>>group: Tizen:Core
+
+define( [ 
+	"jquery",
+	"jqm/jquery.mobile.core",
+	"jqm/jquery.mobile.transition",
+	"jqm/jquery.mobile.buttonMarkup"
+	], function ( jQuery ) {
+
+//>>excludeEnd("jqmBuildExclude");
+
+/*
+ * set TIZEN specific configures
+ */
+
+( function( $, window, undefined ) {
+
+	/* set default transition */
+	$.mobile.defaultPageTransition = "none";
+
+	/* depth transition */
+	$.mobile.transitionHandlers.depth = $.mobile.transitionHandlers.simultaneous;
+	$.mobile.transitionFallbacks.depth = "fade";
+
+	/* Button data-corners default value */
+	$.fn.buttonMarkup.defaults.corners = false;
+
+	/* button hover delay */
+	$.mobile.buttonMarkup.hoverDelay = 0;
+
+})( jQuery, this );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
+

http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.core.js
----------------------------------------------------------------------
diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.core.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.core.js
new file mode 100644
index 0000000..c43f93c
--- /dev/null
+++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.core.js
@@ -0,0 +1,163 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Tizen core library
+//>>label: Tizen core
+//>>group: Tizen:Core
+
+define( [ 
+	'jquery',
+	'jqm/jquery.mobile.core',
+	'./jquery.mobile.tizen.configure',
+	'./util/ensurens'
+	], function ( jQuery ) {
+
+//>>excludeEnd("jqmBuildExclude");
+
+/*
+ * jQuery Mobile Widget @VERSION
+ *
+ * TODO: remove unnecessary codes....
+ *
+ * This software is licensed under the MIT licence (as defined by the OSI at
+ * http://www.opensource.org/licenses/mit-license.php)
+ * 
+ * ***************************************************************************
+ * Copyright (C) 2011 by Intel Corporation Ltd.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * ***************************************************************************
+ *
+ * Authors: Kalyan Kondapally <ka...@intel.com>
+ */
+
+ensureNS("jQuery.mobile.tizen");
+
+(function () {
+jQuery.extend(jQuery.mobile.tizen, {
+	disableSelection: function (element) {
+		this.enableSelection(
+			$(element).find('*').not( 'input, [type="text"], textarea' ),
+			'none'
+		);
+		return true;
+	},
+
+	enableSelection: function (element, value) {
+		var val;
+		switch ( value ) {
+			case 'text' :
+			case 'auto' :
+			case 'none' :
+				val = value;
+			break;
+			default :
+				val = 'auto';
+			break;
+		}
+		return $(element).css( {
+			'user-select': val,
+			'-moz-user-select': val,
+			'-webkit-user-select': val,
+			'-o-user-select': val,
+			'-ms-transform': val
+		} );
+    },
+
+    disableContextMenu: function(element) {
+	var self = this;
+	$(element).find('*').each( function() {
+		if( ( $(this).get(0).tagName !== 'INPUT' &&
+			$(this).attr("type") !== 'text' ) &&
+			$(this).get(0).tagName !== 'TEXTAREA' ) {
+			self._disableContextMenu( this );
+		}
+	} );
+    },
+
+    _disableContextMenu: function(element) {
+
+	$(element).each( function() {
+		$(this).bind("contextmenu", function( event ) {
+			return false;
+		} );
+	} );
+    },
+
+    enableContextMenu: function(element) {
+	$(element).each( function() {
+		$(this).unbind( "contextmenu" );
+	} );
+    },
+
+    // Get document-relative mouse coordinates from a given event
+    // From: http://www.quirksmode.org/js/events_properties.html#position
+    documentRelativeCoordsFromEvent: function(ev) {
+        var e = ev ? ev : window.event,
+            client = { x: e.clientX, y: e.clientY },
+            page   = { x: e.pageX,   y: e.pageY   },
+            posx = 0,
+            posy = 0;
+
+        // Grab useful coordinates from touch events
+        if (e.type.match(/^touch/)) {
+            page = {
+                x: e.originalEvent.targetTouches[0].pageX,
+                y: e.originalEvent.targetTouches[0].pageY
+            };
+            client = {
+                x: e.originalEvent.targetTouches[0].clientX,
+                y: e.originalEvent.targetTouches[0].clientY
+            };
+        }
+
+        if (page.x || page.y) {
+            posx = page.x;
+            posy = page.y;
+        }
+        else
+        if (client.x || client.y) {
+            posx = client.x + document.body.scrollLeft + document.documentElement.scrollLeft;
+            posy = client.y + document.body.scrollTop  + document.documentElement.scrollTop;
+        }
+
+        return { x: posx, y: posy };
+    },
+
+	// TODO : offsetX, offsetY. touch events don't have offsetX and offsetY. support for touch devices.
+    // check algorithm...
+    targetRelativeCoordsFromEvent: function(e) {
+        var coords = { x: e.offsetX, y: e.offsetY };
+
+        if (coords.x === undefined || isNaN(coords.x) ||
+            coords.y === undefined || isNaN(coords.y)) {
+            var offset = $(e.target).offset();
+            //coords = documentRelativeCoordsFromEvent(e);	// Old code. Must be checked again.
+            coords = $.mobile.tizen.documentRelativeCoordsFromEvent(e);
+            coords.x -= offset.left;
+            coords.y -= offset.top;
+        }
+
+        return coords;
+    }
+});
+
+})();
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");

http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.full.js
----------------------------------------------------------------------
diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.full.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.full.js
new file mode 100644
index 0000000..7af1679
--- /dev/null
+++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.full.js
@@ -0,0 +1,75 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Config file to build whole tizen web-ui-fw
+
+define( [
+	"jquery", //make sure that jqeru is loaded before libraries that don"t use requirejs
+	"libs/jquery.easing.1.3",
+	"jqm/widgets/loader",
+	"jqm/jquery.mobile.navigation",
+	"jqm/jquery.mobile.navigation.pushstate",
+	"jqm/jquery.mobile.transitions",
+	"jqm/jquery.mobile.degradeInputs",
+	"jqm/widgets/dialog",
+	"jqm/widgets/page.sections",
+	"jqm/widgets/collapsible",
+	"jqm/widgets/collapsibleSet",
+	"jqm/jquery.mobile.fieldContain",
+	"jqm/widgets/navbar",
+	"jqm/widgets/listview",
+	"jqm/widgets/listview.filter",
+	"jqm/widgets/listview.autodividers",
+	"jqm/jquery.mobile.nojs",
+	"jqm/widgets/forms/checkboxradio",
+	"jqm/widgets/forms/button",
+	"jqm/widgets/forms/slider",
+	"jqm/widgets/forms/textinput",
+	"jqm/widgets/forms/select.custom",
+	"jqm/widgets/forms/select",
+	"jqm/jquery.mobile.buttonMarkup",
+	"jqm/jquery.mobile.controlGroup",
+	"jqm/jquery.mobile.links",
+	"jqm/widgets/fixedToolbar",
+	"jqm/widgets/popup",
+	"jqm/jquery.mobile.zoom",
+	"jqm/jquery.mobile.zoom.iosorientationfix",
+	"jqm/jquery.mobile.init",
+	"./jquery.mobile.tizen.label",
+	"./jquery.mobile.tizen.clrlib",
+	"./jquery.mobile.tizen.core",
+	"./jquery.mobile.tizen.loader",
+	"./jquery.mobile.tizen.pinch",
+	"./jquery.mobile.tizen.scrollview",
+	"./widgets/jquery.mobile.tizen.circularview",
+	"./widgets/jquery.mobile.tizen.datetimepicker",
+	"./widgets/jquery.mobile.tizen.extendablelist",
+	"./widgets/jquery.mobile.tizen.fastscroll",
+	"./widgets/jquery.mobile.tizen.gallery",
+	"./widgets/jquery.mobile.tizen.gallery3d",
+	"./widgets/jquery.mobile.tizen.listdivider",
+	"./widgets/jquery.mobile.tizen.multimediaview",
+	"./widgets/jquery.mobile.tizen.notification",
+	"./widgets/jquery.mobile.tizen.pagelayout",
+	"./widgets/jquery.mobile.tizen.popupwindow.ctxpopup",
+	"./widgets/jquery.mobile.tizen.popupwindow",
+	"./widgets/jquery.mobile.tizen.progress",
+	"./widgets/jquery.mobile.tizen.progressbar",
+	"./widgets/jquery.mobile.tizen.scrollview.handler",
+	"./widgets/jquery.mobile.tizen.searchbar",
+	"./widgets/jquery.mobile.tizen.slider",
+	"./widgets/jquery.mobile.tizen.splitview",
+	"./widgets/jquery.mobile.tizen.swipe",
+	"./widgets/jquery.mobile.tizen.tabbar",
+	"./widgets/jquery.mobile.tizen.tokentextarea",
+	"./widgets/jquery.mobile.tizen.triangle",
+	"./widgets/jquery.mobile.tizen.virtualgrid",
+	"./widgets/jquery.mobile.tizen.virtuallistview",
+	"./widgets/jquery.mobile.tizen.widgetex",
+	], function ( ) {
+
+//>>excludeEnd("jqmBuildExclude");
+
+//Version: __version__
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");

http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.label.js
----------------------------------------------------------------------
diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.label.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.label.js
new file mode 100644
index 0000000..aadc014
--- /dev/null
+++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.label.js
@@ -0,0 +1,58 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Add markup for labels
+//>>label: Label
+//>>group: Tizen:Core
+
+define( [
+	"jquery",
+	"jqm/jquery.mobile.core"
+	], function ( jQuery ) {
+
+//>>excludeEnd("jqmBuildExclude");
+
+/*
+ *
+ * This software is licensed under the MIT licence (as defined by the OSI at
+ * http://www.opensource.org/licenses/mit-license.php)
+ * 
+ * ***************************************************************************
+ * Copyright (C) 2011 by Intel Corporation Ltd.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ * ***************************************************************************
+ */
+
+// Add markup for labels
+
+
+(function($, undefined) {
+
+$(document).bind("pagecreate create", function(e) {
+    $(":jqmData(role='label')", e.target).not(":jqmData(role='none'), :jqmData(role='nojs')").each(function() {
+        $(this).addClass("jquery-mobile-ui-label")
+               .html($("<span>", {"class": "jquery-mobile-ui-label-text"}).text($(this).text()));
+    });
+});
+
+})(jQuery);
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");
+

http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.loader.js
----------------------------------------------------------------------
diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.loader.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.loader.js
new file mode 100644
index 0000000..a313d41
--- /dev/null
+++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.loader.js
@@ -0,0 +1,526 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Loader doing theme loading, viewport setting, globalize loading, etc.
+//>>label: Loader
+//>>group: Tizen:Core
+
+define( [ 
+	'jquery',
+	'libs/globalize',
+	"jqm/jquery.mobile.init",
+
+	// used by theme.js
+	"jqm/widgets/loader",
+	"jqm/widgets/listview",
+	"jqm/widgets/collapsible",
+	"jqm/widgets/forms/button",
+
+	"jqm/widgets/page.sections",
+
+	'./jquery.mobile.tizen.configure',
+	'./jquery.mobile.tizen.core',
+	'widgets/jquery.mobile.tizen.pagelayout'
+	], function ( jQuery, Globalize ) {
+
+//>>excludeEnd("jqmBuildExclude");
+
+/**
+ * @class core
+ * loader.js
+ *
+ * Youmin Ha <yo...@samsung.com>
+ *
+ *
+ */
+/*
+	Web UI scaling concept in Tizen Web UI
+
+Generally, web applications must be designed to be showed acceptable on various size and resolution of screens, and web winsets have to be scaled well.  Tizen Web UI Framework supports various viewport settings, and Tizen Web UI widgets are designed to be scalable on various screen sizes.  In order to make web applications scalable on many devices which have different screen size, it is necessary to understand how mobile web browsers deal with screen resolution, and how Tizen Web UI Framework supports scaling for web applications.
+
+
+* Viewport on mobile web browser
+
+Viewport is an area showing web content on the browser.  Unlike desktop browsers, mobile browsers support logical viewport seting, which means that application can set viewport width/height and zoom level by itself.
+The very important thing that to be remembered is that the viewport resolution in pixel is 'Logical', not physical.  For example, if the viewport width is set to 480 on a mobile device having 720px screen width, the viewport width is considered to 480px logically. All elements put on right side from 480px horizontal position will not be shown on the viewport.
+Most mobile browsers set viewport with given content attribute with <meta name="viewport" content="..."> tag in <head> section in the application source html, whereas desktop browsers ignore the tag.
+Detailed usage of viewport meta tag is found in here: http://www.w3.org/TR/mwabp/#bp-viewport
+
+
+* Viewport setting by application developers
+
+When developers write <meta name="viewport" content="..."> in the <head> section of the web application HTML file, Tizen Web UI Framework does not add another viewport meta tag, nor modify developer-defined viewport.
+
+
+* Automatic viewport setting by Tizen Web UI Framework
+
+If developers do not give a viewport meta tag, Tizen Web UI Framework automatically add a viewport meta tag with default viewport setting.
+
+
+* Portrait/landscape mode
+
+
+* Tizen Web UI widgets scaling
+
+
+ */
+( function ($, Globalize, window, undefined) {
+
+	var tizen = {
+		libFileName : "tizen-web-ui-fw(.custom|.full)?(.min)?.js",
+
+		frameworkData : {
+			rootDir: '/usr/share/tizen-web-ui-fw',
+			version: '0.2',
+			theme: "tizen-black",
+			viewportWidth: "device-width",
+			viewportScale: false,
+
+			defaultFontSize: 22,
+			minified: false,
+			deviceCapa: { inputKeyBack: true, inputKeyMenu: true },
+			debug: false
+		},
+
+		log : {
+			debug : function ( msg ) {
+				if ( tizen.frameworkData.debug ) {
+					console.log( msg );
+				}
+			},
+			warn : function ( msg ) {
+				console.warn( msg );
+			},
+			error : function ( msg ) {
+				console.error( msg );
+			},
+			alert : function ( msg ) {
+				window.alert( msg );
+			}
+		},
+
+		util : {
+
+			loadScriptSync : function ( scriptPath, successCB, errorCB ) {
+				$.ajax( {
+					url: scriptPath,
+					dataType: 'script',
+					async: false,
+					crossDomain: false,
+					success: successCB,
+					error: function ( jqXHR, textStatus, errorThrown ) {
+						if ( errorCB ) {
+							errorCB( jqXHR, textStatus, errorThrown );
+						} else {
+							var ignoreStatusList = [ 404 ],  // 404: not found
+								errmsg = ( 'Error while loading ' + scriptPath + '\n' + jqXHR.status + ':' + jqXHR.statusText );
+							if ( -1 == $.inArray( jqXHR.status, ignoreStatusList ) ) {
+								tizen.log.alert( errmsg );
+							} else {
+								tizen.log.warn( errmsg );
+							}
+						}
+					}
+				} );
+			},
+			isMobileBrowser: function ( ) {
+				var mobileIdx = window.navigator.appVersion.indexOf("Mobile"),
+					isMobile = -1 < mobileIdx;
+				return isMobile;
+			}
+		},
+
+		css : {
+			cacheBust: ( document.location.href.match( /debug=true/ ) ) ?
+					'?cacheBust=' + ( new Date( ) ).getTime( ) :
+					'',
+			addElementToHead : function ( elem ) {
+				var head = document.getElementsByTagName( 'head' )[0];
+				if ( head ) {
+					$( head ).prepend( elem );
+				}
+			},
+			makeLink : function ( href ) {
+				var cssLink = document.createElement( 'link' );
+				cssLink.setAttribute( 'rel', 'stylesheet' );
+				cssLink.setAttribute( 'href', href );
+				cssLink.setAttribute( 'name', 'tizen-theme' );
+				return cssLink;
+			},
+			load: function ( path ) {
+				var head = document.getElementsByTagName( 'head' )[0],
+					cssLinks = head.getElementsByTagName( 'link' ),
+					idx,
+					l = null;
+				// Find css link element
+				for ( idx = 0; idx < cssLinks.length; idx++ ) {
+					if ( cssLinks[idx].getAttribute( 'rel' ) != "stylesheet" ) {
+						continue;
+					}
+					if ( cssLinks[idx].getAttribute( 'name' ) == "tizen-theme"
+							|| cssLinks[idx].getAttribute( 'href' ) == path ) {
+						l = cssLinks[idx];
+						break;
+					}
+				}
+				if ( l ) {	// Found the link element!
+					if ( l.getAttribute( 'href' ) == path ) {
+						tizen.log.debug( "Theme is already loaded. Skip theme loading in the framework." );
+					} else {
+						l.setAttribute( 'href', path );
+					}
+				} else {
+					this.addElementToHead( this.makeLink( path ) );
+				}
+			}
+		},
+
+		getParams: function ( ) {
+			/* Get data-* params from <script> tag, and set tizen.frameworkData.* values
+			 * Returns true if proper <script> tag is found, or false if not.
+			 */
+			// Find current <script> tag element
+			var scriptElems = document.getElementsByTagName( 'script' ),
+				val = null,
+				foundScriptTag = false,
+				idx,
+				elem,
+				src,
+				tokens,
+				version_idx;
+/*
+			function getTizenTheme( ) {
+				var t = navigator.theme ? navigator.theme.split( ':' )[0] : null;
+				if ( t ) {
+					t = t.replace('-hd', '');
+					if ( ! t.match( /^tizen-/ ) ) {
+						t = 'tizen-' + t;
+					}
+				}
+				return t;
+			}
+*/
+			for ( idx in scriptElems ) {
+				elem = scriptElems[idx];
+				src = elem.src ? elem.getAttribute( 'src' ) : undefined;
+				if (src && src.match( this.libFileName )) {
+					// Set framework data, only when they are given.
+					tokens = src.split(/[\/\\]/);
+					version_idx = -3;
+					this.frameworkData.rootDir = ( elem.getAttribute( 'data-framework-root' )
+						|| tokens.slice( 0, tokens.length + version_idx ).join( '/' )
+						|| this.frameworkData.rootDir ).replace( /^file:(\/\/)?/, '' );
+					this.frameworkData.version = elem.getAttribute( 'data-framework-version' )
+						|| tokens[ tokens.length + version_idx ]
+						|| this.frameworkData.version;
+					this.frameworkData.theme = elem.getAttribute( 'data-framework-theme' )
+						//|| getTizenTheme( )
+						|| this.frameworkData.theme;
+					this.frameworkData.viewportWidth = elem.getAttribute( 'data-framework-viewport-width' )
+						|| this.frameworkData.viewportWidth;
+					this.frameworkData.viewportScale =
+						"true" === elem.getAttribute( 'data-framework-viewport-scale' ) ? true
+						: this.frameworkData.viewportScale;
+					this.frameworkData.minified = src.search(/\.min\.js$/) > -1 ? true : false;
+					this.frameworkData.debug = "true" === elem.getAttribute( 'data-framework-debug' ) ? true
+						: this.frameworkData.debug;
+					foundScriptTag = true;
+					break;
+				}
+			}
+			return foundScriptTag;
+		},
+
+		loadTheme: function ( theme ) {
+			var themePath,
+			cssPath,
+			jsPath;
+
+			if ( ! theme ) {
+				theme = tizen.frameworkData.theme;
+			}
+			
+			themePath = tizen.frameworkData.rootDir + '/' + tizen.frameworkData.version + '/themes/' + theme;
+			
+			jsPath = themePath + '/theme.js';
+	
+			if ( tizen.frameworkData.minified ) {
+				cssPath = themePath + '/tizen-web-ui-fw-theme.min.css';
+			} else {
+				cssPath = themePath + '/tizen-web-ui-fw-theme.css';
+			}
+			tizen.css.load( cssPath );
+			tizen.util.loadScriptSync( jsPath );
+		},
+
+		/** Load Globalize culture file, and set default culture.
+		 *  @param[in]  language  (optional) Language code. ex) en-US, en, ko-KR, ko
+		 *                        If language is not given, read language from html 'lang' attribute, 
+		 *                        or from system setting.
+		 *  @param[in]  cultureDic (optional) Dictionary having language code->
+		 */
+		loadGlobalizeCulture: function ( language, cultureDic ) {
+			var self = this,
+				cFPath,
+				lang,
+				mockJSXHR;
+
+			function getLang ( language ) {
+				var lang = language
+						|| $( 'html' ).attr( 'lang' )
+						|| window.navigator.language.split( '.' )[0]	// Webkit, Safari + workaround for Tizen
+						|| window.navigator.userLanguage	// IE
+						|| 'en',
+					countryCode = null,
+					countryCodeIdx = lang.lastIndexOf('-'),
+					ignoreCodes = ['Cyrl', 'Latn', 'Mong'];	// Not country code!
+				if ( countryCodeIdx != -1 ) {	// Found country code!
+					countryCode = lang.substr( countryCodeIdx + 1 );
+					if ( ignoreCodes.join( '-' ).indexOf( countryCode ) < 0 ) {
+						// countryCode is not found from ignoreCodes.
+						// Make countryCode to uppercase.
+						lang = [ lang.substr( 0, countryCodeIdx ), countryCode.toUpperCase( ) ].join( '-' );
+					}
+				}
+				// NOTE: 'en' to 'en-US', because globalize has no 'en' culture file.
+				lang = lang == 'en' ? 'en-US' : lang;
+				return lang;
+			}
+
+			function getNeutralLang ( lang ) {
+				var neutralLangIdx = lang.lastIndexOf( '-' ),
+					neutralLang;
+				if ( neutralLangIdx != -1 ) {
+					neutralLang = lang.substr( 0, neutralLangIdx );
+				}
+				return neutralLang;
+			}
+
+			function getCultureFilePath ( lang, cFDic ) {
+				var cFPath = null;	// error value
+
+				if ( "string" != typeof lang ) {
+					return null;
+				}
+				if ( cFDic && cFDic[lang] ) {
+					cFPath = cFDic[lang];
+				} else {
+					// Default Globalize culture file path
+					cFPath = [
+						self.frameworkData.rootDir,
+						self.frameworkData.version,
+						'js',
+						'cultures',
+						['globalize.culture.', lang, '.js'].join( '' )
+					].join( '/' );
+				}
+				return cFPath;
+			}
+
+			function printLoadError( cFPath, jqXHR ) {
+				tizen.log.error( "Error " + jqXHR.status + ": " + jqXHR.statusText
+						+ "::Culture file (" + cFPath + ") is failed to load.");
+			}
+
+			function loadCultureFile ( cFPath, errCB ) {
+				function _successCB ( ) {
+					tizen.log.debug( "Culture file (" + cFPath + ") is loaded successfully." );
+				}
+				function _errCB ( jqXHR, textStatus, err ) {
+					if ( errCB ) {
+						errCB( jqXHR, textStatus, err );
+					} else {
+						printLoadError( cFPath, jqXHR );
+					}
+				}
+
+				if ( ! cFPath ) {	// Invalid cFPath -> Regard it as '404 Not Found' error.
+					mockJSXHR = {
+						status: 404,
+						statusText: "Not Found"
+					};
+					_errCB( mockJSXHR, null, null );
+				} else {
+					$.ajax( {
+						url: cFPath,
+						dataType: 'script',
+						cache: true,
+						async: false,
+						success: _successCB,
+						error: _errCB
+					} );
+				}
+			}
+
+			lang = getLang( language );
+			cFPath = getCultureFilePath( lang, cultureDic );
+			loadCultureFile( cFPath,
+				function ( jqXHR, textStatus, err ) {
+					if ( jqXHR.status == 404 ) {
+						// If culture file is not found, try once more with neutral lang.
+						var nLang = getNeutralLang( lang ),
+							ncFPath = getCultureFilePath( nLang, cultureDic );
+						loadCultureFile( ncFPath, null );
+					} else {
+						printLoadError( cFPath, jqXHR );
+					}
+				} );
+
+			return lang;
+		},
+		setGlobalize: function ( ) {
+			var lang = this.loadGlobalizeCulture( );
+
+			// Set culture
+			// NOTE: It is not needed to set with neutral lang.
+			//       Globalize automatically deals with it.
+			Globalize.culture( lang );
+		},
+		/**
+		 * Load custom globalize culture file
+		 * Find current system language, and load appropriate culture file from given colture file list.
+		 *
+		 * @param[in]	cultureDic	collection of 'language':'culture file path' key-val pair.
+		 * @example
+		 * var myCultures = {
+		 *	"en"    : "culture/en.js",
+		 *	"fr"    : "culture/fr.js",
+		 *	"ko-KR" : "culture/ko-KR.js"
+		 * };
+		 * loadCultomGlobalizeCulture( myCultures );
+		 *
+		 * ex) culture/fr.js
+		 * -------------------------------
+		 * Globalize.addCultureInfo( "fr", {
+		 *   messages: {
+		 *     "hello" : "bonjour",
+		 *     "translate" : "traduire"
+		 *   }
+		 * } );
+		 * -------------------------------
+		 */
+		loadCustomGlobalizeCulture: function ( cultureDic ) {
+			tizen.loadGlobalizeCulture( null, cultureDic );
+		},
+
+		/** Set viewport meta tag for mobile devices.
+		 *
+		 * @param[in]	viewportWidth	viewport width. "device-width" is OK.
+		 */
+		setViewport: function ( viewportWidth ) {
+			var meta = null,
+				head,
+				content;
+
+			// Do nothing if viewport setting code is already in the code.
+			$( "meta[name=viewport]" ).each( function ( ) {
+				meta = this;
+				return;
+			});
+			if ( meta ) {	// Found custom viewport!
+				content = $( meta ).prop( "content" );
+				viewportWidth = content.replace( /.*width=(device-width|\d+)\s*,?.*$/gi, "$1" );
+				tizen.log.debug( "Viewport is set to '" + viewportWidth + "' in a meta tag. Framework skips viewport setting." );
+			} else {
+				// Create a meta tag
+				meta = document.createElement( "meta" );
+				if ( meta ) {
+					meta.name = "viewport";
+					content = "width=" + viewportWidth + ", user-scalable=no";
+					if ( ! isNaN( viewportWidth ) ) {
+						// Fix scale to 1.0, if viewport width is set to fixed value.
+						// NOTE: Works wrong in Tizen browser!
+						//content = [ content, ", initial-scale=1.0, maximum-scale=1.0" ].join( "" );
+					}
+					meta.content = content;
+					tizen.log.debug( content );
+					head = document.getElementsByTagName( 'head' ).item( 0 );
+					head.insertBefore( meta, head.firstChild );
+				}
+			}
+			return viewportWidth;
+		},
+
+		/**	Read body's font-size, scale it, and reset it.
+		 *  param[in]	desired font-size / base font-size.
+		 */
+		scaleBaseFontSize: function ( themeDefaultFontSize, ratio ) {
+			tizen.log.debug( "themedefaultfont size: " + themeDefaultFontSize + ", ratio: " + ratio );
+			var scaledFontSize = Math.max( Math.floor( themeDefaultFontSize * ratio ), 4 );
+
+			$( 'html' ).css( { 'font-size': scaledFontSize + "px" } );
+			tizen.log.debug( 'html:font size is set to ' + scaledFontSize );
+			$( document ).ready( function ( ) {
+				$( '.ui-mobile' ).children( 'body' ).css( { 'font-size': scaledFontSize + "px" } );
+			} );
+		},
+
+		setScaling: function ( ) {
+			var viewportWidth = this.frameworkData.viewportWidth,
+				themeDefaultFontSize = this.frameworkData.defaultFontSize, // comes from theme.js
+				ratio = 1;
+
+			// Keep original font size
+			$( 'body' ).attr( 'data-tizen-theme-default-font-size', themeDefaultFontSize );
+
+			if ( !tizen.util.isMobileBrowser() ) {
+				return;
+			}
+
+			// Legacy support: tizen.frameworkData.viewportScale
+			if ( this.frameworkData.viewportScale == true ) {
+				viewportWidth = "screen-width";
+			}
+
+			// screen-width support
+			if ( "screen-width" == viewportWidth ) {
+				if ( window.self == window.top ) {
+					// Top frame: for target. Use window.outerWidth.
+					viewportWidth = window.outerWidth;
+				} else {
+					// iframe: for web simulator. Use clientWidth.
+					viewportWidth = document.documentElement.clientWidth;
+				}
+			}
+
+			// set viewport meta tag
+			viewportWidth = this.setViewport( viewportWidth );	// If custom viewport setting exists, get viewport width
+
+			if ( viewportWidth == "device-width" ) {
+				// Do nothing!
+			} else {	// fixed width!
+				ratio = parseFloat( viewportWidth / this.frameworkData.defaultViewportWidth );
+				this.scaleBaseFontSize( themeDefaultFontSize, ratio );
+			}
+		}
+	};
+
+	function export2TizenNS ( $, tizen ) {
+		if ( !$.tizen ) {
+			$.tizen = { };
+		}
+
+		$.tizen.frameworkData = tizen.frameworkData;
+		$.tizen.loadCustomGlobalizeCulture = tizen.loadCustomGlobalizeCulture;
+		$.tizen.loadTheme = tizen.loadTheme;
+
+		$.tizen.__tizen__ = tizen;	// for unit-test
+	}
+
+	export2TizenNS( $, tizen );
+
+	tizen.getParams( );
+	tizen.loadTheme( );
+	tizen.setScaling( );	// Run after loadTheme(), for the default font size.
+	tizen.setGlobalize( );
+	// Turn off JQM's auto initialization option.
+	// NOTE: This job must be done before domready.
+	$.mobile.autoInitializePage = false;
+
+	$(document).ready( function ( ) {
+		$.mobile.initializePage( );
+	});
+
+} ( jQuery, Globalize, window ) );
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");

http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.loadprototype.js
----------------------------------------------------------------------
diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.loadprototype.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.loadprototype.js
new file mode 100644
index 0000000..b14b860
--- /dev/null
+++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jquery.mobile.tizen.loadprototype.js
@@ -0,0 +1,152 @@
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+//>>description: Loads widget's prototype
+//>>label: Widget prototype loader
+//>>group: Tizen:Core
+
+define( [ ], function ( ) {
+//>>excludeEnd("jqmBuildExclude");
+
+(function($, undefined) {
+
+ensureNS("jQuery.mobile.tizen");
+
+jQuery.extend( jQuery.mobile.tizen,
+{
+    _widgetPrototypes: {},
+
+    /*
+     * load the prototype for a widget.
+     *
+     * If @widget is a string, the function looks for @widget.prototype.html in the proto-html/ subdirectory of the
+     * framework's current theme and loads the file via AJAX into a string. Note that the file will only be loaded via
+     * AJAX once. If two widget instances based on the same @widget value are to be constructed, the second will be
+     * constructed from the cached copy of the prototype of the first instance.
+     *
+     * If @widget is not a string, it is assumed to be a hash containing at least one key, "proto", the value of which is
+     * the string to be used for the widget prototype. if another key named "key" is also provided, it will serve as the
+     * key under which to cache the prototype, so it need not be rendered again in the future.
+     *
+     * Given the string for the widget prototype, the following patterns occurring in the string are replaced:
+     *
+     *   "${FRAMEWORK_ROOT}" - replaced with the path to the root of the framework
+     *
+     * The function then creates a jQuery $("<div>") object containing the prototype from the string.
+     *
+     * If @ui is not provided, the jQuery object containing the prototype is returned.
+     *
+     * If @ui is provided, it is assumed to be a (possibly multi-level) hash containing CSS selectors. For every level of
+     * the hash and for each string-valued key at that level, the CSS selector specified as the value is sought in the
+     * prototype jQuery object and, if found, the value of the key is replaced with the jQuery object resulting from the
+     * search. Additionally, if the CSS selector is of the form "#widgetid", the "id" attribute will be removed from the
+     * elements contained within the resulting jQuery object. The resulting hash is returned.
+     *
+     * Examples:
+     *
+     * 1.
+     * $.mobile.tizen.loadPrototype("mywidget") => Returns a <div> containing the structure from the file
+     * mywidget.prototype.html located in the current theme folder of the current framework.
+     *
+     * 2. $.mobile.tizen.loadPrototype("mywidget", ui):
+     * where ui is a hash that looks like this:
+     * ui = {
+     *   element1: "<css selector 1>",
+     *   element2: "<css selector 2>",
+     *   group1: {
+     *     group1element1: "<css selector 3>",
+     *     group1element1: "<css selector 4>"
+     *   }
+     *  ...
+     * }
+     *
+     * In this case, after loading the prototype as in Example 1, loadPrototype will traverse @ui and replace the CSS
+     * selector strings with the result of the search for the selector string upon the prototype. If any of the CSS
+     * selectors are of the form "#elementid" then the "id" attribute will be stripped from the elements selected. This
+     * means that they will no longer be accessible via the selector used initially. @ui is then returned thus modified.
+     */
+
+    loadPrototype: function(widget, ui) {
+        var ret = undefined,
+            theScriptTag = $("script[data-framework-version][data-framework-root][data-framework-theme]"),
+            frameworkRootPath = theScriptTag.attr("data-framework-root")    + "/" +
+                                theScriptTag.attr("data-framework-version") + "/";
+
+        function replaceVariables(s) {
+            return s.replace(/\$\{FRAMEWORK_ROOT\}/g, frameworkRootPath);
+        }
+
+        function fillObj(obj, uiProto) {
+            var selector;
+
+            for (var key in obj) {
+                if (typeof obj[key] === "string") {
+                    selector = obj[key];
+                    obj[key] = uiProto.find(obj[key]);
+                    if (selector.substring(0, 1) === "#")
+                        obj[key].removeAttr("id");
+                }
+                else
+                if (typeof obj[key] === "object")
+                    obj[key] = fillObj(obj[key], uiProto);
+            }
+            return obj;
+        }
+
+        /* If @widget is a string ... */
+        if (typeof widget === "string") {
+            /* ... try to use it as a key into the cached prototype hash ... */
+            ret = $.mobile.tizen._widgetPrototypes[widget];
+            if (ret === undefined) {
+                /* ... and if the proto was not found, try to load its definition ... */
+                var protoPath = frameworkRootPath + "proto-html" + "/" +
+                                theScriptTag.attr("data-framework-theme");
+                $.ajax({
+                    url: protoPath + "/" + widget + ".prototype.html",
+                    async: false,
+                    dataType: "html"
+                })
+                 .success(function(data, textStatus, jqXHR) {
+                    /* ... and if loading succeeds, cache it and use a copy of it ... */
+                    $.mobile.tizen._widgetPrototypes[widget] = $("<div>").html(replaceVariables(data));
+                    ret = $.mobile.tizen._widgetPrototypes[widget].clone();
+                });
+            }
+        }
+        /* Otherwise ... */
+        else {
+            /* ... if a key was provided ... */
+            if (widget.key !== undefined)
+                /* ... try to use it as a key into the cached prototype hash ... */
+                ret = $.mobile.tizen._widgetPrototypes[widget.key];
+
+            /* ... and if the proto was not found in the cache ... */
+            if (ret === undefined) {
+                /* ... and a proto definition string was provided ... */
+                if (widget.proto !== undefined) {
+                    /* ... create a new proto from the definition ... */
+                    ret = $("<div>").html(replaceVariables(widget.proto));
+                    /* ... and if a key was provided ... */
+                    if (widget.key !== undefined)
+                        /* ... cache a copy of the proto under that key */
+                        $.mobile.tizen._widgetPrototypes[widget.key] = ret.clone();
+                }
+            }
+            else
+                /* otherwise, if the proto /was/ found in the cache, return a copy of it */
+                ret = ret.clone();
+        }
+
+        /* If the prototype was found/created successfully ... */
+        if (ret != undefined)
+            /* ... and @ui was provided */
+            if (ui != undefined)
+                /* ... return @ui, but replace the CSS selectors it contains with the elements they select */
+                ret = fillObj(ui, ret);
+
+        return ret;
+    }
+});
+})(jQuery);
+
+//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
+} );
+//>>excludeEnd("jqmBuildExclude");