Index: bp-themes/bp-default/_inc/css/default.css
===================================================================
--- bp-themes/bp-default/_inc/css/default.css	(revision 4485)
+++ bp-themes/bp-default/_inc/css/default.css	(working copy)
@@ -1058,31 +1058,25 @@
 	margin-left: 54px;
 	padding-left: 22px;
 }
-form#whats-new-form #whats-new-textarea {
+form#whats-new-form textarea {
 	background: #fff;
 	border: 1px inset #ccc;
 	-moz-border-radius: 3px;
 	-webkit-border-radius: 3px;
 	border-radius: 3px;
-	margin-bottom: 10px;
-	padding: 8px;
-}
-form#whats-new-form textarea {
-	border: none;
 	color: #555;
 	font-family: inherit;
 	font-size: 14px;
 	height: 50px;
-	margin: 0;
-	padding: 0;
-	width: 100%;
+	padding: 1%;
+	width: 98%;
 }
 form#whats-new-form #whats-new-options select {
 	max-width: 200px;
 }
 form#whats-new-form #whats-new-submit {
 	float: right;
-	margin: 0;
+	margin-top: 12px;
 }
 #whats-new-options {
 	margin-bottom: 18px;
Index: bp-themes/bp-default/_inc/global.js
===================================================================
--- bp-themes/bp-default/_inc/global.js	(revision 4485)
+++ bp-themes/bp-default/_inc/global.js	(working copy)
@@ -1067,6 +1067,15 @@
 			jq.cookie('bp-' + objects[i] + '-extras', null, {path: '/'} );
 		});
 	});
+
+	// @mentions autosuggest
+	if (jQuery.fn.mentions) {
+		jQuery('#comment').mentions();                                                                            // comments
+		jQuery('#whats-new').mentions({ resultsbox : '#whats-new-options', resultsbox_position : 'prepend' });    //  What's new / status update
+		jQuery('#message_content').mentions({ resultsbox : '#message_content', resultsbox_position : 'after' });  // messaging (body)
+		jQuery('#topic_text').mentions({ resultsbox : '#topic_text', resultsbox_position : 'after' });            // forums (bbPress standalone)
+		jQuery('#reply_text').mentions({ resultsbox : '#reply_text', resultsbox_position : 'after' });            // forums (bbPress standalone)
+	}
 });
 
 /* Setup activity scope and filter based on the current cookie settings. */
Index: bp-activity/bp-activity-actions.php
===================================================================
--- bp-activity/bp-activity-actions.php	(revision 4485)
+++ bp-activity/bp-activity-actions.php	(working copy)
@@ -315,4 +315,128 @@
 }
 add_action( 'bp_actions', 'bp_activity_action_favorites_feed' );
 
