Internal linking cleanups. Fix combination of pagination and searching. Add a margin of error (ha, get it?) to triggering the river. props koopersmith, see #11420.

git-svn-id: http://svn.automattic.com/wordpress/trunk@16479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-11-19 05:31:07 +00:00
parent 7cb2ad6d3a
commit 8233e4f6b5
7 changed files with 145 additions and 133 deletions

View File

@ -1078,8 +1078,8 @@ case 'wp-link-ajax':
$args = array();
if ( isset( $_POST['title'] ) )
$args['s'] = stripslashes( $_POST['title'] );
if ( isset( $_POST['search'] ) )
$args['s'] = stripslashes( $_POST['search'] );
$args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
$results = wp_link_query( $args );

View File

@ -94,29 +94,14 @@ function wp_link_dialog() {
</label>
</div>
<div id="search-results" class="query-results">
<ul>
<li class="loading-results unselectable"><em><?php _e( 'Loading...' ); ?></em></li>
</ul>
<ul></ul>
<div class="river-waiting">
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
</div>
</div>
<?php $most_recent = wp_link_query(); ?>
<div id="most-recent-results" class="query-results">
<ul>
<li class="unselectable"><em><?php _e( 'No search term specified. Showing recent items.' ); ?></em></li>
<?php
$alt = true;
foreach ( $most_recent as $item ) : ?>
<li<?php if ( $alt ) echo ' class="alternate"'; ?>>
<input type="hidden" class="item-permalink" value="<?php echo esc_url( $item['permalink'] ); ?>" />
<span class="item-title"><?php echo $item['title']; ?></span>
<span class="item-info"><?php echo esc_html( $item['info'] ); ?></span>
</li>
<?php
$alt = ! $alt;
endforeach; ?>
</ul>
<div class="query-notice"><em><?php _e( 'No search term specified. Showing recent items.' ); ?></em></div>
<ul></ul>
<div class="river-waiting">
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
</div>

View File

@ -1 +1 @@
#wp-link p.howto{margin:3px;}#link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 5px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#open-in-new-tab{display:inline-block;padding:3px 0 0;margin:0 0 0 87px;}#open-in-new-tab span{width:auto;margin-left:6px;font-size:11px;}.query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;}.query-results li{margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#555;padding:4px 6px;cursor:pointer;}.query-results li:hover{background:#eaf2fa;color:#333;}#wp-link .query-results li.unselectable:hover{background:#fff;cursor:auto;color:#555;}#wp-link .query-results li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link .query-results li.selected{background:#f1f1f1;color:#333;}#wp-link .query-results li.selected .item-title{font-weight:bold;}#wp-link .item-info{text-transform:uppercase;color:#aaa;font-size:11px;float:right;}#search-results{display:none;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 5px 0;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;}#wp-link-update a{display:inline-block;}
#wp-link p.howto{margin:3px;}#link-options{padding:10px 0 14px;border-bottom:1px solid #dfdfdf;margin:0 6px 14px;}#wp-link label input[type="text"]{width:360px;margin-top:5px;}#wp-link label span{display:inline-block;width:80px;text-align:right;padding-right:5px;}#wp-link .link-search-wrapper{margin:5px 5px 9px;display:block;overflow:hidden;}#wp-link .link-search-wrapper span{float:left;margin-top:6px;}#wp-link .link-search-wrapper input[type="text"]{float:left;width:220px;}#wp-link .link-search-wrapper img.waiting{margin:8px 1px 0 4px;float:left;display:none;}#wp-link .link-target{width:auto;padding:3px 0 0;margin:0 0 0 87px;font-size:11px;}#wp-link .query-results{border:1px #dfdfdf solid;margin:0 5px 5px;background:#fff;height:185px;overflow:auto;}#wp-link li,#wp-link .query-notice{margin-bottom:0;border-bottom:1px solid #f1f1f1;color:#333;padding:4px 6px;cursor:pointer;}#wp-link li:hover{background:#eaf2fa;color:#151515;}#wp-link li.unselectable{border-bottom:1px solid #dfdfdf;}#wp-link li.unselectable:hover{background:#fff;cursor:auto;color:#333;}#wp-link li.selected{background:#ddd;color:#333;}#wp-link li.selected .item-title{font-weight:bold;}#wp-link .item-info{text-transform:uppercase;color:#666;font-size:11px;float:right;}#search-results{display:none;}#wp-link .river-waiting{display:none;padding:10px 0;}#wp-link .river-waiting img.waiting{margin:0 auto;display:block;}#wp-link .submitbox{padding:5px 10px;font-size:11px;overflow:auto;height:29px;}#wp-link-cancel{line-height:25px;float:left;}#wp-link-update{line-height:23px;float:right;}#wp-link-update a{display:inline-block;}

View File

@ -47,7 +47,8 @@
height: 185px;
overflow: auto;
}
#wp-link li {
#wp-link li,
#wp-link .query-notice {
margin-bottom: 0;
border-bottom: 1px solid #f1f1f1;
color: #333;
@ -66,7 +67,7 @@
cursor: auto;
color: #333;
}
#wp-link li.selected {
#wp-link li.selected {
background: #ddd;
color: #333;
}

