Changeset 5048
- Timestamp:
- 03/02/2017 09:16:02 PM (8 years ago)
- Location:
- sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/js/rosetta-roles.js
r4929 r5048 187 187 // @uses RegExp 188 188 search: function( term ) { 189 var match, results ;189 var match, results, escapedTerm; 190 190 191 191 // Start with a full collection … … 193 193 194 194 // Escape the term string for RegExp meta characters 195 term = term.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' );195 escapedTerm = term.replace( /[-\/\\^$*+?.()|[\]{}]/g, '\\$&' ); 196 196 197 197 // Consider spaces as word delimiters and match the whole string 198 198 // so matching terms can be combined 199 term = term.replace( / /g, ')(?=.*' );200 match = new RegExp( '^(?=.*' + term + ').+', 'i' );199 escapedTerm = escapedTerm.replace( / /g, ')(?=.*' ); 200 match = new RegExp( '^(?=.*' + escapedTerm + ').+', 'i' ); 201 201 202 202 results = this.filter( function( project ) { … … 204 204 if ( match.test( haystack ) ) { 205 205 _.each( haystack, function( word ) { 206 var score = word.score( term );206 var score = word.score( term, .5 ); 207 207 project.set( 'matchScore', Math.max( score, project.get( 'matchScore' ) ) ); 208 208 }); -
sites/trunk/global.wordpress.org/public_html/wp-content/mu-plugins/roles/rosetta-roles.php
r4929 r5048 109 109 public static function enqueue_scripts() { 110 110 wp_enqueue_script( 'string_score', plugins_url( '/js/string_score.min.js', __FILE__ ), array(), '0.1.22', true ); 111 wp_enqueue_script( 'rosetta-roles', plugins_url( '/js/rosetta-roles.js', __FILE__ ), array( 'jquery', 'wp-backbone', 'string_score' ), '1 0', true );111 wp_enqueue_script( 'rosetta-roles', plugins_url( '/js/rosetta-roles.js', __FILE__ ), array( 'jquery', 'wp-backbone', 'string_score' ), '11', true ); 112 112 } 113 113
Note: See TracChangeset
for help on using the changeset viewer.