http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.buttonMarkup.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.buttonMarkup.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.buttonMarkup.js new file mode 100644 index 0000000..38726a6 --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.buttonMarkup.js @@ -0,0 +1,330 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: Applies button styling to links +//>>label: Buttons: Link-based +//>>group: Forms +//>>css.structure: ../css/structure/jquery.mobile.button.css +//>>css.theme: ../css/themes/default/jquery.mobile.theme.css + +define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.vmouse" ], function( jQuery ) { +//>>excludeEnd("jqmBuildExclude"); +(function( $, undefined ) { + +$.fn.buttonMarkup = function( options ) { + var $workingSet = this, + prefix = "data-" + $.mobile.ns, + mapToDataAttr = function( key, value ) { + e.setAttribute( "data-" + $.mobile.ns + key, value ); + el.jqmData( key, value ); + }; + + // Enforce options to be of type string + options = ( options && ( $.type( options ) === "object" ) )? options : {}; + for ( var i = 0; i < $workingSet.length; i++ ) { + var el = $workingSet.eq( i ), + e = el[ 0 ], + o = $.extend( {}, $.fn.buttonMarkup.defaults, { + icon: options.icon !== undefined ? options.icon : $.mobile.getAttrFixed( e, prefix + "icon" ), + iconpos: options.iconpos !== undefined ? options.iconpos : $.mobile.getAttrFixed( e, prefix + "iconpos" ), + theme: options.theme !== undefined ? options.theme : $.mobile.getAttrFixed( e, prefix + "theme" ) || $.mobile.getInheritedTheme( el, $.fn.buttonMarkup.defaults["theme"] ), + inline: options.inline !== undefined ? options.inline : $.mobile.getAttrFixed( e, prefix + "inline" ), + shadow: options.shadow !== undefined ? options.shadow : $.mobile.getAttrFixed( e, prefix + "shadow" ), + corners: options.corners !== undefined ? options.corners : $.mobile.getAttrFixed( e, prefix + "corners" ), + iconshadow: options.iconshadow !== undefined ? options.iconshadow : $.mobile.getAttrFixed( e, prefix + "iconshadow" ), + mini: options.mini !== undefined ? options.mini : $.mobile.getAttrFixed( e, prefix + "mini" ) + }, options ), + + // Classes Defined + innerClass = "ui-btn-inner", + textClass = "ui-btn-text", + buttonClass, iconClass, + // Button inner markup + buttonInner, + buttonText, + buttonIcon, + buttonElements; + + for ( key in o ) { + e.setAttribute ( prefix + key, o[ key ]) + } + + if ( $.mobile.getAttrFixed( e, prefix + "rel" ) === "popup" && el.attr( "href" ) ) { + e.setAttribute( "aria-haspopup", true ); + e.setAttribute( "aria-owns", e.getAttribute( "href" ) ); + } + + if ( e.tagName !== "LI" && e.tagName !== "LABEL" ) { + e.setAttribute( "role", "button" ); + e.setAttribute( "tabindex", "0" ); + } + + // Check if this element is already enhanced + buttonElements = $.data( ( ( e.tagName === "INPUT" || e.tagName === "BUTTON" ) ? e.parentNode : e ), "buttonElements" ); + + if ( buttonElements ) { + e = buttonElements.outer; + el = $( e ); + buttonInner = buttonElements.inner; + buttonText = buttonElements.text; + // We will recreate this icon below + $( buttonElements.icon ).remove(); + buttonElements.icon = null; + } + else { + buttonInner = document.createElement( o.wrapperEls ); + buttonText = document.createElement( o.wrapperEls ); + } + buttonIcon = o.icon ? document.createElement( "span" ) : null; + + if ( attachEvents && !buttonElements ) { + attachEvents(); + } + + // if not, try to find closest theme container + if ( !o.theme ) { + o.theme = $.mobile.getInheritedTheme( el, "c" ); + } + + buttonClass = "ui-btn ui-btn-up-" + o.theme; + buttonClass += o.shadow ? " ui-shadow" : ""; + buttonClass += o.corners ? " ui-btn-corner-all" : ""; + + // To distinguish real buttons + if( $.mobile.getAttrFixed( e, prefix + "role" ) == "button" || e.tagName == "BUTTON" || e.tagName == "DIV" ){ + buttonClass += " ui-btn-box-" + o.theme; + } + + /* TIZEN style markup */ + var buttonStyle = $.mobile.getAttrFixed( e, prefix + "style" ); + + if ( buttonStyle == "circle" && !($(el).text().length > 0) ) { + /* style : no text, Icon only */ + buttonClass += " ui-btn-corner-circle"; + buttonClass += " ui-btn-icon_only"; + } else if ( buttonStyle == "nobg" ) { + /* style : no text, Icon only, no bg */ + buttonClass += " ui-btn-icon-nobg"; + buttonClass += " ui-btn-icon_only"; + } else if ( buttonStyle == "edit" ) { + buttonClass += " ui-btn-edit"; + } else if ( buttonStyle == "round" || ( buttonStyle == "circle" && $(el).text().length > 0 ) ) { + buttonClass += " ui-btn-round"; + } + if ( o.icon ) { + if ( $(el).text().length > 0 ) { + + switch ( o.iconpos ) { + case "right" : + case "left" : + case "top" : + case "bottom" : + textClass += " ui-btn-text-padding-" + o.iconpos; + break; + default: + textClass += " ui-btn-text-padding-left"; + break; + } + + innerClass += " ui-btn-hastxt"; + } else { + if ( buttonStyle == "circle" ) { + /* style : no text, Icon only */ + innerClass += " ui-btn-corner-circle"; + } else if ( buttonStyle == "nobg" ) { + /* style : no text, Icon only, no bg */ + innerClass += " ui-btn-icon-nobg"; + } + + buttonClass += " ui-btn-icon_only"; + innerClass += " ui-btn-icon-only"; + + if ( e.tagName !== "LABEL" ) { + $( el ).text( o.icon.replace( "naviframe-", "" ) ); + } + } + } else { + if ( $(el).text().length > 0 ) { + innerClass += " ui-btn-hastxt"; + } else if ( buttonStyle == "circle" ){ + buttonClass += " ui-btn-round"; + } + } + if ( o.mini !== undefined ) { + // Used to control styling in headers/footers, where buttons default to `mini` style. + buttonClass += o.mini === true ? " ui-mini" : " ui-fullsize"; + } + + if ( o.inline !== undefined ) { + // Used to control styling in headers/footers, where buttons default to `inline` style. + buttonClass += o.inline === true ? " ui-btn-inline" : " ui-btn-block"; + } + + if ( o.icon ) { + o.icon = "ui-icon-" + o.icon; + o.iconpos = o.iconpos || "left"; + + iconClass = "ui-icon " + o.icon; + + if ( o.iconshadow ) { + iconClass += " ui-icon-shadow"; + } + } + + if ( o.iconpos ) { + buttonClass += " ui-btn-icon-" + o.iconpos; + + if ( o.iconpos === "notext" && !el.attr( "title" ) ) { + el.attr( "title", el.getEncodedText() ); + } + } + + innerClass += o.corners ? " ui-btn-corner-all" : ""; + + if ( o.iconpos && o.iconpos === "notext" && !el.attr( "title" ) ) { + el.attr( "title", el.getEncodedText() ); + } + + if ( buttonElements ) { + el.removeClass( buttonElements.bcls || "" ); + } + el.removeClass( "ui-link" ).addClass( buttonClass ); + + buttonInner.className = innerClass; + + buttonText.className = textClass; + if ( !buttonElements ) { + buttonInner.appendChild( buttonText ); + } + if ( buttonIcon ) { + buttonIcon.className = iconClass; + if ( !( buttonElements && buttonElements.icon ) ) { + buttonIcon.innerHTML = " "; + buttonInner.appendChild( buttonIcon ); + } + } + + while ( e.firstChild && !buttonElements ) { + buttonText.appendChild( e.firstChild ); + } + + if ( !buttonElements ) { + e.appendChild( buttonInner ); + } + + // Assign a structure containing the elements of this button to the elements of this button. This + // will allow us to recognize this as an already-enhanced button in future calls to buttonMarkup(). + buttonElements = { + bcls : buttonClass, + outer : e, + inner : buttonInner, + text : buttonText, + icon : buttonIcon + }; + + $.data( e, 'buttonElements', buttonElements ); + $.data( buttonInner, 'buttonElements', buttonElements ); + $.data( buttonText, 'buttonElements', buttonElements ); + if ( buttonIcon ) { + $.data( buttonIcon, 'buttonElements', buttonElements ); + } + } + + return this; +}; + +$.fn.buttonMarkup.defaults = { + theme: "c", + corners: true, + shadow: true, + iconshadow: true, + wrapperEls: "span" +}; + +function closestEnabledButton( element ) { + var cname; + + while ( element ) { + // Note that we check for typeof className below because the element we + // handed could be in an SVG DOM where className on SVG elements is defined to + // be of a different type (SVGAnimatedString). We only operate on HTML DOM + // elements, so we look for plain "string". + cname = ( typeof element.className === 'string' ) && ( element.className + ' ' ); + if ( cname && cname.indexOf( "ui-btn " ) > -1 && cname.indexOf( "ui-disabled " ) < 0 ) { + break; + } + + element = element.parentNode; + } + + return element; +} + +var attachEvents = function() { + var hoverDelay = $.mobile.buttonMarkup.hoverDelay, hov, foc; + + $.mobile.$document.bind( { + "vmousedown vmousecancel vmouseup vmouseover vmouseout focus blur scrollstart touchend touchcancel": function( event ) { + var theme, + $btn = $( closestEnabledButton( event.target ) ), + isTouchEvent = event.originalEvent && /^touch/.test( event.originalEvent.type ), + evt = event.type; + + if ( $btn.length ) { + theme = $btn.attr( "data-" + $.mobile.ns + "theme" ); + + if ( evt === "vmousedown" ) { + if ( isTouchEvent ) { + // Use a short delay to determine if the user is scrolling before highlighting + hov = setTimeout( function() { + $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-down-" + theme ); + }, hoverDelay ); + } else { + $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-down-" + theme ); + } + } else if ( evt === "vmousecancel" || evt === "vmouseup" || evt === "touchend" || evt === "touchcancel" ) { + $btn.removeClass( "ui-btn-down-" + theme ).addClass( "ui-btn-up-" + theme ); + } else if ( evt === "vmouseover" || evt === "focus" ) { + if ( isTouchEvent ) { + // Use a short delay to determine if the user is scrolling before highlighting + foc = setTimeout( function() { + $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-hover-" + theme ); + }, hoverDelay ); + } else { + $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-hover-" + theme ); + } + } else if ( evt === "vmouseout" || evt === "blur" || evt === "scrollstart" ) { + $btn.removeClass( "ui-btn-hover-" + theme + " ui-btn-down-" + theme ).addClass( "ui-btn-up-" + theme ); + if ( hov ) { + clearTimeout( hov ); + } + if ( foc ) { + clearTimeout( foc ); + } + } + } + }, + "focusin focus": function( event ) { + $( closestEnabledButton( event.target ) ).addClass( $.mobile.focusClass ); + }, + "focusout blur": function( event ) { + $( closestEnabledButton( event.target ) ).removeClass( $.mobile.focusClass ); + } + }); + + attachEvents = null; +}; + +//links in bars, or those with data-role become buttons +//auto self-init widgets +$.mobile.$document.bind( "pagecreate create", function( e ) { + + $( ":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a, .ui-bar > :jqmData(role='controlgroup') > a", e.target ) + .jqmEnhanceable() + .not( "button, input, .ui-btn, :jqmData(role='none'), :jqmData(role='nojs')" ) + .buttonMarkup(); +}); + +})( 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/jqm/jquery.mobile.controlGroup.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.controlGroup.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.controlGroup.js new file mode 100644 index 0000000..f1c5ba9 --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.controlGroup.js @@ -0,0 +1,70 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: Visually groups sets of buttons, checks, radios, etc. +//>>label: Controlgroups +//>>group: Forms +//>>css.structure: ../css/structure/jquery.mobile.controlgroup.css +//>>css.theme: ../css/themes/default/jquery.mobile.theme.css + +define( [ "jquery", "./jquery.mobile.buttonMarkup" ], function( jQuery ) { +//>>excludeEnd("jqmBuildExclude"); +(function( $, undefined ) { + +$.fn.controlgroup = function( options ) { + function flipClasses( els, flCorners ) { + els.removeClass( "ui-btn-corner-all ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-controlgroup-last ui-shadow" ) + .eq( 0 ).addClass( flCorners[ 0 ] ) + .end() + .last().addClass( flCorners[ 1 ] ).addClass( "ui-controlgroup-last" ); + } + + return this.each(function() { + var $el = $( this ), + o = $.extend({ + direction: $.mobile.getAttrFixed( $el[0], "data-"+ $.mobile.ns + "type" ) || "vertical", + shadow: false, + excludeInvisible: true, + mini: $.mobile.getAttrFixed( $el[0], "data-"+ $.mobile.ns + "mini" ) + }, options ), + grouplegend = $el.children( "legend" ), + groupheading = $el.children( ".ui-controlgroup-label" ), + groupcontrols = $el.children( ".ui-controlgroup-controls" ), + flCorners = o.direction === "horizontal" ? [ "ui-corner-left", "ui-corner-right" ] : [ "ui-corner-top", "ui-corner-bottom" ], + type = $el.find( "input" ).first().attr( "type" ); + + // First unwrap the controls if the controlgroup was already enhanced + if ( groupcontrols.length ) { + groupcontrols.contents().unwrap(); + } + $el.wrapInner( "<div class='ui-controlgroup-controls'></div>" ); + + if ( grouplegend.length ) { + // Replace legend with more stylable replacement div + $( "<div role='heading' class='ui-controlgroup-label'>" + grouplegend.html() + "</div>" ).insertBefore( $el.children( 0 ) ); + grouplegend.remove(); + } else if ( groupheading.length ) { + // Just move the heading if the controlgroup was already enhanced + $el.prepend( groupheading ); + } + + $el.addClass( "ui-corner-all ui-controlgroup ui-controlgroup-" + o.direction ); + + flipClasses( $el.find( ".ui-btn" + ( o.excludeInvisible ? ":visible" : "" ) ).not( '.ui-slider-handle' ), flCorners ); + flipClasses( $el.find( ".ui-btn-inner" ), flCorners ); + + if ( o.shadow ) { + $el.addClass( "ui-shadow" ); + } + + if ( o.mini ) { + $el.addClass( "ui-mini" ); + } + + }); +}; + +// The pagecreate handler for controlgroup is in jquery.mobile.init because of the soft-dependency on the wrapped widgets + +})(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/jqm/jquery.mobile.core.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.core.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.core.js new file mode 100644 index 0000000..92310f4 --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.core.js @@ -0,0 +1,390 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: Base file for jQuery Mobile +//>>label: Core +//>>group: Core +//>>css.structure: ../css/structure/jquery.mobile.core.css +//>>css.theme: ../css/themes/default/jquery.mobile.theme.css + +define( [ "jquery" ], function( jQuery, __version__ ) { +//>>excludeEnd("jqmBuildExclude"); +(function( $, window, undefined ) { + + var nsNormalizeDict = {}; + + // jQuery.mobile configurable options + $.mobile = $.extend( {}, { + + // Version of the jQuery Mobile Framework + version: __version__, + + // Namespace used framework-wide for data-attrs. Default is no namespace + ns: "", + + // Define the url parameter used for referencing widget-generated sub-pages. + // Translates to to example.html&ui-page=subpageIdentifier + // hash segment before &ui-page= is used to make Ajax request + subPageUrlKey: "ui-page", + + // Class assigned to page currently in view, and during transitions + activePageClass: "ui-page-active", + + // Class used for "active" button state, from CSS framework + activeBtnClass: "ui-btn-active", + + // Class used for "focus" form element state, from CSS framework + focusClass: "ui-focus", + + // Automatically handle clicks and form submissions through Ajax, when same-domain + ajaxEnabled: true, + + // Automatically load and show pages based on location.hash + hashListeningEnabled: true, + + // disable to prevent jquery from bothering with links + linkBindingEnabled: true, + + // Set default page transition - 'none' for no transitions + defaultPageTransition: "fade", + + // Set maximum window width for transitions to apply - 'false' for no limit + maxTransitionWidth: false, + + // Minimum scroll distance that will be remembered when returning to a page + minScrollBack: 250, + + // DEPRECATED: the following property is no longer in use, but defined until 2.0 to prevent conflicts + touchOverflowEnabled: false, + + // Set default dialog transition - 'none' for no transitions + defaultDialogTransition: "pop", + + // Error response message - appears when an Ajax page request fails + pageLoadErrorMessage: "Error Loading Page", + + // For error messages, which theme does the box uses? + pageLoadErrorMessageTheme: "e", + + // replace calls to window.history.back with phonegaps navigation helper + // where it is provided on the window object + phonegapNavigationEnabled: false, + + //automatically initialize the DOM when it's ready + autoInitializePage: true, + + pushStateEnabled: true, + + // allows users to opt in to ignoring content by marking a parent element as + // data-ignored + ignoreContentEnabled: false, + + // turn of binding to the native orientationchange due to android orientation behavior + orientationChangeEnabled: true, + + buttonMarkup: { + hoverDelay: 200 + }, + + // define the window and the document objects + $window: $( window ), + $document: $( document ), + + getAttrFixed : function( e, key ) { + var value = e.getAttribute( key ); + + return value === "true" ? true : + value === "false" ? false : + value === null ? undefined : value; + }, + + // TODO might be useful upstream in jquery itself ? + keyCode: { + ALT: 18, + BACKSPACE: 8, + CAPS_LOCK: 20, + COMMA: 188, + COMMAND: 91, + COMMAND_LEFT: 91, // COMMAND + COMMAND_RIGHT: 93, + CONTROL: 17, + DELETE: 46, + DOWN: 40, + END: 35, + ENTER: 13, + ESCAPE: 27, + HOME: 36, + INSERT: 45, + LEFT: 37, + MENU: 93, // COMMAND_RIGHT + NUMPAD_ADD: 107, + NUMPAD_DECIMAL: 110, + NUMPAD_DIVIDE: 111, + NUMPAD_ENTER: 108, + NUMPAD_MULTIPLY: 106, + NUMPAD_SUBTRACT: 109, + PAGE_DOWN: 34, + PAGE_UP: 33, + PERIOD: 190, + RIGHT: 39, + SHIFT: 16, + SPACE: 32, + TAB: 9, + UP: 38, + WINDOWS: 91 // COMMAND + }, + + // Scroll page vertically: scroll to 0 to hide iOS address bar, or pass a Y value + silentScroll: function( ypos ) { + if ( $.type( ypos ) !== "number" ) { + ypos = $.mobile.defaultHomeScroll; + } + + // prevent scrollstart and scrollstop events + $.event.special.scrollstart.enabled = false; + + setTimeout( function() { + window.scrollTo( 0, ypos ); + $.mobile.$document.trigger( "silentscroll", { x: 0, y: ypos }); + }, 20 ); + + setTimeout( function() { + $.event.special.scrollstart.enabled = true; + }, 150 ); + }, + + // Expose our cache for testing purposes. + nsNormalizeDict: nsNormalizeDict, + + // Take a data attribute property, prepend the namespace + // and then camel case the attribute string. Add the result + // to our nsNormalizeDict so we don't have to do this again. + nsNormalize: function( prop ) { + if ( !prop ) { + return; + } + + return nsNormalizeDict[ prop ] || ( nsNormalizeDict[ prop ] = $.camelCase( $.mobile.ns + prop ) ); + }, + + // Find the closest parent with a theme class on it. Note that + // we are not using $.fn.closest() on purpose here because this + // method gets called quite a bit and we need it to be as fast + // as possible. + getInheritedTheme: function( el, defaultTheme ) { + var e = el[ 0 ], + ltr = "", + re = /ui-(bar|body|overlay)-([a-z])\b/, + c, m; + + while ( e ) { + c = e.className || ""; + if ( c && ( m = re.exec( c ) ) && ( ltr = m[ 2 ] ) ) { + // We found a parent with a theme class + // on it so bail from this loop. + break; + } + + e = e.parentNode; + } + + // Return the theme letter we found, if none, return the + // specified default. + + return ltr || defaultTheme || "a"; + }, + + // TODO the following $ and $.fn extensions can/probably should be moved into jquery.mobile.core.helpers + // + // Find the closest javascript page element to gather settings data jsperf test + // http://jsperf.com/single-complex-selector-vs-many-complex-selectors/edit + // possibly naive, but it shows that the parsing overhead for *just* the page selector vs + // the page and dialog selector is negligable. This could probably be speed up by + // doing a similar parent node traversal to the one found in the inherited theme code above + closestPageData: function( $target ) { + return $target + .closest( ':jqmData(role="page"), :jqmData(role="dialog")' ) + .data( "page" ); + }, + + enhanceable: function( $set ) { + return this.haveParents( $set, "enhance" ); + }, + + hijackable: function( $set ) { + return this.haveParents( $set, "ajax" ); + }, + + haveParents: function( $set, attr ) { + if ( !$.mobile.ignoreContentEnabled ) { + return $set; + } + + var count = $set.length, + $newSet = $(), + e, $element, excluded; + + for ( var i = 0; i < count; i++ ) { + $element = $set.eq( i ); + excluded = false; + e = $set[ i ]; + + while ( e ) { + var c = e.getAttribute ? e.getAttribute( "data-" + $.mobile.ns + attr ) : ""; + + if ( c === "false" ) { + excluded = true; + break; + } + + e = e.parentNode; + } + + if ( !excluded ) { + $newSet = $newSet.add( $element ); + } + } + + return $newSet; + }, + + getScreenHeight: function() { + // Native innerHeight returns more accurate value for this across platforms, + // jQuery version is here as a normalized fallback for platforms like Symbian + return window.innerHeight || $.mobile.$window.height(); + } + }, $.mobile ); + + // Mobile version of data and removeData and hasData methods + // ensures all data is set and retrieved using jQuery Mobile's data namespace + $.fn.jqmData = function( prop, value ) { + var result; + if ( typeof prop !== "undefined" ) { + if ( prop ) { + prop = $.mobile.nsNormalize( prop ); + } + + // undefined is permitted as an explicit input for the second param + // in this case it returns the value and does not set it to undefined + if( arguments.length < 2 || value === undefined ){ + result = this.data( prop ); + } else { + result = this.data( prop, value ); + } + } + return result; + }; + + $.jqmData = function( elem, prop, value ) { + var result; + if ( typeof prop !== "undefined" ) { + result = $.data( elem, prop ? $.mobile.nsNormalize( prop ) : prop, value ); + } + return result; + }; + + $.fn.jqmRemoveData = function( prop ) { + return this.removeData( $.mobile.nsNormalize( prop ) ); + }; + + $.jqmRemoveData = function( elem, prop ) { + return $.removeData( elem, $.mobile.nsNormalize( prop ) ); + }; + + $.fn.removeWithDependents = function() { + $.removeWithDependents( this ); + }; + + $.removeWithDependents = function( elem ) { + var $elem = $( elem ); + + ( $elem.jqmData( 'dependents' ) || $() ).remove(); + $elem.remove(); + }; + + $.fn.addDependents = function( newDependents ) { + $.addDependents( $( this ), newDependents ); + }; + + $.addDependents = function( elem, newDependents ) { + var dependents = $( elem ).jqmData( 'dependents' ) || $(); + + $( elem ).jqmData( 'dependents', $.merge( dependents, newDependents ) ); + }; + + // note that this helper doesn't attempt to handle the callback + // or setting of an html elements text, its only purpose is + // to return the html encoded version of the text in all cases. (thus the name) + $.fn.getEncodedText = function() { + return $( "<div/>" ).text( $( this ).text() ).html(); + }; + + // fluent helper function for the mobile namespaced equivalent + $.fn.jqmEnhanceable = function() { + return $.mobile.enhanceable( this ); + }; + + $.fn.jqmHijackable = function() { + return $.mobile.hijackable( this ); + }; + + // Monkey-patching Sizzle to filter the :jqmData selector + var oldFind = $.find, + jqmDataRE = /:jqmData\(([^)]*)\)/g; + + $.find = function( selector, context, ret, extra ) { + selector = selector.replace( jqmDataRE, "[data-" + ( $.mobile.ns || "" ) + "$1]" ); + + return oldFind.call( this, selector, context, ret, extra ); + }; + + $.extend( $.find, oldFind ); + + $.find.matches = function( expr, set ) { + return $.find( expr, null, null, set ); + }; + + $.find.matchesSelector = function( node, expr ) { + return $.find( expr, null, null, [ node ] ).length > 0; + }; + + $.extend({ + creatorDict: {}, + + delegateSelfInitWithSingleSelector: function( target, useKeepNative ) { + if ( typeof target !== 'function' ) { + return false; + } + var selector = target.prototype.options.initSelector; + var selectorRE = /:jqmData\(role='[A-z\-]+'\)$/; + if ( selectorRE.test(selector) ) { + var firstIdx = selector.indexOf( "'" ) + 1; + var lastIdx = selector.lastIndexOf( "'" ); + var key = selector.substring( firstIdx, lastIdx ); + if ( !$.creatorDict.hasOwnProperty( key ) ) { + $.creatorDict[key] = {}; + $.creatorDict[key].target = target; + if ( useKeepNative === true ) { + $.creatorDict[key].useKeepNative = useKeepNative; + } + return true; + } + } + return false; + } + }); + + //auto self-init widgets + $( document ).bind( "pagecreate create", function( e ) { + var selector = "*[data-" + $.mobile.ns + "role]"; + $( selector, e.target ).each( function () { + var dataRoleValue = this.getAttribute( "data-role" ), + matchedObj = $.creatorDict[dataRoleValue]; + if ( matchedObj ) { + matchedObj.target.prototype.enhance( this, matchedObj.useKeepNative ); + } + }); + }); +})( 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/jqm/jquery.mobile.define.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.define.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.define.js new file mode 100644 index 0000000..973b05b --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.define.js @@ -0,0 +1,5 @@ +// creates the define method on window, only used where async loading +// is not desired in the docs and experiments +window.define = function() { + Array.prototype.slice.call( arguments ).pop()( window.jQuery ); +}; http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.degradeInputs.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.degradeInputs.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.degradeInputs.js new file mode 100644 index 0000000..00f277b --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.degradeInputs.js @@ -0,0 +1,61 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: Changes input type to another after custom enhancements are made (ex. range > numberic). +//>>label: Degrade Inputs +//>>group: Utilities + + +define( [ "jquery", "./widgets/page" ], function( jQuery ) { +//>>excludeEnd("jqmBuildExclude"); +(function( $, undefined ) { + +$.mobile.page.prototype.options.degradeInputs = { + color: false, + date: false, + datetime: false, + "datetime-local": false, + email: false, + month: false, + number: false, + range: "number", + search: "text", + tel: false, + time: false, + url: false, + week: false +}; + + +//auto self-init widgets +$.mobile.$document.bind( "pagecreate create", function( e ) { + + var page = $.mobile.closestPageData( $( e.target ) ), options; + + if ( !page ) { + return; + } + + options = page.options; + + // degrade inputs to avoid poorly implemented native functionality + $( e.target ).find( "input" ).not( page.keepNativeSelector() ).each(function() { + var $this = $( this ), + type = this.getAttribute( "type" ), + optType = options.degradeInputs[ type ] || "text"; + + if ( options.degradeInputs[ type ] ) { + var html = $( "<div>" ).html( $this.clone() ).html(), + // In IE browsers, the type sometimes doesn't exist in the cloned markup, so we replace the closing tag instead + hasType = html.indexOf( " type=" ) > -1, + findstr = hasType ? /\s+type=["']?\w+['"]?/ : /\/?>/, + repstr = " type=\"" + optType + "\" data-" + $.mobile.ns + "type=\"" + type + "\"" + ( hasType ? "" : ">" ); + + $this.replaceWith( html.replace( findstr, repstr ) ); + } + }); + +}); + +})( 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/jqm/jquery.mobile.docs.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.docs.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.docs.js new file mode 100644 index 0000000..adad1c6 --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.docs.js @@ -0,0 +1,5 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +define( [ "depend!../docs/_assets/js/jqm-docs[jquery]" ], function() { + require( [ "./jquery.mobile" ] ); +}); +//>>excludeEnd("jqmBuildExclude"); http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.events.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.events.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.events.js new file mode 100644 index 0000000..02c39bd --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.events.js @@ -0,0 +1,10 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: Custom events and shortcuts. +//>>label: Events +//>>group: Events + +define( [ "jquery", "./events/touch", "./events/orientationchange" ], function( jQuery ) { +//>>excludeEnd("jqmBuildExclude"); +//>>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/jqm/jquery.mobile.fieldContain.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.fieldContain.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.fieldContain.js new file mode 100644 index 0000000..63751b0 --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.fieldContain.js @@ -0,0 +1,29 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: Styling to responsively position forms and labels based on screen width and add visual separation +//>>label: Fieldcontainers +//>>group: Forms +//>>css.structure: ../css/structure/jquery.mobile.forms.fieldcontain.css +//>>css.theme: ../css/themes/default/jquery.mobile.theme.css + +define( [ "jquery" ], function( jQuery ) { +//>>excludeEnd("jqmBuildExclude"); +(function( $, undefined ) { + +// filter function removes whitespace between label and form element so we can use inline-block (nodeType 3 = text) +$.fn.fieldcontain = function( options ) { + return this + .addClass( "ui-field-contain ui-body ui-br" ) + .contents().filter( function() { + return ( this.nodeType === 3 && !/\S/.test( this.nodeValue ) ); + }).remove(); +}; + +//auto self-init widgets +$.mobile.$document.bind( "pagecreate create", function( e ) { + $( ":jqmData(role='fieldcontain')", e.target ).jqmEnhanceable().fieldcontain(); +}); + +})( 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/jqm/jquery.mobile.grid.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.grid.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.grid.js new file mode 100644 index 0000000..3a25f16 --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.grid.js @@ -0,0 +1,59 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: Applies classes for creating grid or column styling. +//>>label: Grid Layouts (Columns) +//>>group: Widgets +//>>css.structure:../css/structure/jquery.mobile.grid.css +//>>css.theme: ../css/themes/default/jquery.mobile.theme.css + +define( [ "jquery" ], function( jQuery ) { +//>>excludeEnd("jqmBuildExclude"); +(function( $, undefined ) { + +$.fn.grid = function( options ) { + return this.each(function() { + + var $this = $( this ), + o = $.extend({ + grid: null + }, options ), + $kids = $this.children(), + gridCols = { solo:1, a:2, b:3, c:4, d:5 }, + grid = o.grid, + iterator; + + if ( !grid ) { + if ( $kids.length <= 5 ) { + for ( var letter in gridCols ) { + if ( gridCols[ letter ] === $kids.length ) { + grid = letter; + } + } + } else { + grid = "a"; + $this.addClass( "ui-grid-duo" ); + } + } + iterator = gridCols[grid]; + + $this.addClass( "ui-grid-" + grid ); + + $kids.filter( ":nth-child(" + iterator + "n+1)" ).addClass( "ui-block-a" ); + + if ( iterator > 1 ) { + $kids.filter( ":nth-child(" + iterator + "n+2)" ).addClass( "ui-block-b" ); + } + if ( iterator > 2 ) { + $kids.filter( ":nth-child(" + iterator + "n+3)" ).addClass( "ui-block-c" ); + } + if ( iterator > 3 ) { + $kids.filter( ":nth-child(" + iterator + "n+4)" ).addClass( "ui-block-d" ); + } + if ( iterator > 4 ) { + $kids.filter( ":nth-child(" + iterator + "n+5)" ).addClass( "ui-block-e" ); + } + }); +}; +})( 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/jqm/jquery.mobile.init.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.init.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.init.js new file mode 100644 index 0000000..43ff2fe --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.init.js @@ -0,0 +1,168 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: Global initialization of the library. +//>>label: Init +//>>group: Core + + +define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery.mobile.navigation", + "./jquery.mobile.navigation.pushstate", "./widgets/loader", "./jquery.mobile.vmouse", "./jquery.hashchange" ], function( jQuery ) { +//>>excludeEnd("jqmBuildExclude"); +(function( $, window, undefined ) { + var $html = $( "html" ), + $head = $( "head" ), + $window = $.mobile.$window; + + //remove initial build class (only present on first pageshow) + function hideRenderingClass() { + $html.removeClass( "ui-mobile-rendering" ); + } + + // trigger mobileinit event - useful hook for configuring $.mobile settings before they're used + $( window.document ).trigger( "mobileinit" ); + + // support conditions + // if device support condition(s) aren't met, leave things as they are -> a basic, usable experience, + // otherwise, proceed with the enhancements + if ( !$.mobile.gradeA() ) { + return; + } + + // override ajaxEnabled on platforms that have known conflicts with hash history updates + // or generally work better browsing in regular http for full page refreshes (BB5, Opera Mini) + if ( $.mobile.ajaxBlacklist ) { + $.mobile.ajaxEnabled = false; + } + + // Add mobile, initial load "rendering" classes to docEl + $html.addClass( "ui-mobile ui-mobile-rendering" ); + + // This is a fallback. If anything goes wrong (JS errors, etc), or events don't fire, + // this ensures the rendering class is removed after 5 seconds, so content is visible and accessible + setTimeout( hideRenderingClass, 5000 ); + + $.extend( $.mobile, { + addEventBlocker: function () { + $html.addClass( "ui-blocker" ); + $html.bind( "touchstart touchend vclick mousedown mouseup click", function () { + return false; + } ); + }, + + removeEventBlocker: function () { + $html.removeClass( "ui-blocker" ); + $html.unbind( "touchstart touchend vclick mousedown mouseup click" ); + }, + + // find and enhance the pages in the dom and transition to the first page. + initializePage: function() { + // find present pages + var $pages = $( ":jqmData(role='page'), :jqmData(role='dialog')" ), + hash = $.mobile.path.parseLocation().hash.replace("#", ""), + hashPage = document.getElementById( hash ); + + // if no pages are found, create one with body's inner html + if ( !$pages.length ) { + $pages = $( "body" ).wrapInner( "<div data-" + $.mobile.ns + "role='page'></div>" ).children( 0 ); + } + + // add dialogs, set data-url attrs + $pages.each(function() { + var $this = $( this ); + + // unless the data url is already set set it to the pathname + if ( !$this[0].getAttribute( "data-" + $.mobile.ns + "url" ) ) { + $this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname + location.search ); + } + }); + + // define first page in dom case one backs out to the directory root (not always the first page visited, but defined as fallback) + $.mobile.firstPage = $pages.first(); + + // define page container + $.mobile.pageContainer = $.mobile.firstPage.parent().addClass( "ui-mobile-viewport" ); + + // alert listeners that the pagecontainer has been determined for binding + // to events triggered on it + $window.trigger( "pagecontainercreate" ); + + // cue page loading message + $.mobile.showPageLoadingMsg(); + $.mobile.addEventBlocker(); + + //remove initial build class (only present on first pageshow) + hideRenderingClass(); + + // if hashchange listening is disabled, there's no hash deeplink, + // the hash is not valid (contains more than one # or does not start with #) + // or there is no page with that hash, change to the first page in the DOM + // Remember, however, that the hash can also be a path! + if ( ! ( $.mobile.hashListeningEnabled && + $.mobile.path.isHashValid( location.hash ) && + ( $( hashPage ).is( ':jqmData(role="page")' ) || + $.mobile.path.isPath( hash ) || + hash === $.mobile.dialogHashKey ) ) ) { + + // Store the initial destination + if ( $.mobile.path.isHashValid( location.hash ) ) { + $.mobile.urlHistory.initialDst = hash.replace( "#", "" ); + } + $.mobile.changePage( $.mobile.firstPage, { transition: "none", reverse: true, changeHash: false, fromHashChange: true } ); + } + // otherwise, trigger a hashchange to load a deeplink + else { + $window.trigger( "hashchange", [ true ] ); + } + } + }); + + // initialize events now, after mobileinit has occurred + $.mobile.navreadyDeferred.resolve(); + + // check which scrollTop value should be used by scrolling to 1 immediately at domready + // then check what the scroll top is. Android will report 0... others 1 + // note that this initial scroll won't hide the address bar. It's just for the check. + $(function() { + // window.scrollTo( 0, 1 ); + + // if defaultHomeScroll hasn't been set yet, see if scrollTop is 1 + // it should be 1 in most browsers, but android treats 1 as 0 (for hiding addr bar) + // so if it's 1, use 0 from now on + $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $.mobile.$window.scrollTop() === 1 ) ? 0 : 1; + + + // TODO: Implement a proper registration mechanism with dependency handling in order to not have exceptions like the one below + //auto self-init widgets for those widgets that have a soft dependency on others + if ( $.fn.controlgroup ) { + $.mobile.$document.bind( "pagecreate create", function( e ) { + $( ":jqmData(role='controlgroup')", e.target ) + .jqmEnhanceable() + .controlgroup({ excludeInvisible: false }); + }); + } + + //dom-ready inits + if ( $.mobile.autoInitializePage ) { + $.mobile.initializePage(); + } + + // window load event + // hide iOS browser chrome on load + $window.load( $.mobile.silentScroll ); + + if ( !$.support.cssPointerEvents ) { + // IE and Opera don't support CSS pointer-events: none that we use to disable link-based buttons + // by adding the 'ui-disabled' class to them. Using a JavaScript workaround for those browser. + // https://github.com/jquery/jquery-mobile/issues/3558 + + $.mobile.$document.delegate( ".ui-disabled", "vclick", + function( e ) { + e.preventDefault(); + e.stopImmediatePropagation(); + } + ); + } + }); +}( 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/jqm/jquery.mobile.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.js new file mode 100644 index 0000000..d386b6e --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.js @@ -0,0 +1,38 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>group: exclude + +define([ + 'require', + './widgets/loader', + './jquery.mobile.navigation', + './jquery.mobile.navigation.pushstate', + './jquery.mobile.transitions', + './jquery.mobile.degradeInputs', + './widgets/dialog', + './widgets/page.sections', + './widgets/collapsible', + './widgets/collapsibleSet', + './jquery.mobile.fieldContain', + './jquery.mobile.grid', + './widgets/navbar', + './widgets/listview', + './widgets/listview.filter', + './widgets/listview.autodividers', + './jquery.mobile.nojs', + './widgets/forms/checkboxradio', + './widgets/forms/button', + './widgets/forms/slider', + './widgets/forms/textinput', + './widgets/forms/select.custom', + './widgets/forms/select', + './jquery.mobile.buttonMarkup', + './jquery.mobile.controlGroup', + './jquery.mobile.links', + './widgets/fixedToolbar', + './widgets/popup', + './jquery.mobile.zoom', + './jquery.mobile.zoom.iosorientationfix' +], function( require ) { + require( [ './jquery.mobile.init' ], function() {} ); +}); +//>>excludeEnd("jqmBuildExclude"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-tizen/blob/e21e0780/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.links.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.links.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.links.js new file mode 100644 index 0000000..1c13bc4 --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.links.js @@ -0,0 +1,26 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: Adds classes to links. +//>>label: Link Classes +//>>group: Utilities + + +define( [ "jquery" ], function( jQuery ) { +//>>excludeEnd("jqmBuildExclude"); +(function( $, undefined ) { + +$.mobile.$document.bind( "pagecreate create", function( e ) { + + //links within content areas, tests included with page + $( e.target ) + .find( "a" ) + .jqmEnhanceable() + .not( ".ui-btn, .ui-link-inherit, :jqmData(role='none'), :jqmData(role='nojs')" ) + .addClass( "ui-link" ); + +}); + +})( 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/jqm/jquery.mobile.media.js ---------------------------------------------------------------------- diff --git a/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.media.js b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.media.js new file mode 100644 index 0000000..3ef76e4 --- /dev/null +++ b/templates/CordovaTizenWebUIFrameworkTemplate/project/tizen-web-ui-fw/latest/js/modules/jqm/jquery.mobile.media.js @@ -0,0 +1,52 @@ +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +//>>description: A workaround for browsers without window.matchMedia +//>>label: Match Media Polyfill +//>>group: Utilities + + +define( [ "jquery", "./jquery.mobile.core" ], function( jQuery ) { +//>>excludeEnd("jqmBuildExclude"); +(function( $, undefined ) { + +var $window = $.mobile.$window, + $html = $( "html" ); + +/* $.mobile.media method: pass a CSS media type or query and get a bool return + note: this feature relies on actual media query support for media queries, though types will work most anywhere + examples: + $.mobile.media('screen') // tests for screen media type + $.mobile.media('screen and (min-width: 480px)') // tests for screen media type with window width > 480px + $.mobile.media('@media screen and (-webkit-min-device-pixel-ratio: 2)') // tests for webkit 2x pixel ratio (iPhone 4) +*/ +$.mobile.media = (function() { + // TODO: use window.matchMedia once at least one UA implements it + var cache = {}, + testDiv = $( "<div id='jquery-mediatest'></div>" ), + fakeBody = $( "<body>" ).append( testDiv ); + + return function( query ) { + if ( !( query in cache ) ) { + var styleBlock = document.createElement( "style" ), + cssrule = "@media " + query + " { #jquery-mediatest { position:absolute; } }"; + + //must set type for IE! + styleBlock.type = "text/css"; + + if ( styleBlock.styleSheet ) { + styleBlock.styleSheet.cssText = cssrule; + } else { + styleBlock.appendChild( document.createTextNode(cssrule) ); + } + + $html.prepend( fakeBody ).prepend( styleBlock ); + cache[ query ] = testDiv.css( "position" ) === "absolute"; + fakeBody.add( styleBlock ).remove(); + } + return cache[ query ]; + }; +})(); + +})(jQuery); +//>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude); +}); +//>>excludeEnd("jqmBuildExclude");