View File

@ -1,16 +1,13 @@
var wpLink;
(function($){
var inputs = {}, results = {}, ed,
var inputs = {}, rivers = {}, ed, River, Query;
wpLink = {
timeToTriggerRiver: 150,
minRiverAJAXDuration: 200,
riverBottomThreshold: 5,
lastSearch: '',
riverDefaults: function() {
return {
page : 2,
allLoaded: false,
active: false
};
},
init : function() {
inputs.dialog = $('#wp-link');
// URL
@ -20,19 +17,16 @@
// Advanced Options
inputs.openInNewTab = $('#link-target-checkbox');
inputs.search = $('#search-field');
// Result lists
results.search = $('#search-results');
results.recent = $('#most-recent-results');
results.search.data('river', wpLink.riverDefaults() );
results.recent.data('river', wpLink.riverDefaults() );
results.group = $('.query-results', inputs.dialog);
// Build Rivers
rivers.search = new River( $('#search-results') );
rivers.recent = new River( $('#most-recent-results') );
rivers.elements = $('.query-results', inputs.dialog);
// Bind event handlers
$('#wp-link-update').click( wpLink.update );
$('#wp-link-cancel').click( function() { tinyMCEPopup.close(); } );
results.group.delegate('li', 'click', wpLink.selectInternalLink )
results.group.scroll( wpLink.maybeLoadRiver );
rivers.elements.delegate('li', 'click', wpLink.selectInternalLink )
inputs.search.keyup( wpLink.searchInternalLinks );
@ -55,9 +49,12 @@
}
// Clear previously selected links
results.group.find('.selected').removeClass('selected');
rivers.elements.find('.selected').removeClass('selected');
// Focus the URL field
inputs.url.focus();
// Load the most recent results if this is the first time opening the panel.
if ( ! rivers.recent.ul.children().length )
rivers.recent.ajax();
},
update : function() {
@ -137,109 +134,29 @@
inputs.title.val( t.children('.item-title').text() );
},
maybeLoadRiver : function() {
var t = $(this),
ul = t.children('ul'),
river = t.data('river'),
bottom = t.scrollTop() + t.height();
if ( bottom != ul.height() || river.active || river.allLoaded )
return;
setTimeout(function() {
var newTop = t.scrollTop(),
newBottom = newTop + t.height(),
waiting = t.find('.river-waiting');
if ( bottom != newBottom || newBottom != ul.height() || river.active || river.allLoaded )
return;
river.active = true;
waiting.show();
t.scrollTop( newTop + waiting.outerHeight() );
wpLink.linkAJAX( t, { page : river.page }, function(r) {
river.page++;
river.active = false;
river.allLoaded = !r;
waiting.hide();
}, {
append : true,
delay : wpLink.minRiverAJAXDuration
});
}, wpLink.timeToTriggerRiver );
},
searchInternalLinks : function() {
var t = $(this), waiting,
title = t.val();
search = t.val();
if ( title.length > 2 ) {
results.recent.hide();
results.search.show();
if ( search.length > 2 ) {
rivers.recent.element.hide();
rivers.search.element.show();
// Don't search if the keypress didn't change the title.
if ( wpLink.lastSearch == title )
if ( wpLink.lastSearch == search )
return;
wpLink.lastSearch = title;
wpLink.lastSearch = search;
waiting = t.siblings('img.waiting').show();
results.search.data('river', wpLink.riverDefaults() );
results.search.scrollTop(0);
wpLink.linkAJAX( results.search, { title : title }, function(){ waiting.hide(); });
rivers.search.change( search );
rivers.search.ajax( function(){ waiting.hide(); });
} else {
results.search.hide();
results.recent.show();
rivers.search.element.hide();
rivers.recent.element.show();
}
},
linkAJAX : function( $panel, params, callback, opts ) {
var response;
opts = opts || {};
if ( ! $panel.hasClass('query-results') )
$panel = $panel.parents('.query-results');
if ( ! $panel.length )
return;
response = wpLink.delayedCallback( function( results ) {
wpLink.processAJAXResponse( $panel, results, callback, opts );
}, opts.delay );
$.post( ajaxurl, $.extend({
action : 'wp-link-ajax'
}, params ), response, "json" );
},
processAJAXResponse: function( $panel, results, callback, opts ) {
var list = '', alt = true;
if ( !results ) {
if ( !opts.append ) {
list += '<li class="unselectable"><span class="item-title"><em>'
+ wpLinkL10n.noMatchesFound
+ '</em></span></li>';
}
} else {
$.each( results, function() {
list += alt ? '<li class="alternate">' : '<li>';
list += '<input type="hidden" class="item-permalink" value="' + this['permalink'] + '" />';
list += '<span class="item-title">';
list += this['title'] ? this['title'] : '<em>'+ wpLinkL10n.untitled + '</em>';
list += '</span><span class="item-info">' + this['info'] + '</span></li>';
alt = ! alt;
});
}
// Set results
$panel.children('ul')[ opts.append ? 'append' : 'html' ]( list );
// Run callback
if ( callback )
callback( results );
},
delayedCallback : function( func, delay ) {
var timeoutTriggered, funcTriggered, funcArgs, funcContext;
@ -263,6 +180,115 @@
};
}
}
River = function( element, search ) {
var self = this;
this.element = element;
this.ul = element.children('ul');
this.waiting = element.find('.river-waiting');
this.change( search );
element.scroll( function(){ self.maybeLoad(); });
};
$.extend( River.prototype, {
ajax: function( callback ) {
var self = this,
delay = this.query.page == 1 ? 0 : wpLink.minRiverAJAXDuration,
response = wpLink.delayedCallback( function( results, params ) {
self.process( results, params );
if ( callback )
callback( results, params );
}, delay );
this.query.ajax( response );
},
change: function( search ) {
if ( this.query && this._search == search )
return;
this._search = search;
this.query = new Query( search );
this.element.scrollTop(0);
},
process: function( results, params ) {
var list = '', alt = true,
firstPage = params.page == 1;
if ( !results ) {
if ( firstPage ) {
list += '<li class="unselectable"><span class="item-title"><em>'
+ wpLinkL10n.noMatchesFound
+ '</em></span></li>';
}
} else {
$.each( results, function() {
list += alt ? '<li class="alternate">' : '<li>';
list += '<input type="hidden" class="item-permalink" value="' + this['permalink'] + '" />';
list += '<span class="item-title">';
list += this['title'] ? this['title'] : '<em>'+ wpLinkL10n.untitled + '</em>';
list += '</span><span class="item-info">' + this['info'] + '</span></li>';
alt = ! alt;
});
}
this.ul[ firstPage ? 'html' : 'append' ]( list );
},
maybeLoad: function() {
var self = this,
el = this.element,
bottom = el.scrollTop() + el.height();
if ( ! this.query.ready() || bottom < this.ul.height() - wpLink.riverBottomThreshold )
return;
setTimeout(function() {
var newTop = el.scrollTop(),
newBottom = newTop + el.height();
if ( ! self.query.ready() || newBottom < self.ul.height() - wpLink.riverBottomThreshold )
return;
self.waiting.show();
el.scrollTop( newTop + self.waiting.outerHeight() );
self.ajax( function() { self.waiting.hide(); });
}, wpLink.timeToTriggerRiver );
}
});
Query = function( search ) {
this.page = 1;
this.allLoaded = false;
this.querying = false;
this.search = search;
};
$.extend( Query.prototype, {
ready: function() {
return !( this.querying || this.allLoaded );
},
ajax: function( callback ) {
var self = this,
query = {
action : 'wp-link-ajax',
page : this.page
};
if ( this.search )
query.search = this.search;
this.querying = true;
$.post( ajaxurl, query, function(r) {
self.page++;
self.querying = false;
self.allLoaded = !r;
callback( r, query );
}, "json" );
}
});
$(document).ready( wpLink.init );
})(jQuery);