-?>
+/**
+ * AJAX receiver for the @mention autosuggest jQuery library. Performs a search on the string provided and returns matches.
+ *
+ * @global object $bp BuddyPress global settings
+ * @return mixed Either HTML or JSON. If error, "-1" for missing parameters, "0" for no matches.
+ * @see bp-activity/js/jquery.mentions.js
+ * @since 1.3
+ */
+function bp_activity_mention_autosuggest() {
+	global $bp;
+
+	if ( empty( $_POST['limit'] ) || empty( $_POST['search'] ) )
+		exit( '-1' );
+
+	// Sanitise input
+	$search_query = implode( '', (array) preg_replace( array( '|^https?://|i', '|\*|', '|@|' ), '', $_POST['search'] ) );
+	if ( empty( $search_query ) )
+		exit( '-1' );
+
+	$args = array(
+		'count_total' => false,
+		'number'      => (int) $_POST['limit'],
+		'search'      => "{$search_query}*"
+	);
+
+	if ( !empty( $bp->loggedin_user->id ) )
+		$args['exclude'] = array( $bp->loggedin_user->id );
+
+	if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) ) {
+		$args['fields']  = array( 'ID', 'user_login' );
+		$args['orderby'] = 'login';
+
+	}	else {
+		$args['fields']  = array( 'ID', 'user_nicename' );
+		$args['orderby'] = 'nicename';
+	}
+
+	$args = apply_filters( 'bp_activity_mention_autosuggest_args', $args );
+
+	// Search users
+	$user_search_results = get_users( $args );
+	if ( empty( $user_search_results ) ) {
+
+		// Return JSON
+		if ( !empty( $_POST['format'] ) && 'json' == $_POST['format'] ) {
+			exit( json_encode( false ) );
+
+		// Return HTML
+		} else {
+			printf( '<li class="section error"><p><span>%s</span> %s</p></li>', _x( 'No matches found.', 'no search results', 'buddypress' ), _x( 'Please check your spelling.', 'no search results', 'buddypress' ) );
+			exit();
+		}
+	}
+
+	// If logged in, get user's friends
+	$friend_ids = array();
+	if ( !empty( $bp->loggedin_user->id ) )
+		$friend_ids = friends_get_friend_user_ids( $bp->loggedin_user->id );
+
+	$search_results = array( 'friends' => array(), 'others' => array() );
+
+	// Build results
+	foreach ( (array) $user_search_results as $user ) {
+		$result         = new stdClass;
+		$result->avatar = bp_core_fetch_avatar( array( 'item_id' => $user->ID, 'width' => 30, 'height' => 30, 'type' => 'thumb', 'alt' => __( 'Profile picture of %s', 'buddypress' ) ) );
+		$result->name   = bp_core_get_user_displayname( $user->ID );
+
+		if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
+		 	$result->id = $user->user_login;
+		else
+		 	$result->id = $user->user_nicename;
+
+		if ( in_array( $user->ID, $friend_ids ) )
+			$search_results['friends'][] = $result;
+		else
+			$search_results['others'][]  = $result;
+	}
+
+	apply_filters_ref_array( 'bp_activity_mention_autosuggest', array( &$search_results, $args ) );
+
+	// Return JSON
+	if ( !empty( $_POST['format'] ) && 'json' == $_POST['format'] ) {
+		exit( json_encode( $search_results ) );
+
+	// Return HTML
+	} else {
+		$html = array();
+
+		foreach ( $search_results as $section => $items ) {
+			if ( empty( $items ) )
+				continue;
+
+			// Friends and other users
+			if ( 'friends' == $section || 'others' == $section ) {
+				if ( 'friends' == $section ) {
+					$html[] = sprintf( '<li class="section friends"><p>%s</p></li>', __( 'Your friends:', 'buddypress' ) );
+
+				} elseif ( 'others' == $section ) {
+					if ( !empty( $search_results['friends'] ) )
+						$html[] = sprintf( '<li class="section other"><p>%s</p></li>', sprintf( __( 'Other people on %s:', 'buddypress' ), get_bloginfo( 'name', 'display' ) ) );
+					else
+						$html[] = sprintf( '<li class="section other"><p>%s</p></li>', sprintf( __( 'People on %s:', 'buddypress' ), get_bloginfo( 'name', 'display' ) ) );
+				}
+
+				foreach ( $items as $item )
+					$html[] = sprintf( '<li class=%s><p>%s</p></li>', esc_attr( $item->id ), $item->avatar . esc_html( $item->name ) );
+
+			// For third-party extensions
+			} else {
+				$custom_section = apply_filters( 'bp_activity_mention_autosuggest_custom_section', false, $section, $items );
+
+				if ( !empty( $custom_section ) )
+					$html = array_merge( $html, (array) $custom_section );
+			}
+		}
+
+		// Safety net
+		if ( empty( $html ) )
+			$html[] = sprintf( '<li class="section error"><p><span>%s</span> %s</p></li>', _x( 'No matches found.', 'no search results', 'buddypress' ), _x( 'Please check your spelling.', 'no search results', 'buddypress' ) );
+
+		exit( apply_filters( 'bp_activity_mention_autosuggest_html', implode( PHP_EOL, $html ), $html ) );
+	}
+}
+add_action( 'wp_ajax_activity_mention_autosuggest', 'bp_activity_mention_autosuggest' );
+?>
\ No newline at end of file
Index: bp-activity/bp-activity-loader.php
===================================================================
--- bp-activity/bp-activity-loader.php	(revision 4485)
+++ bp-activity/bp-activity-loader.php	(working copy)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * BuddyPress Activity Streams Loader
  *
@@ -267,8 +266,36 @@
 
 		parent::_setup_title();
 	}
+
+	/**
+	 * Register the @mentions autosuggest stuff
+	 *
+	 * @since BuddyPress 1.3
+	 * @access private
+	 */
+	function _setup_actions() {
+		parent::_setup_actions();
+
+		if ( is_admin() )
+			return;
+
+		if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
+			wp_enqueue_script( 'bp-activity-mentions-js', BP_PLUGIN_URL . '/bp-activity/js/jquery.mentions.dev.js', array( 'jquery' ), '1.0' );
+		else
+			wp_enqueue_script( 'bp-activity-mentions-js', BP_PLUGIN_URL . '/bp-activity/js/jquery.mentions.js', array( 'jquery' ), '1.0' );
+
+		if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
+			wp_enqueue_style( 'bp-activity-mentions', BP_PLUGIN_URL . '/bp-activity/css/jquery.mentions.dev.css', array(), '1.0' );
+		else
+			wp_enqueue_style( 'bp-activity-mentions', BP_PLUGIN_URL . '/bp-activity/css/jquery.mentions.css', array(), '1.0' );
+
+		wp_localize_script( 'bp-activity-mentions-js', 'BPMentions', array(
+			'error1'     => __( 'Sorry, an error occurred.', 'buddypress' ),
+			'error2'     => _x( 'Please try again.', 'an error occurred', 'buddypress' ),
+			'searching'  => _x( 'Searching...', 'started a search', 'buddypress' )
+		) );
+	}
 }
 // Create the activity component
 $bp->activity = new BP_Activity_Component();
-
-?>
+?>
\ No newline at end of file
Index: bp-activity/css/jquery.mentions.css
===================================================================
--- bp-activity/css/jquery.mentions.css	(revision 0)
+++ bp-activity/css/jquery.mentions.css	(revision 0)
@@ -0,0 +1 @@
+#mentions-autosuggest{background-color:#fafafa;background-color:rgba(250,250,250,0.8);border-bottom:1px solid #000;border-bottom:1px solid rgba(0,0,0,0.25);-moz-border-radius:0 0 6px 6px;-webkit-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;-moz-box-shadow:0 1px 3px rgba(0,0,0,0.5);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.5);box-shadow:0 1px 3px rgba(0,0,0,0.5);display:none;list-style:none;margin:0 2px;overflow:hidden;padding:7px 0;z-index:999;}#mentions-autosuggest img{margin:0 10px 0 0;}#mentions-autosuggest li{border-bottom:1px solid transparent;border-top:1px solid transparent;font-size:14px;margin:0;overflow:hidden;padding:2px 10px;top:9px;}#mentions-autosuggest li:not(.section):hover{background:#ebf4ff;background:-moz-linear-gradient(top,#f0f9ff 0,#ebf4ff 100%);background:-ms-linear-gradient(top,#f0f9ff 0,#ebf4ff 100%);background:-o-linear-gradient(top,#f0f9ff 0,#ebf4ff 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#f0f9ff),color-stop(100%,#ebf4ff));background:-webkit-linear-gradient(top,#f0f9ff 0,#ebf4ff 100%);background:linear-gradient(top,#f0f9ff 0,#ebf4ff 100%);border-bottom:1px solid #a1dcfa;border-top:1px solid #a1dcfa;cursor:pointer;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f0f9ff',endColorstr='#ebf4ff',GradientType=0);}#mentions-autosuggest li img{opacity:.8;}#mentions-autosuggest li:not(.section):hover img{opacity:1;}#mentions-autosuggest li:not(.section) p{line-height:35px;}#mentions-autosuggest .section{font-size:12px;margin-top:10px;}#mentions-autosuggest .section:first-child{margin-top:0;}#mentions-autosuggest .section.error span{font-weight:bold;}
\ No newline at end of file
Index: bp-activity/css/jquery.mentions.dev.css
===================================================================
--- bp-activity/css/jquery.mentions.dev.css	(revision 0)
+++ bp-activity/css/jquery.mentions.dev.css	(revision 0)
@@ -0,0 +1,62 @@
+#mentions-autosuggest {
+	background-color: rgb(250, 250, 250); /* IE7-8 */
+	background-color: rgba(250, 250, 250, 0.8);
+	border-bottom: 1px solid rgb(0, 0, 0); /* IE7-8 */
+	border-bottom: 1px solid rgba(0, 0, 0, 0.25);
+	-moz-border-radius: 0 0 6px 6px;
+	-webkit-border-radius: 0 0 6px 6px;
+	border-radius: 0 0 6px 6px;
+	-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
+	-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
+	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
+	display: none;
+	list-style: none;
+	margin: 0 2px;
+	overflow: hidden;
+	padding: 7px 0;
+	z-index: 999;
+}
+#mentions-autosuggest img {
+	margin: 0 10px 0 0;
+}
+#mentions-autosuggest li {
+	border-bottom: 1px solid transparent;
+	border-top: 1px solid transparent;
+	font-size: 14px;
+	margin: 0;
+	overflow: hidden;
+	padding: 2px 10px;
+	top: 9px;
+}
+#mentions-autosuggest li:not(.section):hover {
+	background: #ebf4ff; /* Fallback */
+	background: -moz-linear-gradient(top, #f0f9ff 0%, #ebf4ff 100%); /* FF3.6+ */
+	background: -ms-linear-gradient(top, #f0f9ff 0%, #ebf4ff 100%); /* IE10+ */
+	background: -o-linear-gradient(top, #f0f9ff 0%, #ebf4ff 100%); /* Opera11.10+ */
+	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f0f9ff), color-stop(100%, #ebf4ff)); /* Chrome,Safari4+ */
+	background: -webkit-linear-gradient(top, #f0f9ff 0%, #ebf4ff 100%); /* Chrome10+,Safari5.1+ */
+	background: linear-gradient(top, #f0f9ff 0%, #ebf4ff 100%); /* W3C */
+	border-bottom: 1px solid #a1dcfa;
+	border-top: 1px solid #a1dcfa;
+	cursor: pointer;
+	filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f0f9ff', endColorstr='#ebf4ff', GradientType=0); /* IE6-9 */
+}
+#mentions-autosuggest li img {
+	opacity: 0.8;
+}
+#mentions-autosuggest li:not(.section):hover img {
+	opacity: 1;
+}
+#mentions-autosuggest li:not(.section) p {
+	line-height: 35px;
+}
+#mentions-autosuggest .section {
+	font-size: 12px;
+	margin-top: 10px;
+}
+#mentions-autosuggest .section:first-child {
+	margin-top: 0;
+}
+#mentions-autosuggest .section.error span {
+	font-weight: bold;
+}
\ No newline at end of file
Index: bp-activity/js/jquery.mentions.dev.js
===================================================================
--- bp-activity/js/jquery.mentions.dev.js	(revision 0)
+++ bp-activity/js/jquery.mentions.dev.js	(revision 0)
@@ -0,0 +1,270 @@
+/*!
+ * jQuery @mentions plugin, v1.0
+ *
+ * Copyright 2011, Paul Gibbs <paul@byotos.com>.
+ *
+ * Licensed under GPL Version 2 and/or 3.
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ * http://www.gnu.org/licenses/gpl-3.0.html
+ *
+ * Requires jQuery 1.6+
+ */
+
+/*
+ * @todo Add keyboard up/down/return/tab support.
+ * @todo Use contentEditable.
+ */
+
+(function($) {
+  $.fn.mentions = function(options) {
+		options = $.extend({}, $.fn.mentions.defaults, options);
+
+		var key = {
+			up    : 38,
+			down  : 40,
+			enter : 13,
+			esc   : 27,
+			at    : 64
+		};
+
+		return this.each(function() {
+			var input_obj   = $(this),
+			found_at_token  = false,
+			results         = null,
+			results_started = false,
+			previous_query  = '',
+			query           = '',
+			timer           = 0,
+
+			// Metadata plugin support - http://docs.jquery.com/Plugins/Metadata/metadata
+			o = $.meta ? $.extend({}, options, input_obj.data()) : options,
+
+			// Have fun parsing this regex. I had fun writing it.
+			at_regex = new RegExp("@[\\w\\\\\\.\\-]+\\s?(?:[\\w\\\\\\.\\-]+\\s?){0," + (o.max_name_parts - 1) + "}(?:[\\w\\\\\\.\\-]w+)?$");
+
+			// Add results box
+			function add_panel() {
+				var html = '<ul id="mentions-autosuggest"></ul>';
+
+				if (o.resultsbox) {
+					if ('string' == typeof o.resultsbox) {
+						if ('prepend' == o.resultsbox_position) {
+							$(o.resultsbox).prepend(html);
+						} else if ('append' == o.resultsbox_position) {
+							$(o.resultsbox).append(html);
+						} else if ('before' == o.resultsbox_position) {
+							$(o.resultsbox).before(html);
+						} else if ('after' == o.resultsbox_position) {
+							$(o.resultsbox).after(html);
+						}
+
+					// Assume jQuery object
+					}	else if (o.resultsbox) {
+						if ('prepend' == o.resultsbox_position) {
+							o.resultsbox.prepend(html);
+						} else if ('append' == o.resultsbox_position) {
+							o.resultsbox.append(html);
+						} else if ('before' == o.resultsbox_position) {
+							o.resultsbox.before(html);
+						} else if ('after' == o.resultsbox_position) {
+							o.resultsbox.after(html);
+						}
+					}
+
+				// Fallback to parent's element
+				} else {
+					if ('prepend' == o.resultsbox_position) {
+						input_obj.parent().prepend(html);
+					} else if ('append' == o.resultsbox_position) {
+						input_obj.parent().append(html);
+					} else if ('before' == o.resultsbox_position) {
+						input_obj.parent().before(html);
+					} else if ('after' == o.resultsbox_position) {
+						input_obj.parent().after(html);
+					}
+				}
+
+				results = $('#mentions-autosuggest');
+			}
+
+			// Close the results panel
+			function close_panel() {
+				clearTimeout(timer);
+
+				results.slideUp('slow', function() {
+					results.empty();
+
+					// Move caret to end
+					input_obj[0].setSelectionRange(input_obj.val().length, input_obj.val().length);
+					input_obj.focus();
+				});
+
+				found_at_token = results_started = false;
+				previous_query = '';
+			}
+
+			// Listen for input
+			function handle_input() {
+				if (!found_at_token) {
+					clearTimeout(timer);
+					return;
+				}
+
+				query = at_regex.exec(input_obj.val());
+				if (!query) {
+					previous_query = query = '';
+					return;
+				}
+
+				if (previous_query == query) {
+					return;
+				}
+
+				// New query is new
+				if ($.isFunction(o.start)) {
+					o.start.call(this, query);
+				}
+
+				if (!results_started) {
+					results.css('width', input_obj.outerWidth(false)-4).html('<li class="section ajaxloader"><p><span class="ajax-loader" style="display: inline"></span>' + BPMentions.searching + '</p></li>').show();
+				} else {
+					// If panel is open, add spinner to top
+					results.css('width', input_obj.outerWidth(false)-4).prepend('<li class="section ajaxloader"><p><span class="ajax-loader" style="display: inline"></span>' + BPMentions.searching + '</p></li>').show();
+				}
+
+				// Make ajax request
+				$.ajax({
+					dataType : o.dataType,
+					type     : 'POST',
+					url      : ajaxurl,
+					data     : {
+						'action' : 'activity_mention_autosuggest',
+						'cookie' : encodeURIComponent(document.cookie),
+						'format' : o.dataType,
+						'limit'  : o.max_suggestions,
+						'search' : query
+					},
+
+					// Callbacks
+					error    : o.error,
+					success  : receive_results
+				});
+
+				previous_query = query;
+			}
+
+			// Data received from ajax request
+			function receive_results(response, textStatus, jqXHR) {
+				// If you've asked for JSON, handle that in the success callback.
+				if ($.isFunction(o.success)) {
+					o.success.call(response, textStatus, jqXHR);
+				}
+
+				if ('html' == o.dataType) {
+					// Fade out the loading spinner
+					results.find('li.ajaxloader').fadeOut('fast', function() {
+						$(this).remove();
+
+						// Missing required parameter
+						if ('-1' == response) {
+							if ($.isFunction(o.error)) {
+								o.error.call(response, textStatus, jqXHR);
+							}
+
+							results.html('<li class="section error"><p><span>' + BPMentions.error1 + '</span> ' + BPMentions.error2 + '</p></li>');
+							return;
+
+						// No results
+						} else if ( '0' == response ) {
+							results.html('<li class="section error"><p><span>' + BPMentions.noresults1 + '</span> ' + BPMentions.noresults2 + '</p></li>');
+
+						// Insert results
+						} else {
+							results.css('width', input_obj.outerWidth(false)-4);
+
+							// Slide panel open if this is the first search
+							if (!results_started) {
+								results.slideUp('10000', function() {
+									results.html(response).slideDown('slow');
+								});
+
+							} else {
+								results.html(response);
+							}
+						}
+
+						results_started = true;
+					});
+
+					if ($.isFunction(o.complete)) {
+						o.complete.call(response, textStatus, jqXHR);
+					}
+				}
+			}
+
+			// Put selected name into input_obj
+			function insert_name(name) {
+				input_obj.val(input_obj.val().substring(0, input_obj.val().lastIndexOf('@')) + '@' + name + ' ');
+				close_panel();
+			}
+
+			$(function() {
+				add_panel();
+
+				// Listen for input
+				input_obj.bind('keypress.mentions', function(event) {
+					if (key.at == event.which && !found_at_token) {
+						found_at_token = true;
+
+					// Start listening for input after "@" key
+					} else if (found_at_token) {
+						clearTimeout(timer);
+
+						if (results_started) {
+							timer = setTimeout(handle_input, 800);
+						} else {
+							// Do the first search very quickly
+							timer = setTimeout(handle_input, 350);
+						}
+					}
+				});
+
+				// Escape / return (cancel)
+				input_obj.bind('keyup.mentions', function(event) {
+					if ((key.esc == event.keyCode || key.enter == event.keyCode) && results_started) {
+						event.preventDefault();
+						close_panel();
+					}
+				});
+
+				// Defocus
+				input_obj.bind('focusout.mentions', function(event) {
+					if (results_started) {
+						close_panel();
+					}
+				});
+
+				// Click
+				results.delegate('li:not(.section)', 'click.mentions', function(event) {
+					event.preventDefault();
+					insert_name($(this).attr('class'));
+				});
+			});
+		});
+  };
+
+	$.fn.mentions.defaults = {
+		// Options
+		'resultsbox_position' : 'append', // Used with resultsbox. How to glue the results panel to the results box; "append", "prepend", "after", "before".
+		'dataType'            : 'html',  // Type of data expected back from the server. Supports 'html' and 'json'.
+		'max_name_parts'      : 3,       // Number of word parts that are identified as a name; i.e. "Boone B Gorges."
+		'max_suggestions'     : 6,       // Max number of suggestions to return.
+		'resultsbox'          : '',      // Used if dataType=html. jQuery identifier or object to append the results' container box to. If not set, defaults to "this'" parent element.
+
+		// Callbacks
+		'start'               : null,    // After a pattern match, before anything else.
+		'success'             : null,    // When data received (before complete).
+		'complete'            : null,    // When we're finished (after success).
+		'error'               : null     // On any type of error.
+	};
+})(jQuery);
\ No newline at end of file
Index: bp-activity/js/jquery.mentions.js
===================================================================
--- bp-activity/js/jquery.mentions.js	(revision 0)
+++ bp-activity/js/jquery.mentions.js	(revision 0)
@@ -0,0 +1,12 @@
+/*
+ * jQuery @mentions plugin, v1.0
+ *
+ * Copyright 2011, Paul Gibbs <paul@byotos.com>.
+ *
+ * Licensed under GPL Version 2 and/or 3.
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ * http://www.gnu.org/licenses/gpl-3.0.html
+ *
+ * Requires jQuery 1.6+
+ */
+(function(a){a.fn.mentions=function(b){b=a.extend({},a.fn.mentions.defaults,b);var c={up:38,down:40,enter:13,esc:27,at:64};return this.each(function(){var q=a(this),l=false,i=null,p=false,f="",m="",d=0,e=a.meta?a.extend({},b,q.data()):b,g=new RegExp("@[\\w\\\\\\.\\-]+\\s?(?:[\\w\\\\\\.\\-]+\\s?){0,"+(e.max_name_parts-1)+"}(?:[\\w\\\\\\.\\-]w+)?$");function k(){var o='<ul id="mentions-autosuggest"></ul>';if(e.resultsbox){if("string"==typeof e.resultsbox){if("prepend"==e.resultsbox_position){a(e.resultsbox).prepend(o)}else{if("append"==e.resultsbox_position){a(e.resultsbox).append(o)}else{if("before"==e.resultsbox_position){a(e.resultsbox).before(o)}else{if("after"==e.resultsbox_position){a(e.resultsbox).after(o)}}}}}else{if(e.resultsbox){if("prepend"==e.resultsbox_position){e.resultsbox.prepend(o)}else{if("append"==e.resultsbox_position){e.resultsbox.append(o)}else{if("before"==e.resultsbox_position){e.resultsbox.before(o)}else{if("after"==e.resultsbox_position){e.resultsbox.after(o)}}}}}}}else{if("prepend"==e.resultsbox_position){q.parent().prepend(o)}else{if("append"==e.resultsbox_position){q.parent().append(o)}else{if("before"==e.resultsbox_position){q.parent().before(o)}else{if("after"==e.resultsbox_position){q.parent().after(o)}}}}}i=a("#mentions-autosuggest")}function r(){clearTimeout(d);i.slideUp("slow",function(){i.empty();q[0].setSelectionRange(q.val().length,q.val().length);q.focus()});l=p=false;f=""}function h(){if(!l){clearTimeout(d);return}m=g.exec(q.val());if(!m){f=m="";return}if(f==m){return}if(a.isFunction(e.start)){e.start.call(this,m)}if(!p){i.css("width",q.outerWidth(false)-4).html('<li class="section ajaxloader"><p><span class="ajax-loader" style="display: inline"></span>'+BPMentions.searching+"</p></li>").show()}else{i.css("width",q.outerWidth(false)-4).prepend('<li class="section ajaxloader"><p><span class="ajax-loader" style="display: inline"></span>'+BPMentions.searching+"</p></li>").show()}a.ajax({dataType:e.dataType,type:"POST",url:ajaxurl,data:{action:"activity_mention_autosuggest",cookie:encodeURIComponent(document.cookie),format:e.dataType,limit:e.max_suggestions,search:m},error:e.error,success:n});f=m}function n(o,t,s){if(a.isFunction(e.success)){e.success.call(o,t,s)}if("html"==e.dataType){i.find("li.ajaxloader").fadeOut("fast",function(){a(this).remove();if("-1"==o){if(a.isFunction(e.error)){e.error.call(o,t,s)}i.html('<li class="section error"><p><span>'+BPMentions.error1+"</span> "+BPMentions.error2+"</p></li>");return}else{if("0"==o){i.html('<li class="section error"><p><span>'+BPMentions.noresults1+"</span> "+BPMentions.noresults2+"</p></li>")}else{i.css("width",q.outerWidth(false)-4);if(!p){i.slideUp("10000",function(){i.html(o).slideDown("slow")})}else{i.html(o)}}}p=true});if(a.isFunction(e.complete)){e.complete.call(o,t,s)}}}function j(o){q.val(q.val().substring(0,q.val().lastIndexOf("@"))+"@"+o+" ");r()}a(function(){k();q.bind("keypress.mentions",function(o){if(c.at==o.which&&!l){l=true}else{if(l){clearTimeout(d);if(p){d=setTimeout(h,800)}else{d=setTimeout(h,350)}}}});q.bind("keyup.mentions",function(o){if((c.esc==o.keyCode||c.enter==o.keyCode)&&p){o.preventDefault();r()}});q.bind("focusout.mentions",function(o){if(p){r()}});i.delegate("li:not(.section)","click.mentions",function(o){o.preventDefault();j(a(this).attr("class"))})})})};a.fn.mentions.defaults={resultsbox_position:"append",dataType:"html",max_name_parts:3,max_suggestions:6,resultsbox:"",start:null,success:null,complete:null,error:null}})(jQuery);
\ No newline at end of file
