Changeset 8214
- Timestamp:
- 06/30/2008 12:04:22 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r8011 r8214 14 14 $s = $_GET['q']; // is this slashed already? 15 15 16 if ( strstr( $s, ',' ) ) 17 die; // it's a multiple tag insert, we won't find anything 18 $results = $wpdb->get_col( $wpdb->prepare("SELECT name FROM $wpdb->terms WHERE name LIKE (%s)", '%' . $s . '%') ); 16 if ( strstr( $s, ',' ) ) { 17 $s = explode( ',', $s ); 18 $s = $s[count( $s ) - 1]; 19 } 20 $s = trim( $s ); 21 if ( strlen( $s ) < 2 ) 22 die; // require 2 chars for matching 23 $results = $wpdb->get_col( "SELECT name FROM $wpdb->terms WHERE name LIKE ('%". $s . "%')" ); 19 24 echo join( $results, "\n" ); 20 25 die; -
trunk/wp-admin/js/post.js
r8177 r8214 99 99 100 100 // auto-suggest stuff 101 jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2 } );101 jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 102 102 jQuery('#newtag').keypress( tag_press_key ); 103 103 -
trunk/wp-includes/js/jquery/suggest.js
r7324 r8214 1 1 /* 2 * jquery.suggest 1.1 - 2007-08-06 2 * jquery.suggest 1.1b - 2007-08-06 3 * Patched by Mark Jaquith with Alexander Dick's "multiple items" patch to allow for auto-suggesting of more than one tag before submitting 4 * See: http://www.vulgarisoip.com/2007/06/29/jquerysuggest-an-alternative-jquery-based-autocomplete-library/#comment-7228 3 5 * 4 6 * Uses code and techniques from following libraries: … … 114 116 var q = $.trim($input.val()); 115 117 118 if ( options.multiple ) { 119 var multipleSepPos = q.lastIndexOf(options.multipleSep); 120 if ( multipleSepPos != -1 ) { 121 q = q.substr(multipleSepPos + options.multipleSep.length); 122 } 123 } 116 124 if (q.length >= options.minchars) { 117 125 … … 246 254 247 255 if ($currentResult) { 248 $input.val($currentResult.text()); 256 if ( options.multiple ) { 257 if ( $input.val().indexOf(options.multipleSep) != -1 ) { 258 $currentVal = $input.val().substr( 0, ( $input.val().lastIndexOf(options.multipleSep) + options.multipleSep.length ) ); 259 } else { 260 $currentVal = ""; 261 } 262 $input.val( $currentVal + $currentResult.text() + options.multipleSep); 263 $input.focus(); 264 } else { 265 $input.val($currentResult.text()); 266 } 249 267 $results.hide(); 250 268 … … 292 310 293 311 options = options || {}; 312 options.multiple = options.multiple || false; 313 options.multipleSep = options.multipleSep || ", "; 294 314 options.source = source; 295 315 options.delay = options.delay || 100; -
trunk/wp-includes/script-loader.php
r8206 r8214 71 71 $scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.js', array('jquery'), '2.0-4561'); 72 72 $scripts->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.2' ); 73 $scripts->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('jquery'), '1.1 ');73 $scripts->add( 'suggest', '/wp-includes/js/jquery/suggest.js', array('jquery'), '1.1b'); 74 74 $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20'); 75 75 $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430'); … … 139 139 'cancel' => __('Cancel'), 140 140 ) ); 141 $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '2008062 3' );141 $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080629' ); 142 142 $scripts->localize( 'post', 'postL10n', array( 143 143 'tagsUsed' => __('Tags used on this post:'),
Note: See TracChangeset
for help on using the changeset viewer.