View File

@ -1 +1 @@
(function(d){var a={},c={},b,e={timeToTriggerRiver:150,minRiverAJAXDuration:200,lastSearch:"",riverDefaults:function(){return{page:2,allLoaded:false,active:false}},init:function(){a.dialog=d("#wp-link");a.url=d("#url-field");a.title=d("#link-title-field");a.openInNewTab=d("#link-target-checkbox");a.search=d("#search-field");c.search=d("#search-results");c.recent=d("#most-recent-results");c.search.data("river",e.riverDefaults());c.recent.data("river",e.riverDefaults());c.group=d(".query-results",a.dialog);d("#wp-link-update").click(e.update);d("#wp-link-cancel").click(function(){tinyMCEPopup.close()});c.group.delegate("li","click",e.selectInternalLink);c.group.scroll(e.maybeLoadRiver);a.search.keyup(e.searchInternalLinks);a.dialog.bind("dialogopen",e.refresh)},refresh:function(){var f;b=tinyMCEPopup.editor;if(f=b.dom.getParent(b.selection.getNode(),"A")){a.url.val(f.href);a.title.val(b.dom.getAttrib(f,"title"));if("_blank"==b.dom.getAttrib(f,"target")){a.openInNewTab.attr("checked","checked")}}c.group.find(".selected").removeClass("selected");a.url.focus()},update:function(){var j,g=tinyMCEPopup.editor,h={href:a.url.val(),title:a.title.val(),target:a.openInNewTab.attr("checked")?"_blank":""},k,f,i=h.title?h.title:h.href;tinyMCEPopup.restoreSelection();k=g.dom.getParent(g.selection.getNode(),"A");if(!h.href){if(g.selection.isCollapsed()){tinyMCEPopup.close();return}else{if(k){tinyMCEPopup.execCommand("mceBeginUndoLevel");f=g.selection.getBookmark();g.dom.remove(k,1);g.selection.moveToBookmark(f);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close();return}}}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(k==null){g.getDoc().execCommand("unlink",false,null);if(g.selection.isCollapsed()){j=g.dom.create("a",{href:"#mce_temp_url#"},i);g.selection.setNode(j)}else{tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1})}tinymce.each(g.dom.select("a"),function(l){if(g.dom.getAttrib(l,"href")=="#mce_temp_url#"){k=l;g.dom.setAttribs(k,h)}})}else{g.dom.setAttribs(k,h)}if(k.childNodes.length!=1||k.firstChild.nodeName!="IMG"){g.focus();g.selection.select(k);g.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},selectInternalLink:function(){var f=d(this);if(f.hasClass("unselectable")){return}f.siblings(".selected").removeClass("selected");f.addClass("selected");a.url.val(f.children(".item-permalink").val());a.title.val(f.children(".item-title").text())},maybeLoadRiver:function(){var h=d(this),g=h.children("ul"),i=h.data("river"),f=h.scrollTop()+h.height();if(f!=g.height()||i.active||i.allLoaded){return}setTimeout(function(){var j=h.scrollTop(),k=j+h.height(),l=h.find(".river-waiting");if(f!=k||k!=g.height()||i.active||i.allLoaded){return}i.active=true;l.show();h.scrollTop(j+l.outerHeight());e.linkAJAX(h,{page:i.page},function(m){i.page++;i.active=false;i.allLoaded=!m;l.hide()},{append:true,delay:e.minRiverAJAXDuration})},e.timeToTriggerRiver)},searchInternalLinks:function(){var f=d(this),h,g=f.val();if(g.length>2){c.recent.hide();c.search.show();if(e.lastSearch==g){return}e.lastSearch=g;h=f.siblings("img.waiting").show();c.search.data("river",e.riverDefaults());c.search.scrollTop(0);e.linkAJAX(c.search,{title:g},function(){h.hide()})}else{c.search.hide();c.recent.show()}},linkAJAX:function(i,h,j,g){var f;g=g||{};if(!i.hasClass("query-results")){i=i.parents(".query-results")}if(!i.length){return}f=e.delayedCallback(function(k){e.processAJAXResponse(i,k,j,g)},g.delay);d.post(ajaxurl,d.extend({action:"wp-link-ajax"},h),f,"json")},processAJAXResponse:function(j,f,k,g){var h="",i=true;if(!f){if(!g.append){h+='<li class="unselectable"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"}}else{d.each(f,function(){h+=i?'<li class="alternate">':"<li>";h+='<input type="hidden" class="item-permalink" value="'+this["permalink"]+'" />';h+='<span class="item-title">';h+=this["title"]?this["title"]:"<em>"+wpLinkL10n.untitled+"</em>";h+='</span><span class="item-info">'+this["info"]+"</span></li>";i=!i})}j.children("ul")[g.append?"append":"html"](h);if(k){k(f)}},delayedCallback:function(h,f){var k,j,i,g;if(!f){return h}setTimeout(function(){if(j){return h.apply(g,i)}k=true},f);return function(){if(k){return h.apply(this,arguments)}i=arguments;g=this;j=true}}};d(document).ready(e.init)})(jQuery);
var wpLink;(function(f){var b={},e={},d,a,c;wpLink={timeToTriggerRiver:150,minRiverAJAXDuration:200,riverBottomThreshold:5,lastSearch:"",init:function(){b.dialog=f("#wp-link");b.url=f("#url-field");b.title=f("#link-title-field");b.openInNewTab=f("#link-target-checkbox");b.search=f("#search-field");e.search=new a(f("#search-results"));e.recent=new a(f("#most-recent-results"));e.elements=f(".query-results",b.dialog);f("#wp-link-update").click(wpLink.update);f("#wp-link-cancel").click(function(){tinyMCEPopup.close()});e.elements.delegate("li","click",wpLink.selectInternalLink);b.search.keyup(wpLink.searchInternalLinks);b.dialog.bind("dialogopen",wpLink.refresh)},refresh:function(){var g;d=tinyMCEPopup.editor;if(g=d.dom.getParent(d.selection.getNode(),"A")){b.url.val(g.href);b.title.val(d.dom.getAttrib(g,"title"));if("_blank"==d.dom.getAttrib(g,"target")){b.openInNewTab.attr("checked","checked")}}e.elements.find(".selected").removeClass("selected");b.url.focus();if(!e.recent.ul.children().length){e.recent.ajax()}},update:function(){var k,h=tinyMCEPopup.editor,i={href:b.url.val(),title:b.title.val(),target:b.openInNewTab.attr("checked")?"_blank":""},l,g,j=i.title?i.title:i.href;tinyMCEPopup.restoreSelection();l=h.dom.getParent(h.selection.getNode(),"A");if(!i.href){if(h.selection.isCollapsed()){tinyMCEPopup.close();return}else{if(l){tinyMCEPopup.execCommand("mceBeginUndoLevel");g=h.selection.getBookmark();h.dom.remove(l,1);h.selection.moveToBookmark(g);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close();return}}}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(l==null){h.getDoc().execCommand("unlink",false,null);if(h.selection.isCollapsed()){k=h.dom.create("a",{href:"#mce_temp_url#"},j);h.selection.setNode(k)}else{tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1})}tinymce.each(h.dom.select("a"),function(m){if(h.dom.getAttrib(m,"href")=="#mce_temp_url#"){l=m;h.dom.setAttribs(l,i)}})}else{h.dom.setAttribs(l,i)}if(l.childNodes.length!=1||l.firstChild.nodeName!="IMG"){h.focus();h.selection.select(l);h.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},selectInternalLink:function(){var g=f(this);if(g.hasClass("unselectable")){return}g.siblings(".selected").removeClass("selected");g.addClass("selected");b.url.val(g.children(".item-permalink").val());b.title.val(g.children(".item-title").text())},searchInternalLinks:function(){var h=f(this),i,g=h.val();if(g.length>2){e.recent.element.hide();e.search.element.show();if(wpLink.lastSearch==g){return}wpLink.lastSearch=g;i=h.siblings("img.waiting").show();e.search.change(g);e.search.ajax(function(){i.hide()})}else{e.search.element.hide();e.recent.element.show()}},delayedCallback:function(i,g){var l,k,j,h;if(!g){return i}setTimeout(function(){if(k){return i.apply(h,j)}l=true},g);return function(){if(l){return i.apply(this,arguments)}j=arguments;h=this;k=true}}};a=function(i,h){var g=this;this.element=i;this.ul=i.children("ul");this.waiting=i.find(".river-waiting");this.change(h);i.scroll(function(){g.maybeLoad()})};f.extend(a.prototype,{ajax:function(j){var h=this,i=this.query.page==1?0:wpLink.minRiverAJAXDuration,g=wpLink.delayedCallback(function(k,l){h.process(k,l);if(j){j(k,l)}},i);this.query.ajax(g)},change:function(g){if(this.query&&this._search==g){return}this._search=g;this.query=new c(g);this.element.scrollTop(0)},process:function(g,k){var h="",i=true,j=k.page==1;if(!g){if(j){h+='<li class="unselectable"><span class="item-title"><em>'+wpLinkL10n.noMatchesFound+"</em></span></li>"}}else{f.each(g,function(){h+=i?'<li class="alternate">':"<li>";h+='<input type="hidden" class="item-permalink" value="'+this["permalink"]+'" />';h+='<span class="item-title">';h+=this["title"]?this["title"]:"<em>"+wpLinkL10n.untitled+"</em>";h+='</span><span class="item-info">'+this["info"]+"</span></li>";i=!i})}this.ul[j?"html":"append"](h)},maybeLoad:function(){var h=this,i=this.element,g=i.scrollTop()+i.height();if(!this.query.ready()||g<this.ul.height()-wpLink.riverBottomThreshold){return}setTimeout(function(){var j=i.scrollTop(),k=j+i.height();if(!h.query.ready()||k<h.ul.height()-wpLink.riverBottomThreshold){return}h.waiting.show();i.scrollTop(j+h.waiting.outerHeight());h.ajax(function(){h.waiting.hide()})},wpLink.timeToTriggerRiver)}});c=function(g){this.page=1;this.allLoaded=false;this.querying=false;this.search=g};f.extend(c.prototype,{ready:function(){return !(this.querying||this.allLoaded)},ajax:function(i){var g=this,h={action:"wp-link-ajax",page:this.page};if(this.search){h.search=this.search}this.querying=true;f.post(ajaxurl,h,function(j){g.page++;g.querying=false;g.allLoaded=!j;i(j,h)},"json")}});f(document).ready(wpLink.init)})(jQuery);

View File

@ -269,7 +269,7 @@ function wp_default_scripts( &$scripts ) {
'noShortlink' => __( 'No shortlink available for this page.' ),
) );
$scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101117' );
$scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101119' );
$scripts->localize( 'wplink', 'wpLinkL10n', array(
'untitled' => __('Untitled'),
'noMatchesFound' => __('No matches found.'),
@ -511,7 +511,7 @@ function wp_default_styles( &$styles ) {
$styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100907' );
$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101117' );
$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101118' );
$styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101118' );
$styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101119' );
foreach ( $rtl_styles as $rtl_style ) {
$styles->add_data( $rtl_style, 'rtl', true );