Commit graph

218 commits

Author SHA1 Message Date
scottjehl
ffa35c0548 improved minheight page logic 2011-06-17 19:19:47 -04:00
scottjehl
fcbfc2f380 added minScrollBack feature to core options. This is the minimum scroll distance that will be jumped-to when returning to a page. By default, the distance is screen.height /2. If you really needed to disable scroll memory altogether, this could be set to Infinity. Note that disabling scroll memory altogether is almost never a good idea for usability, but the option is there. 2011-06-17 19:19:47 -04:00
scottjehl
3bd713c185 added resetActivePage on pagecreate, orientationchange, and after transitions. 2011-06-17 19:19:47 -04:00
scottjehl
690dc66f7c set heights including respective scrolls 2011-06-17 19:19:46 -04:00
scottjehl
aa950ba125 Only call scrollTo if there's a scroll distance we need to go to. If the distance we're jumping to is 20px or less, let it go in for tolerance. Reset toPage height before scrolling, focusing. 2011-06-17 19:19:46 -04:00
scottjehl
df7ac2f642 fix up the page heights during transitions, and min-heights otherwise. 2011-06-17 19:19:46 -04:00
scottjehl
ed7aae1d1c hide address bar during page changes by catching ajax clicks early through binding to touchend, and make pages fit screen height during transitions 2011-06-17 19:19:46 -04:00
scottjehl
722ed2cbbf If ajax is disabled, exit the click handler early and avoid parsing the href at all. Thanks for the idea, @toddparker! Fixes #1846. 2011-06-17 18:33:16 -04:00
Kin Blas
96b3e710d4 Added utility functions $.mobile.getDocumentBase() and $.mobile.getDocumentUrl() so that developers can retrieve the original base and url used when loading the document. 2011-06-16 15:43:40 -07:00
Kin Blas
8b6d14bb03 Fix for issue 1826 - Nightly build - dialog box no longer rounded corners
- Don't set a default value for the 'role' option to loadPage() and changePage(). Instead, rely on the role attribute that is on the element.

- Fixed an error that was happening when a hash change involves going from a dialog back to another dialog. I had recently made changes that assumed the 'to' variable was always going to be a url string, but it turns out in the dialog back to dialog case, it is an actual jQuery collection.
2011-06-16 13:36:39 -07:00
Kin Blas
d2f115349a Fix for issue 1833 - No page transition used when hitting the browser forward button
- Don't use the transition of the initial page on the stack.
2011-06-15 15:28:52 -07:00
jblas@adobe.com
dd69372dd4 Adjusted the urlParserRE regexp to account for double slashes in the directory path to work around a phonegap 0.9.4. 2011-06-15 10:37:08 -07:00
Kin Blas
c011f51f14 Removed unused path.isRelative() function. Replaced unit tests for isRelative() with tests for path.isRelativeUrl. 2011-06-13 16:45:10 -07:00
Kin Blas
e286808391 Rule of thumb ... get your logic right and your code will behave as you expect.
- I should've been using !== instead === when figuring out docBaseDiffers.
2011-06-10 16:13:58 -07:00
Kin Blas
963a84cb18 IE7 returns an empty string for regexp submatches while all other browsers return undefined. Modified the parseUrl() function to normalize all non-matches to an empty string and replaced all strict checks for undefined to strict checks for an empty string. 2011-06-10 15:31:09 -07:00
Kin Blas
244385b9f9 Merge branch 'master' into path-fixes 2011-06-10 10:02:11 -07:00
Kin Blas
b7bcf93620 - We were missing a changepage notification in the case where we were transitioning to the same page.
- Added changepagefailed notification for the case where the load fails. Note we still need beforeloadpage/loadpage notifications.

