wpLink: fix spinners selectors and add some throttling when searching with AJAX while the user is typing, fixes #27615

git-svn-id: https://develop.svn.wordpress.org/trunk@27900 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2014-04-02 02:26:12 +00:00
parent c5f7f95979
commit c28fff3b65
2 changed files with 12 additions and 4 deletions

View File

@ -1212,6 +1212,7 @@ i.mce-i-hr:before {
#wp-link .river-waiting .spinner {
margin: 0 auto;
display: block;
float: none;
}
#wp-link .submitbox {

View File

@ -2,7 +2,7 @@
var wpLink;
( function( $ ) {
var inputs = {}, rivers = {}, editor, River, Query;
var inputs = {}, rivers = {}, editor, searchTimer, River, Query;
wpLink = {
timeToTriggerRiver: 150,
@ -47,7 +47,14 @@ var wpLink;
rivers.elements.on( 'river-select', wpLink.updateFields );
inputs.search.keyup( wpLink.searchInternalLinks );
inputs.search.keyup( function() {
var self = this;
window.clearTimeout( searchTimer );
searchTimer = window.setTimeout( function() {
wpLink.searchInternalLinks.call( self );
}, 500 );
});
},
open: function( editorId ) {
@ -283,7 +290,7 @@ var wpLink;
return;
wpLink.lastSearch = search;
waiting = $( '#river-waiting' ).show();
waiting = t.parent().find('.spinner').show();
rivers.search.change( search );
rivers.search.ajax( function() {
@ -381,7 +388,7 @@ var wpLink;
this.element = element;
this.ul = element.children( 'ul' );
this.contentHeight = element.children( '#link-selector-height' );
this.waiting = $( '#river-waiting' );
this.waiting = element.find('.river-waiting');
this.change( search );
this.refresh();