Skip to content

Instantly share code, notes, and snippets.

@stephanethomas
Last active November 3, 2017 11:35
Show Gist options
  • Save stephanethomas/36e15a7fd3f5281fe92a2ef782eff4d5 to your computer and use it in GitHub Desktop.
Save stephanethomas/36e15a7fd3f5281fe92a2ef782eff4d5 to your computer and use it in GitHub Desktop.
Calypso Webpack Loader
var config = require( 'config' ),
page = require( 'page' ),
React = require( 'react' ),
activateNextLayoutFocus = require( 'state/ui/layout-focus/actions' ).activateNextLayoutFocus,
LoadingError = require( 'layout/error' ),
controller = require( 'controller' ),
restoreLastSession = require( 'lib/restore-last-path' ).restoreLastSession,
preloadHub = require( 'sections-preload' ).hub,
switchCSS = require( 'lib/i18n-utils/switch-locale' ).switchCSS,
debug = require( 'debug' )( 'calypso:bundler:loader' );
var _loadedSections = {};
function preload( sectionName ) {
var loadCSS = function( sectionName, cssUrls ) {
var url = cssUrls.ltr;
if ( typeof document !== 'undefined' && document.documentElement.dir === 'rtl' ) {
url = cssUrls.rtl;
}
switchCSS( 'section-css', url );
};
switch ( sectionName ) {
case "sites":
debug( 'Pre-loading Javascript for "sites" section' );
return require.ensure( [], function() {}, "sites" );
case "customize":
debug( 'Pre-loading Javascript for "customize" section' );
return require.ensure( [], function() {}, "customize" );
case "paladin":
debug( 'Pre-loading Javascript for "paladin" section' );
return require.ensure( [], function() {}, "paladin" );
case "me":
debug( 'Pre-loading Javascript for "me" section' );
return require.ensure( [], function() {}, "me" );
case "account":
debug( 'Pre-loading Javascript for "account" section' );
return require.ensure( [], function() {}, "account" );
case "security":
debug( 'Pre-loading Javascript for "security" section' );
return require.ensure( [], function() {}, "security" );
case "purchases":
debug( 'Pre-loading Javascript for "purchases" section' );
return require.ensure( [], function() {}, "purchases" );
case "notification-settings":
debug( 'Pre-loading Javascript for "notification-settings" section' );
return require.ensure( [], function() {}, "notification-settings" );
case "media":
debug( 'Pre-loading Javascript for "media" section' );
return require.ensure( [], function() {}, "media" );
case "people":
debug( 'Pre-loading Javascript for "people" section' );
return require.ensure( [], function() {}, "people" );
case "plugins":
debug( 'Pre-loading Javascript for "plugins" section' );
return require.ensure( [], function() {}, "plugins" );
case "posts-pages":
debug( 'Pre-loading Javascript for "posts-pages" section' );
return require.ensure( [], function() {}, "posts-pages" );
case "posts-pages":
debug( 'Pre-loading Javascript for "posts-pages" section' );
return require.ensure( [], function() {}, "posts-pages" );
case "settings-writing":
debug( 'Pre-loading Javascript and CSS for "settings-writing" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
} );
return require.ensure( [], function() {}, "settings-writing" );
case "settings-discussion":
debug( 'Pre-loading Javascript and CSS for "settings-discussion" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
} );
return require.ensure( [], function() {}, "settings-discussion" );
case "settings-traffic":
debug( 'Pre-loading Javascript and CSS for "settings-traffic" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
} );
return require.ensure( [], function() {}, "settings-traffic" );
case "settings-security":
debug( 'Pre-loading Javascript and CSS for "settings-security" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
} );
return require.ensure( [], function() {}, "settings-security" );
case "settings":
debug( 'Pre-loading Javascript and CSS for "settings" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
} );
return require.ensure( [], function() {}, "settings" );
case "sharing":
debug( 'Pre-loading Javascript for "sharing" section' );
return require.ensure( [], function() {}, "sharing" );
case "jetpack-connect":
debug( 'Pre-loading Javascript for "jetpack-connect" section' );
return require.ensure( [], function() {}, "jetpack-connect" );
case "signup":
debug( 'Pre-loading Javascript and CSS for "signup" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/signup.css?v=4eaba8e885",
"rtl": "/calypso/sections-rtl/signup.rtl.css?v=2f85a5d64b"
} );
return require.ensure( [], function() {}, "signup" );
case "stats":
debug( 'Pre-loading Javascript for "stats" section' );
return require.ensure( [], function() {}, "stats" );
case "themes":
debug( 'Pre-loading Javascript for "themes" section' );
return require.ensure( [], function() {}, "themes" );
case "theme":
debug( 'Pre-loading Javascript for "theme" section' );
return require.ensure( [], function() {}, "theme" );
case "domains":
debug( 'Pre-loading Javascript for "domains" section' );
return require.ensure( [], function() {}, "domains" );
case "checkout":
debug( 'Pre-loading Javascript for "checkout" section' );
return require.ensure( [], function() {}, "checkout" );
case "plans":
debug( 'Pre-loading Javascript for "plans" section' );
return require.ensure( [], function() {}, "plans" );
case "accept-invite":
debug( 'Pre-loading Javascript for "accept-invite" section' );
return require.ensure( [], function() {}, "accept-invite" );
case "ads":
debug( 'Pre-loading Javascript for "ads" section' );
return require.ensure( [], function() {}, "ads" );
case "mailing-lists":
debug( 'Pre-loading Javascript for "mailing-lists" section' );
return require.ensure( [], function() {}, "mailing-lists" );
case "post-editor":
debug( 'Pre-loading Javascript and CSS for "post-editor" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/post-editor.css?v=3c1eddaf97",
"rtl": "/calypso/sections-rtl/post-editor.rtl.css?v=05a9cd1bcb"
} );
return require.ensure( [], function() {}, "post-editor" );
case "account-recovery":
debug( 'Pre-loading Javascript for "account-recovery" section' );
return require.ensure( [], function() {}, "account-recovery" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript and CSS for "reader" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/reader-full-post.css?v=3d47b628a5",
"rtl": "/calypso/sections-rtl/reader-full-post.rtl.css?v=1c258f1ddf"
} );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "reader":
debug( 'Pre-loading Javascript for "reader" section' );
return require.ensure( [], function() {}, "reader" );
case "help":
debug( 'Pre-loading Javascript for "help" section' );
return require.ensure( [], function() {}, "help" );
case "login":
debug( 'Pre-loading Javascript and CSS for "login" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/login.css?v=7d0f843629",
"rtl": "/calypso/sections-rtl/login.rtl.css?v=ef8e4593c6"
} );
return require.ensure( [], function() {}, "login" );
case "auth":
debug( 'Pre-loading Javascript for "auth" section' );
return require.ensure( [], function() {}, "auth" );
case "posts-custom":
debug( 'Pre-loading Javascript for "posts-custom" section' );
return require.ensure( [], function() {}, "posts-custom" );
case "happychat":
debug( 'Pre-loading Javascript for "happychat" section' );
return require.ensure( [], function() {}, "happychat" );
case "comments":
debug( 'Pre-loading Javascript for "comments" section' );
return require.ensure( [], function() {}, "comments" );
case "preview":
debug( 'Pre-loading Javascript for "preview" section' );
return require.ensure( [], function() {}, "preview" );
case "domain-connect-authorize":
debug( 'Pre-loading Javascript for "domain-connect-authorize" section' );
return require.ensure( [], function() {}, "domain-connect-authorize" );
case "devdocs":
debug( 'Pre-loading Javascript for "devdocs" section' );
return require.ensure( [], function() {}, "devdocs" );
case "devdocs":
debug( 'Pre-loading Javascript for "devdocs" section' );
return require.ensure( [], function() {}, "devdocs" );
case "hello-dolly":
debug( 'Pre-loading Javascript for "hello-dolly" section' );
return require.ensure( [], function() {}, "hello-dolly" );
case "sensei":
debug( 'Pre-loading Javascript for "sensei" section' );
return require.ensure( [], function() {}, "sensei" );
case "woocommerce":
debug( 'Pre-loading Javascript and CSS for "woocommerce" section' );
loadCSS( 'section-css', {
"ltr": "/calypso/sections/woocommerce.css?v=e49582d7f4",
"rtl": "/calypso/sections-rtl/woocommerce.rtl.css?v=bd1dc35294"
} );
return require.ensure( [], function() {}, "woocommerce" );
case "wp-job-manager":
debug( 'Pre-loading Javascript for "wp-job-manager" section' );
return require.ensure( [], function() {}, "wp-job-manager" );
case "wp-super-cache":
debug( 'Pre-loading Javascript for "wp-super-cache" section' );
return require.ensure( [], function() {}, "wp-super-cache" );
case "zoninator":
debug( 'Pre-loading Javascript for "zoninator" section' );
return require.ensure( [], function() {}, "zoninator" );
}
}
preloadHub.on( 'preload', preload );
module.exports = {
get: function() {
return [
{
"name": "sites",
"paths": [
"/sites"
],
"module": "my-sites",
"group": "sites",
"secondary": true
},
{
"name": "customize",
"paths": [
"/customize"
],
"module": "my-sites/customize",
"group": "sites",
"secondary": true
},
{
"name": "paladin",
"paths": [
"/paladin"
],
"module": "my-sites/paladin",
"group": "sites",
"secondary": true
},
{
"name": "me",
"paths": [
"/me"
],
"module": "me",
"group": "me",
"secondary": true
},
{
"name": "account",
"paths": [
"/me/account"
],
"module": "me/account",
"group": "me",
"secondary": true
},
{
"name": "security",
"paths": [
"/me/security"
],
"module": "me/security",
"group": "me",
"secondary": true
},
{
"name": "purchases",
"paths": [
"/me/purchases",
"/purchases",
"/me/billing",
"/payment-methods/add-credit-card"
],
"module": "me/purchases",
"group": "me",
"secondary": true
},
{
"name": "notification-settings",
"paths": [
"/me/notifications"
],
"module": "me/notification-settings",
"group": "me",
"secondary": true
},
{
"name": "media",
"paths": [
"/media"
],
"module": "my-sites/media",
"group": "sites",
"secondary": true
},
{
"name": "people",
"paths": [
"/people"
],
"module": "my-sites/people",
"secondary": true,
"group": "sites"
},
{
"name": "plugins",
"paths": [
"/plugins"
],
"module": "my-sites/plugins",
"secondary": true,
"group": "sites"
},
{
"name": "posts-pages",
"paths": [
"/pages"
],
"module": "my-sites/pages",
"secondary": true,
"group": "sites"
},
{
"name": "posts-pages",
"paths": [
"/posts"
],
"module": "my-sites/posts",
"secondary": true,
"group": "sites"
},
{
"name": "settings-writing",
"paths": [
"/settings/writing",
"/settings/taxonomies"
],
"module": "my-sites/site-settings/settings-writing",
"secondary": true,
"group": "sites",
"css": "site-settings",
"cssUrls": {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
}
},
{
"name": "settings-discussion",
"paths": [
"/settings/discussion"
],
"module": "my-sites/site-settings/settings-discussion",
"secondary": true,
"group": "sites",
"css": "site-settings",
"cssUrls": {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
}
},
{
"name": "settings-traffic",
"paths": [
"/settings/traffic",
"/settings/seo",
"/settings/analytics"
],
"module": "my-sites/site-settings/settings-traffic",
"secondary": true,
"group": "sites",
"css": "site-settings",
"cssUrls": {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
}
},
{
"name": "settings-security",
"paths": [
"/settings/security"
],
"module": "my-sites/site-settings/settings-security",
"secondary": true,
"group": "sites",
"css": "site-settings",
"cssUrls": {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
}
},
{
"name": "settings",
"paths": [
"/settings"
],
"module": "my-sites/site-settings",
"secondary": true,
"group": "sites",
"css": "site-settings",
"cssUrls": {
"ltr": "/calypso/sections/site-settings.css?v=a15c3efac5",
"rtl": "/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"
}
},
{
"name": "sharing",
"paths": [
"/sharing"
],
"module": "my-sites/sharing",
"secondary": true,
"group": "sites"
},
{
"name": "jetpack-connect",
"paths": [
"/jetpack"
],
"module": "jetpack-connect",
"secondary": false,
"enableLoggedOut": true
},
{
"name": "signup",
"paths": [
"/start"
],
"module": "signup",
"secondary": false,
"enableLoggedOut": true,
"isomorphic": true,
"css": "signup",
"cssUrls": {
"ltr": "/calypso/sections/signup.css?v=4eaba8e885",
"rtl": "/calypso/sections-rtl/signup.rtl.css?v=2f85a5d64b"
}
},
{
"name": "stats",
"paths": [
"/stats"
],
"module": "my-sites/stats",
"secondary": true,
"group": "sites"
},
{
"name": "themes",
"paths": [
"/themes",
"/design"
],
"module": "my-sites/themes",
"enableLoggedOut": true,
"secondary": true,
"group": "sites",
"isomorphic": true,
"title": "Themes"
},
{
"name": "theme",
"paths": [
"/theme"
],
"module": "my-sites/theme",
"enableLoggedOut": true,
"secondary": false,
"group": "sites",
"isomorphic": true,
"title": "Themes"
},
{
"name": "domains",
"paths": [
"/domains"
],
"module": "my-sites/domains",
"secondary": true,
"group": "sites"
},
{
"name": "checkout",
"paths": [
"/checkout"
],
"module": "my-sites/checkout",
"secondary": true,
"group": "sites"
},
{
"name": "plans",
"paths": [
"/plans"
],
"module": "my-sites/plans",
"secondary": true,
"group": "sites"
},
{
"name": "accept-invite",
"paths": [
"/accept-invite"
],
"module": "my-sites/invites",
"enableLoggedOut": true
},
{
"name": "ads",
"paths": [
"/ads"
],
"module": "my-sites/ads",
"secondary": true,
"group": "sites"
},
{
"name": "mailing-lists",
"paths": [
"/mailing-lists/unsubscribe"
],
"module": "mailing-lists",
"enableLoggedOut": true
},
{
"name": "post-editor",
"paths": [
"/post",
"/page",
"/edit"
],
"module": "post-editor",
"group": "editor",
"secondary": true,
"css": "post-editor",
"cssUrls": {
"ltr": "/calypso/sections/post-editor.css?v=3c1eddaf97",
"rtl": "/calypso/sections-rtl/post-editor.rtl.css?v=05a9cd1bcb"
}
},
{
"name": "account-recovery",
"paths": [
"/account-recovery"
],
"module": "account-recovery",
"secondary": false,
"enableLoggedOut": true
},
{
"name": "reader",
"paths": [
"/",
"/read"
],
"module": "reader",
"secondary": true,
"group": "reader"
},
{
"name": "reader",
"paths": [
"/read/feeds/[^\\/]+/posts/[^\\/]+",
"/read/blogs/[^\\/]+/posts/[^\\/]+"
],
"module": "reader/full-post",
"secondary": false,
"group": "reader",
"css": "reader-full-post",
"cssUrls": {
"ltr": "/calypso/sections/reader-full-post.css?v=3d47b628a5",
"rtl": "/calypso/sections-rtl/reader-full-post.rtl.css?v=1c258f1ddf"
}
},
{
"name": "reader",
"paths": [
"/recommendations/posts"
],
"module": "reader/recommendations",
"secondary": true,
"group": "reader"
},
{
"name": "reader",
"paths": [
"/recommendations"
],
"module": "reader/recommendations",
"secondary": true,
"group": "reader"
},
{
"name": "reader",
"paths": [
"/discover"
],
"module": "reader/discover",
"secondary": true,
"group": "reader"
},
{
"name": "reader",
"paths": [
"/following"
],
"module": "reader/following",
"secondary": true,
"group": "reader"
},
{
"name": "reader",
"paths": [
"/tags",
"/tag"
],
"module": "reader/tag-stream",
"secondary": true,
"group": "reader"
},
{
"name": "reader",
"paths": [
"/activities"
],
"module": "reader/liked-stream",
"secondary": true,
"group": "reader"
},
{
"name": "reader",
"paths": [
"/read/search"
],
"module": "reader/search",
"secondary": true,
"group": "reader"
},
{
"name": "reader",
"paths": [
"/read/list"
],
"module": "reader/list",
"secondary": true,
"group": "reader"
},
{
"name": "reader",
"paths": [
"/read/conversations"
],
"module": "reader/conversations",
"secondary": true,
"group": "reader"
},
{
"name": "help",
"paths": [
"/help"
],
"module": "me/help",
"secondary": true,
"enableLoggedOut": true,
"group": "me"
},
{
"name": "login",
"paths": [
"/log-in"
],
"module": "login",
"enableLoggedOut": true,
"secondary": false,
"isomorphic": true,
"css": "login",
"cssUrls": {
"ltr": "/calypso/sections/login.css?v=7d0f843629",
"rtl": "/calypso/sections-rtl/login.rtl.css?v=ef8e4593c6"
}
},
{
"name": "auth",
"paths": [
"/oauth-login",
"/authorize",
"/api/oauth/token"
],
"module": "auth",
"secondary": false,
"enableLoggedOut": true
},
{
"name": "posts-custom",
"paths": [
"/types"
],
"module": "my-sites/types",
"secondary": true,
"group": "sites"
},
{
"name": "happychat",
"paths": [
"/me/chat"
],
"module": "me/happychat",
"group": "me",
"secondary": true
},
{
"name": "comments",
"paths": [
"/comments",
"/comment"
],
"module": "my-sites/comments",
"group": "sites",
"secondary": true
},
{
"name": "preview",
"paths": [
"/view"
],
"module": "my-sites/preview",
"group": "sites",
"secondary": true
},
{
"name": "domain-connect-authorize",
"paths": [
"/domain-connect"
],
"module": "my-sites/domains/domain-management/domain-connect",
"enableLoggedOut": false,
"secondary": false,
"isomorphic": false
},
{
"name": "devdocs",
"paths": [
"/devdocs"
],
"module": "devdocs",
"secondary": true,
"enableLoggedOut": true
},
{
"name": "devdocs",
"paths": [
"/devdocs/start"
],
"module": "devdocs",
"secondary": false,
"enableLoggedOut": true
},
{
"name": "hello-dolly",
"paths": [
"/hello-dolly"
],
"module": "hello-dolly",
"group": "sites",
"secondary": true,
"enableLoggedOut": true,
"envId": [
"development",
"wpcalypso"
]
},
{
"name": "sensei",
"paths": [
"/extensions/sensei"
],
"module": "sensei",
"group": "sites",
"secondary": true,
"envId": [
"development",
"wpcalypso"
]
},
{
"name": "woocommerce",
"paths": [
"/store"
],
"module": "woocommerce",
"group": "sites",
"secondary": true,
"css": "woocommerce",
"envId": [
"development",
"wpcalypso",
"stage",
"production"
],
"cssUrls": {
"ltr": "/calypso/sections/woocommerce.css?v=e49582d7f4",
"rtl": "/calypso/sections-rtl/woocommerce.rtl.css?v=bd1dc35294"
}
},
{
"name": "wp-job-manager",
"paths": [
"/extensions/wp-job-manager"
],
"settings_path": "/extensions/wp-job-manager",
"module": "wp-job-manager",
"group": "sites",
"secondary": true,
"envId": [
"development",
"wpcalypso"
]
},
{
"name": "wp-super-cache",
"paths": [
"/extensions/wp-super-cache"
],
"settings_path": "/extensions/wp-super-cache",
"module": "wp-super-cache",
"group": "sites",
"secondary": true,
"envId": [
"development",
"wpcalypso",
"horizon",
"stage",
"production"
]
},
{
"name": "zoninator",
"paths": [
"/extensions/zoninator"
],
"settings_path": "/extensions/zoninator",
"module": "zoninator",
"group": "sites",
"secondary": true,
"envId": [
"development",
"wpcalypso",
"stage"
]
}
];
},
load: function() {
page( /^\/sites(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites" ] ) {
controller.setSection( {"name":"sites","paths":["/sites"],"module":"my-sites","group":"sites","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"sites","paths":["/sites"],"module":"my-sites","group":"sites","secondary":true} )( context );
if ( ! _loadedSections[ "my-sites" ] ) {
require( "my-sites" )( controller.clientRouter );
_loadedSections[ "my-sites" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "sites" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "sites" );
}
}, "sites"
);
} );
page( /^\/customize(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/customize" ] ) {
controller.setSection( {"name":"customize","paths":["/customize"],"module":"my-sites/customize","group":"sites","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"customize","paths":["/customize"],"module":"my-sites/customize","group":"sites","secondary":true} )( context );
if ( ! _loadedSections[ "my-sites/customize" ] ) {
require( "my-sites/customize" )( controller.clientRouter );
_loadedSections[ "my-sites/customize" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "customize" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "customize" );
}
}, "customize"
);
} );
page( /^\/paladin(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/paladin" ] ) {
controller.setSection( {"name":"paladin","paths":["/paladin"],"module":"my-sites/paladin","group":"sites","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"paladin","paths":["/paladin"],"module":"my-sites/paladin","group":"sites","secondary":true} )( context );
if ( ! _loadedSections[ "my-sites/paladin" ] ) {
require( "my-sites/paladin" )( controller.clientRouter );
_loadedSections[ "my-sites/paladin" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "paladin" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "paladin" );
}
}, "paladin"
);
} );
page( /^\/me(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me" ] ) {
controller.setSection( {"name":"me","paths":["/me"],"module":"me","group":"me","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"me","paths":["/me"],"module":"me","group":"me","secondary":true} )( context );
if ( ! _loadedSections[ "me" ] ) {
require( "me" )( controller.clientRouter );
_loadedSections[ "me" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "me" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "me" );
}
}, "me"
);
} );
page( /^\/me\/account(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me/account" ] ) {
controller.setSection( {"name":"account","paths":["/me/account"],"module":"me/account","group":"me","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"account","paths":["/me/account"],"module":"me/account","group":"me","secondary":true} )( context );
if ( ! _loadedSections[ "me/account" ] ) {
require( "me/account" )( controller.clientRouter );
_loadedSections[ "me/account" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "account" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "account" );
}
}, "account"
);
} );
page( /^\/me\/security(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me/security" ] ) {
controller.setSection( {"name":"security","paths":["/me/security"],"module":"me/security","group":"me","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"security","paths":["/me/security"],"module":"me/security","group":"me","secondary":true} )( context );
if ( ! _loadedSections[ "me/security" ] ) {
require( "me/security" )( controller.clientRouter );
_loadedSections[ "me/security" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "security" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "security" );
}
}, "security"
);
} );
page( /^\/me\/purchases(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me/purchases" ] ) {
controller.setSection( {"name":"purchases","paths":["/me/purchases","/purchases","/me/billing","/payment-methods/add-credit-card"],"module":"me/purchases","group":"me","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"purchases","paths":["/me/purchases","/purchases","/me/billing","/payment-methods/add-credit-card"],"module":"me/purchases","group":"me","secondary":true} )( context );
if ( ! _loadedSections[ "me/purchases" ] ) {
require( "me/purchases" )( controller.clientRouter );
_loadedSections[ "me/purchases" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "purchases" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "purchases" );
}
}, "purchases"
);
} );
page( /^\/purchases(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me/purchases" ] ) {
controller.setSection( {"name":"purchases","paths":["/me/purchases","/purchases","/me/billing","/payment-methods/add-credit-card"],"module":"me/purchases","group":"me","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"purchases","paths":["/me/purchases","/purchases","/me/billing","/payment-methods/add-credit-card"],"module":"me/purchases","group":"me","secondary":true} )( context );
if ( ! _loadedSections[ "me/purchases" ] ) {
require( "me/purchases" )( controller.clientRouter );
_loadedSections[ "me/purchases" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "purchases" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "purchases" );
}
}, "purchases"
);
} );
page( /^\/me\/billing(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me/purchases" ] ) {
controller.setSection( {"name":"purchases","paths":["/me/purchases","/purchases","/me/billing","/payment-methods/add-credit-card"],"module":"me/purchases","group":"me","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"purchases","paths":["/me/purchases","/purchases","/me/billing","/payment-methods/add-credit-card"],"module":"me/purchases","group":"me","secondary":true} )( context );
if ( ! _loadedSections[ "me/purchases" ] ) {
require( "me/purchases" )( controller.clientRouter );
_loadedSections[ "me/purchases" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "purchases" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "purchases" );
}
}, "purchases"
);
} );
page( /^\/payment-methods\/add-credit-card(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me/purchases" ] ) {
controller.setSection( {"name":"purchases","paths":["/me/purchases","/purchases","/me/billing","/payment-methods/add-credit-card"],"module":"me/purchases","group":"me","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"purchases","paths":["/me/purchases","/purchases","/me/billing","/payment-methods/add-credit-card"],"module":"me/purchases","group":"me","secondary":true} )( context );
if ( ! _loadedSections[ "me/purchases" ] ) {
require( "me/purchases" )( controller.clientRouter );
_loadedSections[ "me/purchases" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "purchases" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "purchases" );
}
}, "purchases"
);
} );
page( /^\/me\/notifications(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me/notification-settings" ] ) {
controller.setSection( {"name":"notification-settings","paths":["/me/notifications"],"module":"me/notification-settings","group":"me","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"notification-settings","paths":["/me/notifications"],"module":"me/notification-settings","group":"me","secondary":true} )( context );
if ( ! _loadedSections[ "me/notification-settings" ] ) {
require( "me/notification-settings" )( controller.clientRouter );
_loadedSections[ "me/notification-settings" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "notification-settings" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "notification-settings" );
}
}, "notification-settings"
);
} );
page( /^\/media(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/media" ] ) {
controller.setSection( {"name":"media","paths":["/media"],"module":"my-sites/media","group":"sites","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"media","paths":["/media"],"module":"my-sites/media","group":"sites","secondary":true} )( context );
if ( ! _loadedSections[ "my-sites/media" ] ) {
require( "my-sites/media" )( controller.clientRouter );
_loadedSections[ "my-sites/media" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "media" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "media" );
}
}, "media"
);
} );
page( /^\/people(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/people" ] ) {
controller.setSection( {"name":"people","paths":["/people"],"module":"my-sites/people","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"people","paths":["/people"],"module":"my-sites/people","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/people" ] ) {
require( "my-sites/people" )( controller.clientRouter );
_loadedSections[ "my-sites/people" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "people" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "people" );
}
}, "people"
);
} );
page( /^\/plugins(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/plugins" ] ) {
controller.setSection( {"name":"plugins","paths":["/plugins"],"module":"my-sites/plugins","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"plugins","paths":["/plugins"],"module":"my-sites/plugins","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/plugins" ] ) {
require( "my-sites/plugins" )( controller.clientRouter );
_loadedSections[ "my-sites/plugins" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "plugins" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "plugins" );
}
}, "plugins"
);
} );
page( /^\/pages(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/pages" ] ) {
controller.setSection( {"name":"posts-pages","paths":["/pages"],"module":"my-sites/pages","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"posts-pages","paths":["/pages"],"module":"my-sites/pages","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/pages" ] ) {
require( "my-sites/pages" )( controller.clientRouter );
_loadedSections[ "my-sites/pages" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "posts-pages" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "posts-pages" );
}
}, "posts-pages"
);
} );
page( /^\/posts(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/posts" ] ) {
controller.setSection( {"name":"posts-pages","paths":["/posts"],"module":"my-sites/posts","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"posts-pages","paths":["/posts"],"module":"my-sites/posts","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/posts" ] ) {
require( "my-sites/posts" )( controller.clientRouter );
_loadedSections[ "my-sites/posts" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "posts-pages" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "posts-pages" );
}
}, "posts-pages"
);
} );
page( /^\/settings\/writing(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/site-settings/settings-writing" ] ) {
controller.setSection( {"name":"settings-writing","paths":["/settings/writing","/settings/taxonomies"],"module":"my-sites/site-settings/settings-writing","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"settings-writing","paths":["/settings/writing","/settings/taxonomies"],"module":"my-sites/site-settings/settings-writing","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
if ( ! _loadedSections[ "my-sites/site-settings/settings-writing" ] ) {
require( "my-sites/site-settings/settings-writing" )( controller.clientRouter );
_loadedSections[ "my-sites/site-settings/settings-writing" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "settings-writing" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "settings-writing" );
}
}, "settings-writing"
);
} );
page( /^\/settings\/taxonomies(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/site-settings/settings-writing" ] ) {
controller.setSection( {"name":"settings-writing","paths":["/settings/writing","/settings/taxonomies"],"module":"my-sites/site-settings/settings-writing","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"settings-writing","paths":["/settings/writing","/settings/taxonomies"],"module":"my-sites/site-settings/settings-writing","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
if ( ! _loadedSections[ "my-sites/site-settings/settings-writing" ] ) {
require( "my-sites/site-settings/settings-writing" )( controller.clientRouter );
_loadedSections[ "my-sites/site-settings/settings-writing" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "settings-writing" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "settings-writing" );
}
}, "settings-writing"
);
} );
page( /^\/settings\/discussion(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/site-settings/settings-discussion" ] ) {
controller.setSection( {"name":"settings-discussion","paths":["/settings/discussion"],"module":"my-sites/site-settings/settings-discussion","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"settings-discussion","paths":["/settings/discussion"],"module":"my-sites/site-settings/settings-discussion","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
if ( ! _loadedSections[ "my-sites/site-settings/settings-discussion" ] ) {
require( "my-sites/site-settings/settings-discussion" )( controller.clientRouter );
_loadedSections[ "my-sites/site-settings/settings-discussion" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "settings-discussion" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "settings-discussion" );
}
}, "settings-discussion"
);
} );
page( /^\/settings\/traffic(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/site-settings/settings-traffic" ] ) {
controller.setSection( {"name":"settings-traffic","paths":["/settings/traffic","/settings/seo","/settings/analytics"],"module":"my-sites/site-settings/settings-traffic","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"settings-traffic","paths":["/settings/traffic","/settings/seo","/settings/analytics"],"module":"my-sites/site-settings/settings-traffic","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
if ( ! _loadedSections[ "my-sites/site-settings/settings-traffic" ] ) {
require( "my-sites/site-settings/settings-traffic" )( controller.clientRouter );
_loadedSections[ "my-sites/site-settings/settings-traffic" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "settings-traffic" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "settings-traffic" );
}
}, "settings-traffic"
);
} );
page( /^\/settings\/seo(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/site-settings/settings-traffic" ] ) {
controller.setSection( {"name":"settings-traffic","paths":["/settings/traffic","/settings/seo","/settings/analytics"],"module":"my-sites/site-settings/settings-traffic","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"settings-traffic","paths":["/settings/traffic","/settings/seo","/settings/analytics"],"module":"my-sites/site-settings/settings-traffic","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
if ( ! _loadedSections[ "my-sites/site-settings/settings-traffic" ] ) {
require( "my-sites/site-settings/settings-traffic" )( controller.clientRouter );
_loadedSections[ "my-sites/site-settings/settings-traffic" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "settings-traffic" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "settings-traffic" );
}
}, "settings-traffic"
);
} );
page( /^\/settings\/analytics(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/site-settings/settings-traffic" ] ) {
controller.setSection( {"name":"settings-traffic","paths":["/settings/traffic","/settings/seo","/settings/analytics"],"module":"my-sites/site-settings/settings-traffic","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"settings-traffic","paths":["/settings/traffic","/settings/seo","/settings/analytics"],"module":"my-sites/site-settings/settings-traffic","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
if ( ! _loadedSections[ "my-sites/site-settings/settings-traffic" ] ) {
require( "my-sites/site-settings/settings-traffic" )( controller.clientRouter );
_loadedSections[ "my-sites/site-settings/settings-traffic" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "settings-traffic" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "settings-traffic" );
}
}, "settings-traffic"
);
} );
page( /^\/settings\/security(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/site-settings/settings-security" ] ) {
controller.setSection( {"name":"settings-security","paths":["/settings/security"],"module":"my-sites/site-settings/settings-security","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"settings-security","paths":["/settings/security"],"module":"my-sites/site-settings/settings-security","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
if ( ! _loadedSections[ "my-sites/site-settings/settings-security" ] ) {
require( "my-sites/site-settings/settings-security" )( controller.clientRouter );
_loadedSections[ "my-sites/site-settings/settings-security" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "settings-security" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "settings-security" );
}
}, "settings-security"
);
} );
page( /^\/settings(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/site-settings" ] ) {
controller.setSection( {"name":"settings","paths":["/settings"],"module":"my-sites/site-settings","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"settings","paths":["/settings"],"module":"my-sites/site-settings","secondary":true,"group":"sites","css":"site-settings","cssUrls":{"ltr":"/calypso/sections/site-settings.css?v=a15c3efac5","rtl":"/calypso/sections-rtl/site-settings.rtl.css?v=68f550fe36"}} )( context );
if ( ! _loadedSections[ "my-sites/site-settings" ] ) {
require( "my-sites/site-settings" )( controller.clientRouter );
_loadedSections[ "my-sites/site-settings" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "settings" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "settings" );
}
}, "settings"
);
} );
page( /^\/sharing(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/sharing" ] ) {
controller.setSection( {"name":"sharing","paths":["/sharing"],"module":"my-sites/sharing","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"sharing","paths":["/sharing"],"module":"my-sites/sharing","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/sharing" ] ) {
require( "my-sites/sharing" )( controller.clientRouter );
_loadedSections[ "my-sites/sharing" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "sharing" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "sharing" );
}
}, "sharing"
);
} );
page( /^\/jetpack(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "jetpack-connect" ] ) {
controller.setSection( {"name":"jetpack-connect","paths":["/jetpack"],"module":"jetpack-connect","secondary":false,"enableLoggedOut":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"jetpack-connect","paths":["/jetpack"],"module":"jetpack-connect","secondary":false,"enableLoggedOut":true} )( context );
if ( ! _loadedSections[ "jetpack-connect" ] ) {
require( "jetpack-connect" )( controller.clientRouter );
_loadedSections[ "jetpack-connect" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "jetpack-connect" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "jetpack-connect" );
}
}, "jetpack-connect"
);
} );
page( /^\/start(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "signup" ] ) {
controller.setSection( {"name":"signup","paths":["/start"],"module":"signup","secondary":false,"enableLoggedOut":true,"isomorphic":true,"css":"signup","cssUrls":{"ltr":"/calypso/sections/signup.css?v=4eaba8e885","rtl":"/calypso/sections-rtl/signup.rtl.css?v=2f85a5d64b"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"signup","paths":["/start"],"module":"signup","secondary":false,"enableLoggedOut":true,"isomorphic":true,"css":"signup","cssUrls":{"ltr":"/calypso/sections/signup.css?v=4eaba8e885","rtl":"/calypso/sections-rtl/signup.rtl.css?v=2f85a5d64b"}} )( context );
if ( ! _loadedSections[ "signup" ] ) {
require( "signup" )( controller.clientRouter );
_loadedSections[ "signup" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "signup" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "signup" );
}
}, "signup"
);
} );
page( /^\/stats(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/stats" ] ) {
controller.setSection( {"name":"stats","paths":["/stats"],"module":"my-sites/stats","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"stats","paths":["/stats"],"module":"my-sites/stats","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/stats" ] ) {
require( "my-sites/stats" )( controller.clientRouter );
_loadedSections[ "my-sites/stats" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "stats" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "stats" );
}
}, "stats"
);
} );
page( /^\/themes(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/themes" ] ) {
controller.setSection( {"name":"themes","paths":["/themes","/design"],"module":"my-sites/themes","enableLoggedOut":true,"secondary":true,"group":"sites","isomorphic":true,"title":"Themes"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"themes","paths":["/themes","/design"],"module":"my-sites/themes","enableLoggedOut":true,"secondary":true,"group":"sites","isomorphic":true,"title":"Themes"} )( context );
if ( ! _loadedSections[ "my-sites/themes" ] ) {
require( "my-sites/themes" )( controller.clientRouter );
_loadedSections[ "my-sites/themes" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "themes" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "themes" );
}
}, "themes"
);
} );
page( /^\/design(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/themes" ] ) {
controller.setSection( {"name":"themes","paths":["/themes","/design"],"module":"my-sites/themes","enableLoggedOut":true,"secondary":true,"group":"sites","isomorphic":true,"title":"Themes"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"themes","paths":["/themes","/design"],"module":"my-sites/themes","enableLoggedOut":true,"secondary":true,"group":"sites","isomorphic":true,"title":"Themes"} )( context );
if ( ! _loadedSections[ "my-sites/themes" ] ) {
require( "my-sites/themes" )( controller.clientRouter );
_loadedSections[ "my-sites/themes" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "themes" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "themes" );
}
}, "themes"
);
} );
page( /^\/theme(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/theme" ] ) {
controller.setSection( {"name":"theme","paths":["/theme"],"module":"my-sites/theme","enableLoggedOut":true,"secondary":false,"group":"sites","isomorphic":true,"title":"Themes"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"theme","paths":["/theme"],"module":"my-sites/theme","enableLoggedOut":true,"secondary":false,"group":"sites","isomorphic":true,"title":"Themes"} )( context );
if ( ! _loadedSections[ "my-sites/theme" ] ) {
require( "my-sites/theme" )( controller.clientRouter );
_loadedSections[ "my-sites/theme" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "theme" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "theme" );
}
}, "theme"
);
} );
page( /^\/domains(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/domains" ] ) {
controller.setSection( {"name":"domains","paths":["/domains"],"module":"my-sites/domains","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"domains","paths":["/domains"],"module":"my-sites/domains","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/domains" ] ) {
require( "my-sites/domains" )( controller.clientRouter );
_loadedSections[ "my-sites/domains" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "domains" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "domains" );
}
}, "domains"
);
} );
page( /^\/checkout(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/checkout" ] ) {
controller.setSection( {"name":"checkout","paths":["/checkout"],"module":"my-sites/checkout","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"checkout","paths":["/checkout"],"module":"my-sites/checkout","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/checkout" ] ) {
require( "my-sites/checkout" )( controller.clientRouter );
_loadedSections[ "my-sites/checkout" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "checkout" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "checkout" );
}
}, "checkout"
);
} );
page( /^\/plans(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/plans" ] ) {
controller.setSection( {"name":"plans","paths":["/plans"],"module":"my-sites/plans","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"plans","paths":["/plans"],"module":"my-sites/plans","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/plans" ] ) {
require( "my-sites/plans" )( controller.clientRouter );
_loadedSections[ "my-sites/plans" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "plans" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "plans" );
}
}, "plans"
);
} );
page( /^\/accept-invite(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/invites" ] ) {
controller.setSection( {"name":"accept-invite","paths":["/accept-invite"],"module":"my-sites/invites","enableLoggedOut":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"accept-invite","paths":["/accept-invite"],"module":"my-sites/invites","enableLoggedOut":true} )( context );
if ( ! _loadedSections[ "my-sites/invites" ] ) {
require( "my-sites/invites" )( controller.clientRouter );
_loadedSections[ "my-sites/invites" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "accept-invite" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "accept-invite" );
}
}, "accept-invite"
);
} );
page( /^\/ads(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/ads" ] ) {
controller.setSection( {"name":"ads","paths":["/ads"],"module":"my-sites/ads","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"ads","paths":["/ads"],"module":"my-sites/ads","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/ads" ] ) {
require( "my-sites/ads" )( controller.clientRouter );
_loadedSections[ "my-sites/ads" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "ads" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "ads" );
}
}, "ads"
);
} );
page( /^\/mailing-lists\/unsubscribe(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "mailing-lists" ] ) {
controller.setSection( {"name":"mailing-lists","paths":["/mailing-lists/unsubscribe"],"module":"mailing-lists","enableLoggedOut":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"mailing-lists","paths":["/mailing-lists/unsubscribe"],"module":"mailing-lists","enableLoggedOut":true} )( context );
if ( ! _loadedSections[ "mailing-lists" ] ) {
require( "mailing-lists" )( controller.clientRouter );
_loadedSections[ "mailing-lists" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "mailing-lists" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "mailing-lists" );
}
}, "mailing-lists"
);
} );
page( /^\/post(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "post-editor" ] ) {
controller.setSection( {"name":"post-editor","paths":["/post","/page","/edit"],"module":"post-editor","group":"editor","secondary":true,"css":"post-editor","cssUrls":{"ltr":"/calypso/sections/post-editor.css?v=3c1eddaf97","rtl":"/calypso/sections-rtl/post-editor.rtl.css?v=05a9cd1bcb"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"post-editor","paths":["/post","/page","/edit"],"module":"post-editor","group":"editor","secondary":true,"css":"post-editor","cssUrls":{"ltr":"/calypso/sections/post-editor.css?v=3c1eddaf97","rtl":"/calypso/sections-rtl/post-editor.rtl.css?v=05a9cd1bcb"}} )( context );
if ( ! _loadedSections[ "post-editor" ] ) {
require( "post-editor" )( controller.clientRouter );
_loadedSections[ "post-editor" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "post-editor" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "post-editor" );
}
}, "post-editor"
);
} );
page( /^\/page(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "post-editor" ] ) {
controller.setSection( {"name":"post-editor","paths":["/post","/page","/edit"],"module":"post-editor","group":"editor","secondary":true,"css":"post-editor","cssUrls":{"ltr":"/calypso/sections/post-editor.css?v=3c1eddaf97","rtl":"/calypso/sections-rtl/post-editor.rtl.css?v=05a9cd1bcb"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"post-editor","paths":["/post","/page","/edit"],"module":"post-editor","group":"editor","secondary":true,"css":"post-editor","cssUrls":{"ltr":"/calypso/sections/post-editor.css?v=3c1eddaf97","rtl":"/calypso/sections-rtl/post-editor.rtl.css?v=05a9cd1bcb"}} )( context );
if ( ! _loadedSections[ "post-editor" ] ) {
require( "post-editor" )( controller.clientRouter );
_loadedSections[ "post-editor" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "post-editor" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "post-editor" );
}
}, "post-editor"
);
} );
page( /^\/edit(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "post-editor" ] ) {
controller.setSection( {"name":"post-editor","paths":["/post","/page","/edit"],"module":"post-editor","group":"editor","secondary":true,"css":"post-editor","cssUrls":{"ltr":"/calypso/sections/post-editor.css?v=3c1eddaf97","rtl":"/calypso/sections-rtl/post-editor.rtl.css?v=05a9cd1bcb"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"post-editor","paths":["/post","/page","/edit"],"module":"post-editor","group":"editor","secondary":true,"css":"post-editor","cssUrls":{"ltr":"/calypso/sections/post-editor.css?v=3c1eddaf97","rtl":"/calypso/sections-rtl/post-editor.rtl.css?v=05a9cd1bcb"}} )( context );
if ( ! _loadedSections[ "post-editor" ] ) {
require( "post-editor" )( controller.clientRouter );
_loadedSections[ "post-editor" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "post-editor" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "post-editor" );
}
}, "post-editor"
);
} );
page( /^\/account-recovery(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "account-recovery" ] ) {
controller.setSection( {"name":"account-recovery","paths":["/account-recovery"],"module":"account-recovery","secondary":false,"enableLoggedOut":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"account-recovery","paths":["/account-recovery"],"module":"account-recovery","secondary":false,"enableLoggedOut":true} )( context );
if ( ! _loadedSections[ "account-recovery" ] ) {
require( "account-recovery" )( controller.clientRouter );
_loadedSections[ "account-recovery" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "account-recovery" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "account-recovery" );
}
}, "account-recovery"
);
} );
page( "/", function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader" ] ) {
controller.setSection( {"name":"reader","paths":["/","/read"],"module":"reader","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/","/read"],"module":"reader","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader" ] ) {
require( "reader" )( controller.clientRouter );
_loadedSections[ "reader" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/read(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader" ] ) {
controller.setSection( {"name":"reader","paths":["/","/read"],"module":"reader","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/","/read"],"module":"reader","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader" ] ) {
require( "reader" )( controller.clientRouter );
_loadedSections[ "reader" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/read\/feeds\/[^\/]+\/posts\/[^\/]+(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/full-post" ] ) {
controller.setSection( {"name":"reader","paths":["/read/feeds/[^\\/]+/posts/[^\\/]+","/read/blogs/[^\\/]+/posts/[^\\/]+"],"module":"reader/full-post","secondary":false,"group":"reader","css":"reader-full-post","cssUrls":{"ltr":"/calypso/sections/reader-full-post.css?v=3d47b628a5","rtl":"/calypso/sections-rtl/reader-full-post.rtl.css?v=1c258f1ddf"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/read/feeds/[^\\/]+/posts/[^\\/]+","/read/blogs/[^\\/]+/posts/[^\\/]+"],"module":"reader/full-post","secondary":false,"group":"reader","css":"reader-full-post","cssUrls":{"ltr":"/calypso/sections/reader-full-post.css?v=3d47b628a5","rtl":"/calypso/sections-rtl/reader-full-post.rtl.css?v=1c258f1ddf"}} )( context );
if ( ! _loadedSections[ "reader/full-post" ] ) {
require( "reader/full-post" )( controller.clientRouter );
_loadedSections[ "reader/full-post" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/read\/blogs\/[^\/]+\/posts\/[^\/]+(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/full-post" ] ) {
controller.setSection( {"name":"reader","paths":["/read/feeds/[^\\/]+/posts/[^\\/]+","/read/blogs/[^\\/]+/posts/[^\\/]+"],"module":"reader/full-post","secondary":false,"group":"reader","css":"reader-full-post","cssUrls":{"ltr":"/calypso/sections/reader-full-post.css?v=3d47b628a5","rtl":"/calypso/sections-rtl/reader-full-post.rtl.css?v=1c258f1ddf"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/read/feeds/[^\\/]+/posts/[^\\/]+","/read/blogs/[^\\/]+/posts/[^\\/]+"],"module":"reader/full-post","secondary":false,"group":"reader","css":"reader-full-post","cssUrls":{"ltr":"/calypso/sections/reader-full-post.css?v=3d47b628a5","rtl":"/calypso/sections-rtl/reader-full-post.rtl.css?v=1c258f1ddf"}} )( context );
if ( ! _loadedSections[ "reader/full-post" ] ) {
require( "reader/full-post" )( controller.clientRouter );
_loadedSections[ "reader/full-post" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/recommendations\/posts(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/recommendations" ] ) {
controller.setSection( {"name":"reader","paths":["/recommendations/posts"],"module":"reader/recommendations","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/recommendations/posts"],"module":"reader/recommendations","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/recommendations" ] ) {
require( "reader/recommendations" )( controller.clientRouter );
_loadedSections[ "reader/recommendations" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/recommendations(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/recommendations" ] ) {
controller.setSection( {"name":"reader","paths":["/recommendations"],"module":"reader/recommendations","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/recommendations"],"module":"reader/recommendations","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/recommendations" ] ) {
require( "reader/recommendations" )( controller.clientRouter );
_loadedSections[ "reader/recommendations" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/discover(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/discover" ] ) {
controller.setSection( {"name":"reader","paths":["/discover"],"module":"reader/discover","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/discover"],"module":"reader/discover","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/discover" ] ) {
require( "reader/discover" )( controller.clientRouter );
_loadedSections[ "reader/discover" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/following(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/following" ] ) {
controller.setSection( {"name":"reader","paths":["/following"],"module":"reader/following","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/following"],"module":"reader/following","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/following" ] ) {
require( "reader/following" )( controller.clientRouter );
_loadedSections[ "reader/following" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/tags(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/tag-stream" ] ) {
controller.setSection( {"name":"reader","paths":["/tags","/tag"],"module":"reader/tag-stream","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/tags","/tag"],"module":"reader/tag-stream","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/tag-stream" ] ) {
require( "reader/tag-stream" )( controller.clientRouter );
_loadedSections[ "reader/tag-stream" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/tag(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/tag-stream" ] ) {
controller.setSection( {"name":"reader","paths":["/tags","/tag"],"module":"reader/tag-stream","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/tags","/tag"],"module":"reader/tag-stream","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/tag-stream" ] ) {
require( "reader/tag-stream" )( controller.clientRouter );
_loadedSections[ "reader/tag-stream" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/activities(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/liked-stream" ] ) {
controller.setSection( {"name":"reader","paths":["/activities"],"module":"reader/liked-stream","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/activities"],"module":"reader/liked-stream","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/liked-stream" ] ) {
require( "reader/liked-stream" )( controller.clientRouter );
_loadedSections[ "reader/liked-stream" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/read\/search(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/search" ] ) {
controller.setSection( {"name":"reader","paths":["/read/search"],"module":"reader/search","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/read/search"],"module":"reader/search","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/search" ] ) {
require( "reader/search" )( controller.clientRouter );
_loadedSections[ "reader/search" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/read\/list(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/list" ] ) {
controller.setSection( {"name":"reader","paths":["/read/list"],"module":"reader/list","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/read/list"],"module":"reader/list","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/list" ] ) {
require( "reader/list" )( controller.clientRouter );
_loadedSections[ "reader/list" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/read\/conversations(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "reader/conversations" ] ) {
controller.setSection( {"name":"reader","paths":["/read/conversations"],"module":"reader/conversations","secondary":true,"group":"reader"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"reader","paths":["/read/conversations"],"module":"reader/conversations","secondary":true,"group":"reader"} )( context );
if ( ! _loadedSections[ "reader/conversations" ] ) {
require( "reader/conversations" )( controller.clientRouter );
_loadedSections[ "reader/conversations" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "reader" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "reader" );
}
}, "reader"
);
} );
page( /^\/help(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me/help" ] ) {
controller.setSection( {"name":"help","paths":["/help"],"module":"me/help","secondary":true,"enableLoggedOut":true,"group":"me"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"help","paths":["/help"],"module":"me/help","secondary":true,"enableLoggedOut":true,"group":"me"} )( context );
if ( ! _loadedSections[ "me/help" ] ) {
require( "me/help" )( controller.clientRouter );
_loadedSections[ "me/help" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "help" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "help" );
}
}, "help"
);
} );
page( /^\/log-in(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "login" ] ) {
controller.setSection( {"name":"login","paths":["/log-in"],"module":"login","enableLoggedOut":true,"secondary":false,"isomorphic":true,"css":"login","cssUrls":{"ltr":"/calypso/sections/login.css?v=7d0f843629","rtl":"/calypso/sections-rtl/login.rtl.css?v=ef8e4593c6"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"login","paths":["/log-in"],"module":"login","enableLoggedOut":true,"secondary":false,"isomorphic":true,"css":"login","cssUrls":{"ltr":"/calypso/sections/login.css?v=7d0f843629","rtl":"/calypso/sections-rtl/login.rtl.css?v=ef8e4593c6"}} )( context );
if ( ! _loadedSections[ "login" ] ) {
require( "login" )( controller.clientRouter );
_loadedSections[ "login" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "login" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "login" );
}
}, "login"
);
} );
page( /^\/oauth-login(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "auth" ] ) {
controller.setSection( {"name":"auth","paths":["/oauth-login","/authorize","/api/oauth/token"],"module":"auth","secondary":false,"enableLoggedOut":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"auth","paths":["/oauth-login","/authorize","/api/oauth/token"],"module":"auth","secondary":false,"enableLoggedOut":true} )( context );
if ( ! _loadedSections[ "auth" ] ) {
require( "auth" )( controller.clientRouter );
_loadedSections[ "auth" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "auth" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "auth" );
}
}, "auth"
);
} );
page( /^\/authorize(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "auth" ] ) {
controller.setSection( {"name":"auth","paths":["/oauth-login","/authorize","/api/oauth/token"],"module":"auth","secondary":false,"enableLoggedOut":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"auth","paths":["/oauth-login","/authorize","/api/oauth/token"],"module":"auth","secondary":false,"enableLoggedOut":true} )( context );
if ( ! _loadedSections[ "auth" ] ) {
require( "auth" )( controller.clientRouter );
_loadedSections[ "auth" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "auth" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "auth" );
}
}, "auth"
);
} );
page( /^\/api\/oauth\/token(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "auth" ] ) {
controller.setSection( {"name":"auth","paths":["/oauth-login","/authorize","/api/oauth/token"],"module":"auth","secondary":false,"enableLoggedOut":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"auth","paths":["/oauth-login","/authorize","/api/oauth/token"],"module":"auth","secondary":false,"enableLoggedOut":true} )( context );
if ( ! _loadedSections[ "auth" ] ) {
require( "auth" )( controller.clientRouter );
_loadedSections[ "auth" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "auth" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "auth" );
}
}, "auth"
);
} );
page( /^\/types(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/types" ] ) {
controller.setSection( {"name":"posts-custom","paths":["/types"],"module":"my-sites/types","secondary":true,"group":"sites"} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"posts-custom","paths":["/types"],"module":"my-sites/types","secondary":true,"group":"sites"} )( context );
if ( ! _loadedSections[ "my-sites/types" ] ) {
require( "my-sites/types" )( controller.clientRouter );
_loadedSections[ "my-sites/types" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "posts-custom" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "posts-custom" );
}
}, "posts-custom"
);
} );
page( /^\/me\/chat(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "me/happychat" ] ) {
controller.setSection( {"name":"happychat","paths":["/me/chat"],"module":"me/happychat","group":"me","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"happychat","paths":["/me/chat"],"module":"me/happychat","group":"me","secondary":true} )( context );
if ( ! _loadedSections[ "me/happychat" ] ) {
require( "me/happychat" )( controller.clientRouter );
_loadedSections[ "me/happychat" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "happychat" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "happychat" );
}
}, "happychat"
);
} );
page( /^\/comments(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/comments" ] ) {
controller.setSection( {"name":"comments","paths":["/comments","/comment"],"module":"my-sites/comments","group":"sites","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"comments","paths":["/comments","/comment"],"module":"my-sites/comments","group":"sites","secondary":true} )( context );
if ( ! _loadedSections[ "my-sites/comments" ] ) {
require( "my-sites/comments" )( controller.clientRouter );
_loadedSections[ "my-sites/comments" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "comments" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "comments" );
}
}, "comments"
);
} );
page( /^\/comment(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/comments" ] ) {
controller.setSection( {"name":"comments","paths":["/comments","/comment"],"module":"my-sites/comments","group":"sites","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"comments","paths":["/comments","/comment"],"module":"my-sites/comments","group":"sites","secondary":true} )( context );
if ( ! _loadedSections[ "my-sites/comments" ] ) {
require( "my-sites/comments" )( controller.clientRouter );
_loadedSections[ "my-sites/comments" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "comments" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "comments" );
}
}, "comments"
);
} );
page( /^\/view(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/preview" ] ) {
controller.setSection( {"name":"preview","paths":["/view"],"module":"my-sites/preview","group":"sites","secondary":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"preview","paths":["/view"],"module":"my-sites/preview","group":"sites","secondary":true} )( context );
if ( ! _loadedSections[ "my-sites/preview" ] ) {
require( "my-sites/preview" )( controller.clientRouter );
_loadedSections[ "my-sites/preview" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "preview" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "preview" );
}
}, "preview"
);
} );
page( /^\/domain-connect(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "my-sites/domains/domain-management/domain-connect" ] ) {
controller.setSection( {"name":"domain-connect-authorize","paths":["/domain-connect"],"module":"my-sites/domains/domain-management/domain-connect","enableLoggedOut":false,"secondary":false,"isomorphic":false} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"domain-connect-authorize","paths":["/domain-connect"],"module":"my-sites/domains/domain-management/domain-connect","enableLoggedOut":false,"secondary":false,"isomorphic":false} )( context );
if ( ! _loadedSections[ "my-sites/domains/domain-management/domain-connect" ] ) {
require( "my-sites/domains/domain-management/domain-connect" )( controller.clientRouter );
_loadedSections[ "my-sites/domains/domain-management/domain-connect" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "domain-connect-authorize" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "domain-connect-authorize" );
}
}, "domain-connect-authorize"
);
} );
page( /^\/devdocs(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "devdocs" ] ) {
controller.setSection( {"name":"devdocs","paths":["/devdocs"],"module":"devdocs","secondary":true,"enableLoggedOut":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"devdocs","paths":["/devdocs"],"module":"devdocs","secondary":true,"enableLoggedOut":true} )( context );
if ( ! _loadedSections[ "devdocs" ] ) {
require( "devdocs" )( controller.clientRouter );
_loadedSections[ "devdocs" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "devdocs" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "devdocs" );
}
}, "devdocs"
);
} );
page( /^\/devdocs\/start(\/.*)?$/, function( context, next ) {
var envId = undefined;
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "devdocs" ] ) {
controller.setSection( {"name":"devdocs","paths":["/devdocs/start"],"module":"devdocs","secondary":false,"enableLoggedOut":true} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"devdocs","paths":["/devdocs/start"],"module":"devdocs","secondary":false,"enableLoggedOut":true} )( context );
if ( ! _loadedSections[ "devdocs" ] ) {
require( "devdocs" )( controller.clientRouter );
_loadedSections[ "devdocs" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "devdocs" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "devdocs" );
}
}, "devdocs"
);
} );
page( /^\/hello-dolly(\/.*)?$/, function( context, next ) {
var envId = ["development","wpcalypso"];
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "hello-dolly" ] ) {
controller.setSection( {"name":"hello-dolly","paths":["/hello-dolly"],"module":"hello-dolly","group":"sites","secondary":true,"enableLoggedOut":true,"envId":["development","wpcalypso"]} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"hello-dolly","paths":["/hello-dolly"],"module":"hello-dolly","group":"sites","secondary":true,"enableLoggedOut":true,"envId":["development","wpcalypso"]} )( context );
if ( ! _loadedSections[ "hello-dolly" ] ) {
require( "hello-dolly" )( controller.clientRouter );
_loadedSections[ "hello-dolly" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "hello-dolly" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "hello-dolly" );
}
}, "hello-dolly"
);
} );
page( /^\/extensions\/sensei(\/.*)?$/, function( context, next ) {
var envId = ["development","wpcalypso"];
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "sensei" ] ) {
controller.setSection( {"name":"sensei","paths":["/extensions/sensei"],"module":"sensei","group":"sites","secondary":true,"envId":["development","wpcalypso"]} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"sensei","paths":["/extensions/sensei"],"module":"sensei","group":"sites","secondary":true,"envId":["development","wpcalypso"]} )( context );
if ( ! _loadedSections[ "sensei" ] ) {
require( "sensei" )( controller.clientRouter );
_loadedSections[ "sensei" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "sensei" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "sensei" );
}
}, "sensei"
);
} );
page( /^\/store(\/.*)?$/, function( context, next ) {
var envId = ["development","wpcalypso","stage","production"];
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "woocommerce" ] ) {
controller.setSection( {"name":"woocommerce","paths":["/store"],"module":"woocommerce","group":"sites","secondary":true,"css":"woocommerce","envId":["development","wpcalypso","stage","production"],"cssUrls":{"ltr":"/calypso/sections/woocommerce.css?v=e49582d7f4","rtl":"/calypso/sections-rtl/woocommerce.rtl.css?v=bd1dc35294"}} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"woocommerce","paths":["/store"],"module":"woocommerce","group":"sites","secondary":true,"css":"woocommerce","envId":["development","wpcalypso","stage","production"],"cssUrls":{"ltr":"/calypso/sections/woocommerce.css?v=e49582d7f4","rtl":"/calypso/sections-rtl/woocommerce.rtl.css?v=bd1dc35294"}} )( context );
if ( ! _loadedSections[ "woocommerce" ] ) {
require( "woocommerce" )( controller.clientRouter );
_loadedSections[ "woocommerce" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "woocommerce" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "woocommerce" );
}
}, "woocommerce"
);
} );
page( /^\/extensions\/wp-job-manager(\/.*)?$/, function( context, next ) {
var envId = ["development","wpcalypso"];
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "wp-job-manager" ] ) {
controller.setSection( {"name":"wp-job-manager","paths":["/extensions/wp-job-manager"],"settings_path":"/extensions/wp-job-manager","module":"wp-job-manager","group":"sites","secondary":true,"envId":["development","wpcalypso"]} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"wp-job-manager","paths":["/extensions/wp-job-manager"],"settings_path":"/extensions/wp-job-manager","module":"wp-job-manager","group":"sites","secondary":true,"envId":["development","wpcalypso"]} )( context );
if ( ! _loadedSections[ "wp-job-manager" ] ) {
require( "wp-job-manager" )( controller.clientRouter );
_loadedSections[ "wp-job-manager" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "wp-job-manager" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "wp-job-manager" );
}
}, "wp-job-manager"
);
} );
page( /^\/extensions\/wp-super-cache(\/.*)?$/, function( context, next ) {
var envId = ["development","wpcalypso","horizon","stage","production"];
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "wp-super-cache" ] ) {
controller.setSection( {"name":"wp-super-cache","paths":["/extensions/wp-super-cache"],"settings_path":"/extensions/wp-super-cache","module":"wp-super-cache","group":"sites","secondary":true,"envId":["development","wpcalypso","horizon","stage","production"]} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"wp-super-cache","paths":["/extensions/wp-super-cache"],"settings_path":"/extensions/wp-super-cache","module":"wp-super-cache","group":"sites","secondary":true,"envId":["development","wpcalypso","horizon","stage","production"]} )( context );
if ( ! _loadedSections[ "wp-super-cache" ] ) {
require( "wp-super-cache" )( controller.clientRouter );
_loadedSections[ "wp-super-cache" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "wp-super-cache" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "wp-super-cache" );
}
}, "wp-super-cache"
);
} );
page( /^\/extensions\/zoninator(\/.*)?$/, function( context, next ) {
var envId = ["development","wpcalypso","stage"];
if ( envId && envId.indexOf( config( "env_id" ) ) === -1 ) {
return next();
}
if ( _loadedSections[ "zoninator" ] ) {
controller.setSection( {"name":"zoninator","paths":["/extensions/zoninator"],"settings_path":"/extensions/zoninator","module":"zoninator","group":"sites","secondary":true,"envId":["development","wpcalypso","stage"]} )( context );
context.store.dispatch( activateNextLayoutFocus() );
return next();
}
if ( config.isEnabled( "restore-last-location" ) && restoreLastSession( context.path ) ) {
return;
}
context.store.dispatch( { type: "SECTION_SET", isLoading: true } );
require.ensure( [],
function( require ) {
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
controller.setSection( {"name":"zoninator","paths":["/extensions/zoninator"],"settings_path":"/extensions/zoninator","module":"zoninator","group":"sites","secondary":true,"envId":["development","wpcalypso","stage"]} )( context );
if ( ! _loadedSections[ "zoninator" ] ) {
require( "zoninator" )( controller.clientRouter );
_loadedSections[ "zoninator" ] = true;
}
context.store.dispatch( activateNextLayoutFocus() );
next();
}, function onError( error ) {
if ( ! LoadingError.isRetry() ) {
console.warn( error );
LoadingError.retry( "zoninator" );
} else {
console.error( error );
context.store.dispatch( { type: "SECTION_SET", isLoading: false } );
LoadingError.show( "zoninator" );
}
}, "zoninator"
);
} );
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment