Commit graph

53 commits

Author SHA1 Message Date
Alex Kovar
e3a5dd5b09 fixed base undefined error in firefox 2011-02-02 13:10:40 -06:00
Alex Kovar
2754087fc7 externalize $.mobile.urlHistory.clear function 2011-02-02 12:58:27 -06:00
scottjehl
675deb1282 Merge remote branch 'origin/master' 2011-02-02 00:59:59 -05:00
John Bender
4ddc5c7dd5 Merge branch 'changepagefix' of https://github.com/ajkovar/jquery-mobile into ajkovar-changepagefix 2011-02-01 21:36:24 -08:00
scottjehl
4023e1bf68 select menus also need blurring on transition. 2011-02-02 00:11:16 -05:00
Jesse Streb
e15ce80702 moved the setTimeout within the transition to be in the success handler of the ajax response. We now wrap the transitionPages that we call after injecting the new page into the DOM within the setTimeout which fixes the same issue but limits to pages that are injected into the DOM and makes it more clear why we have the setTimeout 2011-02-01 21:44:23 -05:00
Alex Kovar
d4c8c3cee2 fix for $.mobile.urlHistory test 2011-02-01 14:08:19 -06:00
Alex Kovar
1eed03cf0c Fixed issue with simultaneous page transitions. Closes gh-856
Conflicts:

	js/jquery.mobile.navigation.js
	tests/unit/navigation/navigation_transitions.js
2011-02-01 14:07:17 -06:00
scottjehl
3f938fd2f9 fixed bug where a preset data-url was being prefixed by the base url, rather than replacing the whole hash. Fixes #591 2011-02-01 12:32:02 -05:00
scottjehl
6855363375 changing this selector to be more specific prevents an error in IE 7 (and win mobile). Support is coming :) 2011-02-01 11:53:32 -05:00
Mark Schuette
f640646877 added the ability to use the default behavior of links with data-ajax=false 2011-02-01 14:13:04 +08:00
scottjehl
a5c8f86d10 links with no href attribute will not throw an error when clicked. Fixes #932 2011-02-01 01:01:41 -05:00
scottjehl
6eefb23406 changed the name of urlHistory.listeningEnabled to urlHistory.ignoreNextHashChange. The name more accurately reflects the purpose of this internal toggle. Unit tests included. Also Fixes #930 2011-01-31 23:56:56 -05:00
scottjehl
35b1df81e7 changePage was firing more than once because hash listening was not disabled long enough to prevent listening of the resulting async hashchange event after setting location.hash. This change makes urlHistory.listeningEnabled act as an internal toggle (as it used to), so it is only meant for ignoring a single hashchange event. A future change might be appropriate to change its name to something more like "ignoreNextHashChange".
Unit test included.

Fixes #930
2011-01-31 23:47:01 -05:00
scottjehl
3162428558 added hashListeningEnabled global flag. This is meant as a global config option for end users to disable hashchange listening (as opposed to urlHistory.listeningEnabled, which is an internal toggle). Unit test included. Fixes #748 2011-01-31 23:25:36 -05:00
scottjehl
d509404b72 Merge remote branch 'origin/master'
Conflicts:
	js/jquery.mobile.navigation.js
2011-01-31 17:33:25 -05:00
scottjehl
b3a8230638 This commit includes simplifications to the hashchange event handling & changePage logic, which results in a few bug fixes and removal of some previous limitations. Details:
- jquery.mobile.core.js  no longer creates pages from every page and dialog in the DOM automatically at domready. Instead, pages are created as they are referenced via changePage, which can speed up pageload in multi-page documents, and means local "dialogs" referenced via data-rel="dialog" no longer need a data-role="dialog" attribute when served.

- in changePage, "from" is now allowed to be undefined. This simplifies the logic involved in showing the first page, which never had a "from" page, and previously needed a custom pageChange workaround to accommodate that.

- The pageshow event is no longer used as a callback for returning false and preventing the $.mobile.activePage from being set to the newly shown page. In other words, a page always becomes $.mobile.activePage once its shown now (the only reason this was optional before was because of a dialog restriction that's no longer true)

- the hashchange event logic for showing a particular page is now greatly simplified. It either shows the page referenced in location.hash, or if there's no hash it changes to the first page in the dom. This means every pageshow (including the first one) now uses pageChange internally.

- the hashchange event listener is no longer disabled when ajaxEnabled == false. Doing this before prevented local non-ajax page navigation from working properly. To disable hashchange listening, use $.mobile.urlHistory.listeningEnabled. We might consider defining (or moving) this on the $.mobile hash later as well for easier access.

- The internal var $.mobile.startPage is now $.mobile.firstPage, because it's not necessarily the page you started on, but merely a reference to the first "page" in the dom.

- Back buttons are auto-added to every page after the first one you first visit (this includes generated pages, such as those in a multipage document or nested listviews). Keep in mind that a "back" button does not take the place of a standard "home" link, and when building an app with jQuery Mobile, it's good to make use of both (particularly on deep-linked pages). Fixes #908
2011-01-31 17:05:57 -05:00
John Bender
591593dd49 misplaced semicolon 2011-01-31 00:13:01 -08:00
adammessinger
cb4f540645 Fixes #900 - buttons with rel attribute set to external don't show active state 2011-01-30 23:43:53 -08:00
John Bender
8b5f083974 whitespace and missing semicolon in setTimeout for non webkit animationComplete 2011-01-30 22:03:30 -08:00
Alex Kovar
4830ac9e9b tweak for animationComplete 2011-01-30 23:00:51 -06:00
Alex Kovar
62af59983f made $.fn.animationComplete behave more consistently between webkit/non-webkit. Closes gh-918 2011-01-30 17:06:33 -06:00
Jesse Streb
378fb51225 [#455] For the transitions we now have overflow: hidden in order to limit the flickering. We always scroll to the top before we start our transitions in order to make it scroll. The CSS changed to have overflow: hidden during transitions and have a height that is larger enough to keep the address bar hidden. 2011-01-27 12:28:04 -05:00
scottjehl
9a492d06fd allow form data to be passed to $.mobile.changePage as a query string or object. 2011-01-26 22:04:36 -05:00
scottjehl
700ca984bb finished up some navigation changes. Also added and documented a data-rel="back" attribute, which can be applied to links to enhance them to mimica the browser's back button (good for closing dialogs). In these changes, dialogs now create a history hash entry, and the back button works better for closing dialogs. Also, nested list deep-linking is restored after a recent regression. Tests in Navigation and Listview are passing. Fixes #885. Fixes #866. 2011-01-26 14:38:17 -05:00
scottjehl
2c6cc45ad0 incomplete, but close to fixing the dialog-create-history entry piece. Also includes fix for nested-listview deep linking regression. 2011-01-26 14:27:10 -05:00
scottjehl
9ed13f86c8 hashchange event handler should still load the first url, even if Ajax is disabled. Fixes #879 2011-01-25 22:39:29 -05:00
scottjehl
3df24fab6d fixed a regression in safari where images wouldn't load properly because base was being set after html was appended. 2011-01-25 00:29:19 -05:00
scottjehl
5d5336d8b0 fixed firefox regression. check if base is set/supported before setting. 2011-01-24 23:56:53 -05:00
scottjehl
0ba9acfc33 added support for URL updating via a preset data-url on the page div when it is sent from the server.
If data-url is set on a page div when it returns from the server, it's value will be used to replace the url in the hash, and as the base url for future requests if it adds additional segments (such as a trailing slash). This will enable developers to work around the limitation of directory links requiring a trailing slash, and will also allow developers to specify a new url after a redirect occurs (such as after a login). Fixes #867
2011-01-24 19:35:45 -05:00
scottjehl
2e6a396278 added ajaxEnabled option. ajaxLinksEnabled and ajaxFormsEnabled are deprecated and will be removed by 1.0. Fixes #851 2011-01-23 19:03:35 -05:00
scottjehl
be8eb3d0c6 deprecated data-back attribute on links in favor of data-direction="reverse". Updated docs and relevant demos. 2011-01-23 18:12:46 -05:00
scottjehl
9b57c46349 Refactored urlStack and updated dialog and page plugins to match. jQuery Mobile's internal history now attempts to follow the history menu when urls change from hashchange, even for changes that go multiple steps forward or back. The internal history stack is now pruned based on whether a user goes back and then changes direction, whereas before a back-button click would result in a pop off the history. Instead we now maintain an active index number in the history stack, which allows us to maintain references to transitions that are saved on pages reached through clicking the forward button as well. This fixes #636.
In the process, some other small changes should be noted:
urlStack is now urlHistory, a hash of methods and properties used for history stack management (stack, activeIndex, getActive, getPrev, getNext, addNew, clearForward, and listening Enabled). All these are documented inline and exposed on $.mobile.urlHistory (I'm not sure these will be publicly documented, but just exposed internally for plugins for now).

$.changePage has two argument changes: the "back" argument is now called "reverse"; this results in no change from an end-user standpoint, but reflects the fact that it only reverses the direction of a transition without affecting the internal history stack, and second, a new argument at the end defines whether changePage was called from a hashChange which makes that url open to history menu guessing.
2011-01-23 17:33:36 -05:00
scottjehl
9e4b0a484c Overhauled path object and exposed it and the base object via $.mobile. Form and Link handlers now use the path methods internally. Unit tests adjusted, but more are needed to fully cover the path and base propeties and methods. Fixes #566. 2011-01-22 17:42:07 -05:00
scottjehl
6fb50fd289 use inArray instead of indexOf. Fixes #828 2011-01-22 14:04:04 -05:00
John Bender
e5d2bf1b66 added target check to $.mobile.isExternalLink 2011-01-20 23:05:37 -08:00
John Bender
8a5060de13 fixed issue with dialog click handler breaking transitions on external links Fixes #642 2011-01-19 23:48:30 -08:00
Kin Blas
02c9264f0d Fix for issue 613 - Jquery Mobile ignores original 'base' tag defined in HTML
- Fixed baseTagTest() in jquery.mobile.support.js, so that it uses any pre-existing base tag for testing. This fixes the bug on Webkit (Safari) where the relative paths for links were being resolved/expressed with the document path instead of the original base path.

- Modified the base code in jquery.mobile.navigation.js so that it uses the initial path of a pre-existing base tag, instead of always using the document path. This means that a document with a URL such as:

    http://foo.com/a/b/c#docs/pages/index.html

That uses a base tag like:

    <base href="http://foo.com/bar/">

Will resolve properly:

    http://foo.com/bar/docs/pages/index.html

so the mobile page gets loaded properly.

- Reduced the path.get() function down to a couple of regexp replace() calls.
2011-01-18 09:18:22 -08:00
Kin Blas
5617d0c8d3 Merge branch 'delay_duplicateCachedPage' of https://github.com/medovob/jquery-mobile into pull662
Had to fix merge conflicts in:
	js/jquery.mobile.navigation.js
2011-01-11 14:12:07 -08:00
John Bender
96d941ebe9 added the ability to disable ajax forms with data-ajax=false, attribute up for debate, Fixes #519 2011-01-08 23:47:07 -08:00
John Bender
b8babd1003 removed console log and added test for default transition 2010-12-16 19:12:58 -08:00
John Bender
7ffec259c5 added tests for explicit transition on back 2010-12-16 18:21:46 -08:00
John Bender
67aed1320b prefer explicit transition even when the url is popped of the stack Fixes #627 2010-12-16 18:20:17 -08:00
John Bender
95ef08b269 perspective class only added on flip page transition or any transition added to the perspectiveTransitions local var in the transitionPages function Fixes #568 2010-12-13 02:21:40 -08:00
Richard Stutfield
0a87b59a04 Navigation: delay removal of duplicateCachedPage 2010-12-10 12:27:14 +00:00
Kin Blas
4882c068b0 Modified loadComplete() so that it always fires off the "show" event. The idea here is that calling preventDefault() on a "hide" event shouldn't prevent the "show" event from being dispatched. Calling preventDefault() on the "show" event still prevents the "to" page from becoming the active page.
Removed redundant target delcaration in the <a> live click callback.
2010-12-08 12:40:21 -08:00
scottjehl
80d56e655b Changed page navigation scripting to use data-url attributes instead of IDs for storing page URLs. This fixes a number of issues, most importantly #477, which exposed a conflict between jQuery's selector engine that would result in un-enhanced pages whenever linking between two pages in the same directory.
The shift away from interal ID attribute usage also allows users to bind page events (pagecreate, pagebeforecreate) to a page div by its ID, which was a frequent cause of confusion when it didn't work as expected in former versions of the framework.

Seemingly unrelated: these commits allow you to specify data-role="dialog" in multipage and single page templates. In multipage templates, the role must be on the page (a link with data-rel alone will not work in multi-page). This addresses issue number 464, but may need further testing for obscure scenarios.

Fixes #477 (Pages are not enhanced when linking to a filename without a path)
Fixes #493 (Click the same link twice -> blank page)
Fixes #513 (closing dialog + returning to the same dialog)
Fixes #550 (changePage() not updating hash for internal pages - breaks )
Fixes #464 (Dialogs don't work within multi-pages)
Fixes #633 (Recent change to prevent same-page requests breaks select menu close button)
Fixes #599 (Page ids & page specific events)
Fixes #634 (After a bad page request, base url is not reset to current path)

booya.
2010-12-07 12:05:10 -05:00
scottjehl
2931fffb91 blur the active/focused element on changepage sooner. Thx @goulvench 2010-12-04 14:46:41 -05:00
scottjehl
74ebc360ca make sure hashchange event never causes additional hash changes to occur when responding with a page change 2010-12-04 13:13:55 -05:00
Jesse Streb
b725ff8f6a https://github.com/jquery/jquery-mobile/issues#issue/493 If changePage is called with to parameter that matches the current page we simply return out of the function 2010-12-04 13:13:55 -05:00