jackbone.js
function (pageName, page, role) {
            // Extends Views
            // Create JQuery Mobile Page
            var pageid = 'pagename-' + pageName.toLowerCase();
            var isExistingPage = $('#' + pageid);

            // For already existing pages, only delegate events so they can
            // handle onPageBeforeShow and onPageShow.
            if (isExistingPage.length === 1) {

                // Sometimes, controller may have been destroyed but the
                // HTML stayed in the DOM (in case of an exception).
                // We can detect that using needRedraw, which indicate
                // that we have to do a full repaint.
                if (page.needRedraw) {
                    page.render();
                }
                else {
                    page.refresh();
                    page.delegateEvents();
                }

            } else {
                // Create the page, store its page name in an attribute
                // so it can be retrieved later.
                page.el.id = 'pagename-' + pageName.toLowerCase();
                page.el.className = 'page-container';

                // Render it and add it in the DOM.
                page.render();

                if (Jackbone.manualMode) {
                    // Create the new page
                    page._onPageBeforeCreate();
                    Jackbone.trigger('createview', page);
                    page._onPageManualCreate();
                    page._onPageCreate();
                }

                // Append to the DOM.
                document.body.appendChild(page.el);
            }

            if (!Jackbone.manualMode) {
                // Select the transition to apply.
                var t = this.selectTransition(pageName, role);

                // Perform transition using JQuery Mobile
                $.mobile.changePage(page.$el, {
                    changeHash:    false,
                    transition:    t.transition,
                    reverse:       t.reverse,
                    role:          role,
                    pageContainer: page.$el
                });
            }
            else {

                var currentActivePage = Jackbone.activePage;
                try {
                    // Hide previous page, show next
                    if (Jackbone.activePage) {
                        Jackbone.activePage._onPageBeforeHide();
                    }
                    page._onPageBeforeShow();
                    page.$el.show();
                    if (Jackbone.activePage) {
                        Jackbone.activePage.$el.hide();
                        Jackbone.activePage._onPageHide();
                    }
                    page._onPageShow();

                    // Update 'activePage'
                    Jackbone.activePage = page;
                    $.mobile.activePage = page.$el;
                }
                catch (error) {
                    page.$el.hide();
                    if (currentActivePage) {
                        currentActivePage.$el.show();
                        Jackbone.activePage = currentActivePage;
                        $.mobile.activePage = currentActivePage.$el;
                    }
                    throw new Error('Failed to changePage: ' + error);
                }
            }

            // Current hash is stored so a subsequent openView can know
            // which page it comes from.
            this.currentHash = Jackbone.history.getFragment();
        }
function (pageName, page, role) {
            // Extends Views
            // Create JQuery Mobile Page
            var pageid = 'pagename-' + pageName.toLowerCase();
            var isExistingPage = $('#' + pageid);

            // For already existing pages, only delegate events so they can
            // handle onPageBeforeShow and onPageShow.
            if (isExistingPage.length === 1) {

                // Sometimes, controller may have been destroyed but the
                // HTML stayed in the DOM (in case of an exception).
                // We can detect that using needRedraw, which indicate
                // that we have to do a full repaint.
                if (page.needRedraw) {
                    page.render();
                }
                else {
                    page.refresh();
                    page.delegateEvents();
                }

            } else {
                // Create the page, store its page name in an attribute
                // so it can be retrieved later.
                page.el.id = 'pagename-' + pageName.toLowerCase();
                page.el.className = 'page-container';

                // Render it and add it in the DOM.
                page.render();

                if (Jackbone.manualMode) {
                    // Create the new page
                    page._onPageBeforeCreate();
                    Jackbone.trigger('createview', page);
                    page._onPageManualCreate();
                    page._onPageCreate();
                }

                // Append to the DOM.
                document.body.appendChild(page.el);
            }

            if (!Jackbone.manualMode) {
                // Select the transition to apply.
                var t = this.selectTransition(pageName, role);

                // Perform transition using JQuery Mobile
                $.mobile.changePage(page.$el, {
                    changeHash:    false,
                    transition:    t.transition,
                    reverse:       t.reverse,
                    role:          role,
                    pageContainer: page.$el
                });
            }
            else {

                var currentActivePage = Jackbone.activePage;
                try {
                    // Hide previous page, show next
                    if (Jackbone.activePage) {
                        Jackbone.activePage._onPageBeforeHide();
                    }
                    page._onPageBeforeShow();
                    page.$el.show();
                    if (Jackbone.activePage) {
                        Jackbone.activePage.$el.hide();
                        Jackbone.activePage._onPageHide();
                    }
                    page._onPageShow();

                    // Update 'activePage'
                    Jackbone.activePage = page;
                    $.mobile.activePage = page.$el;
                }
                catch (error) {
                    page.$el.hide();
                    if (currentActivePage) {
                        currentActivePage.$el.show();
                        Jackbone.activePage = currentActivePage;
                        $.mobile.activePage = currentActivePage.$el;
                    }
                    throw new Error('Failed to changePage: ' + error);
                }
            }

            // Current hash is stored so a subsequent openView can know
            // which page it comes from.
            this.currentHash = Jackbone.history.getFragment();
        }
function ( pageName , page , role ) { // Extends Views // Create JQuery Mobile Page var pageid = 'pagename-' + pageName . toLowerCase ( ) ; var isExistingPage = $ ( '#' + pageid ) ; // For already existing pages, only delegate events so they can // handle onPageBeforeShow and onPageShow. if ( isExistingPage . length === 1 ) { // Sometimes, controller may have been destroyed but the // HTML stayed in the DOM (in case of an exception). // We can detect that using needRedraw, which indicate // that we have to do a full repaint. if ( page . needRedraw ) { page . render ( ) ; } else { page . refresh ( ) ; page . delegateEvents ( ) ; } } else { // Create the page, store its page name in an attribute // so it can be retrieved later. page . el . id = 'pagename-' + pageName . toLowerCase ( ) ; page . el . className = 'page-container' ; // Render it and add it in the DOM. page . render ( ) ; if ( Jackbone . manualMode ) { // Create the new page page . _onPageBeforeCreate ( ) ; Jackbone . trigger ( 'createview' , page ) ; page . _onPageManualCreate ( ) ; page . _onPageCreate ( ) ; } // Append to the DOM. document . body . appendChild ( page . el ) ; } if ( ! Jackbone . manualMode ) { // Select the transition to apply. var t = this . selectTransition ( pageName , role ) ; // Perform transition using JQuery Mobile $ . mobile . changePage ( page . $el , { changeHash : false , transition : t . transition , reverse : t . reverse , role : role , pageContainer : page . $el } ) ; } else { var currentActivePage = Jackbone . activePage ; try { // Hide previous page, show next if ( Jackbone . activePage ) { Jackbone . activePage . _onPageBeforeHide ( ) ; } page . _onPageBeforeShow ( ) ; page . $el . show ( ) ; if ( Jackbone . activePage ) { Jackbone . activePage . $el . hide ( ) ; Jackbone . activePage . _onPageHide ( ) ; } page . _onPageShow ( ) ; // Update 'activePage' Jackbone . activePage = page ; $ . mobile . activePage = page . $el ; } catch ( error ) { page . $el . hide ( ) ; if ( currentActivePage ) { currentActivePage . $el . show ( ) ; Jackbone . activePage = currentActivePage ; $ . mobile . activePage = currentActivePage . $el ; } throw new Error ( 'Failed to changePage: ' + error ) ; } } // Current hash is stored so a subsequent openView can know // which page it comes from. this . currentHash = Jackbone . history . getFragment ( ) ; }
Change to the given page.
Change to the given page .