Changeset 16479
- Timestamp:
- 11/19/2010 05:31:07 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r16459 r16479 1079 1079 $args = array(); 1080 1080 1081 if ( isset( $_POST[' title'] ) )1082 $args['s'] = stripslashes( $_POST[' title'] );1081 if ( isset( $_POST['search'] ) ) 1082 $args['s'] = stripslashes( $_POST['search'] ); 1083 1083 $args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1; 1084 1084 -
trunk/wp-admin/includes/internal-linking.php
r16459 r16479 95 95 </div> 96 96 <div id="search-results" class="query-results"> 97 <ul> 98 <li class="loading-results unselectable"><em><?php _e( 'Loading...' ); ?></em></li> 99 </ul> 97 <ul></ul> 100 98 <div class="river-waiting"> 101 99 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> 102 100 </div> 103 101 </div> 104 <?php $most_recent = wp_link_query(); ?>105 102 <div id="most-recent-results" class="query-results"> 106 <ul> 107 <li class="unselectable"><em><?php _e( 'No search term specified. Showing recent items.' ); ?></em></li> 108 <?php 109 $alt = true; 110 foreach ( $most_recent as $item ) : ?> 111 <li<?php if ( $alt ) echo ' class="alternate"'; ?>> 112 <input type="hidden" class="item-permalink" value="<?php echo esc_url( $item['permalink'] ); ?>" /> 113 <span class="item-title"><?php echo $item['title']; ?></span> 114 <span class="item-info"><?php echo esc_html( $item['info'] ); ?></span> 115 </li> 116 <?php 117 $alt = ! $alt; 118 endforeach; ?> 119 </ul> 103 <div class="query-notice"><em><?php _e( 'No search term specified. Showing recent items.' ); ?></em></div> 104 <ul></ul> 120 105 <div class="river-waiting"> 121 106 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> -
trunk/wp-includes/js/tinymce/plugins/wplink/css/wplink.css
r16460 r16479 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;}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;}#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;} -
trunk/wp-includes/js/tinymce/plugins/wplink/css/wplink.dev.css
r16460 r16479 48 48 overflow: auto; 49 49 } 50 #wp-link li { 50 #wp-link li, 51 #wp-link .query-notice { 51 52 margin-bottom: 0; 52 53 border-bottom: 1px solid #f1f1f1; … … 67 68 color: #333; 68 69 } 69 #wp-link 70 #wp-link li.selected { 70 71 background: #ddd; 71 72 color: #333; -
trunk/wp-includes/js/tinymce/plugins/wplink/js/wplink.dev.js
r16458 r16479 1 var wpLink; 2 1 3 (function($){ 2 var inputs = {}, results = {}, ed, 4 var inputs = {}, rivers = {}, ed, River, Query; 5 3 6 wpLink = { 4 7 timeToTriggerRiver: 150, 5 8 minRiverAJAXDuration: 200, 9 riverBottomThreshold: 5, 6 10 lastSearch: '', 7 riverDefaults: function() {8 return {9 page : 2,10 allLoaded: false,11 active: false12 };13 },14 11 init : function() { 15 12 inputs.dialog = $('#wp-link'); … … 21 18 inputs.openInNewTab = $('#link-target-checkbox'); 22 19 inputs.search = $('#search-field'); 23 // Result lists 24 results.search = $('#search-results'); 25 results.recent = $('#most-recent-results'); 26 results.search.data('river', wpLink.riverDefaults() ); 27 results.recent.data('river', wpLink.riverDefaults() ); 28 results.group = $('.query-results', inputs.dialog); 20 // Build Rivers 21 rivers.search = new River( $('#search-results') ); 22 rivers.recent = new River( $('#most-recent-results') ); 23 rivers.elements = $('.query-results', inputs.dialog); 29 24 30 25 // Bind event handlers … … 32 27 $('#wp-link-cancel').click( function() { tinyMCEPopup.close(); } ); 33 28 34 results.group.delegate('li', 'click', wpLink.selectInternalLink ) 35 results.group.scroll( wpLink.maybeLoadRiver ); 29 rivers.elements.delegate('li', 'click', wpLink.selectInternalLink ) 36 30 37 31 inputs.search.keyup( wpLink.searchInternalLinks ); … … 56 50 57 51 // Clear previously selected links 58 r esults.group.find('.selected').removeClass('selected');52 rivers.elements.find('.selected').removeClass('selected'); 59 53 // Focus the URL field 60 54 inputs.url.focus(); 55 // Load the most recent results if this is the first time opening the panel. 56 if ( ! rivers.recent.ul.children().length ) 57 rivers.recent.ajax(); 61 58 }, 62 59 … … 138 135 }, 139 136 140 maybeLoadRiver : function() {141 var t = $(this),142 ul = t.children('ul'),143 river = t.data('river'),144 bottom = t.scrollTop() + t.height();145 146 if ( bottom != ul.height() || river.active || river.allLoaded )147 return;148 149 setTimeout(function() {150 var newTop = t.scrollTop(),151 newBottom = newTop + t.height(),152 waiting = t.find('.river-waiting');153 154 if ( bottom != newBottom || newBottom != ul.height() || river.active || river.allLoaded )155 return;156 157 river.active = true;158 waiting.show();159 t.scrollTop( newTop + waiting.outerHeight() );160 161 wpLink.linkAJAX( t, { page : river.page }, function(r) {162 river.page++;163 river.active = false;164 river.allLoaded = !r;165 waiting.hide();166 }, {167 append : true,168 delay : wpLink.minRiverAJAXDuration169 });170 }, wpLink.timeToTriggerRiver );171 },172 137 searchInternalLinks : function() { 173 138 var t = $(this), waiting, 174 title= t.val();175 176 if ( title.length > 2 ) {177 r esults.recent.hide();178 r esults.search.show();139 search = t.val(); 140 141 if ( search.length > 2 ) { 142 rivers.recent.element.hide(); 143 rivers.search.element.show(); 179 144 180 145 // Don't search if the keypress didn't change the title. 181 if ( wpLink.lastSearch == title)182 return; 183 184 wpLink.lastSearch = title;146 if ( wpLink.lastSearch == search ) 147 return; 148 149 wpLink.lastSearch = search; 185 150 waiting = t.siblings('img.waiting').show(); 186 151 187 results.search.data('river', wpLink.riverDefaults() ); 188 results.search.scrollTop(0); 189 wpLink.linkAJAX( results.search, { title : title }, function(){ waiting.hide(); }); 152 rivers.search.change( search ); 153 rivers.search.ajax( function(){ waiting.hide(); }); 190 154 } else { 191 results.search.hide(); 192 results.recent.show(); 193 } 194 }, 195 196 linkAJAX : function( $panel, params, callback, opts ) { 197 var response; 198 opts = opts || {}; 199 200 if ( ! $panel.hasClass('query-results') ) 201 $panel = $panel.parents('.query-results'); 202 203 if ( ! $panel.length ) 155 rivers.search.element.hide(); 156 rivers.recent.element.show(); 157 } 158 }, 159 160 delayedCallback : function( func, delay ) { 161 var timeoutTriggered, funcTriggered, funcArgs, funcContext; 162 163 if ( ! delay ) 164 return func; 165 166 setTimeout( function() { 167 if ( funcTriggered ) 168 return func.apply( funcContext, funcArgs ); 169 // Otherwise, wait. 170 timeoutTriggered = true; 171 }, delay); 172 173 return function() { 174 if ( timeoutTriggered ) 175 return func.apply( this, arguments ); 176 // Otherwise, wait. 177 funcArgs = arguments; 178 funcContext = this; 179 funcTriggered = true; 180 }; 181 } 182 } 183 184 River = function( element, search ) { 185 var self = this; 186 this.element = element; 187 this.ul = element.children('ul'); 188 this.waiting = element.find('.river-waiting'); 189 190 this.change( search ); 191 192 element.scroll( function(){ self.maybeLoad(); }); 193 }; 194 195 $.extend( River.prototype, { 196 ajax: function( callback ) { 197 var self = this, 198 delay = this.query.page == 1 ? 0 : wpLink.minRiverAJAXDuration, 199 response = wpLink.delayedCallback( function( results, params ) { 200 self.process( results, params ); 201 if ( callback ) 202 callback( results, params ); 203 }, delay ); 204 205 this.query.ajax( response ); 206 }, 207 change: function( search ) { 208 if ( this.query && this._search == search ) 204 209 return; 205 206 response = wpLink.delayedCallback( function( results ) { 207 wpLink.processAJAXResponse( $panel, results, callback, opts ); 208 }, opts.delay ); 209 210 $.post( ajaxurl, $.extend({ 211 action : 'wp-link-ajax' 212 }, params ), response, "json" ); 213 }, 214 215 processAJAXResponse: function( $panel, results, callback, opts ) { 216 var list = '', alt = true; 210 211 this._search = search; 212 this.query = new Query( search ); 213 this.element.scrollTop(0); 214 }, 215 process: function( results, params ) { 216 var list = '', alt = true, 217 firstPage = params.page == 1; 217 218 218 219 if ( !results ) { 219 if ( !opts.append) {220 if ( firstPage ) { 220 221 list += '<li class="unselectable"><span class="item-title"><em>' 221 222 + wpLinkL10n.noMatchesFound … … 233 234 } 234 235 235 // Set results 236 $panel.children('ul')[ opts.append ? 'append' : 'html' ]( list ); 237 238 // Run callback 239 if ( callback ) 240 callback( results ); 241 }, 242 243 delayedCallback : function( func, delay ) { 244 var timeoutTriggered, funcTriggered, funcArgs, funcContext; 245 246 if ( ! delay ) 247 return func; 248 249 setTimeout( function() { 250 if ( funcTriggered ) 251 return func.apply( funcContext, funcArgs ); 252 // Otherwise, wait. 253 timeoutTriggered = true; 254 }, delay); 255 256 return function() { 257 if ( timeoutTriggered ) 258 return func.apply( this, arguments ); 259 // Otherwise, wait. 260 funcArgs = arguments; 261 funcContext = this; 262 funcTriggered = true; 263 }; 236 this.ul[ firstPage ? 'html' : 'append' ]( list ); 237 }, 238 maybeLoad: function() { 239 var self = this, 240 el = this.element, 241 bottom = el.scrollTop() + el.height(); 242 243 if ( ! this.query.ready() || bottom < this.ul.height() - wpLink.riverBottomThreshold ) 244 return; 245 246 setTimeout(function() { 247 var newTop = el.scrollTop(), 248 newBottom = newTop + el.height(); 249 250 if ( ! self.query.ready() || newBottom < self.ul.height() - wpLink.riverBottomThreshold ) 251 return; 252 253 self.waiting.show(); 254 el.scrollTop( newTop + self.waiting.outerHeight() ); 255 256 self.ajax( function() { self.waiting.hide(); }); 257 }, wpLink.timeToTriggerRiver ); 264 258 } 265 } 259 }); 260 261 Query = function( search ) { 262 this.page = 1; 263 this.allLoaded = false; 264 this.querying = false; 265 this.search = search; 266 }; 267 268 $.extend( Query.prototype, { 269 ready: function() { 270 return !( this.querying || this.allLoaded ); 271 }, 272 ajax: function( callback ) { 273 var self = this, 274 query = { 275 action : 'wp-link-ajax', 276 page : this.page 277 }; 278 279 if ( this.search ) 280 query.search = this.search; 281 282 this.querying = true; 283 284 $.post( ajaxurl, query, function(r) { 285 self.page++; 286 self.querying = false; 287 self.allLoaded = !r; 288 callback( r, query ); 289 }, "json" ); 290 } 291 }); 266 292 267 293 $(document).ready( wpLink.init ); -
trunk/wp-includes/js/tinymce/plugins/wplink/js/wplink.js
r16458 r16479 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);1 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); -
trunk/wp-includes/script-loader.php
r16472 r16479 270 270 ) ); 271 271 272 $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '2010111 7' );272 $scripts->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/js/wplink$suffix.js", array('jquery'), '20101119' ); 273 273 $scripts->localize( 'wplink', 'wpLinkL10n', array( 274 274 'untitled' => __('Untitled'), … … 512 512 $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array(), '20101117' ); 513 513 $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array(), '20101118' ); 514 $styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '2010111 8' );514 $styles->add( 'wplink', "/wp-includes/js/tinymce/plugins/wplink/css/wplink$suffix.css", array(), '20101119' ); 515 515 516 516 foreach ( $rtl_styles as $rtl_style ) {
Note: See TracChangeset
for help on using the changeset viewer.