- Misc fixes to stop the navigation unit tests from seemingly random failures. It seems that the hash resets in setup/teardown of the test modules sometimes interferes with the changePage() requests in the tests. Added code to the setup/teardown functions to wait for the reset to complete before moving on to the tests.
2011-06-10 10:00:25 -07:00
frietsch
d99d096ab7 Bugfix: ":jqmData(ajax='false')" might also match forms, which have neither of "src" or "href". In that case, thisUrl is undefined, and the following replace results in an error. 2011-06-09 08:21:21 -07:00
Kin Blas
3d6bd402a2 - Changes to get the navigation_helpers.js unit tests green.
- Modified isExternal so that it returns true/false to help with unit tests.
2011-06-08 17:20:01 -07:00
Kin Blas
8e1e77badf Get deep linking to internal pages working again. We can now also deep link to nested list sub-pages that are contained within internal pages. 2011-06-08 15:06:41 -07:00
Kin Blas
33b9ee8052 Changes to make sure the data-url are either an id, site relative path (for same domain), or absolute Url (for cross-domain Phone Gap). 2011-06-08 14:47:24 -07:00
Kin Blas
a99728d178 - Added addSearchParams() utility function.
- Removed unused path functions: setOrigin(), makeAbsolute(), and isQuery().
- Modified loadPage() so that it uses addSearchParams() instead of naively appending it to the URL.
- Switched the global "click" handler back to using the link @href attribute and manually converting it to an absolute URL. This was necessary because it turns out that the href property on a link is dynamically calculated at the time of access based on the *CURRENT* base tag setting. This means the same link can return a different href value if the the base tag is different each time you access it.
2011-06-06 15:58:21 -07:00
Kin Blas
19f1a775b9 Missed a couple of places I should've used hrefNoHash when I converted documentBase to an urlObject. 2011-06-04 10:51:41 -07:00
Kin Blas
f9dd767528 Switched form handler over to processing absolute urls. 2011-06-04 01:22:16 -07:00
Kin Blas
ba502f0aff Changes to switch the global link click handler over to processing absolute urls. 2011-06-04 00:26:25 -07:00
Kin Blas
b148ee424a Added isSameDomain() Utility function. 2011-06-03 13:57:25 -07:00
Kin Blas
b31825a1d7 Fixed issue 1767 - loadPage/changePage broken in trunk (latest build)
- Not sure how/why I added that extra absUrl, but its gone now.
2011-06-02 10:41:55 -07:00
Kin Blas
a2182dafa9 - Added a getClosestBaseUrl() utility function for calculating the correct base URL to use for a given element.
- We should be using makeUrlAbsolute() instead of makePathAbsolute() when calculating the documentBase.
- Removed bogus code in pathname calculatino in makeUrlAbsolute().
- Reworked calculation of search in makeUrlAbsolute() to prevent an undefined in the case where rel and abs urls have no search.
2011-06-01 17:15:18 -07:00
Kin Blas
3ca5dd854a - Added URL parsing and relative to absolute path and url utility methods.
- Switched the base tag management code over to using new utilities.
2011-06-01 11:59:13 -07:00
Kin Blas
ef9d55f4b6 Hopefully the last set of fixes for issue 1712 - $.mobile.changePage broken in latest
- The test case calls changePage() with a hash ("#b"). In our normal processing of clicks/form submits we strip it before calling. The old code did a strip in changePage() just in case, so I added it back in to fix the last bug.
2011-05-27 10:53:19 -07:00
Kin Blas
6fdb90df17 Fixed a typo in $.mobile.loadPage.defaults. The default for the data property should be undefined, not the string "undefined". 2011-05-26 17:04:27 -07:00
Kin Blas
7befe9087a The signature of changePage() has changed but folks need some time to transition to using the new signature. I added code to changePage() that maps any old signature calls to changePage() into a new call. This should fix issue 1712 ($.mobile.changePage broken in latest). This code should be removed before shipping 1.0. 2011-05-26 16:39:09 -07:00
Kin Blas
bee8549a18 Fixed a bad typo caught by @johnbender and @gseguin.
- Replaced an un-intentional semi-colon with a comma.
2011-05-25 15:13:44 -07:00
scottjehl
8929ac33b9 Removed the ajaxLinksEnabled and ajaxFormsEnabled settings. These were deprecated in a4 and scheduled for removal. Automated link and form ajax handling can still be globally disabled via the ajaxEnabled option. 2011-05-24 16:08:30 -04:00
Kin Blas
786ef25e0a Changes to get the navigation unit tests green again.
- Modified changePage() to set isPageTransitioning earlier.
- Modified pageSequence() to allow the current changepage callback stack to unwind before firing off the next function in the sequence.
2011-05-23 14:30:40 -07:00
John Bender
dc530ea751 page sequence helper added, nav tests in a somewhat better state. the event trigger spot, namespace, and general setup are all up for debate 2011-05-21 22:15:12 -07:00
Kin Blas
5ba2cc975e Inverted the logic around ignoreNextHashChange so that it actually matches the name of the variable.
Modified the hashchange callback so that it specifies a "none" transition, instead of a false boolean, for the case where the hash changed and there is nothing on the urlHistory stack.
2011-05-20 15:19:54 -07:00
Kin Blas
edc94fb6ec The dialog "pop" unit test was failing because the active variable in changePage() was being dereferenced. The unit test clears the urlHistory.stack array manually so we just need to make sure we don't dereference active if it doesn't exist. 2011-05-19 17:01:26 -07:00
Kin Blas
59afbda49b Added a pageContainer option to changePage and loadPage. 2011-05-18 18:06:15 -07:00
Kin Blas
3a047112a0 Removed debug try/catch block I accidentally checked in.
Made lots of whitespace changes to bring file up to jquery core style guidelines.
2011-05-18 16:38:04 -07:00
Kin Blas
cafb6acef9 Separated changePage() into 2 functions:
- loadPage() now loads all pages into the DOM.
	- changePage() only functions on pages that are in the DOM. If you call it with a URL instead of an element, it will call loadPage() which will then trigger a call to changePage() with the resulting page at a later time.
2011-05-18 15:58:15 -07:00
Kin Blas
b96310eedf - Externalize some of the nested functions in changePage().
- Modified changePage() so that it can take an options object. Updated all references throughout the framework.
- Split $.mobile.pageLoading() into 2 functions $.mobile.show/hidePageLoadingMsg(). Updated docs accordingly.
- Renamed $.mobile.defaultTransition to $.mobie.defaultPageTransition. Updated docs accordingly.
- Added $.mobile.defaultDialogTransition so that it isn't hard coded in the changePage/transitionPages and select code.
- Hand integrated jquery.mobile.navigation.js checkins from master: 4b4ee54a, e775f5e8, e597ccb3, 084bbbd8.
2011-05-16 16:02:26 -07:00
Kin Blas
52a666d71f Check $from before dereferencing it. 2011-04-26 16:36:31 -07:00
Kin Blas
19c06952fd Changes to allow 3rd party transitions. Developers can now register a custom transition by adding their transition handler to the $.mobile.transitionHandlers dictionary. The name of the custom transition is used as the key within the transtionsHandlers dictionary, and should be the same name used within the @data-transtion attribute.
The expected prototype for a transitionHandler is as follows:

function handler(name, reverse, $to, $from)

The name parameter is the name of the transition as specified by @data-transition attribute, reverse is a boolean that is false for a normal transition, and true for a reverse transition. The $to param is a jQuery collection containing the page that is being transitioned "to", and $from is an optional collection that tells us what page we are transitioning "from". Because $from is optional, handler developers should take care and check $from to make sure it is not undefined before attempting to dereference it.

In addition to registering custom transition by name, developers can specify a handler to use in the case where a transition name is specified and does not exist within the $.mobile.transitionHanlders dictionary. Within jQuery Mobile, the default handler for unknown transition types is the $.mobile.css3Transition() handler. This handler always assumes that the transition name is to be used as a CSS class to be placed on the $to and $from elements. To change the default handler, simply set $.mobile.defaultTransitionHandler to you function handler:

$.mobile.defaultTransitionHandler = myTransitionHandler;

The changes to make all this necessary are as follows:

- Created $.mobile.noneTransitionHandler which is the default transitionHandler for the framework that simply adds and removes the page active class on the $from and $to pages with no animations.

- Moved class based transition code into a new plugin jquery.mobile.transition.js file. This plugin, when present, overrides the noneTransitionHandler as the defaultTranstionHandler for the framework so that CSS3 animation transitions are available.

- Removed code related to the setting/removal of the ui-mobile-viewport-perspective class. The css3TransitionHandler plugin takes care of automatically placing a "viewport-<transition name>" class on the viewport (body) element. This allows any other transition to specify properties on the viewport that are necessary to accomplish the transition.

- changed the CSS class ui-mobile-viewport-perspective to viewport-flip to match code changes. This makes it more apparent that setting -webkit-perspective is only used with the flip transition.

- Updated js/index.php, Makefile and build.xml to include the new jquery.mobile.transition.js file.
2011-04-26 14:06:10 -07:00
Kin Blas
f7749504b8 Modified the vclick handler code in navgation.js so that it doesn't place the ui-btn-active class on any links meant for interactivity.
Removed the return false in the vclick handler of collapsible and replaced it with a preventDefault(). The only reason we were returning false was to stopPropagation() so that the vclick handler in navigation.js  didn't place a ui-btn-active on it.
2011-04-22 10:53:24 -07:00
Kin Blas
2d2e6d7741 Fix for issue 1461 - Tops of pages missing after dialog click in Safari and iPhone.
- Delayed the setting of focus till *AFTER* the scroll position is restored.
2011-04-21 15:31:21 -07:00
John Bender
dbd68472b4 whitespace and comment fixes 2011-04-18 22:35:13 -07:00
John Bender
8e42b52767 beginning to move to absolute hashes in all cases, still some more work to do 2011-04-18 21:46:53 -07:00
Kin Blas
c31ee33a0f Fix for 1407 - Bad scroll performance since A4 on iPhone 3G
- Modified vmouse code so that it uses $.data() instead of $().data() which is significantly faster.

- Modified the navigation and buttonMarkup code so they stop using live(). The vmouse code triggers several events during the touch events, which in turn causes the underlying event code to call $.closest() with the selector used during the live() call to figure out if the event should be handled. This turns out to be very expensive, so instead, we now just bind directly to the document, and walk the DOM manually to figure out if we should handle it. This is much faster since we are avoid triggering multiple nested function calls.
2011-04-18 16:13:50 -07:00
scottjehl
472cbb1778 moved calls into one. #cleaning 2011-04-17 14:24:47 -07:00