Media Grid: make the router work when `?item=` is in the URL on page load. This is still a hack, needs to be event-driven.
See #24716. Built from https://develop.svn.wordpress.org/trunk@29073 git-svn-id: http://core.svn.wordpress.org/trunk@28859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
df241d2259
commit
7a438ad0dc
|
@ -140,19 +140,6 @@
|
||||||
this.bindHandlers();
|
this.bindHandlers();
|
||||||
this.render();
|
this.render();
|
||||||
|
|
||||||
this.gridRouter = new media.view.Frame.Router( this );
|
|
||||||
|
|
||||||
// Set up the Backbone router after a brief delay
|
|
||||||
_.delay( function(){
|
|
||||||
// Verify pushState support and activate
|
|
||||||
if ( window.history && window.history.pushState ) {
|
|
||||||
Backbone.history.start({
|
|
||||||
root: mediaGridSettings.adminUrl,
|
|
||||||
pushState: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 250);
|
|
||||||
|
|
||||||
// Update the URL when entering search string (at most once per second)
|
// Update the URL when entering search string (at most once per second)
|
||||||
$( '#media-search-input' ).on( 'input', _.debounce( function(e) {
|
$( '#media-search-input' ).on( 'input', _.debounce( function(e) {
|
||||||
var val = $( e.currentTarget ).val(), url = '';
|
var val = $( e.currentTarget ).val(), url = '';
|
||||||
|
@ -161,6 +148,20 @@
|
||||||
}
|
}
|
||||||
self.gridRouter.navigate( self.gridRouter.baseUrl( url ) );
|
self.gridRouter.navigate( self.gridRouter.baseUrl( url ) );
|
||||||
}, 1000 ) );
|
}, 1000 ) );
|
||||||
|
|
||||||
|
_.delay( _.bind( this.createRouter, this ), 1000 );
|
||||||
|
},
|
||||||
|
|
||||||
|
createRouter: function() {
|
||||||
|
this.gridRouter = new media.view.Frame.Router( this );
|
||||||
|
|
||||||
|
// Verify pushState support and activate
|
||||||
|
if ( window.history && window.history.pushState ) {
|
||||||
|
Backbone.history.start({
|
||||||
|
root: mediaGridSettings.adminUrl,
|
||||||
|
pushState: true
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
createSelection: function() {
|
createSelection: function() {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue